Main MRPT website > C++ reference
MRPT logo
SE_traits.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | The Mobile Robot Programming Toolkit (MRPT) C++ library |
3  | |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (C) 2005-2012 University of Malaga |
7  | |
8  | This software was written by the Machine Perception and Intelligent |
9  | Robotics Lab, University of Malaga (Spain). |
10  | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11  | |
12  | This file is part of the MRPT project. |
13  | |
14  | MRPT is free software: you can redistribute it and/or modify |
15  | it under the terms of the GNU General Public License as published by |
16  | the Free Software Foundation, either version 3 of the License, or |
17  | (at your option) any later version. |
18  | |
19  | MRPT is distributed in the hope that it will be useful, |
20  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22  | GNU General Public License for more details. |
23  | |
24  | You should have received a copy of the GNU General Public License |
25  | along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26  | |
27  +---------------------------------------------------------------------------+ */
28 #ifndef MRPT_SE3_TRAITS_H
29 #define MRPT_SE3_TRAITS_H
30 
31 #include <mrpt/poses/CPose3D.h>
32 #include <mrpt/poses/CPose2D.h>
34 
35 namespace mrpt
36 {
37  namespace poses
38  {
39  /** \addtogroup poses_grp
40  * @{ */
41 
42  /** A helper class for SE(2) and SE(3) geometry-related transformations, on-manifold optimization Jacobians, etc.
43  * \sa SE_traits<2>, SE_traits<3>, CPose3D, CPose2D
44  */
45  template <size_t DOF> struct BASE_IMPEXP SE_traits;
46 
47  /** Specialization of SE for 3D poses \sa SE_traits */
48  template <> struct BASE_IMPEXP SE_traits<3>
49  {
50  enum { VECTOR_SIZE = 6 };
51  typedef CArrayDouble<VECTOR_SIZE> array_t;
52  typedef CMatrixFixedNumeric<double,VECTOR_SIZE,VECTOR_SIZE> matrix_VxV_t;
53  typedef CPose3D pose_t;
54 
55  /** Exponential map in SE(3) */
56  static inline void exp(const array_t &x, CPose3D &P) { P = CPose3D::exp(x); }
57 
58  /** Logarithm map in SE(3) */
59  static inline void ln(const CPose3D &P, array_t &x) { P.ln(x); }
60 
61  /** A pseudo-Logarithm map in SE(3), where the output = [X,Y,Z, Ln(ROT)], that is, the normal
62  * SO(3) logarithm is used for the rotation components, but the translation is left unmodified.
63  */
64  static void pseudo_ln(const CPose3D &P, array_t &x);
65 
66  /** Return one or both of the following 6x6 Jacobians, useful in graph-slam problems:
67  * \f[ \frac{\partial pseudoLn(P_1 D P_2^{-1}) }{\partial \epsilon_1} \f]
68  * \f[ \frac{\partial pseudoLn(P_1 D P_2^{-1}) }{\partial \epsilon_2} \f]
69  * With \f$ \epsilon_1 \f$ and \f$ \epsilon_2 \f$ being increments in the linearized manifold for P1 and P2.
70  */
71  static void jacobian_dP1DP2inv_depsilon(
72  const CPose3D &P1DP2inv,
73  matrix_VxV_t *df_de1,
74  matrix_VxV_t *df_de2);
75 
76  }; // end SE_traits
77 
78  /** Specialization of SE for 2D poses \sa SE_traits */
79  template <> struct BASE_IMPEXP SE_traits<2>
80  {
81  enum { VECTOR_SIZE = 3 };
82  typedef CArrayDouble<VECTOR_SIZE> array_t;
83  typedef CMatrixFixedNumeric<double,VECTOR_SIZE,VECTOR_SIZE> matrix_VxV_t;
84  typedef CPose2D pose_t;
85 
86  /** Exponential map in SE(2) */
87  static inline void exp(const array_t &x, CPose2D &P) { P.x(x[0]); P.y(x[1]); P.phi(x[2]); }
88 
89  /** Logarithm map in SE(2) */
90  static inline void ln(const CPose2D &P, array_t &x) { x[0] = P.x(); x[1] = P.y(); x[2] = P.phi(); }
91 
92  /** A pseudo-Logarithm map in SE(2), where the output = [X,Y, Ln(ROT)], that is, the normal
93  * SO(2) logarithm is used for the rotation components, but the translation is left unmodified.
94  */
95  static inline void pseudo_ln(const CPose2D &P, array_t &x) { ln(P,x); }
96 
97  /** Return one or both of the following 3x3 Jacobians, useful in graph-slam problems:
98  * \f[ \frac{\partial pseudoLn(P_1 D P_2^{-1}) }{\partial \epsilon_1} \f]
99  * \f[ \frac{\partial pseudoLn(P_1 D P_2^{-1}) }{\partial \epsilon_2} \f]
100  * With \f$ \epsilon_1 \f$ and \f$ \epsilon_2 \f$ being increments in the linearized manifold for P1 and P2.
101  */
102  static void jacobian_dP1DP2inv_depsilon(
103  const CPose2D &P1DP2inv,
104  matrix_VxV_t *df_de1,
105  matrix_VxV_t *df_de2);
106 
107  }; // end SE_traits
108 
109  /** @} */ // end of grouping
110 
111  } // End of namespace
112 } // End of namespace
113 
114 #endif



Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013