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



Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020