Main MRPT website > C++ reference for MRPT 1.5.7
List of all members | Classes | Public Types | Public Member Functions | Public Attributes
mrpt::bayes::CParticleFilter Class Reference

Detailed Description

This class acts as a common interface to the different interfaces (see CParticleFilter::TParticleFilterAlgorithm) any bayes::CParticleFilterCapable class can implement: it is the invoker of particle filter algorithms.

The particle filter is executed on a probability density function (PDF) described by a CParticleFilterCapable object, passed in the constructor or alternatively through the CParticleFilter::executeOn method.

For a complete example and further details, see the Particle Filter tutorial.

The basic SIR algorithm (pfStandardProposal) consists of:

See also

Definition at line 40 of file CParticleFilter.h.

#include <mrpt/bayes/CParticleFilter.h>

Inheritance diagram for mrpt::bayes::CParticleFilter:
Inheritance graph


struct  TParticleFilterOptions
 The configuration of a particle filter. More...
struct  TParticleFilterStats
 Statistics for being returned from the "execute" method. More...

Public Types

enum  TParticleFilterAlgorithm { pfStandardProposal = 0, pfAuxiliaryPFStandard, pfOptimalProposal, pfAuxiliaryPFOptimal }
 Defines different types of particle filter algorithms. More...
enum  TParticleResamplingAlgorithm { prMultinomial = 0, prResidual, prStratified, prSystematic }
 Defines the different resampling algorithms. More...

Public Member Functions

 CParticleFilter ()
 Default constructor. More...
virtual ~CParticleFilter ()
void executeOn (CParticleFilterCapable &obj, const mrpt::obs::CActionCollection *action, const mrpt::obs::CSensoryFrame *observation, TParticleFilterStats *stats=NULL)
 Executes a complete prediction + update step of the selected particle filtering algorithm. More...

Public Attributes

CParticleFilter::TParticleFilterOptions m_options
 The options to be used in the PF, must be set before executing any step of the particle filter. More...

Member Enumeration Documentation

◆ TParticleFilterAlgorithm

Defines different types of particle filter algorithms.

The defined SIR implementations are:

  • pfStandardProposal: Standard proposal distribution + weights according to likelihood function.
  • pfAuxiliaryPFStandard: An auxiliary PF using the standard proposal distribution.
  • pfOptimalProposal: Use the optimal proposal distribution (where available!, usually this will perform approximations)
  • pfAuxiliaryPFOptimal: Use the optimal proposal and a auxiliary particle filter (see paper).

See the theoretical discussion in resampling schemes.


Definition at line 53 of file CParticleFilter.h.

◆ TParticleResamplingAlgorithm

Defines the different resampling algorithms.

The implemented resampling methods are:

  • prMultinomial (Default): Uses standard select with replacement (draws M random uniform numbers)
  • prResidual: The residual or "remainder" method.
  • prStratified: The stratified resampling, where a uniform sample is drawn for each of M subdivisions of the range (0,1].
  • prSystematic: A single uniform sample is drawn in the range (0,1/M].

See the theoretical discussion in resampling schemes.


Definition at line 70 of file CParticleFilter.h.

Constructor & Destructor Documentation

◆ CParticleFilter()

CParticleFilter::CParticleFilter ( )

Default constructor.

After creating the PF object, set the options in CParticleFilter::m_options, then execute steps through CParticleFilter::executeOn.

Definition at line 32 of file CParticleFilter.cpp.

◆ ~CParticleFilter()

virtual mrpt::bayes::CParticleFilter::~CParticleFilter ( )

Definition at line 127 of file CParticleFilter.h.

Member Function Documentation

◆ executeOn()

void CParticleFilter::executeOn ( CParticleFilterCapable obj,
const mrpt::obs::CActionCollection action,
const mrpt::obs::CSensoryFrame observation,
TParticleFilterStats stats = NULL 

Executes a complete prediction + update step of the selected particle filtering algorithm.

The member CParticleFilter::m_options must be set before calling this to settle the algorithm parameters.

objThe object representing the probability distribution function (PDF) which apply the particle filter algorithm to.
actionA pointer to an action in the form of a CActionCollection, or NULL if there is no action.
observationA pointer to observations in the form of a CSensoryFrame, or NULL if there is no observation.
statsAn output structure for gathering statistics of the particle filter execution, or set to NULL if you do not need it (see CParticleFilter::TParticleFilterStats).
See also
CParticleFilterCapable, executeOn

Definition at line 48 of file CParticleFilter.cpp.

References mrpt::bayes::CParticleFilter::TParticleFilterOptions::adaptiveSampleSize, mrpt::bayes::CParticleFilter::TParticleFilterOptions::BETA, mrpt::bayes::CParticleFilter::TParticleFilterStats::ESS_beforeResample, mrpt::mrpt::format(), m_options, MRPT_END, MRPT_LOG_DEBUG, MRPT_START, mrpt::bayes::CParticleFilter::TParticleFilterOptions::PF_algorithm, pfOptimalProposal, pfStandardProposal, mrpt::math::square(), and mrpt::bayes::CParticleFilter::TParticleFilterStats::weightsVariance_beforeResample.

Referenced by mrpt::slam::CMetricMapBuilderRBPF::processActionObservation(), mrpt::hmtslam::CLSLAM_RBPF_2DLASER::processOneLMH(), and run_test_pf_localization().

Member Data Documentation

◆ m_options

CParticleFilter::TParticleFilterOptions mrpt::bayes::CParticleFilter::m_options

The options to be used in the PF, must be set before executing any step of the particle filter.

Definition at line 148 of file CParticleFilter.h.

Referenced by executeOn(), mrpt::slam::CMetricMapBuilderRBPF::processActionObservation(), mrpt::hmtslam::CLSLAM_RBPF_2DLASER::processOneLMH(), and run_test_pf_localization().

Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 8277875f6 Mon Jun 11 02:47:32 2018 +0200 at lun oct 28 01:50:49 CET 2019