Particle Filters

The following C++ classes are the base for different PF implementations all across MRPT:

  • mrpt::bayes::CParticleFilterCapable: This virtual class defines the interface that any particles based PDF class must implement in order to be executed by a CParticleFilter.
  • mrpt::bayes::CParticleFilter: The class that executes iterations on a CParticleFilterCapable object.
  • The container model mrpt::bayes::CParticleFilterData is used by some classes which are not really intended to be processed with a PF. It just represent a C++ template for sets of weighted samples a any given type, and common memory-keeping tasks.

Both the specific particle filter algorithm to run and the resampling scheme to use can be independently selected in the options structuremrpt::bayes::CParticleFilter::TParticleFilterOptions:

  • PF algorithms – See also the description of the algorithms.
    • pfStandardProposal: Standard proposal distribution + weights according to likelihood function.
    • pfAuxiliaryPFStandard: An auxiliary PF using the standard proposal distribution.
    • pfOptimalProposal: Use the exact optimal proposal distribution (where available!, usually this will perform approximations)
    • pfAuxiliaryPFOptimal: Use the optimal proposal and a auxiliary particle filter (see paper).
    • In addition, adaptiveSampleSize can select whether to use a dynamic number of samples, or not. Take into account that only a subset of all the possible combinations of algorithms may be implemented for each problem.
  • Resampling algorithms – See also the description of the algorithms.
    • 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].

An illustrative implementation: 2D tracking

The following video shows the example samples/bayesianTracking running. Follow the link to check out the source code to get all the details of the implementation. The same code demonstrates Kalman filtering.