Main MRPT website > C++ reference
MRPT logo
CPose3DQuatPDF.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | The Mobile Robot Programming Toolkit (MRPT) C++ library |
3  | |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (C) 2005-2012 University of Malaga |
7  | |
8  | This software was written by the Machine Perception and Intelligent |
9  | Robotics Lab, University of Malaga (Spain). |
10  | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11  | |
12  | This file is part of the MRPT project. |
13  | |
14  | MRPT is free software: you can redistribute it and/or modify |
15  | it under the terms of the GNU General Public License as published by |
16  | the Free Software Foundation, either version 3 of the License, or |
17  | (at your option) any later version. |
18  | |
19  | MRPT is distributed in the hope that it will be useful, |
20  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22  | GNU General Public License for more details. |
23  | |
24  | You should have received a copy of the GNU General Public License |
25  | along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26  | |
27  +---------------------------------------------------------------------------+ */
28 #ifndef CPose3DQuatPDF_H
29 #define CPose3DQuatPDF_H
30 
31 #include <mrpt/poses/CPose3D.h>
32 #include <mrpt/poses/CPose3DQuat.h>
33 #include <mrpt/math/CMatrixD.h>
35 
36 namespace mrpt
37 {
38  namespace poses
39  {
40  using namespace mrpt::math;
41 
42  class CPosePDF;
43  class CPose3DPDF;
44 
46 
47  /** Declares a class that represents a Probability Density Function (PDF) of a 3D pose (6D actually), by means of a 7-vector with a translation [x y z] and a quaternion [qr qx qy qz].
48  * This class is just the base class for unifying many diferent ways this PDF can be implemented.
49  *
50  * For convenience, a pose composition is also defined for any
51  * PDF derived class, changeCoordinatesReference, in the form of a method rather than an operator.
52  *
53  * - For a similar class for 3D points (without attitude), see CPointPDF.
54  * - For a similar class for 3D poses (with Euler angles instead of quaternions), see CPose3DPDF.
55  *
56  *
57  * See also the tutorial on <a href="http://www.mrpt.org/Probability_Density_Distributions_Over_Spatial_Representations" >probabilistic spatial representations in the MRPT</a>.
58  *
59  * \sa CPose3DQuatPDF, CPose3DPDF
60  * \ingroup poses_pdf_grp
61  */
63  public mrpt::utils::CSerializable,
64  public mrpt::utils::CProbabilityDensityFunction<CPose3DQuat,7>
65  {
67 
68  public:
69  /** Copy operator, translating if necesary (for example, between particles and gaussian representations)
70  * \sa createFrom2D
71  */
72  virtual void copyFrom(const CPose3DQuatPDF &o) = 0;
73 
74  /** This is a static transformation method from 2D poses to 3D PDFs, preserving the representation type (particles->particles, Gaussians->Gaussians,etc)
75  * It returns a new object of any of the derived classes of CPose3DQuatPDF. This object must be deleted by the user when not required anymore.
76  * \sa copyFrom
77  */
78  static CPose3DQuatPDF* createFrom2D(const CPosePDF &o);
79 
80  /** Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF */
81  virtual void inverse(CPose3DQuatPDF &o) const = 0;
82 
83  /** This static method computes the two Jacobians of a pose composition operation $f(x,u)= x \oplus u$
84  * \param out_x_oplus_u If set to !=NULL, the result of "x+u" will be stored here (it will be computed internally anyway).
85  * To see the mathematical derivation of the formulas, refer to the technical report here:
86  * - http://www.mrpt.org/Probability_Density_Distributions_Over_Spatial_Representations
87  */
88  static void jacobiansPoseComposition(
89  const CPose3DQuat &x,
90  const CPose3DQuat &u,
91  CMatrixDouble77 &df_dx,
92  CMatrixDouble77 &df_du,
93  CPose3DQuat *out_x_oplus_u=NULL);
94 
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 
116  } // End of namespace
117 } // End of namespace
118 
119 #endif



Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013