# class mrpt::bayes::CParticleFilter¶

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:

• Execute a prediction with the given “action”.

• Update the weights of the particles using the likelihood of the “observation”.

• Normalize weights.

• Perform resampling if the ESS is below the threshold options.BETA.

See also:

mrpt::poses::CPoseParticlesPDF

#include <mrpt/bayes/CParticleFilter.h>

class CParticleFilter: public mrpt::system::COutputLogger
{
public:
// enums

enum TParticleFilterAlgorithm;
enum TParticleResamplingAlgorithm;

// structs

struct TParticleFilterOptions;
struct TParticleFilterStats;

//
fields

CParticleFilter::TParticleFilterOptions m_options;

//
methods

void executeOn(CParticleFilterCapable& obj, const mrpt::obs::CActionCollection* action, const mrpt::obs::CSensoryFrame* observation, TParticleFilterStats* stats = nullptr);
};

## Inherited Members¶

public:
// structs

struct TMsg;

## Fields¶

CParticleFilter::TParticleFilterOptions m_options

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

## Methods¶

void executeOn(CParticleFilterCapable& obj, const mrpt::obs::CActionCollection* action, const mrpt::obs::CSensoryFrame* observation, TParticleFilterStats* stats = nullptr)

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.

Parameters:

 obj The object representing the probability distribution function (PDF) which apply the particle filter algorithm to. action A pointer to an action in the form of a CActionCollection, or nullptr if there is no action. observation A pointer to observations in the form of a CSensoryFrame, or nullptr if there is no observation. stats An output structure for gathering statistics of the particle filter execution, or set to nullptr if you do not need it (see CParticleFilter::TParticleFilterStats).

See also: