Main MRPT website > C++ reference
MRPT logo
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-2014, 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/poses/CPose3D.h>
14 #include <mrpt/math/CMatrixD.h>
16 
17 namespace mrpt
18 {
19 namespace poses
20 {
21  using namespace mrpt::math;
22 
23  class CPosePDF;
24 
26 
27  /** Declares a class that represents a Probability Density Function (PDF) of a 3D pose (6D actually).
28  * This class is just the base class for unifying many diferent
29  * ways this PDF can be implemented.
30  *
31  * For convenience, a pose composition is also defined for any
32  * PDF derived class, changeCoordinatesReference, in the form of a method rather than an operator.
33  *
34  * For a similar class for 3D points (without attitude), see CPointPDF
35  *
36  *
37  * See also the tutorial on <a href="http://www.mrpt.org/Probability_Density_Distributions_Over_Spatial_Representations">probabilistic spatial representations in the MRPT</a>.
38  *
39  * \sa CPose3D, CPosePDF, CPointPDF
40  * \ingroup poses_pdf_grp
41  */
42  class BASE_IMPEXP CPose3DPDF : public mrpt::utils::CSerializable, public mrpt::utils::CProbabilityDensityFunction<CPose3D,6>
43  {
45 
46  public:
47  /** Copy operator, translating if necesary (for example, between particles and gaussian representations)
48  * \sa createFrom2D
49  */
50  virtual void copyFrom(const CPose3DPDF &o) = 0;
51 
52  /** This is a static transformation method from 2D poses to 3D PDFs, preserving the representation type (particles->particles, Gaussians->Gaussians,etc)
53  * 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.
54  * \sa copyFrom
55  */
56  static CPose3DPDF* createFrom2D(const CPosePDF &o);
57 
58  /** 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) */
59  virtual void bayesianFusion( const CPose3DPDF &p1, const CPose3DPDF &p2 ) = 0 ;
60 
61  /** Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF */
62  virtual void inverse(CPose3DPDF &o) const = 0;
63 
64  /** This static method computes the pose composition Jacobians.
65  *
66  * See this techical report: http:///www.mrpt.org/6D_poses:equivalences_compositions_and_uncertainty
67  *
68  * Direct equations (for the covariances) in yaw-pitch-roll are too complex.
69  * Make a way around them and consider instead this path:
70  * \code
71  * X(6D) U(6D)
72  * | |
73  * v v
74  * X(7D) U(7D)
75  * | |
76  * +--- (+) ---+
77  * |
78  * v
79  * RES(7D)
80  * |
81  * v
82  * RES(6D)
83  * \endcode
84  *
85  */
86  static void jacobiansPoseComposition(
87  const CPose3D &x,
88  const CPose3D &u,
89  CMatrixDouble66 &df_dx,
90  CMatrixDouble66 &df_du);
91 
92 
93  enum { is_3D_val = 1 };
94  static inline bool is_3D() { return is_3D_val!=0; }
95  enum { is_PDF_val = 1 };
96  static inline bool is_PDF() { return is_PDF_val!=0; }
97 
98  /** 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)
99  * \note Needs the mrpt-opengl library, and using mrpt::opengl::CSetOfObjectsPtr as template argument.
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.
117 
118 
119  } // End of namespace
120 } // End of namespace
121 
122 #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:32
#define DEFINE_VIRTUAL_SERIALIZABLE(class_name)
This declaration must be inserted in virtual CSerializable classes definition:
A numeric matrix of compile-time fixed size.
This base provides a set of functions for maths stuff.
Definition: CArray.h:19
class BASE_IMPEXP CSerializable
Definition: CStream.h:21
Eigen::Matrix< dataType, 4, 4 > inverse(Eigen::Matrix< dataType, 4, 4 > &pose)
Definition: Miscellaneous.h:71
#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:96
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:41
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:71
static bool is_3D()
Definition: CPose3DPDF.h:94
Declares a class that represents a Probability Density Function (PDF) of a 3D pose (6D actually)...
Definition: CPose3DPDF.h:42
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.1.0 SVN: at lun oct 28 00:54:49 CET 2019 Hosted on:
SourceForge.net Logo