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



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020