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
d5aeffee
Commit
d5aeffee
authored
7 years ago
by
Gabriele Buondonno
Committed by
jcarpent
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[unittest] check calc_aba for each joint
parent
bd9885b2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
unittest/aba.cpp
+85
-0
85 additions, 0 deletions
unittest/aba.cpp
with
85 additions
and
0 deletions
unittest/aba.cpp
+
85
−
0
View file @
d5aeffee
...
...
@@ -37,6 +37,91 @@
BOOST_AUTO_TEST_SUITE
(
BOOST_TEST_MODULE
)
template
<
typename
JointModel
>
void
test_joint_methods
(
const
se3
::
JointModelBase
<
JointModel
>
&
jmodel
)
{
typedef
typename
se3
::
JointModelBase
<
JointModel
>::
JointDataDerived
JointData
;
typedef
typename
JointModel
::
ConfigVector_t
ConfigVector_t
;
JointData
jdata
=
jmodel
.
createData
();
ConfigVector_t
ql
(
ConfigVector_t
::
Constant
(
jmodel
.
nq
(),
-
M_PI
));
ConfigVector_t
qu
(
ConfigVector_t
::
Constant
(
jmodel
.
nq
(),
M_PI
));
ConfigVector_t
q
=
jmodel
.
randomConfiguration
(
ql
,
qu
);
se3
::
Inertia
::
Matrix6
I
(
se3
::
Inertia
::
Random
().
matrix
());
se3
::
Inertia
::
Matrix6
I_check
=
I
;
jmodel
.
calc
(
jdata
,
q
);
jmodel
.
calc_aba
(
jdata
,
I
,
true
);
Eigen
::
MatrixXd
S
=
constraint_xd
(
jdata
).
matrix
();
Eigen
::
MatrixXd
U_check
=
I_check
*
S
;
Eigen
::
MatrixXd
D_check
=
S
.
transpose
()
*
U_check
;
Eigen
::
MatrixXd
Dinv_check
=
D_check
.
inverse
();
Eigen
::
MatrixXd
UDinv_check
=
U_check
*
Dinv_check
;
Eigen
::
MatrixXd
update_check
=
U_check
*
Dinv_check
*
U_check
.
transpose
();
I_check
-=
update_check
;
BOOST_CHECK
(
jdata
.
U
.
isApprox
(
U_check
));
BOOST_CHECK
(
jdata
.
Dinv
.
isApprox
(
Dinv_check
));
BOOST_CHECK
(
jdata
.
UDinv
.
isApprox
(
UDinv_check
));
// Checking the inertia was correctly updated
// We use isApprox as usual, except for the freeflyer,
// where the correct result is exacly zero and isApprox would fail.
// Only for this single case, we use the infinity norm of the difference
if
(
jmodel
.
shortname
()
==
"JointModelFreeFlyer"
)
BOOST_CHECK
((
I
-
I_check
).
lpNorm
<
Eigen
::
Infinity
>
()
<
Eigen
::
NumTraits
<
double
>::
dummy_precision
());
else
BOOST_CHECK
(
I
.
isApprox
(
I_check
));
}
struct
TestJointMethods
{
template
<
typename
JointModel
>
void
operator
()(
const
se3
::
JointModelBase
<
JointModel
>
&
)
const
{
JointModel
jmodel
;
jmodel
.
setIndexes
(
0
,
0
,
0
);
test_joint_methods
(
jmodel
);
}
void
operator
()(
const
se3
::
JointModelBase
<
se3
::
JointModelComposite
>
&
)
const
{
se3
::
JointModelComposite
jmodel_composite
;
jmodel_composite
.
addJoint
(
se3
::
JointModelRX
());
jmodel_composite
.
addJoint
(
se3
::
JointModelRY
());
jmodel_composite
.
setIndexes
(
0
,
0
,
0
);
test_joint_methods
(
jmodel_composite
);
}
void
operator
()(
const
se3
::
JointModelBase
<
se3
::
JointModelRevoluteUnaligned
>
&
)
const
{
se3
::
JointModelRevoluteUnaligned
jmodel
(
1.5
,
1.
,
0.
);
jmodel
.
setIndexes
(
0
,
0
,
0
);
test_joint_methods
(
jmodel
);
}
void
operator
()(
const
se3
::
JointModelBase
<
se3
::
JointModelPrismaticUnaligned
>
&
)
const
{
se3
::
JointModelPrismaticUnaligned
jmodel
(
1.5
,
1.
,
0.
);
jmodel
.
setIndexes
(
0
,
0
,
0
);
test_joint_methods
(
jmodel
);
}
};
BOOST_AUTO_TEST_CASE
(
test_joint_basic
)
{
boost
::
mpl
::
for_each
<
se3
::
JointModelVariant
::
types
>
(
TestJointMethods
());
}
BOOST_AUTO_TEST_CASE
(
test_aba_simple
)
{
using
namespace
Eigen
;
...
...
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