Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tsid
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
tsid
Commits
cd25f469
Commit
cd25f469
authored
7 years ago
by
jcarpent
Browse files
Options
Downloads
Patches
Plain Diff
[Unit Tests] Change check according to the numerical accuracy
parent
a8d10069
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/tasks.cpp
+17
-4
17 additions, 4 deletions
unittest/tasks.cpp
with
17 additions
and
4 deletions
unittest/tasks.cpp
+
17
−
4
View file @
cd25f469
...
...
@@ -30,7 +30,9 @@
#include
<tsid/trajectories/trajectory-se3.hpp>
#include
<tsid/trajectories/trajectory-euclidian.hpp>
#include
<pinocchio/parsers/srdf.hpp>
#include
<pinocchio/algorithm/joint-configuration.hpp>
#include
<pinocchio/algorithm/center-of-mass.hpp>
#include
<Eigen/SVD>
using
namespace
tsid
;
...
...
@@ -133,6 +135,17 @@ BOOST_AUTO_TEST_CASE ( test_task_com_equality )
package_dirs
,
se3
::
JointModelFreeFlyer
(),
false
);
se3
::
Data
data
(
robot
.
model
());
const
string
srdfFileName
=
package_dirs
[
0
]
+
"/srdf/romeo_collision.srdf"
;
se3
::
srdf
::
getNeutralConfigurationFromSrdf
(
robot
.
model
(),
srdfFileName
);
const
unsigned
int
nv
=
robot
.
nv
();
VectorXd
q
=
robot
.
model
().
neutralConfiguration
;
std
::
cout
<<
"q: "
<<
q
.
transpose
()
<<
std
::
endl
;
q
(
2
)
+=
0.84
;
se3
::
centerOfMass
(
robot
.
model
(),
data
,
q
);
TaskComEquality
task
(
"task-com"
,
robot
);
...
...
@@ -143,7 +156,7 @@ BOOST_AUTO_TEST_CASE ( test_task_com_equality )
BOOST_CHECK
(
task
.
Kp
().
isApprox
(
Kp
));
BOOST_CHECK
(
task
.
Kd
().
isApprox
(
Kd
));
Vector3
com_ref
=
Vector3
::
Random
(
);
Vector3
com_ref
=
data
.
com
[
0
]
+
se3
::
SE3
::
Vector3
(
0.02
,
0.02
,
0.02
);
TrajectoryBase
*
traj
=
new
TrajectoryEuclidianConstant
(
"traj_com"
,
com_ref
);
TrajectorySample
sample
;
...
...
@@ -151,9 +164,7 @@ BOOST_AUTO_TEST_CASE ( test_task_com_equality )
const
double
dt
=
0.001
;
MatrixXd
Jpinv
(
robot
.
nv
(),
3
);
double
error
,
error_past
=
1e100
;
VectorXd
q
=
robot
.
model
().
neutralConfiguration
;
VectorXd
v
=
VectorXd
::
Zero
(
robot
.
nv
());
se3
::
Data
data
(
robot
.
model
());
for
(
int
i
=
0
;
i
<
max_it
;
i
++
)
{
robot
.
computeAllTerms
(
data
,
q
,
v
);
...
...
@@ -179,8 +190,10 @@ BOOST_AUTO_TEST_CASE ( test_task_com_equality )
error
=
task
.
position_error
().
norm
();
BOOST_REQUIRE
(
is_finite
(
task
.
position_error
()));
BOOST_CHECK
(
error
<=
error_past
);
BOOST_CHECK
(
(
error
-
error_past
)
<=
1e-4
)
;
error_past
=
error
;
if
(
error
<
1e-8
)
break
;
if
(
i
%
100
==
0
)
cout
<<
"Time "
<<
t
<<
"
\t
CoM pos error "
<<
error
<<
...
...
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