MRPT  1.9.9
CPose3DQuatPDF.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 CPose3DQuatPDF_H
10 #define CPose3DQuatPDF_H
11 
12 #include <mrpt/poses/CPose3D.h>
13 #include <mrpt/poses/CPose3DQuat.h>
14 #include <mrpt/math/CMatrixD.h>
16 
17 namespace mrpt::poses
18 {
19 class CPosePDF;
20 class CPose3DPDF;
21 
22 /** Declares a class that represents a Probability Density Function (PDF) of a
23  * 3D pose (6D actually), by means of a 7-vector with a translation [x y z] and
24  * a quaternion [qr qx qy qz].
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
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  * - For a similar class for 3D poses (with Euler angles instead of
34  * quaternions), see CPose3DPDF.
35  *
36  *
37  * See also the tutorial on <a
38  * href="http://www.mrpt.org/Probability_Density_Distributions_Over_Spatial_Representations"
39  * >probabilistic spatial representations in the MRPT</a>.
40  *
41  * \sa CPose3DQuatPDF, CPose3DPDF
42  * \ingroup poses_pdf_grp
43  */
46  public mrpt::math::CProbabilityDensityFunction<CPose3DQuat, 7>
47 {
49 
50  public:
51  /** Copy operator, translating if necesary (for example, between particles
52  * and gaussian representations)
53  * \sa createFrom2D
54  */
55  virtual void copyFrom(const CPose3DQuatPDF& o) = 0;
56 
57  /** This is a static transformation method from 2D poses to 3D PDFs,
58  * preserving the representation type (particles->particles,
59  * Gaussians->Gaussians,etc)
60  * It returns a new object of any of the derived classes of
61  * CPose3DQuatPDF. This object must be deleted by the user when not required
62  * anymore.
63  * \sa copyFrom
64  */
65  static CPose3DQuatPDF* createFrom2D(const CPosePDF& o);
66 
67  /** Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF */
68  virtual void inverse(CPose3DQuatPDF& o) const = 0;
69 
70  virtual void changeCoordinatesReference(
71  const CPose3D& newReferenceBase) = 0;
72 
73  /** This static method computes the two Jacobians of a pose composition
74  * operation $f(x,u)= x \oplus u$
75  * \param out_x_oplus_u If set to !=nullptr, the result of "x+u" will be
76  * stored here (it will be computed internally anyway).
77  * To see the mathematical derivation of the formulas, refer to the
78  * technical report here:
79  * -
80  * http://www.mrpt.org/Probability_Density_Distributions_Over_Spatial_Representations
81  */
82  static void jacobiansPoseComposition(
83  const CPose3DQuat& x, const CPose3DQuat& u,
85  CPose3DQuat* out_x_oplus_u = nullptr);
86 
87  /** Returns a 3D representation of this PDF (it doesn't clear the current
88  * contents of out_obj, but append new OpenGL objects to that list)
89  * \note Needs the mrpt-opengl library, and using
90  * mrpt::opengl::CSetOfObjects::Ptr as template argument.
91  * \note By default, ellipsoids for the confidence intervals of "q=3" are
92  * drawn; for more mathematical details, see
93  * CGeneralizedEllipsoidTemplate::setQuantiles()
94  */
95  template <class OPENGL_SETOFOBJECTSPTR>
96  inline void getAs3DObject(OPENGL_SETOFOBJECTSPTR& out_obj) const
97  {
98  using SETOFOBJECTS = typename OPENGL_SETOFOBJECTSPTR::value_type;
99  out_obj->insertCollection(*SETOFOBJECTS::posePDF2opengl(*this));
100  }
101 
102  /** Returns a 3D representation of this PDF.
103  * \note Needs the mrpt-opengl library, and using
104  * mrpt::opengl::CSetOfObjects::Ptr as template argument.
105  */
106  template <class OPENGL_SETOFOBJECTSPTR>
107  inline OPENGL_SETOFOBJECTSPTR getAs3DObject() const
108  {
109  using SETOFOBJECTS = typename OPENGL_SETOFOBJECTSPTR::value_type;
110  return SETOFOBJECTS::posePDF2opengl(*this);
111  }
112 
113 }; // End of class def.
114 }
115 #endif
116 
117 
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...
virtual void copyFrom(const CPose3DQuatPDF &o)=0
Copy operator, translating if necesary (for example, between particles and gaussian representations) ...
#define DEFINE_VIRTUAL_SERIALIZABLE(class_name)
This declaration must be inserted in virtual CSerializable classes definition:
A numeric matrix of compile-time fixed size.
virtual void changeCoordinatesReference(const CPose3D &newReferenceBase)=0
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,qz).
Definition: CPose3DQuat.h:46
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...
OPENGL_SETOFOBJECTSPTR getAs3DObject() const
Returns a 3D representation of this PDF.
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
Declares a class that represents a Probability Density Function (PDF) of a 3D pose (6D actually)...
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
static void jacobiansPoseComposition(const CPose3DQuat &x, const CPose3DQuat &u, mrpt::math::CMatrixDouble77 &df_dx, mrpt::math::CMatrixDouble77 &df_du, CPose3DQuat *out_x_oplus_u=nullptr)
This static method computes the two Jacobians of a pose composition operation $f(x,u)= x u$.
virtual void inverse(CPose3DQuatPDF &o) const =0
Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF.
A generic template for probability density distributions (PDFs).
static CPose3DQuatPDF * createFrom2D(const CPosePDF &o)
This is a static transformation method from 2D poses to 3D PDFs, preserving the representation type (...



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