Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pinocchio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Stack Of Tasks
pinocchio
Commits
b47f6673
Commit
b47f6673
authored
7 years ago
by
Joseph Mirabel
Committed by
Joseph Mirabel
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[C++] Add Jacobian of log3 and log6
parent
1143cff3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/spatial/explog.hpp
+89
-0
89 additions, 0 deletions
src/spatial/explog.hpp
with
89 additions
and
0 deletions
src/spatial/explog.hpp
+
89
−
0
View file @
b47f6673
...
...
@@ -106,6 +106,45 @@ namespace se3
return
log3
(
R
.
derived
(),
theta
);
}
template
<
typename
Scalar
,
typename
_Vector3
,
typename
_Matrix3
>
void
Jlog3
(
const
Scalar
&
theta
,
const
Eigen
::
MatrixBase
<
_Vector3
>&
log
,
const
Eigen
::
MatrixBase
<
_Matrix3
>&
Jlog
)
{
_Matrix3
&
Jout
=
const_cast
<
_Matrix3
&>
(
Jlog
.
derived
());
if
(
theta
<
1e-6
)
Jout
.
setIdentity
();
else
{
// Jlog = alpha I
Scalar
ct
,
st
;
SINCOS
(
theta
,
&
st
,
&
ct
);
const
Scalar
st_1mct
=
st
/
(
1
-
ct
);
Jout
.
setZero
();
Jout
.
diagonal
().
setConstant
(
theta
*
st_1mct
);
// Jlog += r_{\times}/2
Jout
(
0
,
1
)
=
-
log
(
2
);
Jout
(
1
,
0
)
=
log
(
2
);
Jout
(
0
,
2
)
=
log
(
1
);
Jout
(
2
,
0
)
=
-
log
(
1
);
Jout
(
1
,
2
)
=
-
log
(
0
);
Jout
(
2
,
1
)
=
log
(
0
);
Jout
/=
2
;
const
Scalar
alpha
=
1
/
(
theta
*
theta
)
-
st_1mct
/
(
2
*
theta
);
Jout
.
noalias
()
+=
alpha
*
log
*
log
.
transpose
();
}
}
template
<
typename
_D
,
typename
_Matrix3
>
void
Jlog3
(
const
Eigen
::
MatrixBase
<
_D
>
&
R
,
const
Eigen
::
MatrixBase
<
_Matrix3
>&
Jlog
)
{
typedef
typename
_D
::
Scalar
Scalar
;
typedef
Eigen
::
Matrix
<
Scalar
,
3
,
1
>
Vector3
;
Scalar
t
;
Vector3
w
(
log3
(
R
,
t
));
Jlog3
(
t
,
w
,
Jlog
);
}
/// \brief Exp: se3 -> SE3.
///
/// Return the integral of the input twist during time 1.
...
...
@@ -210,6 +249,56 @@ namespace se3
SE3Tpl
<
typename
D
::
Scalar
,
Eigen
::
internal
::
traits
<
D
>::
Options
>
m
(
rot
,
trans
);
return
log6
(
m
);
}
template
<
typename
_Scalar
,
int
_Options
,
typename
D
>
void
Jlog6
(
const
SE3Tpl
<
_Scalar
,
_Options
>
&
M
,
const
Eigen
::
MatrixBase
<
D
>&
Jlog
)
{
typedef
_Scalar
Scalar
;
typedef
typename
SE3Tpl
<
Scalar
,
_Options
>::
Vector3
Vector3
;
typedef
typename
SE3Tpl
<
Scalar
,
_Options
>::
Matrix3
Matrix3
;
EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE
(
D
,
6
,
6
);
D
&
value
=
const_cast
<
D
&>
(
Jlog
.
derived
());
const
Matrix3
&
R
=
M
.
rotation
();
const
Vector3
&
p
=
M
.
translation
();
Scalar
t
;
Vector3
w
(
log3
(
R
,
t
));
Matrix3
J3
;
Jlog3
(
t
,
w
,
J3
);
const
Scalar
t2
=
t
*
t
;
Scalar
alpha
,
beta
,
beta_dot_over_theta
;
if
(
fabs
(
t
)
<
1e-2
)
{
alpha
=
1
-
t2
/
12
-
t2
*
t2
/
720
;
beta
=
1.
/
12
+
t2
/
720
;
beta_dot_over_theta
=
1.
/
360.
;
}
else
{
Scalar
st
,
ct
;
SINCOS
(
t
,
&
st
,
&
ct
);
alpha
=
t
*
st
/
(
2
*
(
1
-
ct
));
beta
=
1
/
(
t2
)
-
st
/
(
2
*
t
*
(
1
-
ct
));
beta_dot_over_theta
=
-
2
/
(
t2
*
t2
)
+
(
t
+
st
)
/
(
2
*
t2
*
t
*
(
1
-
ct
));
}
Matrix3
V
(
alpha
*
Matrix3
::
Identity
()
-
alphaSkew
(
.5
,
w
)
+
beta
*
w
*
w
.
transpose
());
Scalar
wTp
(
w
.
dot
(
p
));
Matrix3
J
((
alphaSkew
(
.5
,
p
)
+
(
beta_dot_over_theta
*
wTp
)
*
w
*
w
.
transpose
()
-
(
t2
*
beta_dot_over_theta
+
2
*
beta
)
*
p
*
w
.
transpose
()
+
wTp
*
beta
*
Matrix3
::
Identity
()
+
beta
*
w
*
p
.
transpose
()
)
*
J3
);
value
<<
V
*
R
,
J
,
Matrix3
::
Zero
(),
J3
;
}
}
// namespace se3
#endif //#ifndef __spatial_explog_hpp__
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