00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2009 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 CPose3DPDFParticles_H 00029 #define CPose3DPDFParticles_H 00030 00031 #include <mrpt/poses/CPose3DPDF.h> 00032 #include <mrpt/slam/CMultiMetricMap.h> 00033 #include <mrpt/bayes/CProbabilityParticle.h> 00034 #include <mrpt/bayes/CParticleFilterCapable.h> 00035 #include <mrpt/bayes/CParticleFilterData.h> 00036 00037 namespace mrpt 00038 { 00039 namespace slam 00040 { 00041 class COccupancyGridMap2D; 00042 class CSensoryFrame; 00043 } 00044 00045 namespace poses 00046 { 00047 using namespace mrpt::bayes; 00048 using namespace mrpt::utils; 00049 using namespace mrpt::slam; 00050 00054 typedef CProbabilityParticle<CPose3D> CPose3DParticle; 00055 00056 // This must be added to any CSerializable derived class: 00057 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE(CPose3DPDFParticles,CPose3DPDF) 00058 00059 00066 class MRPTDLLIMPEXP CPose3DPDFParticles : public CPose3DPDF, public mrpt::bayes::CParticleFilterData<CPose3D> 00067 { 00068 // This must be added to any CSerializable derived class: 00069 DEFINE_SERIALIZABLE( CPose3DPDFParticles ) 00070 00071 // This uses CParticleFilterData to implement some methods required for CParticleFilterCapable: 00072 IMPLEMENT_PARTICLE_FILTER_CAPABLE(CPose3D) 00073 00074 public: 00078 CPose3DPDFParticles( size_t M = 1 ); 00079 00082 CPose3DPDFParticles( const CPose3DPDFParticles& obj ) : 00083 CPose3DPDF(), 00084 CParticleFilterData<CPose3D>() 00085 { 00086 copyFrom( obj ); 00087 } 00088 00091 virtual ~CPose3DPDFParticles(); 00092 00093 00096 void copyFrom(const CPose3DPDF &o); 00097 00103 void resetDeterministic( const CPose3D &location, 00104 size_t particlesCount = 0); 00105 00109 CPose3D getEstimatedPose() const; 00110 00113 CMatrixD getEstimatedCovariance() const; 00114 00117 CPose3D getParticlePose(int i) const; 00118 00121 void saveToTextFile(const std::string &file) const; 00122 00125 size_t size() const { return m_particles.size(); } 00126 00130 void changeCoordinatesReference( const CPose3D &newReferenceBase ); 00131 00134 void drawSingleSample( CPose3D &outPart ) const; 00135 00138 void drawManySamples( size_t N, std::vector<vector_double> & outSamples ) const; 00139 00142 void operator += ( CPose3D Ap); 00143 00146 void append( CPose3DPDFParticles &o ); 00147 00150 void inverse(CPose3DPDF &o) const; 00151 00154 CPose3D getMostLikelyParticle() const; 00155 00158 void bayesianFusion( CPose3DPDF &p1, CPose3DPDF &p2 ); 00159 00160 }; // End of class def. 00161 00162 00163 } // End of namespace 00164 } // End of namespace 00165 00166 #endif
Page generated by Doxygen 1.5.8 for MRPT 0.6.5 SVN: at Thu Feb 26 02:14:51 EST 2009 |