00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://www.mrpt.org/ | 00005 | | 00006 | Copyright (C) 2005-2011 University of Malaga | 00007 | | 00008 | This software was written by the Machine Perception and Intelligent | 00009 | Robotics Lab, University of Malaga (Spain). | 00010 | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> | 00011 | | 00012 | This file is part of the MRPT project. | 00013 | | 00014 | MRPT is free software: you can redistribute it and/or modify | 00015 | it under the terms of the GNU General Public License as published by | 00016 | the Free Software Foundation, either version 3 of the License, or | 00017 | (at your option) any later version. | 00018 | | 00019 | MRPT is distributed in the hope that it will be useful, | 00020 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00021 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 00022 | GNU General Public License for more details. | 00023 | | 00024 | You should have received a copy of the GNU General Public License | 00025 | along with MRPT. If not, see <http://www.gnu.org/licenses/>. | 00026 | | 00027 +---------------------------------------------------------------------------+ */ 00028 #ifndef CPose3DPDF_H 00029 #define CPose3DPDF_H 00030 00031 #include <mrpt/utils/CSerializable.h> 00032 #include <mrpt/poses/CPose3D.h> 00033 #include <mrpt/math/CMatrixD.h> 00034 #include <mrpt/utils/CProbabilityDensityFunction.h> 00035 00036 namespace mrpt 00037 { 00038 namespace poses 00039 { 00040 using namespace mrpt::math; 00041 00042 class CPosePDF; 00043 00044 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE( CPose3DPDF, mrpt::utils::CSerializable ) 00045 00046 /** Declares a class that represents a Probability Density Function (PDF) of a 3D pose (6D actually). 00047 * This class is just the base class for unifying many diferent 00048 * ways this PDF can be implemented. 00049 * 00050 * For convenience, a pose composition is also defined for any 00051 * PDF derived class, changeCoordinatesReference, in the form of a method rather than an operator. 00052 * 00053 * For a similar class for 3D points (without attitude), see CPointPDF 00054 * 00055 * 00056 * See also the tutorial on <a href="http://www.mrpt.org/Probability_Density_Distributions_Over_Spatial_Representations">probabilistic spatial representations in the MRPT</a>. 00057 * 00058 * \sa CPose3D, CPosePDF, CPointPDF 00059 * \ingroup poses_pdf_grp 00060 */ 00061 class BASE_IMPEXP CPose3DPDF : public mrpt::utils::CSerializable, public mrpt::utils::CProbabilityDensityFunction<CPose3D,6> 00062 { 00063 DEFINE_VIRTUAL_SERIALIZABLE( CPose3DPDF ) 00064 00065 public: 00066 /** Copy operator, translating if necesary (for example, between particles and gaussian representations) 00067 * \sa createFrom2D 00068 */ 00069 virtual void copyFrom(const CPose3DPDF &o) = 0; 00070 00071 /** This is a static transformation method from 2D poses to 3D PDFs, preserving the representation type (particles->particles, Gaussians->Gaussians,etc) 00072 * It returns a new object of any of the derived classes of CPose3DPDF. This object must be deleted by the user when not required anymore. 00073 * \sa copyFrom 00074 */ 00075 static CPose3DPDF* createFrom2D(const CPosePDF &o); 00076 00077 /** Bayesian fusion of two pose distributions, then save the result in this object (WARNING: Currently only distributions of the same class can be fused! eg, gaussian with gaussian,etc) */ 00078 virtual void bayesianFusion( const CPose3DPDF &p1, const CPose3DPDF &p2 ) = 0 ; 00079 00080 /** Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF */ 00081 virtual void inverse(CPose3DPDF &o) const = 0; 00082 00083 /** This static method computes the pose composition Jacobians. 00084 * 00085 * See this techical report: http:///www.mrpt.org/6D_poses:equivalences_compositions_and_uncertainty 00086 * 00087 * Direct equations (for the covariances) in yaw-pitch-roll are too complex. 00088 * Make a way around them and consider instead this path: 00089 * \code 00090 * X(6D) U(6D) 00091 * | | 00092 * v v 00093 * X(7D) U(7D) 00094 * | | 00095 * +--- (+) ---+ 00096 * | 00097 * v 00098 * RES(7D) 00099 * | 00100 * v 00101 * RES(6D) 00102 * \endcode 00103 * 00104 */ 00105 static void jacobiansPoseComposition( 00106 const CPose3D &x, 00107 const CPose3D &u, 00108 CMatrixDouble66 &df_dx, 00109 CMatrixDouble66 &df_du); 00110 00111 00112 enum { is_3D_val = 1 }; 00113 static inline bool is_3D() { return is_3D_val!=0; } 00114 enum { is_PDF_val = 1 }; 00115 static inline bool is_PDF() { return is_PDF_val!=0; } 00116 00117 /** Returns a 3D representation of this PDF. 00118 * \note Needs the mrpt-opengl library, and using mrpt::opengl::CSetOfObjectsPtr as template argument. 00119 */ 00120 template <class OPENGL_SETOFOBJECTSPTR> 00121 inline void getAs3DObject(OPENGL_SETOFOBJECTSPTR &out_obj) const { 00122 typedef typename OPENGL_SETOFOBJECTSPTR::value_type SETOFOBJECTS; 00123 *out_obj = *SETOFOBJECTS::posePDF2opengl(*this); 00124 } 00125 00126 /** Returns a 3D representation of this PDF. 00127 * \note Needs the mrpt-opengl library, and using mrpt::opengl::CSetOfObjectsPtr as template argument. 00128 */ 00129 template <class OPENGL_SETOFOBJECTSPTR> 00130 inline OPENGL_SETOFOBJECTSPTR getAs3DObject() const { 00131 typedef typename OPENGL_SETOFOBJECTSPTR::value_type SETOFOBJECTS; 00132 return SETOFOBJECTS::posePDF2opengl(*this); 00133 } 00134 00135 }; // End of class def. 00136 00137 00138 } // End of namespace 00139 } // End of namespace 00140 00141 #endif
| Page generated by Doxygen 1.7.4 for MRPT 0.9.5 SVN:2717 at Sun Oct 16 16:08:03 PDT 2011 | Hosted on: |