Main MRPT website > C++ reference
MRPT logo
CMonteCarloLocalization3D.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | The Mobile Robot Programming Toolkit (MRPT) C++ library |
3  | |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (C) 2005-2012 University of Malaga |
7  | |
8  | This software was written by the Machine Perception and Intelligent |
9  | Robotics Lab, University of Malaga (Spain). |
10  | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11  | |
12  | This file is part of the MRPT project. |
13  | |
14  | MRPT is free software: you can redistribute it and/or modify |
15  | it under the terms of the GNU General Public License as published by |
16  | the Free Software Foundation, either version 3 of the License, or |
17  | (at your option) any later version. |
18  | |
19  | MRPT is distributed in the hope that it will be useful, |
20  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22  | GNU General Public License for more details. |
23  | |
24  | You should have received a copy of the GNU General Public License |
25  | along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26  | |
27  +---------------------------------------------------------------------------+ */
28 #ifndef CMonteCarloLocalization3D_H
29 #define CMonteCarloLocalization3D_H
30 
34 
35 #include <mrpt/slam/link_pragmas.h>
36 
37 namespace mrpt
38 {
39  namespace slam
40  {
41  class CSensoryFrame;
42 
43  using namespace mrpt::poses;
44  using namespace mrpt::slam;
45  using namespace mrpt::bayes;
46 
47  /** 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.
48  *
49  * This class also implements particle filtering for robot localization. See the MRPT
50  * application "app/pf-localization" for an example of usage.
51  *
52  * \sa CMonteCarloLocalization2D, CPose2D, CPosePDF, CPoseGaussianPDF, CParticleFilterCapable
53  * \ingroup mrpt_slam_grp
54  */
56  public CPose3DPDFParticles,
57  public PF_implementation<CPose3D,CMonteCarloLocalization3D>
58  {
59  //template <class PARTICLE_TYPE, class MYSELF> friend class PF_implementation;
60 
61  public:
63 
64  /** Constructor
65  * \param M The number of m_particles.
66  */
67  CMonteCarloLocalization3D( size_t M = 1 );
68 
69  /** Destructor */
70  virtual ~CMonteCarloLocalization3D();
71 
72  /** Update the m_particles, predicting the posterior of robot pose and map after a movement command.
73  * This method has additional configuration parameters in "options".
74  * Performs the update stage of the RBPF, using the sensed CSensoryFrame:
75  *
76  * \param action This is a pointer to CActionCollection, containing the pose change the robot has been commanded.
77  * \param observation This must be a pointer to a CSensoryFrame object, with robot sensed observations.
78  *
79  * \sa options
80  */
81  void prediction_and_update_pfStandardProposal(
82  const mrpt::slam::CActionCollection * action,
83  const mrpt::slam::CSensoryFrame * observation,
85 
86  /** Update the m_particles, predicting the posterior of robot pose and map after a movement command.
87  * This method has additional configuration parameters in "options".
88  * Performs the update stage of the RBPF, using the sensed CSensoryFrame:
89  *
90  * \param Action This is a pointer to CActionCollection, containing the pose change the robot has been commanded.
91  * \param observation This must be a pointer to a CSensoryFrame object, with robot sensed observations.
92  *
93  * \sa options
94  */
95  void prediction_and_update_pfAuxiliaryPFStandard(
96  const mrpt::slam::CActionCollection * action,
97  const mrpt::slam::CSensoryFrame * observation,
99 
100  /** Update the m_particles, predicting the posterior of robot pose and map after a movement command.
101  * This method has additional configuration parameters in "options".
102  * Performs the update stage of the RBPF, using the sensed CSensoryFrame:
103  *
104  * \param Action This is a pointer to CActionCollection, containing the pose change the robot has been commanded.
105  * \param observation This must be a pointer to a CSensoryFrame object, with robot sensed observations.
106  *
107  * \sa options
108  */
109  void prediction_and_update_pfAuxiliaryPFOptimal(
110  const mrpt::slam::CActionCollection * action,
111  const mrpt::slam::CSensoryFrame * observation,
113 
114  //protected:
115  /** \name Virtual methods that the PF_implementations assume exist.
116  @{ */
117  /** Return a pointer to the last robot pose in the i'th particle (or NULL if it's a path and it's empty). */
118  const TPose3D * getLastPose(const size_t i) const;
119 
120  void PF_SLAM_implementation_custom_update_particle_with_new_pose(
121  CParticleDataContent *particleData,
122  const TPose3D &newPose) const;
123 
124  // We'll redefine this one:
125  void PF_SLAM_implementation_replaceByNewParticleSet(
126  CParticleList &old_particles,
127  const std::vector<TPose3D> &newParticles,
128  const vector_double &newParticlesWeight,
129  const std::vector<size_t> &newParticlesDerivedFromIdx ) const;
130 
131  /** Evaluate the observation likelihood for one particle at a given location */
132  double PF_SLAM_computeObservationLikelihoodForParticle(
133  const CParticleFilter::TParticleFilterOptions &PF_options,
134  const size_t particleIndexForMap,
135  const CSensoryFrame &observation,
136  const CPose3D &x ) const;
137  /** @} */
138 
139 
140  }; // End of class def.
141 
142  } // End of namespace
143 } // End of namespace
144 
145 #endif



Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013