Main MRPT website > C++ reference for MRPT 1.4.0
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-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 CPose3DPDF_H
10#define CPose3DPDF_H
11
14#include <mrpt/poses/CPose3D.h>
16
17namespace mrpt
18{
19namespace poses
20{
21 class CPosePDF;
22
23 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE( CPose3DPDF, mrpt::utils::CSerializable )
24
25 /** Declares a class that represents a Probability Density Function (PDF) of a 3D pose (6D actually).
26 * This class is just the base class for unifying many diferent
27 * ways this PDF can be implemented.
28 *
29 * For convenience, a pose composition is also defined for any
30 * PDF derived class, changeCoordinatesReference, in the form of a method rather than an operator.
31 *
32 * For a similar class for 3D points (without attitude), see CPointPDF
33 *
34 *
35 * See also the tutorial on <a href="http://www.mrpt.org/Probability_Density_Distributions_Over_Spatial_Representations">probabilistic spatial representations in the MRPT</a>.
36 *
37 * \sa CPose3D, CPosePDF, CPointPDF
38 * \ingroup poses_pdf_grp
39 */
40 class BASE_IMPEXP CPose3DPDF : public mrpt::utils::CSerializable, public mrpt::utils::CProbabilityDensityFunction<CPose3D,6>
41 {
43
44 public:
45 /** Copy operator, translating if necesary (for example, between particles and gaussian representations)
46 * \sa createFrom2D
47 */
48 virtual void copyFrom(const CPose3DPDF &o) = 0;
49
50 /** This is a static transformation method from 2D poses to 3D PDFs, preserving the representation type (particles->particles, Gaussians->Gaussians,etc)
51 * 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.
52 * \sa copyFrom
53 */
54 static CPose3DPDF* createFrom2D(const CPosePDF &o);
55
56 /** 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) */
57 virtual void bayesianFusion( const CPose3DPDF &p1, const CPose3DPDF &p2 ) = 0 ;
58
59 /** Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF */
60 virtual void inverse(CPose3DPDF &o) const = 0;
61
62 /** This static method computes the pose composition Jacobians.
63 *
64 * See this techical report: http:///www.mrpt.org/6D_poses:equivalences_compositions_and_uncertainty
65 *
66 * Direct equations (for the covariances) in yaw-pitch-roll are too complex.
67 * Make a way around them and consider instead this path:
68 * \code
69 * X(6D) U(6D)
70 * | |
71 * v v
72 * X(7D) U(7D)
73 * | |
74 * +--- (+) ---+
75 * |
76 * v
77 * RES(7D)
78 * |
79 * v
80 * RES(6D)
81 * \endcode
82 *
83 */
85 const CPose3D &x,
86 const CPose3D &u,
89
90
91 enum { is_3D_val = 1 };
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 }; // End of class def.
115 DEFINE_SERIALIZABLE_POST_CUSTOM_BASE( CPose3DPDF, mrpt::utils::CSerializable )
116
117
118 } // End of namespace
119} // End of namespace
120
121#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 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:73
Declares a class that represents a Probability Density Function (PDF) of a 3D pose (6D actually).
Definition: CPose3DPDF.h:41
static bool is_PDF()
Definition: CPose3DPDF.h:94
virtual void bayesianFusion(const CPose3DPDF &p1, const CPose3DPDF &p2)=0
Bayesian fusion of two pose distributions, then save the result in this object (WARNING: Currently on...
virtual void copyFrom(const CPose3DPDF &o)=0
Copy operator, translating if necesary (for example, between particles and gaussian representations)
static void jacobiansPoseComposition(const CPose3D &x, const CPose3D &u, mrpt::math::CMatrixDouble66 &df_dx, mrpt::math::CMatrixDouble66 &df_du)
This static method computes the pose composition Jacobians.
virtual void inverse(CPose3DPDF &o) const =0
Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF.
static bool is_3D()
Definition: CPose3DPDF.h:92
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: CPose3DPDF.h:100
static CPose3DPDF * createFrom2D(const CPosePDF &o)
This is a static transformation method from 2D poses to 3D PDFs, preserving the representation type (...
OPENGL_SETOFOBJECTSPTR getAs3DObject() const
Returns a 3D representation of this PDF.
Definition: CPose3DPDF.h:109
Declares a class that represents a probability density function (pdf) of a 2D pose (x,...
Definition: CPosePDF.h:40
class BASE_IMPEXP CPosePDF
Definition: CPosePDF.h:25
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 06:08:57 UTC 2023