MRPT  1.9.9
SE_traits.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #ifndef MRPT_SE3_TRAITS_H
10 #define MRPT_SE3_TRAITS_H
11 
12 #include <mrpt/poses/CPose3D.h>
13 #include <mrpt/poses/CPose2D.h>
16 
17 namespace mrpt::poses
18 {
19 /** \addtogroup poses_grp
20  * @{ */
21 
22 /** A helper class for SE(2) and SE(3) geometry-related transformations,
23  * on-manifold optimization Jacobians, etc.
24  * \sa SE_traits<2>, SE_traits<3>, CPose3D, CPose2D
25  */
26 template <size_t DOF>
27 struct SE_traits;
28 
29 /** Specialization of SE for 3D poses \sa SE_traits */
30 template <>
31 struct SE_traits<3>
32 {
33  constexpr static size_t VECTOR_SIZE = 6;
35  using matrix_VxV_t =
37  using pose_t = CPose3D;
40 
41  /** Exponential map in SE(3), with XYZ different from the first three values
42  * of "x" \sa pseudo_exp */
43  static inline void exp(const array_t& x, CPose3D& P)
44  {
45  CPose3D::exp(x, P, false);
46  }
47 
48  /** Pseudo-Exponential map in SE(3), with XYZ copied from the first three
49  * values of "x" \sa exp */
50  static inline void pseudo_exp(const array_t& x, CPose3D& P)
51  {
52  CPose3D::exp(x, P, true);
53  }
54 
55  /** Logarithm map in SE(3) */
56  static inline void ln(const CPose3D& P, array_t& x) { P.ln(x); }
57  /** A pseudo-Logarithm map in SE(3), where the output = [X,Y,Z, Ln(ROT)],
58  * that is, the normal
59  * SO(3) logarithm is used for the rotation components, but the
60  * translation is left unmodified. */
61  static void pseudo_ln(const CPose3D& P, array_t& x);
62 
63  /** Return one or both of the following 6x6 Jacobians, useful in graph-slam
64  * problems:
65  * \f[ \frac{\partial pseudoLn(P_1 D P_2^{-1}) }{\partial \epsilon_1}
66  * \f]
67  * \f[ \frac{\partial pseudoLn(P_1 D P_2^{-1}) }{\partial \epsilon_2}
68  * \f]
69  * With \f$ \epsilon_1 \f$ and \f$ \epsilon_2 \f$ being increments in the
70  * linearized manifold for P1 and P2.
71  */
72  static void jacobian_dP1DP2inv_depsilon(
73  const CPose3D& P1DP2inv, matrix_VxV_t* df_de1, matrix_VxV_t* df_de2);
74 
75  /** Return one or both of the following 3x3 Jacobians, useful in graph-slam
76  * problems:
77  * \f[ \frac{\partial pseudoLn(D^{-1} P_1^{-1} P_2}{\partial \epsilon_1}
78  * \f]
79  * \f[ \frac{\partial pseudoLn(D^{-1} P_1^{-1} P_2}{\partial \epsilon_1}
80  * \f]
81  * With \f$ \epsilon_1 \f$ and \f$ \epsilon_2 \f$ being increments in the
82  * linearized manifold for P1 and P2.
83  */
84  static void jacobian_dDinvP1invP2_depsilon(
85  const CPose3D& Dinv, const CPose3D& P1, const CPose3D& P2,
86  matrix_VxV_t* df_de1, matrix_VxV_t* df_de2);
87 
88 }; // end SE_traits
89 
90 /** Specialization of SE for 2D poses \sa SE_traits */
91 template <>
92 struct SE_traits<2>
93 {
94  constexpr static size_t VECTOR_SIZE = 3;
96  using matrix_VxV_t =
98  using pose_t = CPose2D;
101 
102  /** Exponential map in SE(2) */
103  static inline void exp(const array_t& x, CPose2D& P)
104  {
105  P.x(x[0]);
106  P.y(x[1]);
107  P.phi(x[2]);
108  }
109 
110  /** Pseudo-Exponential map in SE(2), in this case identical to exp() */
111  static inline void pseudo_exp(const array_t& x, CPose2D& P) { exp(x, P); }
112  /** Logarithm map in SE(2) */
113  static inline void ln(const CPose2D& P, array_t& x)
114  {
115  x[0] = P.x();
116  x[1] = P.y();
117  x[2] = P.phi();
118  } //-V537
119 
120  /** A pseudo-Logarithm map in SE(2), where the output = [X,Y, Ln(ROT)], that
121  * is, the normal
122  * SO(2) logarithm is used for the rotation components, but the
123  * translation is left unmodified.
124  */
125  static inline void pseudo_ln(const CPose2D& P, array_t& x) { ln(P, x); }
126  /** Return one or both of the following 3x3 Jacobians, useful in graph-slam
127  * problems:
128  * \f[ \frac{\partial pseudoLn(P_1 D P_2^{-1}) }{\partial \epsilon_1}
129  * \f]
130  * \f[ \frac{\partial pseudoLn(P_1 D P_2^{-1}) }{\partial \epsilon_2}
131  * \f]
132  * With \f$ \epsilon_1 \f$ and \f$ \epsilon_2 \f$ being increments in the
133  * linearized manifold for P1 and P2.
134  */
135  static void jacobian_dP1DP2inv_depsilon(
136  const CPose2D& P1DP2inv, matrix_VxV_t* df_de1, matrix_VxV_t* df_de2);
137 
138  /** Return one or both of the following 3x3 Jacobians, useful in graph-slam
139  * problems:
140  * \f[ \frac{\partial pseudoLn(D^{-1} P_1^{-1} P_2}{\partial \epsilon_1}
141  * \f]
142  * \f[ \frac{\partial pseudoLn(D^{-1} P_1^{-1} P_2}{\partial \epsilon_1}
143  * \f]
144  * With \f$ \epsilon_1 \f$ and \f$ \epsilon_2 \f$ being increments in the
145  * linearized manifold for P1 and P2.
146  */
147  static void jacobian_dDinvP1invP2_depsilon(
148  const CPose2D& Dinv, const CPose2D& P1, const CPose2D& P2,
149  matrix_VxV_t* df_de1, matrix_VxV_t* df_de2);
150 
151 }; // end SE_traits
152 
153 /** @} */ // end of grouping
154 
155 } // namespace mrpt::poses
156 #endif
static void exp(const array_t &x, CPose3D &P)
Exponential map in SE(3), with XYZ different from the first three values of "x".
Definition: SE_traits.h:43
double x() const
Common members of all points & poses classes.
Definition: CPoseOrPoint.h:140
CArrayNumeric is an array for numeric types supporting several mathematical operations (actually...
Definition: CArrayNumeric.h:25
static void ln(const CPose2D &P, array_t &x)
Logarithm map in SE(2)
Definition: SE_traits.h:113
static void ln(const CPose3D &P, array_t &x)
Logarithm map in SE(3)
Definition: SE_traits.h:56
A numeric matrix of compile-time fixed size.
static void exp(const array_t &x, CPose2D &P)
Exponential map in SE(2)
Definition: SE_traits.h:103
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
Definition: CPose2D.h:38
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:86
const double & phi() const
Get the phi angle of the 2D pose (in radians)
Definition: CPose2D.h:80
A helper class for SE(2) and SE(3) geometry-related transformations, on-manifold optimization Jacobia...
Definition: SE_traits.h:27
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
Lightweight 2D pose.
static void pseudo_exp(const array_t &x, CPose3D &P)
Pseudo-Exponential map in SE(3), with XYZ copied from the first three values of "x".
Definition: SE_traits.h:50
static void pseudo_ln(const CPose2D &P, array_t &x)
A pseudo-Logarithm map in SE(2), where the output = [X,Y, Ln(ROT)], that is, the normal SO(2) logarit...
Definition: SE_traits.h:125
static void pseudo_exp(const array_t &x, CPose2D &P)
Pseudo-Exponential map in SE(2), in this case identical to exp()
Definition: SE_traits.h:111
GLenum GLint x
Definition: glext.h:3538
Lightweight 3D point.
Lightweight 2D point.
void ln(mrpt::math::CArrayDouble< 6 > &out_ln) const
Take the logarithm of the 3x4 matrix defined by this pose, generating the corresponding vector in the...
Definition: CPose3D.cpp:801
static CPose3D exp(const mrpt::math::CArrayNumeric< double, 6 > &vect, bool pseudo_exponential=false)
Exponentiate a Vector in the SE(3) Lie Algebra to generate a new CPose3D (static method).
Definition: CPose3D.cpp:758



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020