Main MRPT website > C++ reference
MRPT logo
landmarks.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-2015, 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 
10 #pragma once
11 
14 
15 namespace mrpt { namespace srba {
16 namespace landmarks {
17 
18  /** \defgroup mrpt_srba_landmarks Landmark parameterizations
19  * \ingroup mrpt_srba_grp */
20 
21  /** \addtogroup mrpt_srba_landmarks
22  * @{ */
23 
24  /** A parameterization of landmark positions in Euclidean coordinates (3D) */
25  struct Euclidean3D
26  {
27  static const size_t LM_DIMS = 3; //!< The number of parameters in each LM parameterization relative to its base KF: (x,y,z)
28  static const landmark_jacob_family_t jacob_family = jacob_point_landmark; //!< Specify the kind of Jacobian to be used for compute_jacobian_dAepsDx_deps<>
29  //static const size_t LM_EUCLIDEAN_DIMS = 3; //!< Either 2 or 3, depending on the real minimum number of coordinates needed to parameterize the landmark.
31 
32  /** Converts the landmark parameterization into 3D Eucliden coordinates (used for OpenGL rendering, etc.) */
33  template <class VECTOR> inline static void relativeEuclideanLocation(const VECTOR &posParams, mrpt::math::TPoint3D &posEuclidean)
34  {
35  posEuclidean.x = posParams[0];
36  posEuclidean.y = posParams[1];
37  posEuclidean.z = posParams[2];
38  }
39 
40  /** Evaluates pt = pose (+) pt
41  * \param[in,out] pt A vector with the landmark parameterization values
42  * \param[in] pose The relative pose */
43  template <class POSE,class VECTOR>
44  inline static void composePosePoint(VECTOR & pt, const POSE & pose) {
45  pose.composePoint(pt[0],pt[1],pt[2], pt[0],pt[1],pt[2]);
46  }
47  /** Evaluates lm_local = lm_global (-) pose
48  * \param[in] lm_global A vector with the landmark parameterization values in "global" coordinates
49  * \param[out] lm_local A vector with the landmark parameterization values in "local" coordinates, as seen from "pose"
50  * \param[in] pose The relative pose */
51  template <class POSE,class VECTOR>
52  static inline void inverseComposePosePoint(const VECTOR &lm_global,VECTOR &lm_local,const POSE &pose) {
53  pose.inverseComposePoint(lm_global[0],lm_global[1],lm_global[2], lm_local[0],lm_local[1],lm_local[2]);
54  }
55  };
56 
57  /** A parameterization of landmark positions in Euclidean coordinates (2D) */
58  struct Euclidean2D
59  {
60  static const size_t LM_DIMS = 2; //!< The number of parameters in each LM parameterization relative to its base KF: (x,y)
61  static const landmark_jacob_family_t jacob_family = jacob_point_landmark; //!< Specify the kind of Jacobian to be used for compute_jacobian_dAepsDx_deps<>
62  //static const size_t LM_EUCLIDEAN_DIMS = 2; //!< Either 2 or 3, depending on the real minimum number of coordinates needed to parameterize the landmark.
64 
65  /** Converts the landmark parameterization into 3D Eucliden coordinates (used for OpenGL rendering, etc.) */
66  template <class VECTOR> inline static void relativeEuclideanLocation(const VECTOR &posParams, mrpt::math::TPoint3D &posEuclidean)
67  {
68  posEuclidean.x = posParams[0];
69  posEuclidean.y = posParams[1];
70  posEuclidean.z = 0;
71  }
72 
73  /** Evaluates pt = pose (+) pt
74  * \param[in,out] pt A vector with the landmark parameterization values
75  * \param[in] pose The relative pose */
76  template <class POSE,class VECTOR>
77  inline static void composePosePoint(VECTOR & pt, const POSE & pose) {
78  double lx,ly,lz;
79  pose.composePoint(pt[0],pt[1],0, lx,ly,lz);
80  pt[0]=lx; pt[1]=ly;
81  ASSERTMSG_(std::abs(lz)<1e-2, "Error: Using a 3D transformation to obtain a 2D point but it results in |z|>eps")
82  }
83  /** Evaluates lm_local = lm_global (-) pose
84  * \param[in] lm_global A vector with the landmark parameterization values in "global" coordinates
85  * \param[out] lm_local A vector with the landmark parameterization values in "local" coordinates, as seen from "pose"
86  * \param[in] pose The relative pose */
87  template <class POSE,class VECTOR>
88  static inline void inverseComposePosePoint(const VECTOR &lm_global,VECTOR &lm_local,const POSE &pose) {
89  pose.inverseComposePoint(lm_global[0],lm_global[1], lm_local[0],lm_local[1]);
90  }
91  };
92 
93  /** A parameterization of SE(2) relative poses ("fake landmarks" to emulate graph-SLAM) */
95  {
96  static const size_t LM_DIMS = 3; //!< The number of parameters in each LM parameterization relative to its base KF
97  static const landmark_jacob_family_t jacob_family = jacob_relpose_landmark; //!< Specify the kind of Jacobian to be used for compute_jacobian_dAepsDx_deps<>
98  //static const size_t LM_EUCLIDEAN_DIMS = 3; //!< Either 2 or 3, depending on the real minimum number of coordinates needed to parameterize the landmark.
100 
101  /** Evaluates pt = pose (+) pt
102  * \param[in,out] pt A vector with the landmark parameterization values
103  * \param[in] pose The relative pose */
104  template <class POSE,class VECTOR>
105  inline static void composePosePoint(VECTOR & pt, const POSE & pose) {
106  MRPT_UNUSED_PARAM(pt);
107  MRPT_UNUSED_PARAM(pose);
108  // Not applicable: nothing to do on "pt"
109  }
110  /** Evaluates lm_local = lm_global (-) pose
111  * \param[in] lm_global A vector with the landmark parameterization values in "global" coordinates
112  * \param[out] lm_local A vector with the landmark parameterization values in "local" coordinates, as seen from "pose"
113  * \param[in] pose The relative pose */
114  template <class POSE,class VECTOR>
115  static inline void inverseComposePosePoint(const VECTOR &lm_global,VECTOR &lm_local,const POSE &pose) {
116  // Not applicable
117  MRPT_UNUSED_PARAM(pose);
118  lm_local=lm_global;
119  }
120 
121  };
122 
123  /** A parameterization of SE(3) relative poses ("fake landmarks" to emulate graph-SLAM) */
125  {
126  static const size_t LM_DIMS = 6; //!< The number of parameters in each LM parameterization relative to its base KF
127  static const landmark_jacob_family_t jacob_family = jacob_relpose_landmark; //!< Specify the kind of Jacobian to be used for compute_jacobian_dAepsDx_deps<>
128  //static const size_t LM_EUCLIDEAN_DIMS = 3; //!< Either 2 or 3, depending on the real minimum number of coordinates needed to parameterize the landmark.
130 
131  /** Evaluates pt = pose (+) pt
132  * \param[in,out] pt A vector with the landmark parameterization values
133  * \param[in] pose The relative pose */
134  template <class POSE,class VECTOR>
135  inline static void composePosePoint(VECTOR & pt, const POSE & pose) {
136  MRPT_UNUSED_PARAM(pt);
137  MRPT_UNUSED_PARAM(pose);
138  // Not applicable: nothing to do on "pt"
139  }
140  /** Evaluates lm_local = lm_global (-) pose
141  * \param[in] lm_global A vector with the landmark parameterization values in "global" coordinates
142  * \param[out] lm_local A vector with the landmark parameterization values in "local" coordinates, as seen from "pose"
143  * \param[in] pose The relative pose */
144  template <class POSE,class VECTOR>
145  static inline void inverseComposePosePoint(const VECTOR &lm_global,VECTOR &lm_local,const POSE &pose) {
146  // Not applicable
147  MRPT_UNUSED_PARAM(pose);
148  lm_local=lm_global;
149  }
150 
151  };
152 
153  /** @} */
154 
155 }
156 } } // end NS
A parameterization of SE(3) relative poses ("fake landmarks" to emulate graph-SLAM) ...
Definition: landmarks.h:124
A parameterization of SE(2) relative poses ("fake landmarks" to emulate graph-SLAM) ...
Definition: landmarks.h:94
static const landmark_jacob_family_t jacob_family
Specify the kind of Jacobian to be used for compute_jacobian_dAepsDx_deps<>
Definition: landmarks.h:61
static void composePosePoint(VECTOR &pt, const POSE &pose)
Evaluates pt = pose (+) pt.
Definition: landmarks.h:44
static void inverseComposePosePoint(const VECTOR &lm_global, VECTOR &lm_local, const POSE &pose)
Evaluates lm_local = lm_global (-) pose.
Definition: landmarks.h:115
static const size_t LM_DIMS
The number of parameters in each LM parameterization relative to its base KF: (x,y,z)
Definition: landmarks.h:27
static const size_t LM_DIMS
The number of parameters in each LM parameterization relative to its base KF.
Definition: landmarks.h:96
static void relativeEuclideanLocation(const VECTOR &posParams, mrpt::math::TPoint3D &posEuclidean)
Converts the landmark parameterization into 3D Eucliden coordinates (used for OpenGL rendering...
Definition: landmarks.h:66
double z
X,Y,Z coordinates.
static void relativeEuclideanLocation(const VECTOR &posParams, mrpt::math::TPoint3D &posEuclidean)
Converts the landmark parameterization into 3D Eucliden coordinates (used for OpenGL rendering...
Definition: landmarks.h:33
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
static void composePosePoint(VECTOR &pt, const POSE &pose)
Evaluates pt = pose (+) pt.
Definition: landmarks.h:77
T abs(T x)
Definition: nanoflann.hpp:237
mrpt::srba::landmark_rendering_as_pose_constraints render_mode_t
Definition: landmarks.h:99
mrpt::srba::landmark_rendering_as_pose_constraints render_mode_t
Definition: landmarks.h:129
mrpt::srba::landmark_rendering_as_point render_mode_t
Definition: landmarks.h:30
Render "fake graph-slam-like landmarks" as keyframe-to-keyframe constraints.
static void inverseComposePosePoint(const VECTOR &lm_global, VECTOR &lm_local, const POSE &pose)
Evaluates lm_local = lm_global (-) pose.
Definition: landmarks.h:52
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
static const size_t LM_DIMS
The number of parameters in each LM parameterization relative to its base KF.
Definition: landmarks.h:126
static void composePosePoint(VECTOR &pt, const POSE &pose)
Evaluates pt = pose (+) pt.
Definition: landmarks.h:135
static const landmark_jacob_family_t jacob_family
Specify the kind of Jacobian to be used for compute_jacobian_dAepsDx_deps<>
Definition: landmarks.h:127
static const landmark_jacob_family_t jacob_family
Specify the kind of Jacobian to be used for compute_jacobian_dAepsDx_deps<>
Definition: landmarks.h:28
A parameterization of landmark positions in Euclidean coordinates (2D)
Definition: landmarks.h:58
A parameterization of landmark positions in Euclidean coordinates (3D)
Definition: landmarks.h:25
static void composePosePoint(VECTOR &pt, const POSE &pose)
Evaluates pt = pose (+) pt.
Definition: landmarks.h:105
static void inverseComposePosePoint(const VECTOR &lm_global, VECTOR &lm_local, const POSE &pose)
Evaluates lm_local = lm_global (-) pose.
Definition: landmarks.h:145
"fake landmarks" used for relative pose observations
static const landmark_jacob_family_t jacob_family
Specify the kind of Jacobian to be used for compute_jacobian_dAepsDx_deps<>
Definition: landmarks.h:97
static const size_t LM_DIMS
The number of parameters in each LM parameterization relative to its base KF: (x,y) ...
Definition: landmarks.h:60
landmark_jacob_family_t
Specify the kind of Jacobian to be used for compute_jacobian_dAepsDx_deps<>
Lightweight 3D point.
mrpt::srba::landmark_rendering_as_point render_mode_t
Definition: landmarks.h:63
#define ASSERTMSG_(f, __ERROR_MSG)
static void inverseComposePosePoint(const VECTOR &lm_global, VECTOR &lm_local, const POSE &pose)
Evaluates lm_local = lm_global (-) pose.
Definition: landmarks.h:88



Page generated by Doxygen 1.8.9.1 for MRPT 1.3.0 SVN: at Sun Sep 13 03:55:12 UTC 2015