Main MRPT website > C++ reference for MRPT 1.9.9
CPose3DPDF.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-2017, 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 CPose3DPDF_H
10 #define CPose3DPDF_H
11 
13 #include <mrpt/math/math_frwds.h>
14 #include <mrpt/poses/CPose3D.h>
16 
17 namespace mrpt
18 {
19 namespace poses
20 {
21 class CPosePDF;
22 
23 /** Declares a class that represents a Probability Density Function (PDF) of a
24  * 3D pose (6D actually).
25  * This class is just the base class for unifying many diferent
26  * ways this PDF can be implemented.
27  *
28  * For convenience, a pose composition is also defined for any
29  * PDF derived class, changeCoordinatesReference, in the form of a method
30  * rather than an operator.
31  *
32  * For a similar class for 3D points (without attitude), see CPointPDF
33  *
34  *
35  * See also the tutorial on <a
36  * href="http://www.mrpt.org/Probability_Density_Distributions_Over_Spatial_Representations">probabilistic
37  * spatial representations in the MRPT</a>.
38  *
39  * \sa CPose3D, CPosePDF, CPointPDF
40  * \ingroup poses_pdf_grp
41  */
44 {
46 
47  public:
48  /** Copy operator, translating if necesary (for example, between particles
49  * and gaussian representations)
50  * \sa createFrom2D
51  */
52  virtual void copyFrom(const CPose3DPDF& o) = 0;
53 
54  /** This is a static transformation method from 2D poses to 3D PDFs,
55  * preserving the representation type (particles->particles,
56  * Gaussians->Gaussians,etc)
57  * It returns a new object of any of the derived classes of CPose3DPDF.
58  * This object must be deleted by the user when not required anymore.
59  * \sa copyFrom
60  */
61  static CPose3DPDF* createFrom2D(const CPosePDF& o);
62 
63  /** Bayesian fusion of two pose distributions, then save the result in this
64  * object (WARNING: Currently only distributions of the same class can be
65  * fused! eg, gaussian with gaussian,etc) */
66  virtual void bayesianFusion(const CPose3DPDF& p1, const CPose3DPDF& p2) = 0;
67 
68  /** Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF */
69  virtual void inverse(CPose3DPDF& o) const = 0;
70 
71  /** This static method computes the pose composition Jacobians.
72  *
73  * See this techical report:
74  * http:///www.mrpt.org/6D_poses:equivalences_compositions_and_uncertainty
75  *
76  * Direct equations (for the covariances) in yaw-pitch-roll are too complex.
77  * Make a way around them and consider instead this path:
78  * \code
79  * X(6D) U(6D)
80  * | |
81  * v v
82  * X(7D) U(7D)
83  * | |
84  * +--- (+) ---+
85  * |
86  * v
87  * RES(7D)
88  * |
89  * v
90  * RES(6D)
91  * \endcode
92  *
93  */
94  static void jacobiansPoseComposition(
95  const CPose3D& x, const CPose3D& u, mrpt::math::CMatrixDouble66& df_dx,
97 
98  enum
99  {
101  };
102  static inline bool is_3D() { return is_3D_val != 0; }
103  enum
104  {
106  };
107  static inline bool is_PDF() { return is_PDF_val != 0; }
108  /** Returns a 3D representation of this PDF (it doesn't clear the current
109  * contents of out_obj, but append new OpenGL objects to that list)
110  * \note Needs the mrpt-opengl library, and using
111  * mrpt::opengl::CSetOfObjects::Ptr as template argument.
112  * \note By default, ellipsoids for the confidence intervals of "q=3" are
113  * drawn; for more mathematical details, see
114  * CGeneralizedEllipsoidTemplate::setQuantiles()
115  * \sa mrpt::opengl::CSetOfObjects::posePDF2opengl() for details on
116  * pose-to-opengl conversion
117  */
118  template <class OPENGL_SETOFOBJECTSPTR>
119  inline void getAs3DObject(OPENGL_SETOFOBJECTSPTR& out_obj) const
120  {
121  typedef typename OPENGL_SETOFOBJECTSPTR::element_type SETOFOBJECTS;
122  out_obj->insertCollection(*SETOFOBJECTS::posePDF2opengl(*this));
123  }
124 
125  /** Returns a 3D representation of this PDF.
126  * \note Needs the mrpt-opengl library, and using
127  * mrpt::opengl::CSetOfObjects::Ptr as template argument.
128  */
129  template <class OPENGL_SETOFOBJECTSPTR>
130  inline OPENGL_SETOFOBJECTSPTR getAs3DObject() const
131  {
132  typedef typename OPENGL_SETOFOBJECTSPTR::value_type SETOFOBJECTS;
133  return SETOFOBJECTS::posePDF2opengl(*this);
134  }
135 
136 }; // End of class def.
137 } // End of namespace
138 } // End of namespace
139 
140 #endif
virtual void inverse(CPose3DPDF &o) const =0
Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF.
OPENGL_SETOFOBJECTSPTR getAs3DObject() const
Returns a 3D representation of this PDF.
Definition: CPose3DPDF.h:130
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:44
static void jacobiansPoseComposition(const CPose3D &x, const CPose3D &u, mrpt::math::CMatrixDouble66 &df_dx, mrpt::math::CMatrixDouble66 &df_du)
This static method computes the pose composition Jacobians.
Definition: CPose3DPDF.cpp:141
static CPose3DPDF * createFrom2D(const CPosePDF &o)
This is a static transformation method from 2D poses to 3D PDFs, preserving the representation type (...
Definition: CPose3DPDF.cpp:34
#define DEFINE_VIRTUAL_SERIALIZABLE(class_name)
This declaration must be inserted in virtual CSerializable classes definition:
A numeric matrix of compile-time fixed size.
static bool is_PDF()
Definition: CPose3DPDF.h:107
virtual void copyFrom(const CPose3DPDF &o)=0
Copy operator, translating if necesary (for example, between particles and gaussian representations) ...
void getAs3DObject(OPENGL_SETOFOBJECTSPTR &out_obj) const
Returns a 3D representation of this PDF (it doesn&#39;t clear the current contents of out_obj...
Definition: CPose3DPDF.h:119
virtual void bayesianFusion(const CPose3DPDF &p1, const CPose3DPDF &p2)=0
Bayesian fusion of two pose distributions, then save the result in this object (WARNING: Currently on...
Declares a class that represents a probability density function (pdf) of a 2D pose (x...
Definition: CPosePDF.h:41
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
CSetOfObjects::Ptr posePDF2opengl(const POSE_PDF &o)
Returns a representation of a the PDF - this is just an auxiliary function, it&#39;s more natural to call...
Definition: pose_pdfs.h:24
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
static bool is_3D()
Definition: CPose3DPDF.h:102
GLenum GLint x
Definition: glext.h:3538
A generic template for probability density distributions (PDFs).
Declares a class that represents a Probability Density Function (PDF) of a 3D pose (6D actually)...
Definition: CPose3DPDF.h:42



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019