Main MRPT website > C++ reference for MRPT 1.4.0
CPosePDF.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-2016, 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 CPOSEPDF_H
10 #define CPOSEPDF_H
11 
13 #include <mrpt/poses/CPose2D.h>
16 
17 
18 namespace mrpt
19 {
20 namespace poses
21 {
22  class CPosePDFGaussian; // frd decl.
23 
24  // This must be added to any CSerializable derived class:
26 
27  /** Declares a class that represents a probability density function (pdf) of a 2D pose (x,y,phi).
28  * This class is just the base class for unifying many diferent ways this pdf can be implemented.
29  *
30  * For convenience, a pose composition is also defined for any pdf derived class,
31  * changeCoordinatesReference, in the form of a method rather than an operator.
32  *
33  *
34  * See also the tutorial on <a href="http://www.mrpt.org/Probability_Density_Distributions_Over_Spatial_Representations" >probabilistic spatial representations in the MRPT</a>.
35  *
36  * \sa CPose2D, CPose3DPDF, CPoseRandomSampler
37  * \ingroup poses_pdf_grp
38  */
39  class BASE_IMPEXP CPosePDF : public mrpt::utils::CSerializable, public mrpt::utils::CProbabilityDensityFunction<CPose2D,3>
40  {
42 
43  public:
44  /** Copy operator, translating if necesary (for example, between particles and gaussian representations)
45  */
46  virtual void copyFrom(const CPosePDF &o) = 0;
47 
48 
49  /** Bayesian fusion of two pose distributions (product of two distributions->new distribution), then save the result in this object (WARNING: See implementing classes to see classes that can and cannot be mixtured!)
50  * \param p1 The first distribution to fuse
51  * \param p2 The second distribution to fuse
52  * \param minMahalanobisDistToDrop If set to different of 0, the result of very separate Gaussian modes (that will result in negligible components) in SOGs will be dropped to reduce the number of modes in the output.
53  */
54  virtual void bayesianFusion(const CPosePDF &p1,const CPosePDF &p2, const double&minMahalanobisDistToDrop = 0) = 0 ;
55 
56  /** Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF
57  */
58  virtual void inverse(CPosePDF &o) const = 0;
59 
60 
61  /** This static method computes the pose composition Jacobians, with these formulas:
62  \code
63  df_dx =
64  [ 1, 0, -sin(phi_x)*x_u-cos(phi_x)*y_u ]
65  [ 0, 1, cos(phi_x)*x_u-sin(phi_x)*y_u ]
66  [ 0, 0, 1 ]
67 
68  df_du =
69  [ cos(phi_x) , -sin(phi_x) , 0 ]
70  [ sin(phi_x) , cos(phi_x) , 0 ]
71  [ 0 , 0 , 1 ]
72  \endcode
73  */
74  static void jacobiansPoseComposition(
75  const CPose2D &x,
76  const CPose2D &u,
79  const bool compute_df_dx = true,
80  const bool compute_df_du = true );
81 
82  /** \overload */
83  static void jacobiansPoseComposition(
84  const CPosePDFGaussian &x,
85  const CPosePDFGaussian &u,
88 
89 
90 
91  enum { is_3D_val = 0 };
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  */
99  template <class OPENGL_SETOFOBJECTSPTR>
100  inline void getAs3DObject(OPENGL_SETOFOBJECTSPTR &out_obj) const {
101  typedef typename OPENGL_SETOFOBJECTSPTR::value_type SETOFOBJECTS;
102  out_obj->insertCollection( *SETOFOBJECTS::posePDF2opengl(*this) );
103  }
104 
105  /** Returns a 3D representation of this PDF.
106  * \note Needs the mrpt-opengl library, and using mrpt::opengl::CSetOfObjectsPtr as template argument.
107  */
108  template <class OPENGL_SETOFOBJECTSPTR>
109  inline OPENGL_SETOFOBJECTSPTR getAs3DObject() const {
110  typedef typename OPENGL_SETOFOBJECTSPTR::value_type SETOFOBJECTS;
111  return SETOFOBJECTS::posePDF2opengl(*this);
112  }
113 
114 
115  }; // End of class def.
117 
118 
119  } // End of namespace
120 } // End of namespace
121 
122 #endif
CProbabilityDensityFunction.h
mrpt::poses::CPosePDF::getAs3DObject
void getAs3DObject(OPENGL_SETOFOBJECTSPTR &out_obj) const
Returns a 3D representation of this PDF (it doesn't clear the current contents of out_obj,...
Definition: CPosePDF.h:100
DEFINE_SERIALIZABLE_POST_CUSTOM_BASE
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE(class_name, base_name)
Definition: CSerializable.h:182
mrpt::poses::CPosePDF::is_PDF
static bool is_PDF()
Definition: CPosePDF.h:94
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CParticleFilter.h:16
mrpt::pbmap::inverse
Eigen::Matrix< dataType, 4, 4 > inverse(Eigen::Matrix< dataType, 4, 4 > &pose)
Definition: Miscellaneous.h:74
CPose2D.h
CMatrixTemplateNumeric.h
mrpt::poses::CPose2D
A class used to store a 2D pose.
Definition: CPose2D.h:36
DEFINE_VIRTUAL_SERIALIZABLE
#define DEFINE_VIRTUAL_SERIALIZABLE(class_name)
This declaration must be inserted in virtual CSerializable classes definition:
Definition: CSerializable.h:192
mrpt::math::CMatrixFixedNumeric
A numeric matrix of compile-time fixed size.
Definition: CMatrixFixedNumeric.h:34
mrpt::utils::CSerializable
The virtual base class which provides a unified interface for all persistent objects in MRPT.
Definition: CSerializable.h:39
mrpt::poses::CPosePDF
Declares a class that represents a probability density function (pdf) of a 2D pose (x,...
Definition: CPosePDF.h:39
mrpt::poses::CPosePDF::is_3D
static bool is_3D()
Definition: CPosePDF.h:92
mrpt::poses::CPosePDF::getAs3DObject
OPENGL_SETOFOBJECTSPTR getAs3DObject() const
Returns a 3D representation of this PDF.
Definition: CPosePDF.h:109
mrpt::opengl::posePDF2opengl
CSetOfObjectsPtr posePDF2opengl(const POSE_PDF &o)
Returns a representation of a the PDF - this is just an auxiliary function, it's more natural to call...
Definition: pose_pdfs.h:23
mrpt::poses::CPosePDFGaussian
Declares a class that represents a Probability Density function (PDF) of a 2D pose .
Definition: CPosePDFGaussian.h:32
CSerializable.h
DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE(class_name, base_name)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
Definition: CSerializable.h:178



Page generated by Doxygen 1.8.16 for MRPT 1.4.0 SVN: at Mon Oct 14 22:32:58 UTC 2019