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
0b0335b1
Commit
0b0335b1
authored
7 years ago
by
jcarpent
Browse files
Options
Downloads
Patches
Plain Diff
[Algo] Allows an external third argument for RNEA derivatives
parent
60407422
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/algorithm/rnea-derivatives.hpp
+3
-1
3 additions, 1 deletion
src/algorithm/rnea-derivatives.hpp
src/algorithm/rnea-derivatives.hxx
+9
-4
9 additions, 4 deletions
src/algorithm/rnea-derivatives.hxx
unittest/rnea-derivatives.cpp
+8
-7
8 additions, 7 deletions
unittest/rnea-derivatives.cpp
with
20 additions
and
12 deletions
src/algorithm/rnea-derivatives.hpp
+
3
−
1
View file @
0b0335b1
...
...
@@ -52,6 +52,7 @@ namespace se3
/// \param[in] a The joint acceleration vector (dim model.nv).
/// \param[out] rnea_partial_dq Partial derivative of the generalized torque vector with respect to the joint configuration.
/// \param[out] rnea_partial_dv Partial derivative of the generalized torque vector with respect to the joint velocity.
/// \param[out] rnea_partial_da Partial derivative of the generalized torque vector with respect to the joint acceleration.
///
/// \remark rnea_partial_dq and rnea_partial_dv must be first initialized with zeros (gravity_partial_dq.setZero).
///
...
...
@@ -63,7 +64,8 @@ namespace se3
const
Eigen
::
VectorXd
&
v
,
const
Eigen
::
VectorXd
&
a
,
Eigen
::
MatrixXd
&
rnea_partial_dq
,
Eigen
::
MatrixXd
&
rnea_partial_dv
);
Eigen
::
MatrixXd
&
rnea_partial_dv
,
Eigen
::
MatrixXd
&
rnea_partial_da
);
}
// namespace se3
...
...
This diff is collapsed.
Click to expand it.
src/algorithm/rnea-derivatives.hxx
+
9
−
4
View file @
0b0335b1
...
...
@@ -242,6 +242,7 @@ namespace se3
typedef
boost
::
fusion
::
vector
<
const
Model
&
,
Data
&
,
Eigen
::
MatrixXd
&
,
Eigen
::
MatrixXd
&
,
Eigen
::
MatrixXd
&
>
ArgsType
;
...
...
@@ -252,7 +253,8 @@ namespace se3
const
Model
&
model
,
Data
&
data
,
Eigen
::
MatrixXd
&
rnea_partial_dq
,
Eigen
::
MatrixXd
&
rnea_partial_dv
)
Eigen
::
MatrixXd
&
rnea_partial_dv
,
Eigen
::
MatrixXd
&
rnea_partial_da
)
{
const
Model
::
JointIndex
&
i
=
jmodel
.
id
();
const
Model
::
JointIndex
&
parent
=
model
.
parents
[
i
];
...
...
@@ -273,7 +275,7 @@ namespace se3
// dtau/da similar to data.M
motionSet
::
inertiaAction
(
data
.
oYo
[
i
],
J_cols
,
dFda_cols
);
data
.
M
.
block
(
jmodel
.
idx_v
(),
jmodel
.
idx_v
(),
jmodel
.
nv
(),
data
.
nvSubtree
[
i
]).
noalias
()
rnea_partial_da
.
block
(
jmodel
.
idx_v
(),
jmodel
.
idx_v
(),
jmodel
.
nv
(),
data
.
nvSubtree
[
i
]).
noalias
()
=
J_cols
.
transpose
()
*
data
.
dFda
.
middleCols
(
jmodel
.
idx_v
(),
data
.
nvSubtree
[
i
]);
// dtau/dv
...
...
@@ -332,7 +334,8 @@ namespace se3
const
Eigen
::
VectorXd
&
v
,
const
Eigen
::
VectorXd
&
a
,
Eigen
::
MatrixXd
&
rnea_partial_dq
,
Eigen
::
MatrixXd
&
rnea_partial_dv
)
Eigen
::
MatrixXd
&
rnea_partial_dv
,
Eigen
::
MatrixXd
&
rnea_partial_da
)
{
assert
(
q
.
size
()
==
model
.
nq
&&
"The joint configuration vector is not of right size"
);
assert
(
v
.
size
()
==
model
.
nv
&&
"The joint velocity vector is not of right size"
);
...
...
@@ -341,6 +344,8 @@ namespace se3
assert
(
rnea_partial_dq
.
rows
()
==
model
.
nv
);
assert
(
rnea_partial_dv
.
cols
()
==
model
.
nv
);
assert
(
rnea_partial_dv
.
rows
()
==
model
.
nv
);
assert
(
rnea_partial_da
.
cols
()
==
model
.
nv
);
assert
(
rnea_partial_da
.
rows
()
==
model
.
nv
);
assert
(
model
.
check
(
data
)
&&
"data is not consistent with model."
);
data
.
oa
[
0
]
=
-
model
.
gravity
;
...
...
@@ -354,7 +359,7 @@ namespace se3
for
(
size_t
i
=
(
size_t
)
(
model
.
njoints
-
1
);
i
>
0
;
--
i
)
{
computeRNEADerivativesBackwardStep
::
run
(
model
.
joints
[
i
],
computeRNEADerivativesBackwardStep
::
ArgsType
(
model
,
data
,
rnea_partial_dq
,
rnea_partial_dv
));
computeRNEADerivativesBackwardStep
::
ArgsType
(
model
,
data
,
rnea_partial_dq
,
rnea_partial_dv
,
rnea_partial_da
));
}
}
...
...
This diff is collapsed.
Click to expand it.
unittest/rnea-derivatives.cpp
+
8
−
7
View file @
0b0335b1
...
...
@@ -93,7 +93,8 @@ BOOST_AUTO_TEST_CASE(test_rnea_derivatives)
/// Check againt computeGeneralizedGravityDerivatives
MatrixXd
rnea_partial_dq
(
model
.
nv
,
model
.
nv
);
rnea_partial_dq
.
setZero
();
MatrixXd
rnea_partial_dv
(
model
.
nv
,
model
.
nv
);
rnea_partial_dv
.
setZero
();
computeRNEADerivatives
(
model
,
data
,
q
,
0
*
v
,
0
*
a
,
rnea_partial_dq
,
rnea_partial_dv
);
MatrixXd
rnea_partial_da
(
model
.
nv
,
model
.
nv
);
rnea_partial_da
.
setZero
();
computeRNEADerivatives
(
model
,
data
,
q
,
0
*
v
,
0
*
a
,
rnea_partial_dq
,
rnea_partial_dv
,
rnea_partial_da
);
MatrixXd
g_partial_dq
(
model
.
nv
,
model
.
nv
);
g_partial_dq
.
setZero
();
computeGeneralizedGravityDerivatives
(
model
,
data_ref
,
q
,
g_partial_dq
);
...
...
@@ -134,7 +135,7 @@ BOOST_AUTO_TEST_CASE(test_rnea_derivatives)
}
rnea_partial_dq
.
setZero
();
computeRNEADerivatives
(
model
,
data
,
q
,
0
*
v
,
a
,
rnea_partial_dq
,
rnea_partial_dv
);
computeRNEADerivatives
(
model
,
data
,
q
,
0
*
v
,
a
,
rnea_partial_dq
,
rnea_partial_dv
,
rnea_partial_da
);
forwardKinematics
(
model
,
data_ref
,
q
,
0
*
v
,
a
);
for
(
Model
::
JointIndex
k
=
1
;
k
<
(
Model
::
JointIndex
)
model
.
njoints
;
++
k
)
...
...
@@ -178,7 +179,7 @@ BOOST_AUTO_TEST_CASE(test_rnea_derivatives)
rnea_partial_dq
.
setZero
();
rnea_partial_dv
.
setZero
();
computeRNEADerivatives
(
model
,
data
,
q
,
v
,
0
*
a
,
rnea_partial_dq
,
rnea_partial_dv
);
computeRNEADerivatives
(
model
,
data
,
q
,
v
,
0
*
a
,
rnea_partial_dq
,
rnea_partial_dv
,
rnea_partial_da
);
forwardKinematics
(
model
,
data_ref
,
q
,
v
,
0
*
a
);
for
(
Model
::
JointIndex
k
=
1
;
k
<
(
Model
::
JointIndex
)
model
.
njoints
;
++
k
)
...
...
@@ -224,7 +225,7 @@ BOOST_AUTO_TEST_CASE(test_rnea_derivatives)
rnea_partial_dq
.
setZero
();
rnea_partial_dv
.
setZero
();
computeRNEADerivatives
(
model
,
data
,
q
,
v
,
a
,
rnea_partial_dq
,
rnea_partial_dv
);
computeRNEADerivatives
(
model
,
data
,
q
,
v
,
a
,
rnea_partial_dq
,
rnea_partial_dv
,
rnea_partial_da
);
forwardKinematics
(
model
,
data_ref
,
q
,
v
,
a
);
for
(
Model
::
JointIndex
k
=
1
;
k
<
(
Model
::
JointIndex
)
model
.
njoints
;
++
k
)
...
...
@@ -238,11 +239,11 @@ BOOST_AUTO_TEST_CASE(test_rnea_derivatives)
BOOST_CHECK
(
data
.
dJ
.
isApprox
(
data_ref
.
dJ
));
crba
(
model
,
data_ref
,
q
);
data
.
M
.
triangularView
<
Eigen
::
StrictlyLower
>
()
=
data
.
M
.
transpose
().
triangularView
<
Eigen
::
StrictlyLower
>
();
rnea_partial_da
.
triangularView
<
Eigen
::
StrictlyLower
>
()
=
rnea_partial_da
.
transpose
().
triangularView
<
Eigen
::
StrictlyLower
>
();
data_ref
.
M
.
triangularView
<
Eigen
::
StrictlyLower
>
()
=
data_ref
.
M
.
transpose
().
triangularView
<
Eigen
::
StrictlyLower
>
();
BOOST_CHECK
(
data
.
M
.
isApprox
(
data_ref
.
M
));
BOOST_CHECK
(
rnea_partial_da
.
isApprox
(
data_ref
.
M
));
BOOST_CHECK
(
data
.
tau
.
isApprox
(
tau0
));
BOOST_CHECK
(
rnea_partial_dq
.
isApprox
(
rnea_partial_dq_fd
,
sqrt
(
alpha
)));
...
...
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