Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bodydynamics
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
mobile_robotics
wolf_projects
wolf_lib
plugins
bodydynamics
Commits
5b1abbf6
Commit
5b1abbf6
authored
5 years ago
by
Médéric Fourmy
Browse files
Options
Downloads
Patches
Plain Diff
Helper perturbation function
parent
4e0e0f82
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
test/gtest_factor_force_torque.cpp
+31
-19
31 additions, 19 deletions
test/gtest_factor_force_torque.cpp
with
31 additions
and
19 deletions
test/gtest_factor_force_torque.cpp
+
31
−
19
View file @
5b1abbf6
...
@@ -106,6 +106,21 @@ Matrix9d computeKinCov(const Matrix3d& Qp,
...
@@ -106,6 +106,21 @@ Matrix9d computeKinCov(const Matrix3d& Qp,
}
}
void
perturbateIfUnFixed
(
const
FrameBasePtr
&
KF
,
std
::
string
sb_name
){
if
(
!
KF
->
getStateBlock
(
sb_name
)
->
isFixed
())
{
if
(
sb_name
==
"O"
)
{
KF
->
getStateBlock
(
"O"
)
->
setState
(
KF
->
getStateBlock
(
"O"
)
->
getState
().
reverse
());
}
else
{
Eigen
::
Vector3d
pert
=
Eigen
::
Vector3d
::
Random
();
KF
->
getStateBlock
(
sb_name
)
->
setState
(
KF
->
getStateBlock
(
sb_name
)
->
getState
()
+
pert
);
}
}
}
class
FactorInertialKinematics_1KF
:
public
testing
::
Test
class
FactorInertialKinematics_1KF
:
public
testing
::
Test
{
{
...
@@ -316,27 +331,24 @@ TEST_F(FactorInertialKinematics_1KF,ZeroMvt)
...
@@ -316,27 +331,24 @@ TEST_F(FactorInertialKinematics_1KF,ZeroMvt)
Eigen
::
Vector3d
Lc_exp
=
Eigen
::
Vector3d
::
Zero
();
Eigen
::
Vector3d
Lc_exp
=
Eigen
::
Vector3d
::
Zero
();
Eigen
::
Vector3d
bp_exp
=
Eigen
::
Vector3d
::
Zero
();
Eigen
::
Vector3d
bp_exp
=
Eigen
::
Vector3d
::
Zero
();
Vector3d
errP
=
Vector3d
::
Random
();
Vector3d
errV
=
Vector3d
::
Random
();
Vector3d
errC
=
Vector3d
::
Random
();
Vector3d
errD
=
Vector3d
::
Random
();
Vector3d
errL
=
Vector3d
::
Random
();
Vector3d
errBp
=
Vector3d
::
Random
();
string
report
=
ceres_manager_
->
solve
(
SolverManager
::
ReportVerbosity
::
BRIEF
);
// 0: nothing, 1: BriefReport, 2: FullReport;
string
report
=
ceres_manager_
->
solve
(
SolverManager
::
ReportVerbosity
::
BRIEF
);
// 0: nothing, 1: BriefReport, 2: FullReport;
// throw std::invalid_argument( "received negative value" );
perturbateIfUnFixed
(
KFA_
,
"P"
);
if
(
!
KFA_
->
getP
()
->
isFixed
())
{
KFA_
->
getP
()
->
setState
(
KFA_
->
getP
()
->
getState
()
+
errP
);}
perturbateIfUnFixed
(
KFA_
,
"O"
);
if
(
!
KFA_
->
getO
()
->
isFixed
())
{
KFA_
->
getO
()
->
setState
(
KFA_
->
getO
()
->
getState
().
reverse
());}
perturbateIfUnFixed
(
KFA_
,
"V"
);
if
(
!
KFA_
->
getV
()
->
isFixed
())
{
KFA_
->
getV
()
->
setState
(
KFA_
->
getV
()
->
getState
()
+
errV
);}
perturbateIfUnFixed
(
KFA_
,
"C"
);
if
(
!
KFA_
->
getStateBlock
(
"C"
)
->
isFixed
())
{
KFA_
->
getStateBlock
(
"C"
)
->
setState
(
KFA_
->
getStateBlock
(
"C"
)
->
getState
()
+
errC
);}
perturbateIfUnFixed
(
KFA_
,
"D"
);
if
(
!
KFA_
->
getStateBlock
(
"D"
)
->
isFixed
())
{
KFA_
->
getStateBlock
(
"D"
)
->
setState
(
KFA_
->
getStateBlock
(
"D"
)
->
getState
()
+
errD
);}
perturbateIfUnFixed
(
KFA_
,
"L"
);
if
(
!
KFA_
->
getStateBlock
(
"L"
)
->
isFixed
())
{
KFA_
->
getStateBlock
(
"L"
)
->
setState
(
KFA_
->
getStateBlock
(
"L"
)
->
getState
()
+
errL
);}
perturbateIfUnFixed
(
KFA_
,
"B"
);
if
(
!
KFB_
->
getStateBlock
(
"C"
)
->
isFixed
())
{
KFB_
->
getStateBlock
(
"C"
)
->
setState
(
KFB_
->
getStateBlock
(
"C"
)
->
getState
()
+
errC
);}
if
(
!
KFB_
->
getStateBlock
(
"D"
)
->
isFixed
())
{
KFB_
->
getStateBlock
(
"D"
)
->
setState
(
KFB_
->
getStateBlock
(
"D"
)
->
getState
()
+
errD
);}
perturbateIfUnFixed
(
KFB_
,
"P"
);
if
(
!
KFB_
->
getStateBlock
(
"L"
)
->
isFixed
())
{
KFB_
->
getStateBlock
(
"L"
)
->
setState
(
KFB_
->
getStateBlock
(
"L"
)
->
getState
()
+
errL
);}
perturbateIfUnFixed
(
KFB_
,
"O"
);
if
(
!
KFB_
->
getStateBlock
(
"B"
)
->
isFixed
())
{
KFA_
->
getStateBlock
(
"B"
)
->
setState
(
KFA_
->
getStateBlock
(
"B"
)
->
getState
()
+
errBp
);}
perturbateIfUnFixed
(
KFB_
,
"V"
);
perturbateIfUnFixed
(
KFB_
,
"C"
);
perturbateIfUnFixed
(
KFB_
,
"D"
);
perturbateIfUnFixed
(
KFB_
,
"L"
);
perturbateIfUnFixed
(
KFB_
,
"B"
);
problem_
->
print
(
4
,
true
,
true
,
true
);
problem_
->
print
(
4
,
true
,
true
,
true
);
report
=
ceres_manager_
->
solve
(
SolverManager
::
ReportVerbosity
::
BRIEF
);
// 0: nothing, 1: BriefReport, 2: FullReport;
report
=
ceres_manager_
->
solve
(
SolverManager
::
ReportVerbosity
::
BRIEF
);
// 0: nothing, 1: BriefReport, 2: FullReport;
std
::
cout
<<
report
<<
std
::
endl
;
std
::
cout
<<
report
<<
std
::
endl
;
...
...
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