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
ab45fedf
Commit
ab45fedf
authored
2 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Remove cast<T> and some size errors
parent
1e5ae7ea
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
+9
-9
9 additions, 9 deletions
include/imu/factor/factor_imu.h
with
9 additions
and
9 deletions
include/imu/factor/factor_imu.h
+
9
−
9
View file @
ab45fedf
...
@@ -216,7 +216,7 @@ inline bool FactorImu::operator ()(const T* const _p1,
...
@@ -216,7 +216,7 @@ inline bool FactorImu::operator ()(const T* const _p1,
Map
<
const
Quaternion
<
T
>
>
q2
(
_q2
);
Map
<
const
Quaternion
<
T
>
>
q2
(
_q2
);
Map
<
const
Matrix
<
T
,
3
,
1
>
>
v2
(
_v2
);
Map
<
const
Matrix
<
T
,
3
,
1
>
>
v2
(
_v2
);
Map
<
Matrix
<
T
,
15
,
1
>
>
res
(
_res
);
Map
<
Matrix
<
T
,
9
,
1
>
>
res
(
_res
);
residual
(
p1
,
q1
,
v1
,
ab1
,
wb1
,
p2
,
q2
,
v2
,
res
);
residual
(
p1
,
q1
,
v1
,
ab1
,
wb1
,
p2
,
q2
,
v2
,
res
);
...
@@ -301,23 +301,23 @@ inline bool FactorImu::residual(const Eigen::MatrixBase<D1> & _p1,
...
@@ -301,23 +301,23 @@ inline bool FactorImu::residual(const Eigen::MatrixBase<D1> & _p1,
//needed typedefs
//needed typedefs
typedef
typename
D1
::
Scalar
T
;
typedef
typename
D1
::
Scalar
T
;
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE
(
D3
,
15
);
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE
(
D3
,
9
);
// 1. Expected delta from states
// 1. Expected delta from states
Eigen
::
Matrix
<
T
,
3
,
1
>
dp_exp
;
Eigen
::
Matrix
<
T
,
3
,
1
>
dp_exp
;
Eigen
::
Quaternion
<
T
>
dq_exp
;
Eigen
::
Quaternion
<
T
>
dq_exp
;
Eigen
::
Matrix
<
T
,
3
,
1
>
dv_exp
;
Eigen
::
Matrix
<
T
,
3
,
1
>
dv_exp
;
imu
::
betweenStates
(
_p1
,
_q1
,
_v1
,
_p2
,
_q2
,
_v2
,
(
T
)
dt_
,
dp_exp
,
dq_exp
,
dv_exp
);
imu
::
betweenStates
(
_p1
,
_q1
,
_v1
,
_p2
,
_q2
,
_v2
,
dt_
,
dp_exp
,
dq_exp
,
dv_exp
);
// 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
,
9
,
1
>
d_step
;
d_step
.
block
(
0
,
0
,
3
,
1
)
=
dDp_dab_
.
cast
<
T
>
()
*
(
_ab1
-
acc_bias_preint_
.
cast
<
T
>
()
)
+
dDp_dwb_
.
cast
<
T
>
()
*
(
_wb1
-
gyro_bias_preint_
.
cast
<
T
>
()
);
d_step
.
block
(
0
,
0
,
3
,
1
)
=
dDp_dab_
*
(
_ab1
-
acc_bias_preint_
)
+
dDp_dwb_
*
(
_wb1
-
gyro_bias_preint_
);
d_step
.
block
(
3
,
0
,
3
,
1
)
=
dDq_dwb_
.
cast
<
T
>
()
*
(
_wb1
-
gyro_bias_preint_
.
cast
<
T
>
()
);
d_step
.
block
(
3
,
0
,
3
,
1
)
=
dDq_dwb_
*
(
_wb1
-
gyro_bias_preint_
);
d_step
.
block
(
6
,
0
,
3
,
1
)
=
dDv_dab_
.
cast
<
T
>
()
*
(
_ab1
-
acc_bias_preint_
.
cast
<
T
>
()
)
+
dDv_dwb_
.
cast
<
T
>
()
*
(
_wb1
-
gyro_bias_preint_
.
cast
<
T
>
()
);
d_step
.
block
(
6
,
0
,
3
,
1
)
=
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
>
dp_step
=
d_step
.
block
(
0
,
0
,
3
,
1
);
...
@@ -351,10 +351,10 @@ inline bool FactorImu::residual(const Eigen::MatrixBase<D1> & _p1,
...
@@ -351,10 +351,10 @@ inline bool FactorImu::residual(const Eigen::MatrixBase<D1> & _p1,
J_err_corr
.
block
(
3
,
3
,
3
,
3
)
=
J_do_dq2
;
J_err_corr
.
block
(
3
,
3
,
3
,
3
)
=
J_do_dq2
;
// 4. Residuals are the weighted errors
// 4. Residuals are the weighted errors
_res
.
head
(
9
)
=
J_err_corr
.
inverse
().
transpose
()
*
getMeasurementSquareRootInformationUpper
()
.
cast
<
T
>
()
*
d_error
;
_res
.
head
(
9
)
=
J_err_corr
.
inverse
().
transpose
()
*
getMeasurementSquareRootInformationUpper
()
*
d_error
;
#else
#else
imu
::
diff
(
dp_exp
,
dq_exp
,
dv_exp
,
dp_correct
,
dq_correct
,
dv_correct
,
dp_error
,
do_error
,
dv_error
);
imu
::
diff
(
dp_exp
,
dq_exp
,
dv_exp
,
dp_correct
,
dq_correct
,
dv_correct
,
dp_error
,
do_error
,
dv_error
);
_res
.
head
(
9
)
=
getMeasurementSquareRootInformationUpper
()
.
cast
<
T
>
()
*
d_error
;
_res
=
getMeasurementSquareRootInformationUpper
()
*
d_error
;
#endif
#endif
#else // method 2
#else // method 2
...
@@ -372,7 +372,7 @@ inline bool FactorImu::residual(const Eigen::MatrixBase<D1> & _p1,
...
@@ -372,7 +372,7 @@ inline bool FactorImu::residual(const Eigen::MatrixBase<D1> & _p1,
d_error
<<
d_diff
-
d_step
;
d_error
<<
d_diff
-
d_step
;
// 4. Residuals are the weighted errors
// 4. Residuals are the weighted errors
_res
.
head
(
9
)
=
getMeasurementSquareRootInformationUpper
()
.
cast
<
T
>
()
*
d_error
;
_res
=
getMeasurementSquareRootInformationUpper
()
*
d_error
;
#endif
#endif
...
...
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