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
480e3ca8
Commit
480e3ca8
authored
2 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
cosmetics
parent
65eebf78
No related branches found
No related tags found
3 merge requests
!31
devel->main
,
!29
Add functionality for UAV
,
!27
Fix test with acc_x = 2 m/s2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/gtest_solve_problem_force_torque_inertial_dynamics.cpp
+14
-22
14 additions, 22 deletions
test/gtest_solve_problem_force_torque_inertial_dynamics.cpp
with
14 additions
and
22 deletions
test/gtest_solve_problem_force_torque_inertial_dynamics.cpp
+
14
−
22
View file @
480e3ca8
...
@@ -49,7 +49,7 @@ class Test_SolveProblemForceTorqueInertialPreintDynamics_yaml : public testing::
...
@@ -49,7 +49,7 @@ class Test_SolveProblemForceTorqueInertialPreintDynamics_yaml : public testing::
ProblemPtr
P
;
ProblemPtr
P
;
SensorForceTorqueInertialPtr
S
;
SensorForceTorqueInertialPtr
S
;
ProcessorForceTorqueInertialPreintDynamicsPtr
p
;
ProcessorForceTorqueInertialPreintDynamicsPtr
p
;
SolverCeresPtr
solver
_
;
SolverCeresPtr
solver
;
Vector3d
cdm_true
;
Vector3d
cdm_true
;
Vector3d
inertia_true
;
Vector3d
inertia_true
;
double
mass_true
;
double
mass_true
;
...
@@ -63,13 +63,11 @@ class Test_SolveProblemForceTorqueInertialPreintDynamics_yaml : public testing::
...
@@ -63,13 +63,11 @@ class Test_SolveProblemForceTorqueInertialPreintDynamics_yaml : public testing::
ParamsServer
server
=
ParamsServer
(
parser
.
getParams
());
ParamsServer
server
=
ParamsServer
(
parser
.
getParams
());
P
=
Problem
::
autoSetup
(
server
);
P
=
Problem
::
autoSetup
(
server
);
// CERES WRAPPER
// CERES WRAPPER
solver_
=
std
::
make_shared
<
SolverCeres
>
(
P
);
solver
=
std
::
make_shared
<
SolverCeres
>
(
P
);
// solver_->getSolverOptions().minimizer_type = ceres::TRUST_REGION; // ceres::TRUST_REGION;ceres::LINE_SEARCH
// solver->getSolverOptions().max_num_iterations = 1e4;
// solver_->getSolverOptions().max_line_search_step_contraction = 1e-3;
// solver->getSolverOptions().function_tolerance = 1e-15;
// solver_->getSolverOptions().max_num_iterations = 1e4;
// solver->getSolverOptions().gradient_tolerance = 1e-15;
// solver_->getSolverOptions().function_tolerance = 1e-15;
// solver->getSolverOptions().parameter_tolerance = 1e-15;
// solver_->getSolverOptions().gradient_tolerance = 1e-15;
// solver_->getSolverOptions().parameter_tolerance = 1e-15;
S
=
std
::
static_pointer_cast
<
SensorForceTorqueInertial
>
(
P
->
getHardware
()
->
getSensorList
().
front
());
S
=
std
::
static_pointer_cast
<
SensorForceTorqueInertial
>
(
P
->
getHardware
()
->
getSensorList
().
front
());
p
=
std
::
static_pointer_cast
<
ProcessorForceTorqueInertialPreintDynamics
>
(
S
->
getProcessorList
().
front
());
p
=
std
::
static_pointer_cast
<
ProcessorForceTorqueInertialPreintDynamics
>
(
S
->
getProcessorList
().
front
());
...
@@ -127,14 +125,13 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_only_hoveri
...
@@ -127,14 +125,13 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_only_hoveri
P
->
print
(
4
,
1
,
1
,
1
);
P
->
print
(
4
,
1
,
1
,
1
);
WOLF_INFO
(
"======== SOLVE PROBLEM ======="
)
WOLF_INFO
(
"======== SOLVE PROBLEM ======="
)
std
::
string
report
=
solver
_
->
solve
(
wolf
::
SolverManager
::
ReportVerbosity
::
FULL
);
std
::
string
report
=
solver
->
solve
(
wolf
::
SolverManager
::
ReportVerbosity
::
FULL
);
WOLF_INFO
(
report
);
WOLF_INFO
(
report
);
P
->
print
(
4
,
1
,
1
,
1
);
WOLF_INFO
(
"True mass : "
,
mass_true
,
" Kg."
);
WOLF_INFO
(
"True mass : "
,
mass_true
,
" Kg."
);
WOLF_INFO
(
"Guess mass : "
,
mass_guess
,
" Kg."
);
WOLF_INFO
(
"Guess mass : "
,
mass_guess
,
" Kg."
);
WOLF_INFO
(
"Estimated mass: "
,
S
->
getStateBlock
(
'm'
)
->
getState
(),
" Kg."
);
WOLF_INFO
(
"Estimated mass: "
,
S
->
getStateBlock
(
'm'
)
->
getState
(),
" Kg."
);
WOLF_INFO
(
"-----------------------------"
);
CaptureMotionPtr
C
=
std
::
make_shared
<
CaptureMotion
>
(
"CaptureMotion"
,
2.0
,
S
,
data
,
data_cov
,
nullptr
);
CaptureMotionPtr
C
=
std
::
make_shared
<
CaptureMotion
>
(
"CaptureMotion"
,
2.0
,
S
,
data
,
data_cov
,
nullptr
);
...
@@ -143,13 +140,11 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_only_hoveri
...
@@ -143,13 +140,11 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_only_hoveri
C
->
setTimeStamp
(
t
);
C
->
setTimeStamp
(
t
);
C
->
process
();
C
->
process
();
p
->
getOrigin
()
->
getFrame
()
->
fix
();
p
->
getOrigin
()
->
getFrame
()
->
fix
();
report
=
solver
_
->
solve
(
wolf
::
SolverManager
::
ReportVerbosity
::
FULL
);
report
=
solver
->
solve
(
wolf
::
SolverManager
::
ReportVerbosity
::
FULL
);
WOLF_INFO
(
"Estimated mass: "
,
S
->
getStateBlock
(
'm'
)
->
getState
(),
" Kg."
);
WOLF_INFO
(
"Estimated mass: "
,
S
->
getStateBlock
(
'm'
)
->
getState
(),
" Kg."
);
WOLF_INFO
(
"-----------------------------"
);
WOLF_INFO
(
"-----------------------------"
);
}
}
ASSERT_NEAR
(
S
->
getStateBlock
(
'm'
)
->
getState
()(
0
),
mass_true
,
1e-3
);
ASSERT_NEAR
(
S
->
getStateBlock
(
'm'
)
->
getState
()(
0
),
mass_true
,
1e-3
);
}
}
...
@@ -197,16 +192,13 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, cdm_only_hoverin
...
@@ -197,16 +192,13 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, cdm_only_hoverin
P
->
print
(
4
,
1
,
1
,
1
);
P
->
print
(
4
,
1
,
1
,
1
);
WOLF_INFO
(
"======== SOLVE PROBLEM ======="
)
WOLF_INFO
(
"======== SOLVE PROBLEM ======="
)
std
::
string
report
=
solver
_
->
solve
(
wolf
::
SolverManager
::
ReportVerbosity
::
FULL
);
std
::
string
report
=
solver
->
solve
(
wolf
::
SolverManager
::
ReportVerbosity
::
FULL
);
WOLF_INFO
(
report
);
// should show a very low iteration number (possibly 1)
WOLF_INFO
(
report
);
// should show a very low iteration number (possibly 1)
P
->
print
(
4
,
1
,
1
,
1
);
WOLF_INFO
(
"True cdm : "
,
cdm_true
.
transpose
(),
" m."
);
WOLF_INFO
(
"True cdm : "
,
cdm_true
.
transpose
(),
" m."
);
WOLF_INFO
(
"Guess cdm : "
,
cdm_guess
.
transpose
(),
" m."
);
WOLF_INFO
(
"Guess cdm : "
,
cdm_guess
.
transpose
(),
" m."
);
WOLF_INFO
(
"Estimated cdm: "
,
S
->
getStateBlock
(
'C'
)
->
getState
().
transpose
(),
" m."
);
WOLF_INFO
(
"Estimated cdm: "
,
S
->
getStateBlock
(
'C'
)
->
getState
().
transpose
(),
" m."
);
WOLF_INFO
(
"-----------------------------"
);
CaptureMotionPtr
C
=
std
::
make_shared
<
CaptureMotion
>
(
"CaptureMotion"
,
2.0
,
S
,
data
,
data_cov
,
nullptr
);
CaptureMotionPtr
C
=
std
::
make_shared
<
CaptureMotion
>
(
"CaptureMotion"
,
2.0
,
S
,
data
,
data_cov
,
nullptr
);
for
(
TimeStamp
t
=
p
->
getLast
()
->
getTimeStamp
()
+
1.0
;
t
<=
11.0
;
t
+=
1.0
)
for
(
TimeStamp
t
=
p
->
getLast
()
->
getTimeStamp
()
+
1.0
;
t
<=
11.0
;
t
+=
1.0
)
...
@@ -215,7 +207,7 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, cdm_only_hoverin
...
@@ -215,7 +207,7 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, cdm_only_hoverin
C
->
process
();
C
->
process
();
p
->
getOrigin
()
->
getFrame
()
->
getStateBlock
(
'L'
)
->
setState
(
Vector3d
::
Zero
());
// Make sure L is not moving due to torques
p
->
getOrigin
()
->
getFrame
()
->
getStateBlock
(
'L'
)
->
setState
(
Vector3d
::
Zero
());
// Make sure L is not moving due to torques
p
->
getOrigin
()
->
getFrame
()
->
fix
();
p
->
getOrigin
()
->
getFrame
()
->
fix
();
report
=
solver
_
->
solve
(
wolf
::
SolverManager
::
ReportVerbosity
::
FULL
);
report
=
solver
->
solve
(
wolf
::
SolverManager
::
ReportVerbosity
::
FULL
);
WOLF_INFO
(
"Estimated cdm : "
,
S
->
getStateBlock
(
'C'
)
->
getState
().
transpose
(),
" m."
);
WOLF_INFO
(
"Estimated cdm : "
,
S
->
getStateBlock
(
'C'
)
->
getState
().
transpose
(),
" m."
);
WOLF_INFO
(
"-----------------------------"
);
WOLF_INFO
(
"-----------------------------"
);
}
}
...
@@ -269,7 +261,7 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_and_cdm_hov
...
@@ -269,7 +261,7 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_and_cdm_hov
P
->
print
(
4
,
1
,
1
,
1
);
P
->
print
(
4
,
1
,
1
,
1
);
WOLF_INFO
(
"======== SOLVE PROBLEM ======="
)
WOLF_INFO
(
"======== SOLVE PROBLEM ======="
)
std
::
string
report
=
solver
_
->
solve
(
wolf
::
SolverManager
::
ReportVerbosity
::
FULL
);
std
::
string
report
=
solver
->
solve
(
wolf
::
SolverManager
::
ReportVerbosity
::
FULL
);
WOLF_INFO
(
report
);
// should show a very low iteration number (possibly 1)
WOLF_INFO
(
report
);
// should show a very low iteration number (possibly 1)
WOLF_INFO
(
"True mass : "
,
mass_true
,
" Kg."
);
WOLF_INFO
(
"True mass : "
,
mass_true
,
" Kg."
);
...
@@ -294,7 +286,7 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_and_cdm_hov
...
@@ -294,7 +286,7 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_and_cdm_hov
C
->
process
();
C
->
process
();
p
->
getOrigin
()
->
getFrame
()
->
getStateBlock
(
'L'
)
->
setState
(
Vector3d
::
Zero
());
// Make sure L is not moving due to torques
p
->
getOrigin
()
->
getFrame
()
->
getStateBlock
(
'L'
)
->
setState
(
Vector3d
::
Zero
());
// Make sure L is not moving due to torques
p
->
getOrigin
()
->
getFrame
()
->
fix
();
p
->
getOrigin
()
->
getFrame
()
->
fix
();
report
=
solver
_
->
solve
(
wolf
::
SolverManager
::
ReportVerbosity
::
FULL
);
report
=
solver
->
solve
(
wolf
::
SolverManager
::
ReportVerbosity
::
FULL
);
WOLF_INFO
(
"Estimated mass: "
,
S
->
getStateBlock
(
'm'
)
->
getState
(),
" Kg."
);
WOLF_INFO
(
"Estimated mass: "
,
S
->
getStateBlock
(
'm'
)
->
getState
(),
" Kg."
);
WOLF_INFO
(
"Estimated cdm : "
,
S
->
getStateBlock
(
'C'
)
->
getState
().
transpose
(),
" m."
);
WOLF_INFO
(
"Estimated cdm : "
,
S
->
getStateBlock
(
'C'
)
->
getState
().
transpose
(),
" m."
);
WOLF_INFO
(
"-----------------------------"
);
WOLF_INFO
(
"-----------------------------"
);
...
...
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