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 CMonteCarloLocalization3D_H 00029 #define CMonteCarloLocalization3D_H 00030 00031 #include <mrpt/poses/CPose3DPDFParticles.h> 00032 #include <mrpt/slam/PF_implementations_data.h> 00033 #include <mrpt/slam/TMonteCarloLocalizationParams.h> 00034 00035 #include <mrpt/slam/link_pragmas.h> 00036 00037 namespace mrpt 00038 { 00039 namespace slam 00040 { 00041 class CSensoryFrame; 00042 00043 using namespace mrpt::poses; 00044 using namespace mrpt::slam; 00045 using namespace mrpt::bayes; 00046 00047 /** Declares a class that represents a Probability Density Function (PDF) over a 3D pose (x,y,phi,yaw,pitch,roll), using a set of weighted samples. 00048 * 00049 * This class also implements particle filtering for robot localization. See the MRPT 00050 * application "app/pf-localization" for an example of usage. 00051 * 00052 * \sa CMonteCarloLocalization2D, CPose2D, CPosePDF, CPoseGaussianPDF, CParticleFilterCapable 00053 * \ingroup mrpt_slam_grp 00054 */ 00055 class SLAM_IMPEXP CMonteCarloLocalization3D : 00056 public CPose3DPDFParticles, 00057 public PF_implementation<CPose3D,CMonteCarloLocalization3D> 00058 { 00059 //template <class PARTICLE_TYPE, class MYSELF> friend class PF_implementation; 00060 00061 public: 00062 TMonteCarloLocalizationParams options; //!< MCL parameters 00063 00064 /** Constructor 00065 * \param M The number of m_particles. 00066 */ 00067 CMonteCarloLocalization3D( size_t M = 1 ); 00068 00069 /** Destructor */ 00070 virtual ~CMonteCarloLocalization3D(); 00071 00072 /** Update the m_particles, predicting the posterior of robot pose and map after a movement command. 00073 * This method has additional configuration parameters in "options". 00074 * Performs the update stage of the RBPF, using the sensed CSensoryFrame: 00075 * 00076 * \param action This is a pointer to CActionCollection, containing the pose change the robot has been commanded. 00077 * \param observation This must be a pointer to a CSensoryFrame object, with robot sensed observations. 00078 * 00079 * \sa options 00080 */ 00081 void prediction_and_update_pfStandardProposal( 00082 const mrpt::slam::CActionCollection * action, 00083 const mrpt::slam::CSensoryFrame * observation, 00084 const bayes::CParticleFilter::TParticleFilterOptions &PF_options ); 00085 00086 /** Update the m_particles, predicting the posterior of robot pose and map after a movement command. 00087 * This method has additional configuration parameters in "options". 00088 * Performs the update stage of the RBPF, using the sensed CSensoryFrame: 00089 * 00090 * \param Action This is a pointer to CActionCollection, containing the pose change the robot has been commanded. 00091 * \param observation This must be a pointer to a CSensoryFrame object, with robot sensed observations. 00092 * 00093 * \sa options 00094 */ 00095 void prediction_and_update_pfAuxiliaryPFStandard( 00096 const mrpt::slam::CActionCollection * action, 00097 const mrpt::slam::CSensoryFrame * observation, 00098 const bayes::CParticleFilter::TParticleFilterOptions &PF_options ); 00099 00100 /** Update the m_particles, predicting the posterior of robot pose and map after a movement command. 00101 * This method has additional configuration parameters in "options". 00102 * Performs the update stage of the RBPF, using the sensed CSensoryFrame: 00103 * 00104 * \param Action This is a pointer to CActionCollection, containing the pose change the robot has been commanded. 00105 * \param observation This must be a pointer to a CSensoryFrame object, with robot sensed observations. 00106 * 00107 * \sa options 00108 */ 00109 void prediction_and_update_pfAuxiliaryPFOptimal( 00110 const mrpt::slam::CActionCollection * action, 00111 const mrpt::slam::CSensoryFrame * observation, 00112 const bayes::CParticleFilter::TParticleFilterOptions &PF_options ); 00113 00114 //protected: 00115 /** \name Virtual methods that the PF_implementations assume exist. 00116 @{ */ 00117 /** Return a pointer to the last robot pose in the i'th particle (or NULL if it's a path and it's empty). */ 00118 const TPose3D * getLastPose(const size_t i) const; 00119 00120 void PF_SLAM_implementation_custom_update_particle_with_new_pose( 00121 CParticleDataContent *particleData, 00122 const TPose3D &newPose) const; 00123 00124 // We'll redefine this one: 00125 void PF_SLAM_implementation_replaceByNewParticleSet( 00126 CParticleList &old_particles, 00127 const std::vector<TPose3D> &newParticles, 00128 const vector_double &newParticlesWeight, 00129 const std::vector<size_t> &newParticlesDerivedFromIdx ) const; 00130 00131 /** Evaluate the observation likelihood for one particle at a given location */ 00132 double PF_SLAM_computeObservationLikelihoodForParticle( 00133 const CParticleFilter::TParticleFilterOptions &PF_options, 00134 const size_t particleIndexForMap, 00135 const CSensoryFrame &observation, 00136 const CPose3D &x ) const; 00137 /** @} */ 00138 00139 00140 }; // End of class def. 00141 00142 } // End of namespace 00143 } // End of namespace 00144 00145 #endif
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011 |