Main MRPT website > C++ reference for MRPT 1.9.9
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-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 CPose3DPDF_H
10 #define CPose3DPDF_H
11 
13 #include <mrpt/math/math_frwds.h>
14 #include <mrpt/poses/CPose3D.h>
16 
17 namespace mrpt
18 {
19 namespace poses
20 {
21 class CPosePDF;
22 
23 /** Declares a class that represents a Probability Density Function (PDF) of a
24  * 3D pose (6D actually).
25  * This class is just the base class for unifying many diferent
26  * ways this PDF can be implemented.
27  *
28  * For convenience, a pose composition is also defined for any
29  * PDF derived class, changeCoordinatesReference, in the form of a method
30  * 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
36  * href="http://www.mrpt.org/Probability_Density_Distributions_Over_Spatial_Representations">probabilistic
37  * spatial representations in the MRPT</a>.
38  *
39  * \sa CPose3D, CPosePDF, CPointPDF
40  * \ingroup poses_pdf_grp
41  */
44 {
46 
47  public:
48  /** Copy operator, translating if necesary (for example, between particles
49  * and gaussian representations)
50  * \sa createFrom2D
51  */
52  virtual void copyFrom(const CPose3DPDF& o) = 0;
53 
54  /** This is a static transformation method from 2D poses to 3D PDFs,
55  * preserving the representation type (particles->particles,
56  * Gaussians->Gaussians,etc)
57  *
58  * \warning It returns a new object of any of the derived classes of
59  * CPose3DPDF. This object must be deleted by the user when not required
60  * anymore.
61  *
62  * \sa copyFrom
63  */
64  static CPose3DPDF* createFrom2D(const CPosePDF& o);
65 
66  virtual void changeCoordinatesReference(
67  const CPose3D& newReferenceBase) = 0;
68 
69  /** Bayesian fusion of two pose distributions, then save the result in this
70  * object (WARNING: Currently only distributions of the same class can be
71  * fused! eg, gaussian with gaussian,etc) */
72  virtual void bayesianFusion(const CPose3DPDF& p1, const CPose3DPDF& p2) = 0;
73 
74  /** Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF */
75  virtual void inverse(CPose3DPDF& o) const = 0;
76 
77  /** This static method computes the pose composition Jacobians.
78  *
79  * See this techical report:
80  * http:///www.mrpt.org/6D_poses:equivalences_compositions_and_uncertainty
81  *
82  * Direct equations (for the covariances) in yaw-pitch-roll are too complex.
83  * Make a way around them and consider instead this path:
84  * \code
85  * X(6D) U(6D)
86  * | |
87  * v v
88  * X(7D) U(7D)
89  * | |
90  * +--- (+) ---+
91  * |
92  * v
93  * RES(7D)
94  * |
95  * v
96  * RES(6D)
97  * \endcode
98  *
99  */
100  static void jacobiansPoseComposition(
101  const CPose3D& x, const CPose3D& u, mrpt::math::CMatrixDouble66& df_dx,
103 
104  enum
105  {
107  };
108  static inline bool is_3D() { return is_3D_val != 0; }
109  enum
110  {
112  };
113  static inline bool is_PDF() { return is_PDF_val != 0; }
114  /** Returns a 3D representation of this PDF (it doesn't clear the current
115  * contents of out_obj, but append new OpenGL objects to that list)
116  * \note Needs the mrpt-opengl library, and using
117  * mrpt::opengl::CSetOfObjects::Ptr as template argument.
118  * \note By default, ellipsoids for the confidence intervals of "q=3" are
119  * drawn; for more mathematical details, see
120  * CGeneralizedEllipsoidTemplate::setQuantiles()
121  * \sa mrpt::opengl::CSetOfObjects::posePDF2opengl() for details on
122  * pose-to-opengl conversion
123  */
124  template <class OPENGL_SETOFOBJECTSPTR>
125  inline void getAs3DObject(OPENGL_SETOFOBJECTSPTR& out_obj) const
126  {
127  using SETOFOBJECTS = typename OPENGL_SETOFOBJECTSPTR::element_type;
128  out_obj->insertCollection(*SETOFOBJECTS::posePDF2opengl(*this));
129  }
130 
131  /** Returns a 3D representation of this PDF.
132  * \note Needs the mrpt-opengl library, and using
133  * mrpt::opengl::CSetOfObjects::Ptr as template argument.
134  */
135  template <class OPENGL_SETOFOBJECTSPTR>
136  inline OPENGL_SETOFOBJECTSPTR getAs3DObject() const
137  {
138  using SETOFOBJECTS = typename OPENGL_SETOFOBJECTSPTR::value_type;
139  return SETOFOBJECTS::posePDF2opengl(*this);
140  }
141 
142 }; // End of class def.
143 } // End of namespace
144 } // End of namespace
145 
146 #endif
mrpt::poses::CPose3DPDF::inverse
virtual void inverse(CPose3DPDF &o) const =0
Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF.
CProbabilityDensityFunction.h
mrpt::poses::CPose3DPDF::jacobiansPoseComposition
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.
Definition: CPose3DPDF.cpp:141
mrpt::poses::CPose3DPDF::bayesianFusion
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...
mrpt::math::CProbabilityDensityFunction
A generic template for probability density distributions (PDFs).
Definition: CProbabilityDensityFunction.h:28
mrpt::poses::CPose3DPDF
Declares a class that represents a Probability Density Function (PDF) of a 3D pose (6D actually).
Definition: CPose3DPDF.h:42
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
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::CPose3DPDF::changeCoordinatesReference
virtual void changeCoordinatesReference(const CPose3D &newReferenceBase)=0
mrpt::poses::CPose3DPDF::createFrom2D
static CPose3DPDF * createFrom2D(const CPosePDF &o)
This is a static transformation method from 2D poses to 3D PDFs, preserving the representation type (...
Definition: CPose3DPDF.cpp:34
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
math_frwds.h
mrpt::serialization::CSerializable
The virtual base class which provides a unified interface for all persistent objects in MRPT.
Definition: CSerializable.h:32
mrpt::poses::CPose3DPDF::is_3D_val
@ is_3D_val
Definition: CPose3DPDF.h:106
mrpt::poses::CPose3DPDF::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: CPose3DPDF.h:125
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
A numeric matrix of compile-time fixed size.
Definition: CMatrixFixedNumeric.h:40
mrpt::poses::CPose3DPDF::copyFrom
virtual void copyFrom(const CPose3DPDF &o)=0
Copy operator, translating if necesary (for example, between particles and gaussian representations)
CPose3D.h
mrpt::poses::CPosePDF
Declares a class that represents a probability density function (pdf) of a 2D pose (x,...
Definition: CPosePDF.h:41
mrpt::poses::CPose3DPDF::is_PDF_val
@ is_PDF_val
Definition: CPose3DPDF.h:111
mrpt::poses::CPose3DPDF::is_PDF
static bool is_PDF()
Definition: CPose3DPDF.h:113
CSerializable.h
mrpt::poses::CPose3DPDF::getAs3DObject
OPENGL_SETOFOBJECTSPTR getAs3DObject() const
Returns a 3D representation of this PDF.
Definition: CPose3DPDF.h:136
mrpt::poses::CPose3DPDF::is_3D
static bool is_3D()
Definition: CPose3DPDF.h:108
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