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-2018, 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  virtual void changeCoordinatesReference(
71  const CPose3D& newReferenceBase) = 0;
72 
73  /** This static method computes the pose composition Jacobians, with these
74  formulas:
75  \code
76  df_dx =
77  [ 1, 0, -sin(phi_x)*x_u-cos(phi_x)*y_u ]
78  [ 0, 1, cos(phi_x)*x_u-sin(phi_x)*y_u ]
79  [ 0, 0, 1 ]
80 
81  df_du =
82  [ cos(phi_x) , -sin(phi_x) , 0 ]
83  [ sin(phi_x) , cos(phi_x) , 0 ]
84  [ 0 , 0 , 1 ]
85  \endcode
86  */
87  static void jacobiansPoseComposition(
88  const CPose2D& x, const CPose2D& u, mrpt::math::CMatrixDouble33& df_dx,
89  mrpt::math::CMatrixDouble33& df_du, const bool compute_df_dx = true,
90  const bool compute_df_du = true);
91 
92  /** \overload */
93  static void jacobiansPoseComposition(
94  const CPosePDFGaussian& x, const CPosePDFGaussian& u,
96 
97  enum
98  {
100  };
101  static inline bool is_3D() { return is_3D_val != 0; }
102  enum
103  {
105  };
106  static inline bool is_PDF() { return is_PDF_val != 0; }
107  /** Returns a 3D representation of this PDF (it doesn't clear the current
108  * contents of out_obj, but append new OpenGL objects to that list)
109  * \note Needs the mrpt-opengl library, and using
110  * mrpt::opengl::CSetOfObjects::Ptr as template argument.
111  * \note By default, ellipsoids for the confidence intervals of "q=3" are
112  * drawn; for more mathematical details, see
113  * CGeneralizedEllipsoidTemplate::setQuantiles()
114  */
115  template <class OPENGL_SETOFOBJECTSPTR>
116  inline void getAs3DObject(OPENGL_SETOFOBJECTSPTR& out_obj) const
117  {
118  using SETOFOBJECTS = typename OPENGL_SETOFOBJECTSPTR::element_type;
119  out_obj->insertCollection(*SETOFOBJECTS::posePDF2opengl(*this));
120  }
121 
122  /** Returns a 3D representation of this PDF.
123  * \note Needs the mrpt-opengl library, and using
124  * mrpt::opengl::CSetOfObjects::Ptr as template argument.
125  */
126  template <class OPENGL_SETOFOBJECTSPTR>
127  inline OPENGL_SETOFOBJECTSPTR getAs3DObject() const
128  {
129  using SETOFOBJECTS = typename OPENGL_SETOFOBJECTSPTR::element_type;
130  return SETOFOBJECTS::posePDF2opengl(*this);
131  }
132 
133  public:
135 }; // End of class def.
136 
137 } // End of namespace
138 } // End of namespace
139 
140 #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:116
mrpt::poses::CPosePDF::inverse
virtual void inverse(CPosePDF &o) const =0
Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF.
mrpt::poses::CPosePDF::is_PDF
static bool is_PDF()
Definition: CPosePDF.h:106
mrpt::math::CProbabilityDensityFunction
A generic template for probability density distributions (PDFs).
Definition: CProbabilityDensityFunction.h:28
mrpt::poses::CPosePDF::jacobiansPoseComposition
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
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::poses::CPosePDF::copyFrom
virtual void copyFrom(const CPosePDF &o)=0
Copy operator, translating if necesary (for example, between particles and gaussian representations)
mrpt::poses::CPosePDF::bayesianFusion
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),...
CPose2D.h
mrpt::opengl::posePDF2opengl
CSetOfObjects::Ptr 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:24
mrpt::poses::CPosePDF::is_3D_val
@ is_3D_val
Definition: CPosePDF.h:99
CMatrixTemplateNumeric.h
mrpt::poses::CPose2D
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle.
Definition: CPose2D.h:40
mrpt::poses::CPosePDF::is_PDF_val
@ is_PDF_val
Definition: CPosePDF.h:104
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
mrpt::serialization::CSerializable
The virtual base class which provides a unified interface for all persistent objects in MRPT.
Definition: CSerializable.h:32
DEFINE_VIRTUAL_SERIALIZABLE
#define DEFINE_VIRTUAL_SERIALIZABLE(class_name)
This declaration must be inserted in virtual CSerializable classes definition:
Definition: CSerializable.h:119
mrpt::math::CMatrixFixedNumeric< double, 3, 3 >
mrpt::poses::CPosePDF
Declares a class that represents a probability density function (pdf) of a 2D pose (x,...
Definition: CPosePDF.h:41
mrpt::poses::CPosePDF::is_3D
static bool is_3D()
Definition: CPosePDF.h:101
mrpt::poses::CPosePDF::getAs3DObject
OPENGL_SETOFOBJECTSPTR getAs3DObject() const
Returns a 3D representation of this PDF.
Definition: CPosePDF.h:127
MRPT_MAKE_ALIGNED_OPERATOR_NEW
#define MRPT_MAKE_ALIGNED_OPERATOR_NEW
Put this macro inside any class with members that require {16,32,64}-byte memory alignment (e....
Definition: aligned_allocator.h:90
mrpt::poses::CPosePDF::changeCoordinatesReference
virtual void changeCoordinatesReference(const CPose3D &newReferenceBase)=0
mrpt::poses::CPosePDFGaussian
Declares a class that represents a Probability Density function (PDF) of a 2D pose .
Definition: CPosePDFGaussian.h:31
CSerializable.h
x
GLenum GLint x
Definition: glext.h:3538



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST