Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
imu
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
imu
Commits
ddc40385
Commit
ddc40385
authored
4 years ago
by
Médéric Fourmy
Browse files
Options
Downloads
Patches
Plain Diff
2 frequencies for lin and ang quantities
parent
fa4f84aa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!39
release after RAL
,
!38
After 2nd RAL submission
,
!29
Resolve "gtest imu and mocap"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/gtest_imu_mocap_fusion.cpp
+24
-18
24 additions, 18 deletions
test/gtest_imu_mocap_fusion.cpp
with
24 additions
and
18 deletions
test/gtest_imu_mocap_fusion.cpp
+
24
−
18
View file @
ddc40385
...
@@ -31,7 +31,6 @@ using std::endl;
...
@@ -31,7 +31,6 @@ using std::endl;
const
Vector3d
zero3
=
Vector3d
::
Zero
();
const
Vector3d
zero3
=
Vector3d
::
Zero
();
const
double
dt
=
0.0001
;
const
double
dt
=
0.0001
;
const
Vector3d
freq
=
Vector3d
::
Ones
();
class
ImuMocapFusion_Test
:
public
testing
::
Test
class
ImuMocapFusion_Test
:
public
testing
::
Test
...
@@ -57,6 +56,13 @@ class ImuMocapFusion_Test : public testing::Test
...
@@ -57,6 +56,13 @@ class ImuMocapFusion_Test : public testing::Test
// simulate trajectory
// simulate trajectory
//////////////////////
//////////////////////
Vector3d
freq_lin
;
freq_lin
<<
0.5
,
1
,
1.5
;
Vector3d
freq_ang
;
freq_ang
<<
1.5
,
1
,
0.5
;
// P = sin(freq*t)
// V = freq*cos(freq*t)
// A = -freq^2*cos(freq*t)
// biases and extrinsics
// biases and extrinsics
ba_
=
Vector3d
::
Zero
();
ba_
=
Vector3d
::
Zero
();
bw_
=
Vector3d
::
Zero
();
bw_
=
Vector3d
::
Zero
();
...
@@ -66,10 +72,10 @@ class ImuMocapFusion_Test : public testing::Test
...
@@ -66,10 +72,10 @@ class ImuMocapFusion_Test : public testing::Test
// initialize state
// initialize state
Vector3d
w_p_wb
=
Vector3d
::
Zero
();
Vector3d
w_p_wb
=
Vector3d
::
Zero
();
Quaterniond
w_q_b
=
Quaterniond
::
Identity
();
Quaterniond
w_q_b
=
Quaterniond
::
Identity
();
Vector3d
w_v_wb
=
freq
.
array
();
// *(1,1,1)
Vector3d
w_v_wb
=
freq
_lin
.
array
();
// *(1,1,1)
// Problem and solver_
// Problem and solver_
problem_
=
Problem
::
create
(
"PO"
,
3
);
problem_
=
Problem
::
create
(
"PO
V
"
,
3
);
solver_
=
std
::
make_shared
<
SolverCeres
>
(
problem_
);
solver_
=
std
::
make_shared
<
SolverCeres
>
(
problem_
);
solver_
->
getSolverOptions
().
max_num_iterations
=
500
;
solver_
->
getSolverOptions
().
max_num_iterations
=
500
;
...
@@ -106,22 +112,22 @@ class ImuMocapFusion_Test : public testing::Test
...
@@ -106,22 +112,22 @@ class ImuMocapFusion_Test : public testing::Test
sensor_imu_
->
fixIntrinsics
();
sensor_imu_
->
fixIntrinsics
();
// Store necessary values in vectors
// Store necessary values in vectors
std
::
vector
<
Vector3d
>
w_p_wb_vec
;
//
std::vector<Vector3d> w_p_wb_vec;
std
::
vector
<
Vector3d
>
w_p_wb_sin_vec
;
//
std::vector<Vector3d> w_p_wb_sin_vec;
std
::
vector
<
Quaterniond
>
w_q_b_vec
;
//
std::vector<Quaterniond> w_q_b_vec;
std
::
vector
<
Vector3d
>
w_v_wb_vec
;
//
std::vector<Vector3d> w_v_wb_vec;
w_p_wb_vec
.
push_back
(
w_p_wb
);
//
w_p_wb_vec.push_back(w_p_wb);
w_p_wb_sin_vec
.
push_back
(
w_p_wb
);
//
w_p_wb_sin_vec.push_back(w_p_wb);
w_q_b_vec
.
push_back
(
w_q_b
);
//
w_q_b_vec.push_back(w_q_b);
w_v_wb_vec
.
push_back
(
w_v_wb
);
//
w_v_wb_vec.push_back(w_v_wb);
int
traj_size
=
10001
;
int
traj_size
=
10001
;
for
(
int
i
=
0
;
i
<
traj_size
;
i
++
){
for
(
int
i
=
0
;
i
<
traj_size
;
i
++
){
double
t
=
i
*
dt
;
double
t
=
i
*
dt
;
Vector3d
w_p_wb_sin
=
Eigen
::
sin
((
freq
*
t
).
array
());
Vector3d
w_p_wb_sin
=
Eigen
::
sin
((
freq
_lin
*
t
).
array
());
// just for comparison with the integration
Vector3d
w_omg_b
=
freq
.
array
()
*
Eigen
::
cos
((
freq
*
t
).
array
());
Vector3d
w_omg_b
=
freq
_ang
.
array
()
*
Eigen
::
cos
((
freq
_ang
*
t
).
array
());
Vector3d
w_a_wb
=
-
freq
.
array
().
square
()
*
Eigen
::
sin
((
freq
*
t
).
array
());
Vector3d
w_a_wb
=
-
freq
_lin
.
array
().
square
()
*
Eigen
::
sin
((
freq
_lin
*
t
).
array
());
// integrate simulated traj
// integrate simulated traj
w_p_wb
=
w_p_wb
+
w_v_wb
*
dt
+
0.5
*
w_a_wb
*
dt
*
dt
;
w_p_wb
=
w_p_wb
+
w_v_wb
*
dt
+
0.5
*
w_a_wb
*
dt
*
dt
;
...
@@ -145,9 +151,9 @@ class ImuMocapFusion_Test : public testing::Test
...
@@ -145,9 +151,9 @@ class ImuMocapFusion_Test : public testing::Test
CP
->
process
();
CP
->
process
();
if
((
i
%
1000
)
==
0
){
if
((
i
%
1000
)
==
0
){
std
::
cout
<<
""
<<
std
::
endl
;
std
::
cout
<<
t
<<
std
::
endl
;
std
::
cout
<<
w_p_wb
.
transpose
()
<<
std
::
endl
;
std
::
cout
<<
"w_p_wb: "
<<
w_p_wb
.
transpose
()
<<
std
::
endl
;
std
::
cout
<<
w_p_wb_sin
.
transpose
()
<<
std
::
endl
;
std
::
cout
<<
"w_p_wb_sin: "
<<
w_p_wb_sin
.
transpose
()
<<
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