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
4118189f
Commit
4118189f
authored
6 years ago
by
Rohan Budhiraja
Browse files
Options
Downloads
Patches
Plain Diff
[unittest/dynamics] remove svd decomposition. only check the residual on constraint and dynamics
parent
86593939
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/dynamics.cpp
+3
-31
3 additions, 31 deletions
unittest/dynamics.cpp
with
3 additions
and
31 deletions
unittest/dynamics.cpp
+
3
−
31
View file @
4118189f
...
...
@@ -23,8 +23,6 @@
#include
"pinocchio/parsers/sample-models.hpp"
#include
"pinocchio/utils/timer.hpp"
#include
<Eigen/SVD>
#include
<iostream>
#include
<boost/test/unit_test.hpp>
...
...
@@ -93,6 +91,7 @@ BOOST_AUTO_TEST_CASE ( test_FD )
Eigen
::
VectorXd
dynamics_residual
(
data
.
M
*
data
.
ddq
+
data
.
nle
-
tau
-
J
.
transpose
()
*
data
.
lambda_c
);
BOOST_CHECK
(
dynamics_residual
.
norm
()
<=
1e-12
);
}
BOOST_AUTO_TEST_CASE
(
test_FD_with_damping
)
...
...
@@ -143,38 +142,11 @@ BOOST_AUTO_TEST_CASE ( test_FD_with_damping )
Eigen
::
MatrixXd
H_ref
(
G_ref
.
transpose
()
*
G_ref
);
BOOST_CHECK
(
H_ref
.
isApprox
(
JMinvJt
,
1e-12
));
//Find the ground truth
typedef
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
>
SVDType
;
const
double
threshold
=
1e-8
;
SVDType
svd
(
JMinvJt
,
Eigen
::
ComputeThinU
|
Eigen
::
ComputeThinV
);
SVDType
::
SingularValuesType
m_singularValues
=
svd
.
singularValues
();
SVDType
::
SingularValuesType
singularValues_inv
;
singularValues_inv
.
resizeLike
(
m_singularValues
);
for
(
unsigned
int
i
=
0
;
i
<
m_singularValues
.
size
();
++
i
)
{
if
(
m_singularValues
(
i
)
>
threshold
)
singularValues_inv
(
i
)
=
1.0
/
m_singularValues
(
i
);
else
singularValues_inv
(
i
)
=
0
;
}
MatrixXd
JMinvJt_inv
(
JMinvJt
.
rows
(),
JMinvJt
.
cols
());
JMinvJt_inv
=
svd
.
matrixV
()
*
singularValues_inv
.
asDiagonal
()
*
svd
.
matrixU
().
transpose
();
// Reference acceleration and lambda
VectorXd
lambda_ref
=
-
JMinvJt_inv
*
(
J
*
Minv
*
(
tau
-
data
.
nle
)
+
gamma
);
VectorXd
a_ref
=
Minv
*
(
tau
-
data
.
nle
+
J
.
transpose
()
*
lambda_ref
);
Eigen
::
VectorXd
dynamics_residual_ref
(
data
.
M
*
a_ref
+
data
.
nle
-
tau
-
J
.
transpose
()
*
lambda_ref
);
BOOST_CHECK
(
dynamics_residual_ref
.
norm
()
<=
1e-11
);
// Actual lambda and acceleration
BOOST_CHECK
(
data
.
lambda_c
.
isApprox
(
lambda_ref
,
1e-12
));
BOOST_CHECK
(
data
.
ddq
.
isApprox
(
a_ref
,
1e-12
));
// Actual Residuals
Eigen
::
VectorXd
constraint_residual
(
J
*
data
.
ddq
+
gamma
);
Eigen
::
VectorXd
dynamics_residual
(
data
.
M
*
data
.
ddq
+
data
.
nle
-
tau
-
J
.
transpose
()
*
data
.
lambda_c
);
BOOST_CHECK
(
constraint_residual
.
norm
()
<=
1e-10
);
BOOST_CHECK
(
dynamics_residual
.
norm
()
<=
1e-12
);
BOOST_CHECK
(
constraint_residual
.
norm
()
<=
1e-10
);
BOOST_CHECK
(
dynamics_residual
.
norm
()
<=
1e-12
);
}
BOOST_AUTO_TEST_CASE
(
test_ID
)
...
...
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