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
4f4284ad
Commit
4f4284ad
authored
2 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
slight code optimization
parent
4ef9d1e9
No related branches found
No related tags found
1 merge request
!54
devel->main
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/imu/factor/factor_imu.h
+7
-10
7 additions, 10 deletions
include/imu/factor/factor_imu.h
with
7 additions
and
10 deletions
include/imu/factor/factor_imu.h
+
7
−
10
View file @
4f4284ad
...
@@ -269,8 +269,8 @@ inline bool FactorImu::residual(const Eigen::MatrixBase<D1> & _p1,
...
@@ -269,8 +269,8 @@ inline bool FactorImu::residual(const Eigen::MatrixBase<D1> & _p1,
*
*
* We use the following functions from imu_tools.h:
* We use the following functions from imu_tools.h:
* D = betweenStates(x1,x2,dt) : obtain a Delta from two states separated dt=t2-t1
* D = betweenStates(x1,x2,dt) : obtain a Delta from two states separated dt=t2-t1
* D2 = plus(D1,T) : plus operator, D2 = D1
(+)
T
* D2 = plus(D1,T) :
blocl-
plus operator, D2 = D1
<+>
T
* T = diff(D1,D2) : minus operator, T = D2
(-)
D1
* T = diff(D1,D2) :
block-
minus operator, T = D2
<->
D1
*
*
* Two methods are possible (select with #define below this note) :
* Two methods are possible (select with #define below this note) :
*
*
...
@@ -313,16 +313,13 @@ inline bool FactorImu::residual(const Eigen::MatrixBase<D1> & _p1,
...
@@ -313,16 +313,13 @@ inline bool FactorImu::residual(const Eigen::MatrixBase<D1> & _p1,
// 2. Corrected integrated delta: delta_corr = delta_preint (+) J_bias * (bias_current - bias_preint)
// 2. Corrected integrated delta: delta_corr = delta_preint (+) J_bias * (bias_current - bias_preint)
// 2.a. Compute the delta step in tangent space: step = J_bias * (bias - bias_preint)
// 2.a. Compute the delta step in tangent space: step = J_bias * (bias - bias_preint)
Eigen
::
Matrix
<
T
,
9
,
1
>
d_step
;
Eigen
::
Matrix
<
T
,
3
,
1
>
d
p_step
,
do_step
,
dv
_step
;
d_step
.
block
(
0
,
0
,
3
,
1
)
=
dDp_dab_
*
(
_ab1
-
acc_bias_preint_
)
+
dDp_dwb_
*
(
_wb1
-
gyro_bias_preint_
);
d
p
_step
=
dDp_dab_
*
(
_ab1
-
acc_bias_preint_
)
+
dDp_dwb_
*
(
_wb1
-
gyro_bias_preint_
);
d_step
.
block
(
3
,
0
,
3
,
1
)
=
dDq_dwb_
*
(
_wb1
-
gyro_bias_preint_
);
d
o
_step
=
/* it happens that dDq_dab = 0 ! */
dDq_dwb_
*
(
_wb1
-
gyro_bias_preint_
);
d_step
.
block
(
6
,
0
,
3
,
1
)
=
dDv_dab_
*
(
_ab1
-
acc_bias_preint_
)
+
dDv_dwb_
*
(
_wb1
-
gyro_bias_preint_
);
d
v
_step
=
dDv_dab_
*
(
_ab1
-
acc_bias_preint_
)
+
dDv_dwb_
*
(
_wb1
-
gyro_bias_preint_
);
#ifdef METHOD_1 // method 1
#ifdef METHOD_1 // method 1
Eigen
::
Matrix
<
T
,
3
,
1
>
dp_step
=
d_step
.
block
(
0
,
0
,
3
,
1
);
Eigen
::
Matrix
<
T
,
3
,
1
>
do_step
=
d_step
.
block
(
3
,
0
,
3
,
1
);
Eigen
::
Matrix
<
T
,
3
,
1
>
dv_step
=
d_step
.
block
(
6
,
0
,
3
,
1
);
// 2.b. Add the correction step to the preintegrated delta: delta_cor = delta_preint (+) step
// 2.b. Add the correction step to the preintegrated delta: delta_cor = delta_preint (+) step
Eigen
::
Matrix
<
T
,
3
,
1
>
dp_correct
;
Eigen
::
Matrix
<
T
,
3
,
1
>
dp_correct
;
...
@@ -336,7 +333,7 @@ inline bool FactorImu::residual(const Eigen::MatrixBase<D1> & _p1,
...
@@ -336,7 +333,7 @@ inline bool FactorImu::residual(const Eigen::MatrixBase<D1> & _p1,
// 3. Delta error in minimal form: D_err = diff(D_exp , D_corr)
// 3. Delta error in minimal form: D_err = diff(D_exp , D_corr)
// Note the Dt here is zero because it's the delta-time between the same time stamps!
// Note the Dt here is zero because it's the delta-time between the same time stamps!
Eigen
::
Matrix
<
T
,
9
,
1
>
d_error
;
Eigen
::
Matrix
<
T
,
9
,
1
>
d_error
;
Eigen
::
Map
<
Eigen
::
Matrix
<
T
,
3
,
1
>
>
dp_error
(
d_error
.
data
()
);
Eigen
::
Map
<
Eigen
::
Matrix
<
T
,
3
,
1
>
>
dp_error
(
d_error
.
data
()
+
0
);
Eigen
::
Map
<
Eigen
::
Matrix
<
T
,
3
,
1
>
>
do_error
(
d_error
.
data
()
+
3
);
Eigen
::
Map
<
Eigen
::
Matrix
<
T
,
3
,
1
>
>
do_error
(
d_error
.
data
()
+
3
);
Eigen
::
Map
<
Eigen
::
Matrix
<
T
,
3
,
1
>
>
dv_error
(
d_error
.
data
()
+
6
);
Eigen
::
Map
<
Eigen
::
Matrix
<
T
,
3
,
1
>
>
dv_error
(
d_error
.
data
()
+
6
);
...
...
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