Main MRPT website > C++ reference for MRPT 1.9.9
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-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 CPOSEPDF_H
10 #define CPOSEPDF_H
11 
13 #include <mrpt/poses/CPose2D.h>
16 
17 namespace mrpt
18 {
19 namespace poses
20 {
21 class CPosePDFGaussian; // frd decl.
22 
23 /** Declares a class that represents a probability density function (pdf) of a
24  * 2D pose (x,y,phi).
25  * This class is just the base class for unifying many diferent ways this pdf
26  * can be implemented.
27  *
28  * For convenience, a pose composition is also defined for any pdf derived
29  * class,
30  * changeCoordinatesReference, in the form of a method rather than an
31  * operator.
32  *
33  *
34  * See also the tutorial on <a
35  * href="http://www.mrpt.org/Probability_Density_Distributions_Over_Spatial_Representations"
36  * >probabilistic spatial representations in the MRPT</a>.
37  *
38  * \sa CPose2D, CPose3DPDF, CPoseRandomSampler
39  * \ingroup poses_pdf_grp
40  */
43 {
45 
46  public:
47  /** Copy operator, translating if necesary (for example, between particles
48  * and gaussian representations)
49  */
50  virtual void copyFrom(const CPosePDF& o) = 0;
51 
52  /** Bayesian fusion of two pose distributions (product of two
53  * distributions->new distribution), then save the result in this object
54  * (WARNING: See implementing classes to see classes that can and cannot be
55  * mixtured!)
56  * \param p1 The first distribution to fuse
57  * \param p2 The second distribution to fuse
58  * \param minMahalanobisDistToDrop If set to different of 0, the result of
59  * very separate Gaussian modes (that will result in negligible components)
60  * in SOGs will be dropped to reduce the number of modes in the output.
61  */
62  virtual void bayesianFusion(
63  const CPosePDF& p1, const CPosePDF& p2,
64  const double& minMahalanobisDistToDrop = 0) = 0;
65 
66  /** Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF
67  */
68  virtual void inverse(CPosePDF& o) const = 0;
69 
70  /** This static method computes the pose composition Jacobians, with these
71  formulas:
72  \code
73  df_dx =
74  [ 1, 0, -sin(phi_x)*x_u-cos(phi_x)*y_u ]
75  [ 0, 1, cos(phi_x)*x_u-sin(phi_x)*y_u ]
76  [ 0, 0, 1 ]
77 
78  df_du =
79  [ cos(phi_x) , -sin(phi_x) , 0 ]
80  [ sin(phi_x) , cos(phi_x) , 0 ]
81  [ 0 , 0 , 1 ]
82  \endcode
83  */
84  static void jacobiansPoseComposition(
85  const CPose2D& x, const CPose2D& u, mrpt::math::CMatrixDouble33& df_dx,
86  mrpt::math::CMatrixDouble33& df_du, const bool compute_df_dx = true,
87  const bool compute_df_du = true);
88 
89  /** \overload */
90  static void jacobiansPoseComposition(
91  const CPosePDFGaussian& x, const CPosePDFGaussian& u,
93 
94  enum
95  {
97  };
98  static inline bool is_3D() { return is_3D_val != 0; }
99  enum
100  {
102  };
103  static inline bool is_PDF() { return is_PDF_val != 0; }
104  /** Returns a 3D representation of this PDF (it doesn't clear the current
105  * contents of out_obj, but append new OpenGL objects to that list)
106  * \note Needs the mrpt-opengl library, and using
107  * mrpt::opengl::CSetOfObjects::Ptr as template argument.
108  * \note By default, ellipsoids for the confidence intervals of "q=3" are
109  * drawn; for more mathematical details, see
110  * CGeneralizedEllipsoidTemplate::setQuantiles()
111  */
112  template <class OPENGL_SETOFOBJECTSPTR>
113  inline void getAs3DObject(OPENGL_SETOFOBJECTSPTR& out_obj) const
114  {
115  typedef typename OPENGL_SETOFOBJECTSPTR::element_type SETOFOBJECTS;
116  out_obj->insertCollection(*SETOFOBJECTS::posePDF2opengl(*this));
117  }
118 
119  /** Returns a 3D representation of this PDF.
120  * \note Needs the mrpt-opengl library, and using
121  * mrpt::opengl::CSetOfObjects::Ptr as template argument.
122  */
123  template <class OPENGL_SETOFOBJECTSPTR>
124  inline OPENGL_SETOFOBJECTSPTR getAs3DObject() const
125  {
126  typedef typename OPENGL_SETOFOBJECTSPTR::element_type SETOFOBJECTS;
127  return SETOFOBJECTS::posePDF2opengl(*this);
128  }
129 
130  public:
132 }; // End of class def.
133 
134 } // End of namespace
135 } // End of namespace
136 
137 #endif
static bool is_3D()
Definition: CPosePDF.h:98
static bool is_PDF()
Definition: CPosePDF.h:103
OPENGL_SETOFOBJECTSPTR getAs3DObject() const
Returns a 3D representation of this PDF.
Definition: CPosePDF.h:124
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:44
#define MRPT_MAKE_ALIGNED_OPERATOR_NEW
Definition: memory.h:134
#define DEFINE_VIRTUAL_SERIALIZABLE(class_name)
This declaration must be inserted in virtual CSerializable classes definition:
Declares a class that represents a Probability Density function (PDF) of a 2D pose ...
virtual void copyFrom(const CPosePDF &o)=0
Copy operator, translating if necesary (for example, between particles and gaussian representations) ...
Declares a class that represents a probability density function (pdf) of a 2D pose (x...
Definition: CPosePDF.h:41
virtual void bayesianFusion(const CPosePDF &p1, const CPosePDF &p2, const double &minMahalanobisDistToDrop=0)=0
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!)
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
virtual void inverse(CPosePDF &o) const =0
Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF.
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
Definition: CPose2D.h:40
static void jacobiansPoseComposition(const CPose2D &x, const CPose2D &u, mrpt::math::CMatrixDouble33 &df_dx, mrpt::math::CMatrixDouble33 &df_du, const bool compute_df_dx=true, const bool compute_df_du=true)
This static method computes the pose composition Jacobians, with these formulas:
Definition: CPosePDF.cpp:32
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: CPosePDF.h:113
GLenum GLint x
Definition: glext.h:3538
A generic template for probability density distributions (PDFs).



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