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
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Leander Singer
RobotAPI
Commits
664295b9
Commit
664295b9
authored
4 years ago
by
Rainer Kartmann
Browse files
Options
Downloads
Patches
Plain Diff
Add conversion test
parent
846df235
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/RobotAPI/components/ObjectPoseObserver/test/ObjectPoseObserverTest.cpp
+34
-3
34 additions, 3 deletions
...onents/ObjectPoseObserver/test/ObjectPoseObserverTest.cpp
with
34 additions
and
3 deletions
source/RobotAPI/components/ObjectPoseObserver/test/ObjectPoseObserverTest.cpp
+
34
−
3
View file @
664295b9
...
...
@@ -27,11 +27,42 @@
#include
<RobotAPI/Test.h>
#include
<RobotAPI/components/ObjectPoseObserver/ObjectPoseObserver.h>
#include
<RobotAPI/components/ObjectPoseObserver/ice_conversions.h>
#include
<RobotAPI/libraries/core/Pose.h>
#include
<iostream>
BOOST_AUTO_TEST_CASE
(
testExample
)
using
namespace
armarx
;
BOOST_AUTO_TEST_CASE
(
test_from_to_OOBB
)
{
armarx
::
ObjectPoseObserver
instance
;
Eigen
::
Vector3f
pos
(
-
100
,
-
200
,
-
300
);
Eigen
::
Matrix3f
ori
=
Eigen
::
AngleAxisf
(
1.0
,
Eigen
::
Vector3f
(
1
,
2
,
3
).
normalized
()).
toRotationMatrix
();
Eigen
::
Vector3f
extents
(
40
,
50
,
60
);
armarx
::
objpose
::
Box
box
;
box
.
position
=
new
Vector3
(
pos
);
box
.
orientation
=
new
Quaternion
(
ori
);
box
.
extents
=
new
Vector3
(
extents
);
const
float
prec
=
1e-3
;
simox
::
OrientedBoxf
oobb
;
armarx
::
objpose
::
fromIce
(
box
,
oobb
);
ARMARX_CHECK_LESS_EQUAL
((
oobb
.
center
()
-
pos
).
norm
(),
prec
);
ARMARX_CHECK
(
oobb
.
rotation
().
isApprox
(
ori
,
prec
));
ARMARX_CHECK_LESS_EQUAL
((
oobb
.
dimensions
()
-
extents
).
norm
(),
prec
);
armarx
::
objpose
::
Box
boxOut
;
armarx
::
objpose
::
toIce
(
boxOut
,
oobb
);
Eigen
::
Vector3f
posOut
=
Vector3Ptr
::
dynamicCast
(
boxOut
.
position
)
->
toEigen
();
Eigen
::
Matrix3f
oriOut
=
QuaternionPtr
::
dynamicCast
(
boxOut
.
orientation
)
->
toEigen
();
Eigen
::
Vector3f
extentsOut
=
Vector3Ptr
::
dynamicCast
(
boxOut
.
extents
)
->
toEigen
();
BOOST_CHECK_EQUAL
(
true
,
true
);
ARMARX_CHECK_LESS_EQUAL
((
posOut
-
pos
).
norm
(),
prec
);
ARMARX_CHECK
(
oriOut
.
isApprox
(
ori
,
prec
));
ARMARX_CHECK_LESS_EQUAL
((
extentsOut
-
extents
).
norm
(),
prec
);
}
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