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
18namespace mrpt
19{
20namespace poses
21{
22 class CPosePDFGaussian; // frd decl.
23
24 // This must be added to any CSerializable derived class:
25 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE( CPosePDF, mrpt::utils::CSerializable )
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 */
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 */
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.
116 DEFINE_SERIALIZABLE_POST_CUSTOM_BASE( CPosePDF, mrpt::utils::CSerializable )
117
118
119 } // End of namespace
120} // End of namespace
121
122#endif
#define DEFINE_VIRTUAL_SERIALIZABLE(class_name)
This declaration must be inserted in virtual CSerializable classes definition:
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE(class_name, base_name)
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE(class_name, base_name)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
A numeric matrix of compile-time fixed size.
A class used to store a 2D pose.
Definition: CPose2D.h:37
Declares a class that represents a Probability Density function (PDF) of a 2D pose .
Declares a class that represents a probability density function (pdf) of a 2D pose (x,...
Definition: CPosePDF.h:40
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
static bool is_3D()
Definition: CPosePDF.h:92
static bool is_PDF()
Definition: CPosePDF.h:94
OPENGL_SETOFOBJECTSPTR getAs3DObject() const
Returns a 3D representation of this PDF.
Definition: CPosePDF.h:109
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),...
virtual void copyFrom(const CPosePDF &o)=0
Copy operator, translating if necesary (for example, between particles and gaussian representations)
virtual void inverse(CPosePDF &o) const =0
Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF.
static void jacobiansPoseComposition(const CPosePDFGaussian &x, const CPosePDFGaussian &u, mrpt::math::CMatrixDouble33 &df_dx, mrpt::math::CMatrixDouble33 &df_du)
This is an overloaded member function, provided for convenience. It differs from the above function o...
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:
class BASE_IMPEXP CPosePDFGaussian
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.



Page generated by Doxygen 1.9.6 for MRPT 1.4.0 SVN: at Wed Mar 22 04:35:51 UTC 2023