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
f2667665
Commit
f2667665
authored
5 years ago
by
Médéric Fourmy
Browse files
Options
Downloads
Patches
Plain Diff
Testing the Adjoint matrix, WIP
parent
daacab5a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/IMU/math/IMU_tools_Lie.h
+41
-35
41 additions, 35 deletions
include/IMU/math/IMU_tools_Lie.h
test/gtest_IMU_tools_Lie.cpp
+13
-1
13 additions, 1 deletion
test/gtest_IMU_tools_Lie.cpp
with
54 additions
and
36 deletions
include/IMU/math/IMU_tools_Lie.h
+
41
−
35
View file @
f2667665
...
...
@@ -78,41 +78,6 @@ inline Matrix<T, 11, 1> identity()
return
ret
;
}
template
<
typename
D1
,
typename
D2
>
inline
void
adjoint
(
const
MatrixBase
<
D1
>
d
,
MatrixBase
<
D1
>
adjd
)
{
// Adjoint matrix associated to the adjoint operator
Matrix
<
typename
D1
::
Scalar
,
3
,
1
>
dp
=
d
.
segment
<
3
>
(
0
);
Matrix
<
typename
D1
::
Scalar
,
3
,
3
>
dR
=
q2R
(
d
.
segment
<
4
>
(
3
));
Matrix
<
typename
D1
::
Scalar
,
3
,
1
>
dv
=
d
.
segment
<
3
>
(
7
);
typename
D1
::
Scalar
dt
=
d
(
10
);
adjd
.
setIdentity
();
adjd
<
3
,
3
>
(
0
,
0
)
=
dR
;
adjd
<
3
,
3
>
(
0
,
3
)
=
skew
(
dp
-
dv
*
dt
)
*
dR
;
adjd
<
3
,
3
>
(
0
,
6
)
=
-
dR
*
dt
;
adjd
<
3
,
1
>
(
0
,
9
)
=
dv
;
adjd
<
3
,
3
>
(
3
,
3
)
=
dR
;
adjd
<
3
,
3
>
(
6
,
3
)
=
skew
(
dv
)
*
dR
;
adjd
<
3
,
3
>
(
6
,
6
)
=
dR
;
}
template
<
typename
D
>
inline
Matrix
<
typename
D
::
Scalar
,
10
,
10
>
adjoint
(
const
MatrixBase
<
D
>
d
){
Matrix
<
typename
D
::
Scalar
,
10
,
10
>
adjd
;
adjoint
(
d
,
adjd
);
return
adjd
;
}
// template<typename D1, typename D2>
// inline Matrix<T, 11, 1> smalladjoint(const MatrixBase<D1> d, MatrixBase<D1> sadjd)
// {
// // Adjoint matrix associated to the adjoint operator
// TODO
// return ret;
// }
template
<
typename
D1
,
typename
D2
,
typename
D3
,
typename
D4
,
typename
D5
,
typename
D6
,
typename
T
>
inline
void
inverse
(
const
MatrixBase
<
D1
>&
dp
,
const
QuaternionBase
<
D2
>&
dq
,
const
MatrixBase
<
D3
>&
dv
,
const
T
&
dt
,
...
...
@@ -217,6 +182,47 @@ inline Matrix<typename D1::Scalar, 11, 1> compose(const MatrixBase<D1>& delta1,
return
ret
;
}
template
<
typename
D1
,
typename
D2
>
inline
void
adjoint
(
const
MatrixBase
<
D1
>&
d
,
MatrixBase
<
D2
>&
adjd
)
{
MatrixSizeCheck
<
11
,
1
>::
check
(
d
);
MatrixSizeCheck
<
10
,
10
>::
check
(
adjd
);
// Adjoint matrix associated to the adjoint operator
Matrix
<
typename
D1
::
Scalar
,
3
,
1
>
dp
(
&
d
(
0
)
);
Matrix
<
typename
D1
::
Scalar
,
3
,
3
>
dR
(
&
d
(
3
)
);
Matrix
<
typename
D1
::
Scalar
,
3
,
1
>
dv
(
&
d
(
7
)
);
const
typename
D1
::
Scalar
&
dt
=
d
(
10
);
// pqvt impl -> problem with gtest
adjd
.
setIdentity
();
adjd
.
block
(
0
,
0
,
3
,
3
)
=
dR
;
adjd
.
block
(
0
,
3
,
3
,
3
)
=
skew
(
dp
-
dv
*
dt
)
*
dR
;
adjd
.
block
(
0
,
6
,
3
,
3
)
=
-
dR
*
dt
;
adjd
.
block
(
0
,
9
,
3
,
1
)
=
dv
;
adjd
.
block
(
3
,
3
,
3
,
3
)
=
dR
;
adjd
.
block
(
6
,
3
,
3
,
3
)
=
skew
(
dv
)
*
dR
;
adjd
.
block
(
6
,
6
,
3
,
3
)
=
dR
;
}
template
<
typename
D
>
inline
Matrix
<
typename
D
::
Scalar
,
10
,
10
>
adjoint
(
const
MatrixBase
<
D
>&
delta
){
Matrix
<
typename
D
::
Scalar
,
10
,
10
>
adjd
;
adjoint
(
delta
,
adjd
);
return
adjd
;
}
// template<typename D1, typename D2>
// inline Matrix<T, 11, 1> smalladjoint(const MatrixBase<D1> d, MatrixBase<D1> sadjd)
// {
// // Adjoint matrix associated to the adjoint operator
// TODO
// return ret;
// }
template
<
typename
D1
,
typename
D2
,
typename
D3
,
typename
D4
,
typename
D5
>
inline
void
compose
(
const
MatrixBase
<
D1
>&
delta1
,
const
MatrixBase
<
D2
>&
delta2
,
...
...
This diff is collapsed.
Click to expand it.
test/gtest_IMU_tools_Lie.cpp
+
13
−
1
View file @
f2667665
...
...
@@ -161,12 +161,24 @@ TEST(IMU_tools, plus_minus)
Vector4s
qv2
=
(
Vector4s
()
<<
6
,
5
,
4
,
3
).
finished
().
normalized
();
delta1
<<
0
,
1
,
2
,
qv1
,
7
,
8
,
9
,
0.1
;
delta2
<<
10
,
11
,
12
,
qv2
,
17
,
18
,
19
,
0.3
;
err
<<
0.01
,
0.02
,
0.03
,
0.04
,
0.05
,
0.06
,
0.07
,
0.08
,
0.09
,
0.1
;
delta2_eq
=
plus
(
delta1
,
diff
(
delta1
,
delta2
));
ASSERT_MATRIX_APPROX
(
delta2_eq
,
delta2
,
1e-10
);
}
TEST
(
IMU_tools
,
adjazdzadazoint
)
{
VectorXs
delta1
(
11
),
delta2
(
11
);
Vector4s
qv1
=
(
Vector4s
()
<<
3
,
4
,
5
,
6
).
finished
().
normalized
();
Vector4s
qv2
=
(
Vector4s
()
<<
6
,
5
,
4
,
3
).
finished
().
normalized
();
delta1
<<
0
,
1
,
2
,
qv1
,
7
,
8
,
9
,
0.1
;
delta2
<<
10
,
11
,
12
,
qv2
,
17
,
18
,
19
,
0.3
;
ASSERT_MATRIX_APPROX
(
adjoint
(
delta1
).
inverse
(),
adjoint
(
inverse
(
delta1
)),
1e-6
);
// ASSERT_MATRIX_APPROX(adjoint(compose(delta1, delta2)), adjoint(delta1)*adjoint(delta2), 1e-10);
}
// TEST(IMU_tools, plus)
// {
// FORSTER's formulas -> TODO remove?
...
...
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