Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pinocchio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stack Of Tasks
pinocchio
Commits
fcb402de
Commit
fcb402de
authored
8 years ago
by
jcarpent
Browse files
Options
Downloads
Patches
Plain Diff
[C++][Unit test] Add isIdentity method to SE3
parent
a5174b6b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/spatial/se3.hpp
+14
-1
14 additions, 1 deletion
src/spatial/se3.hpp
unittest/tspatial.cpp
+8
-2
8 additions, 2 deletions
unittest/tspatial.cpp
with
22 additions
and
3 deletions
src/spatial/se3.hpp
+
14
−
1
View file @
fcb402de
...
...
@@ -46,7 +46,7 @@ namespace se3
* aMb (x) = aRb*x + aAB
* where aAB is the vector from origin A to origin B expressed in coordinates A.
*/
template
<
class
Derived
>
template
<
class
Derived
>
class
SE3Base
{
protected:
...
...
@@ -120,6 +120,14 @@ namespace se3
X
.
disp
(
os
);
return
os
;
}
///
/// \returns true if *this is approximately equal to the identity placement, within the precision given by prec.
///
bool
isIdentity
(
const
typename
traits
<
Derived
>::
Scalar
&
prec
=
Eigen
::
NumTraits
<
typename
traits
<
Derived
>::
Scalar
>::
dummy_precision
())
const
{
return
derived
().
isIdentity
(
prec
);
}
};
// class SE3Base
...
...
@@ -287,6 +295,11 @@ namespace se3
{
return
rot
.
isApprox
(
m2
.
rot
,
prec
)
&&
trans
.
isApprox
(
m2
.
trans
,
prec
);
}
bool
isIdentity
(
const
Scalar
&
prec
=
Eigen
::
NumTraits
<
Scalar
>::
dummy_precision
())
const
{
return
rot
.
isIdentity
(
prec
)
&&
trans
.
isZero
(
prec
);
}
ConstAngular_t
&
rotation_impl
()
const
{
return
rot
;
}
Angular_t
&
rotation_impl
()
{
return
rot
;
}
...
...
This diff is collapsed.
Click to expand it.
unittest/tspatial.cpp
+
8
−
2
View file @
fcb402de
...
...
@@ -33,7 +33,7 @@ BOOST_AUTO_TEST_SUITE ( tspatialTest)
BOOST_AUTO_TEST_CASE
(
test_SE3
)
{
using
namespace
se3
;
using
namespace
se3
;
typedef
Eigen
::
Matrix
<
double
,
4
,
4
>
Matrix4
;
typedef
SE3
::
Matrix6
Matrix6
;
typedef
SE3
::
Vector3
Vector3
;
...
...
@@ -62,7 +62,6 @@ using namespace se3;
Vector3
Mip
=
(
aMb
.
inverse
()
*
p4
).
head
(
3
);
BOOST_CHECK
(
amb
.
actInv
(
p
).
isApprox
(
Mip
,
1e-12
));
// Test action matrix
Matrix6
aXb
=
amb
;
Matrix6
bXc
=
bmc
;
...
...
@@ -71,6 +70,13 @@ using namespace se3;
Matrix6
bXa
=
amb
.
inverse
();
BOOST_CHECK
(
bXa
.
isApprox
(
aXb
.
inverse
(),
1e-12
));
// Test isIdentity
SE3
identity
=
SE3
::
Identity
();
BOOST_CHECK
(
identity
.
isIdentity
());
// Test isApprox
BOOST_CHECK
(
identity
.
isApprox
(
identity
));
}
BOOST_AUTO_TEST_CASE
(
test_Motion
)
...
...
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