Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RobotAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software
ArmarX
RobotAPI
Commits
0ebd49e0
Commit
0ebd49e0
authored
2 years ago
by
Christoph Pohl
Browse files
Options
Downloads
Patches
Plain Diff
Add more support for conversion from eigen types to NDArrays
parent
81313006
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!290
Draft: Aron/feature/defaults ranges docs
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/RobotAPI/libraries/aron/converter/eigen/EigenConverter.h
+22
-0
22 additions, 0 deletions
.../RobotAPI/libraries/aron/converter/eigen/EigenConverter.h
with
22 additions
and
0 deletions
source/RobotAPI/libraries/aron/converter/eigen/EigenConverter.h
+
22
−
0
View file @
0ebd49e0
...
...
@@ -135,6 +135,16 @@ namespace armarx::aron::converter
}
}
template
<
typename
T
>
static
data
::
NDArrayPtr
ConvertFromQuaternion
(
const
Eigen
::
Quaternion
<
T
>&
quat
)
{
data
::
NDArrayPtr
ndArr
(
new
data
::
NDArray
);
ndArr
->
setShape
({
1
,
4
});
ndArr
->
setData
(
sizeof
(
T
)
*
4
,
reinterpret_cast
<
const
unsigned
char
*
>
(
quat
.
coeffs
().
data
()));
return
ndArr
;
}
template
<
typename
T
>
static
data
::
NDArrayPtr
ConvertFromMatrix
(
...
...
@@ -148,6 +158,18 @@ namespace armarx::aron::converter
return
ndArr
;
}
template
<
typename
T
,
int
Rows
=
Eigen
::
Dynamic
,
int
Cols
=
Eigen
::
Dynamic
>
static
data
::
NDArrayPtr
ConvertFromMatrix
(
const
Eigen
::
Matrix
<
T
,
Rows
,
Cols
>&
mat
)
{
data
::
NDArrayPtr
ndArr
(
new
data
::
NDArray
);
ndArr
->
setShape
({
Rows
,
Cols
});
ndArr
->
setData
(
sizeof
(
T
)
*
mat
.
size
(),
reinterpret_cast
<
const
unsigned
char
*
>
(
mat
.
data
()));
return
ndArr
;
}
// Eigen::Array
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment