Main MRPT website > C++ reference for MRPT 1.9.9
List of all members | Public Types | Public Member Functions | Public Attributes
mrpt::slam::CMonteCarloLocalization3D Class Referenceabstract

Detailed Description

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.

This class also implements particle filtering for robot localization. See the MRPT application "app/pf-localization" for an example of usage.

See also
CMonteCarloLocalization2D, CPose2D, CPosePDF, CPoseGaussianPDF,

Definition at line 30 of file CMonteCarloLocalization3D.h.

#include <mrpt/slam/CMonteCarloLocalization3D.h>

Inheritance diagram for mrpt::slam::CMonteCarloLocalization3D:
Inheritance graph

Public Types

using CParticleDataContent = mrpt::poses::CPose3DPDFParticles::CParticleDataContent
 
using CParticleList = mrpt::poses::CPose3DPDFParticles::CParticleList
 

Public Member Functions

 CMonteCarloLocalization3D (size_t M=1)
 Constructor. More...
 
virtual ~CMonteCarloLocalization3D ()
 Destructor. More...
 
template<typename T >
void prediction_and_update (const mrpt::obs::CActionCollection *action, const mrpt::obs::CSensoryFrame *observation, const bayes::CParticleFilter::TParticleFilterOptions &PF_options)
 Update the m_particles, predicting the posterior of robot pose and map after a movement command. More...
 
void executeOn (mrpt::bayes::CParticleFilter &pf, const mrpt::obs::CActionCollection *action, const mrpt::obs::CSensoryFrame *observation, mrpt::bayes::CParticleFilter::TParticleFilterStats *stats, mrpt::bayes::CParticleFilter::TParticleFilterAlgorithm PF_algorithm)
 
Virtual methods that the PF_implementations assume exist.
mrpt::math::TPose3D getLastPose (const size_t i, bool &is_valid_pose) const override
 Return the robot pose for the i'th particle. More...
 
void PF_SLAM_implementation_custom_update_particle_with_new_pose (CParticleDataContent *particleData, const mrpt::math::TPose3D &newPose) const
 
void PF_SLAM_implementation_replaceByNewParticleSet (CParticleList &old_particles, const std::vector< mrpt::math::TPose3D > &newParticles, const std::vector< double > &newParticlesWeight, const std::vector< size_t > &newParticlesDerivedFromIdx) const
 
double PF_SLAM_computeObservationLikelihoodForParticle (const mrpt::bayes::CParticleFilter::TParticleFilterOptions &PF_options, const size_t particleIndexForMap, const mrpt::obs::CSensoryFrame &observation, const mrpt::poses::CPose3D &x) const
 Evaluate the observation likelihood for one particle at a given location. More...
 
Virtual methods that the PF_implementations assume exist.
virtual void PF_SLAM_implementation_custom_update_particle_with_new_pose (mrpt::poses::CPose3D *particleData, const mrpt::math::TPose3D &newPose) const=0
 
virtual void PF_SLAM_implementation_replaceByNewParticleSet (typename mrpt::poses::CPose3DPDFParticles ::CParticleList &old_particles, const std::vector< mrpt::math::TPose3D > &newParticles, const std::vector< double > &newParticlesWeight, const std::vector< size_t > &newParticlesDerivedFromIdx) const
 This is the default algorithm to efficiently replace one old set of samples by another new set. More...
 
virtual bool PF_SLAM_implementation_doWeHaveValidObservations (const typename mrpt::bayes::CParticleFilterData< mrpt::poses::CPose3D >::typename mrpt::poses::CPose3DPDFParticles ::CParticleList &particles, const mrpt::obs::CSensoryFrame *sf) const
 
virtual bool PF_SLAM_implementation_skipRobotMovement () const
 Make a specialization if needed, eg. More...
 

Public Attributes

mrpt::poses::CPose3DPDFParticles m_poseParticles
 
TMonteCarloLocalizationParams options
 MCL parameters. More...
 

Data members and methods used by generic PF implementations

mrpt::obs::CActionRobotMovement2D m_accumRobotMovement2D
 
bool m_accumRobotMovement2DIsValid
 
mrpt::poses::CPose3DPDFGaussian m_accumRobotMovement3D
 
bool m_accumRobotMovement3DIsValid
 
mrpt::poses::CPoseRandomSampler m_movementDrawer
 Used in al PF implementations. More...
 
mrpt::math::CVectorDouble m_pfAuxiliaryPFOptimal_estimatedProb
 Auxiliary variable used in the "pfAuxiliaryPFOptimal" algorithm. More...
 
mrpt::math::CVectorDouble m_pfAuxiliaryPFStandard_estimatedProb
 Auxiliary variable used in the "pfAuxiliaryPFStandard" algorithm. More...
 
mrpt::math::CVectorDouble m_pfAuxiliaryPFOptimal_maxLikelihood
 Auxiliary variable used in the "pfAuxiliaryPFOptimal" algorithm. More...
 
std::vector< mrpt::math::TPose3Dm_pfAuxiliaryPFOptimal_maxLikDrawnMovement
 Auxiliary variable used in the "pfAuxiliaryPFOptimal" algorithm. More...
 
std::vector< bool > m_pfAuxiliaryPFOptimal_maxLikMovementDrawHasBeenUsed
 
static double PF_SLAM_particlesEvaluator_AuxPFStandard (const mrpt::bayes::CParticleFilter::TParticleFilterOptions &PF_options, const mrpt::bayes::CParticleFilterCapable *obj, size_t index, const void *action, const void *observation)
 Compute w[i]*p(z_t | mu_t^i), with mu_t^i being the mean of the new robot pose. More...
 

Member Typedef Documentation

◆ CParticleDataContent

Definition at line 36 of file CMonteCarloLocalization3D.h.

◆ CParticleList

Definition at line 37 of file CMonteCarloLocalization3D.h.

Constructor & Destructor Documentation

◆ CMonteCarloLocalization3D()

mrpt::slam::CMonteCarloLocalization3D::CMonteCarloLocalization3D ( size_t  M = 1)

Constructor.

Parameters
MThe number of m_particles.

Definition at line 77 of file CMonteCarloLocalization3D.cpp.

Referenced by executeOn(), and prediction_and_update().

Here is the caller graph for this function:

◆ ~CMonteCarloLocalization3D()

mrpt::slam::CMonteCarloLocalization3D::~CMonteCarloLocalization3D ( )
virtual

Destructor.

Definition at line 86 of file CMonteCarloLocalization3D.cpp.

Member Function Documentation

◆ executeOn()

void mrpt::slam::CMonteCarloLocalization3D::executeOn ( mrpt::bayes::CParticleFilter pf,
const mrpt::obs::CActionCollection action,
const mrpt::obs::CSensoryFrame observation,
mrpt::bayes::CParticleFilter::TParticleFilterStats stats,
mrpt::bayes::CParticleFilter::TParticleFilterAlgorithm  PF_algorithm 
)

Definition at line 188 of file CMonteCarloLocalization3D.cpp.

References CMonteCarloLocalization3D(), mrpt::bayes::CParticleFilter::executeOn(), and THROW_EXCEPTION.

Here is the call graph for this function:

◆ getLastPose()

TPose3D mrpt::slam::CMonteCarloLocalization3D::getLastPose ( const size_t  i,
bool &  is_valid_pose 
) const
overridevirtual

Return the robot pose for the i'th particle.

is_valid is always true in this class.

Implements mrpt::slam::PF_implementation< mrpt::poses::CPose3D, mrpt::poses::CPose3DPDFParticles >.

Definition at line 87 of file CMonteCarloLocalization3D.cpp.

References ASSERTDEB_, mrpt::bayes::CParticleFilterData< T >::m_particles, m_poseParticles, and THROW_EXCEPTION.

◆ PF_SLAM_computeObservationLikelihoodForParticle()

double mrpt::slam::CMonteCarloLocalization3D::PF_SLAM_computeObservationLikelihoodForParticle ( const mrpt::bayes::CParticleFilter::TParticleFilterOptions PF_options,
const size_t  particleIndexForMap,
const mrpt::obs::CSensoryFrame observation,
const mrpt::poses::CPose3D x 
) const
virtual

◆ PF_SLAM_implementation_custom_update_particle_with_new_pose() [1/2]

void mrpt::slam::CMonteCarloLocalization3D::PF_SLAM_implementation_custom_update_particle_with_new_pose ( CParticleDataContent particleData,
const mrpt::math::TPose3D newPose 
) const

Definition at line 156 of file CMonteCarloLocalization3D.cpp.

◆ PF_SLAM_implementation_custom_update_particle_with_new_pose() [2/2]

virtual void mrpt::slam::PF_implementation< mrpt::poses::CPose3D , mrpt::poses::CPose3DPDFParticles , typename mrpt::poses::CPose3DPDFParticles ::CParticleList >::PF_SLAM_implementation_custom_update_particle_with_new_pose ( mrpt::poses::CPose3D particleData,
const mrpt::math::TPose3D newPose 
) const
pure virtualinherited

◆ PF_SLAM_implementation_doWeHaveValidObservations()

virtual bool mrpt::slam::PF_implementation< mrpt::poses::CPose3D , mrpt::poses::CPose3DPDFParticles , typename mrpt::poses::CPose3DPDFParticles ::CParticleList >::PF_SLAM_implementation_doWeHaveValidObservations ( const typename mrpt::bayes::CParticleFilterData< mrpt::poses::CPose3D >::typename mrpt::poses::CPose3DPDFParticles ::CParticleList &  particles,
const mrpt::obs::CSensoryFrame sf 
) const
inlinevirtualinherited

Definition at line 179 of file PF_implementations_data.h.

◆ PF_SLAM_implementation_replaceByNewParticleSet() [1/2]

void mrpt::slam::CMonteCarloLocalization3D::PF_SLAM_implementation_replaceByNewParticleSet ( CParticleList old_particles,
const std::vector< mrpt::math::TPose3D > &  newParticles,
const std::vector< double > &  newParticlesWeight,
const std::vector< size_t > &  newParticlesDerivedFromIdx 
) const

Definition at line 162 of file CMonteCarloLocalization3D.cpp.

References ASSERT_, and MRPT_UNUSED_PARAM.

◆ PF_SLAM_implementation_replaceByNewParticleSet() [2/2]

virtual void mrpt::slam::PF_implementation< mrpt::poses::CPose3D , mrpt::poses::CPose3DPDFParticles , typename mrpt::poses::CPose3DPDFParticles ::CParticleList >::PF_SLAM_implementation_replaceByNewParticleSet ( typename mrpt::poses::CPose3DPDFParticles ::CParticleList &  old_particles,
const std::vector< mrpt::math::TPose3D > &  newParticles,
const std::vector< double > &  newParticlesWeight,
const std::vector< size_t > &  newParticlesDerivedFromIdx 
) const
inlinevirtualinherited

This is the default algorithm to efficiently replace one old set of samples by another new set.

The method uses pointers to make fast copies the first time each particle is duplicated, then makes real copies for the next ones.

Note that more efficient specializations might exist for specific particle data structs.

Definition at line 105 of file PF_implementations_data.h.

◆ PF_SLAM_implementation_skipRobotMovement()

virtual bool mrpt::slam::PF_implementation< mrpt::poses::CPose3D , mrpt::poses::CPose3DPDFParticles , typename mrpt::poses::CPose3DPDFParticles ::CParticleList >::PF_SLAM_implementation_skipRobotMovement ( ) const
inlinevirtualinherited

Make a specialization if needed, eg.

in the first step in SLAM.

Definition at line 190 of file PF_implementations_data.h.

◆ PF_SLAM_particlesEvaluator_AuxPFStandard()

static double mrpt::slam::PF_implementation< mrpt::poses::CPose3D , mrpt::poses::CPose3DPDFParticles , typename mrpt::poses::CPose3DPDFParticles ::CParticleList >::PF_SLAM_particlesEvaluator_AuxPFStandard ( const mrpt::bayes::CParticleFilter::TParticleFilterOptions PF_options,
const mrpt::bayes::CParticleFilterCapable obj,
size_t  index,
const void action,
const void observation 
)
staticinherited

Compute w[i]*p(z_t | mu_t^i), with mu_t^i being the mean of the new robot pose.

Parameters
actionMUST be a "const CPose3D*"
observationMUST be a "const CSensoryFrame*"

◆ prediction_and_update()

template<typename T >
void mrpt::slam::CMonteCarloLocalization3D::prediction_and_update ( const mrpt::obs::CActionCollection action,
const mrpt::obs::CSensoryFrame observation,
const bayes::CParticleFilter::TParticleFilterOptions PF_options 
)

Update the m_particles, predicting the posterior of robot pose and map after a movement command.

This method has additional configuration parameters in "options". Performs the update stage of the RBPF, using the sensed CSensoryFrame:

Parameters
actionThis is a pointer to CActionCollection, containing the pose change the robot has been commanded.
observationThis must be a pointer to a CSensoryFrame object, with robot sensed observations.
See also
options

Definition at line 103 of file CMonteCarloLocalization3D.cpp.

References ASSERT_, CMonteCarloLocalization3D(), mrpt::slam::TMonteCarloLocalizationParams::KLD_params, mrpt::bayes::CParticleFilterData< T >::m_particles, m_poseParticles, mrpt::slam::TMonteCarloLocalizationParams::metricMap, mrpt::slam::TMonteCarloLocalizationParams::metricMaps, MRPT_END, MRPT_START, and options.

Here is the call graph for this function:

Member Data Documentation

◆ m_accumRobotMovement2D

Definition at line 48 of file PF_implementations_data.h.

◆ m_accumRobotMovement2DIsValid

Definition at line 49 of file PF_implementations_data.h.

◆ m_accumRobotMovement3D

Definition at line 50 of file PF_implementations_data.h.

◆ m_accumRobotMovement3DIsValid

Definition at line 51 of file PF_implementations_data.h.

◆ m_movementDrawer

Used in al PF implementations.

See also
PF_SLAM_implementation_gatherActionsCheckBothActObs

Definition at line 55 of file PF_implementations_data.h.

◆ m_pfAuxiliaryPFOptimal_estimatedProb

Auxiliary variable used in the "pfAuxiliaryPFOptimal" algorithm.

Definition at line 57 of file PF_implementations_data.h.

◆ m_pfAuxiliaryPFOptimal_maxLikDrawnMovement

std::vector<mrpt::math::TPose3D> mrpt::slam::PF_implementation< mrpt::poses::CPose3D , mrpt::poses::CPose3DPDFParticles , typename mrpt::poses::CPose3DPDFParticles ::CParticleList >::m_pfAuxiliaryPFOptimal_maxLikDrawnMovement
mutableinherited

Auxiliary variable used in the "pfAuxiliaryPFOptimal" algorithm.

Definition at line 64 of file PF_implementations_data.h.

◆ m_pfAuxiliaryPFOptimal_maxLikelihood

Auxiliary variable used in the "pfAuxiliaryPFOptimal" algorithm.

Definition at line 61 of file PF_implementations_data.h.

◆ m_pfAuxiliaryPFOptimal_maxLikMovementDrawHasBeenUsed

std::vector<bool> mrpt::slam::PF_implementation< mrpt::poses::CPose3D , mrpt::poses::CPose3DPDFParticles , typename mrpt::poses::CPose3DPDFParticles ::CParticleList >::m_pfAuxiliaryPFOptimal_maxLikMovementDrawHasBeenUsed
inherited

Definition at line 65 of file PF_implementations_data.h.

◆ m_pfAuxiliaryPFStandard_estimatedProb

Auxiliary variable used in the "pfAuxiliaryPFStandard" algorithm.

Definition at line 59 of file PF_implementations_data.h.

◆ m_poseParticles

mrpt::poses::CPose3DPDFParticles mrpt::slam::CMonteCarloLocalization3D::m_poseParticles

Definition at line 39 of file CMonteCarloLocalization3D.h.

Referenced by getLastPose(), and prediction_and_update().

◆ options

TMonteCarloLocalizationParams mrpt::slam::CMonteCarloLocalization3D::options

MCL parameters.

Definition at line 42 of file CMonteCarloLocalization3D.h.

Referenced by PF_SLAM_computeObservationLikelihoodForParticle(), and prediction_and_update().




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019