Main MRPT website > C++ reference
MRPT logo

CMonteCarloLocalization3D.h

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



Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:40:17 UTC 2011