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



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020