00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2010 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 */ 00054 class SLAM_IMPEXP CMonteCarloLocalization3D : 00055 public CPose3DPDFParticles, 00056 public PF_implementation<CPose3D> 00057 { 00058 public: 00059 TMonteCarloLocalizationParams options; //!< MCL parameters 00060 00061 /** Constructor 00062 * \param M The number of m_particles. 00063 */ 00064 CMonteCarloLocalization3D( size_t M = 1 ); 00065 00066 /** Destructor */ 00067 virtual ~CMonteCarloLocalization3D(); 00068 00069 /** Update the m_particles, predicting the posterior of robot pose and map after a movement command. 00070 * This method has additional configuration parameters in "options". 00071 * Performs the update stage of the RBPF, using the sensed Sensorial Frame: 00072 * 00073 * \param action This is a pointer to CActionCollection, containing the pose change the robot has been commanded. 00074 * \param observation This must be a pointer to a CSensoryFrame object, with robot sensed observations. 00075 * 00076 * \sa options 00077 */ 00078 void prediction_and_update_pfStandardProposal( 00079 const mrpt::slam::CActionCollection * action, 00080 const mrpt::slam::CSensoryFrame * observation, 00081 const bayes::CParticleFilter::TParticleFilterOptions &PF_options ); 00082 00083 /** Update the m_particles, predicting the posterior of robot pose and map after a movement command. 00084 * This method has additional configuration parameters in "options". 00085 * Performs the update stage of the RBPF, using the sensed Sensorial Frame: 00086 * 00087 * \param Action This is a pointer to CActionCollection, containing the pose change the robot has been commanded. 00088 * \param observation This must be a pointer to a CSensoryFrame object, with robot sensed observations. 00089 * 00090 * \sa options 00091 */ 00092 void prediction_and_update_pfAuxiliaryPFStandard( 00093 const mrpt::slam::CActionCollection * action, 00094 const mrpt::slam::CSensoryFrame * observation, 00095 const bayes::CParticleFilter::TParticleFilterOptions &PF_options ); 00096 00097 /** Update the m_particles, predicting the posterior of robot pose and map after a movement command. 00098 * This method has additional configuration parameters in "options". 00099 * Performs the update stage of the RBPF, using the sensed Sensorial Frame: 00100 * 00101 * \param Action This is a pointer to CActionCollection, containing the pose change the robot has been commanded. 00102 * \param observation This must be a pointer to a CSensoryFrame object, with robot sensed observations. 00103 * 00104 * \sa options 00105 */ 00106 void prediction_and_update_pfAuxiliaryPFOptimal( 00107 const mrpt::slam::CActionCollection * action, 00108 const mrpt::slam::CSensoryFrame * observation, 00109 const bayes::CParticleFilter::TParticleFilterOptions &PF_options ); 00110 00111 protected: 00112 /** \name Virtual methods that the PF_implementations assume exist. 00113 @{ */ 00114 /** Return a pointer to the last robot pose in the i'th particle (or NULL if it's a path and it's empty). */ 00115 const TPose3D * getLastPose(const size_t i) const; 00116 00117 void PF_SLAM_implementation_custom_update_particle_with_new_pose( 00118 CParticleDataContent *particleData, 00119 const TPose3D &newPose) const; 00120 00121 // We'll redefine this one: 00122 void PF_SLAM_implementation_replaceByNewParticleSet( 00123 CParticleList &old_particles, 00124 const vector<TPose3D> &newParticles, 00125 const vector_double &newParticlesWeight, 00126 const vector<size_t> &newParticlesDerivedFromIdx ) const; 00127 00128 /** Evaluate the observation likelihood for one particle at a given location */ 00129 double PF_SLAM_computeObservationLikelihoodForParticle( 00130 const CParticleFilter::TParticleFilterOptions &PF_options, 00131 const size_t particleIndexForMap, 00132 const CSensoryFrame &observation, 00133 const CPose3D &x ) const; 00134 /** @} */ 00135 00136 00137 }; // End of class def. 00138 00139 } // End of namespace 00140 } // End of namespace 00141 00142 #endif
| Page generated by Doxygen 1.6.1 for MRPT 0.9.0 SVN: at Mon Jun 7 06:47:58 UTC 2010 |
