00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 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 CPose3DQuatPDF_H 00029 #define CPose3DQuatPDF_H 00030 00031 #include <mrpt/poses/CPose3D.h> 00032 #include <mrpt/poses/CPose3DQuat.h> 00033 #include <mrpt/math/CMatrixD.h> 00034 #include <mrpt/utils/CProbabilityDensityFunction.h> 00035 #include <mrpt/poses/opengl_frwd_decl.h> 00036 00037 namespace mrpt 00038 { 00039 namespace poses 00040 { 00041 using namespace mrpt::math; 00042 00043 class CPosePDF; 00044 class CPose3DPDF; 00045 00046 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE( CPose3DQuatPDF, mrpt::utils::CSerializable ) 00047 00048 /** 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]. 00049 * This class is just the base class for unifying many diferent ways this PDF can be implemented. 00050 * 00051 * For convenience, a pose composition is also defined for any 00052 * PDF derived class, changeCoordinatesReference, in the form of a method rather than an operator. 00053 * 00054 * - For a similar class for 3D points (without attitude), see CPointPDF. 00055 * - For a similar class for 3D poses (with Euler angles instead of quaternions), see CPose3DPDF. 00056 * 00057 * 00058 * See also the tutorial on <a href="http://www.mrpt.org/Probability_Density_Distributions_Over_Spatial_Representations">probabilistic spatial representations in the MRPT</a>. 00059 * 00060 * \sa CPose3DQuatPDF, CPose3DPDF 00061 */ 00062 class BASE_IMPEXP CPose3DQuatPDF : 00063 public mrpt::utils::CSerializable, 00064 public mrpt::utils::CProbabilityDensityFunction<CPose3DQuat,7> 00065 { 00066 DEFINE_VIRTUAL_SERIALIZABLE( CPose3DQuatPDF ) 00067 00068 public: 00069 /** Copy operator, translating if necesary (for example, between particles and gaussian representations) 00070 * \sa createFrom2D 00071 */ 00072 virtual void copyFrom(const CPose3DQuatPDF &o) = 0; 00073 00074 /** This is a static transformation method from 2D poses to 3D PDFs, preserving the representation type (particles->particles, Gaussians->Gaussians,etc) 00075 * 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. 00076 * \sa copyFrom 00077 */ 00078 static CPose3DQuatPDF* createFrom2D(const CPosePDF &o); 00079 00080 /** 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) 00081 */ 00082 virtual void bayesianFusion(const CPose3DQuatPDF &p1, const CPose3DQuatPDF &p2 ) = 0 ; 00083 00084 /** Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF 00085 */ 00086 virtual void inverse(CPose3DQuatPDF &o) const = 0; 00087 00088 /** Returns a 3D representation of this PDF. 00089 * \note Needs the mrpt-opengl library, and using mrpt::opengl::CSetOfObjectsPtr as template argument. 00090 */ 00091 template <class OPENGL_SETOFOBJECTSPTR> 00092 inline void getAs3DObject(OPENGL_SETOFOBJECTSPTR &out_obj) const { 00093 *out_obj = *mrpt::opengl::posePDF2opengl<CPose3DQuatPDF,OPENGL_SETOFOBJECTSPTR>(*this); 00094 } 00095 00096 /** Returns a 3D representation of this PDF. 00097 * \note Needs the mrpt-opengl library, and using mrpt::opengl::CSetOfObjectsPtr as template argument. 00098 */ 00099 template <class OPENGL_SETOFOBJECTSPTR> 00100 inline OPENGL_SETOFOBJECTSPTR getAs3DObject() const { 00101 return mrpt::opengl::posePDF2opengl<CPosePDF,OPENGL_SETOFOBJECTSPTR>(*this); 00102 } 00103 00104 }; // End of class def. 00105 00106 } // End of namespace 00107 } // End of namespace 00108 00109 #endif
Page generated by Doxygen 1.7.1 for MRPT 0.9.4 SVN: at Mon Jan 10 23:33:19 UTC 2011 |