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
65eebf78
Commit
65eebf78
authored
2 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Fix m and com tests with more KFs.
parent
73cd08c2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
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
+39
-5
39 additions, 5 deletions
test/gtest_solve_problem_force_torque_inertial_dynamics.cpp
with
39 additions
and
5 deletions
test/gtest_solve_problem_force_torque_inertial_dynamics.cpp
+
39
−
5
View file @
65eebf78
...
@@ -135,6 +135,22 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_only_hoveri
...
@@ -135,6 +135,22 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_only_hoveri
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."
);
CaptureMotionPtr
C
=
std
::
make_shared
<
CaptureMotion
>
(
"CaptureMotion"
,
2.0
,
S
,
data
,
data_cov
,
nullptr
);
for
(
TimeStamp
t
=
p
->
getLast
()
->
getTimeStamp
()
+
1.0
;
t
<=
7.0
;
t
+=
1.0
)
{
C
->
setTimeStamp
(
t
);
C
->
process
();
p
->
getOrigin
()
->
getFrame
()
->
fix
();
report
=
solver_
->
solve
(
wolf
::
SolverManager
::
ReportVerbosity
::
FULL
);
WOLF_INFO
(
"Estimated mass: "
,
S
->
getStateBlock
(
'm'
)
->
getState
(),
" Kg."
);
WOLF_INFO
(
"-----------------------------"
);
}
ASSERT_NEAR
(
S
->
getStateBlock
(
'm'
)
->
getState
()(
0
),
mass_true
,
1e-3
);
}
}
TEST_F
(
Test_SolveProblemForceTorqueInertialPreintDynamics_yaml
,
cdm_only_hovering
)
TEST_F
(
Test_SolveProblemForceTorqueInertialPreintDynamics_yaml
,
cdm_only_hovering
)
...
@@ -175,6 +191,7 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, cdm_only_hoverin
...
@@ -175,6 +191,7 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, cdm_only_hoverin
CaptureMotionPtr
C_KF1
=
std
::
static_pointer_cast
<
CaptureMotion
>
(
p
->
getOrigin
());
CaptureMotionPtr
C_KF1
=
std
::
static_pointer_cast
<
CaptureMotion
>
(
p
->
getOrigin
());
C_KF0
->
getFrame
()
->
fix
();
C_KF0
->
getFrame
()
->
fix
();
C_KF1
->
getFrame
()
->
getStateBlock
(
'L'
)
->
setState
(
Vector3d
::
Zero
());
// Make sure L is not moving due to torques
C_KF1
->
getFrame
()
->
fix
();
C_KF1
->
getFrame
()
->
fix
();
P
->
print
(
4
,
1
,
1
,
1
);
P
->
print
(
4
,
1
,
1
,
1
);
...
@@ -188,6 +205,23 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, cdm_only_hoverin
...
@@ -188,6 +205,23 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, cdm_only_hoverin
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."
);
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
)
{
C
->
setTimeStamp
(
t
);
C
->
process
();
p
->
getOrigin
()
->
getFrame
()
->
getStateBlock
(
'L'
)
->
setState
(
Vector3d
::
Zero
());
// Make sure L is not moving due to torques
p
->
getOrigin
()
->
getFrame
()
->
fix
();
report
=
solver_
->
solve
(
wolf
::
SolverManager
::
ReportVerbosity
::
FULL
);
WOLF_INFO
(
"Estimated cdm : "
,
S
->
getStateBlock
(
'C'
)
->
getState
().
transpose
(),
" m."
);
WOLF_INFO
(
"-----------------------------"
);
}
ASSERT_MATRIX_APPROX
(
S
->
getStateBlock
(
'C'
)
->
getState
().
head
(
2
),
cdm_true
.
head
(
2
),
1e-5
);
// cdm_z is not observable while hovering
}
}
TEST_F
(
Test_SolveProblemForceTorqueInertialPreintDynamics_yaml
,
mass_and_cdm_hovering
)
TEST_F
(
Test_SolveProblemForceTorqueInertialPreintDynamics_yaml
,
mass_and_cdm_hovering
)
...
@@ -229,7 +263,7 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_and_cdm_hov
...
@@ -229,7 +263,7 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_and_cdm_hov
CaptureMotionPtr
C_KF1
=
std
::
static_pointer_cast
<
CaptureMotion
>
(
p
->
getOrigin
());
CaptureMotionPtr
C_KF1
=
std
::
static_pointer_cast
<
CaptureMotion
>
(
p
->
getOrigin
());
C_KF0
->
getFrame
()
->
fix
();
C_KF0
->
getFrame
()
->
fix
();
C_KF1
->
getFrame
()
->
getStateBlock
(
'L'
)
->
setState
(
Vector3d
::
Zero
());
C_KF1
->
getFrame
()
->
getStateBlock
(
'L'
)
->
setState
(
Vector3d
::
Zero
());
// Make sure L is not moving due to torques
C_KF1
->
getFrame
()
->
fix
();
C_KF1
->
getFrame
()
->
fix
();
P
->
print
(
4
,
1
,
1
,
1
);
P
->
print
(
4
,
1
,
1
,
1
);
...
@@ -239,10 +273,10 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_and_cdm_hov
...
@@ -239,10 +273,10 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_and_cdm_hov
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."
);
WOLF_INFO
(
"Guess mass : "
,
mass_guess
,
" Kg."
);
WOLF_INFO
(
"Estimated mass: "
,
S
->
getStateBlock
(
'm'
)
->
getState
(),
" Kg."
);
WOLF_INFO
(
"True cdm : "
,
cdm_true
.
transpose
(),
" m."
);
WOLF_INFO
(
"True cdm : "
,
cdm_true
.
transpose
(),
" m."
);
WOLF_INFO
(
"Guess mass : "
,
mass_guess
,
" Kg."
);
WOLF_INFO
(
"Guess cdm : "
,
cdm_guess
.
transpose
(),
" m."
);
WOLF_INFO
(
"Guess cdm : "
,
cdm_guess
.
transpose
(),
" m."
);
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
(
"-----------------------------"
);
...
@@ -258,7 +292,7 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_and_cdm_hov
...
@@ -258,7 +292,7 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_and_cdm_hov
{
{
C
->
setTimeStamp
(
t
);
C
->
setTimeStamp
(
t
);
C
->
process
();
C
->
process
();
p
->
getOrigin
()
->
getFrame
()
->
getStateBlock
(
'L'
)
->
setState
(
Vector3d
::
Zero
());
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."
);
...
@@ -277,6 +311,6 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_and_cdm_hov
...
@@ -277,6 +311,6 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_and_cdm_hov
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
testing
::
InitGoogleTest
(
&
argc
,
argv
);
testing
::
InitGoogleTest
(
&
argc
,
argv
);
// ::testing::GTEST_FLAG(filter) = "Test_SolveProblemForceTorqueInertialPreintDynamics_yaml.
mass_and_cdm
_hovering";
// ::testing::GTEST_FLAG(filter) = "Test_SolveProblemForceTorqueInertialPreintDynamics_yaml.
cdm_only
_hovering";
return
RUN_ALL_TESTS
();
return
RUN_ALL_TESTS
();
}
}
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