Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

ParticleBase< ParticleT > Class Template Reference

Provides a common base class for particles used by the ParticleFilter. More...

#include <ParticleFilter.h>

Inheritance diagram for ParticleBase< ParticleT >:

Detailed Description

template<class ParticleT>
class ParticleBase< ParticleT >

Provides a common base class for particles used by the ParticleFilter.

Each particle represents a hypothesis regarding a position in state space. The state space being modeled is defined by the fields tracked by the particles, a sensor model which evaluates the 'health' of each particle based on incoming information from the world, and a motion model which updates particles based on the robot's own changes to the world.

For a common example, see the LocalizationParticle for tracking a robot's position and orientation in a 2D world.

The default LowVarianceResamplingPolicy has two requirements for particles. One requirement is that all particle implementations must define a 'DistributionPolicy' (usually via typedef within your class) so that the resampler can create randomly generated particles and modify existing ones. (see ParticleFilter::DistributionPolicy)

The second requirement is that all particles provide a public 'weight' field so that particles can be compared. The recommended way to do this is to inherit from this ParticleBase base class. However, since templates are used to specify the particle type to the particle filter, you can use an unaffiliated class as long as it provides a weight member. (However, inheritance is still recommended so you'll automatically pick up any changes or new requirements made to this base class.)

The final requirement of the ParticleFilter itself is to provide a sumSqErr() function so that a confidence interval can be computed. However, the meaning of the value returned by this function is entirely up to you. The base class provides a prototype for the function, but its implementation is abstract.

Definition at line 40 of file ParticleFilter.h.

List of all members.

Public Member Functions

 ParticleBase ()
 constructor
virtual ~ParticleBase ()
 destructor
virtual float sumSqErr (const ParticleT &p) const =0
 returns the sum squared error between this particle and p

Public Attributes

float weight
 indicates the 'health' of the particle -- the bigger the value, the better this particle

Constructor & Destructor Documentation

template<class ParticleT>
ParticleBase< ParticleT >::ParticleBase (  ) 

constructor

Definition at line 43 of file ParticleFilter.h.

template<class ParticleT>
virtual ParticleBase< ParticleT >::~ParticleBase (  )  [virtual]

destructor

Definition at line 45 of file ParticleFilter.h.


Member Function Documentation

template<class ParticleT>
virtual float ParticleBase< ParticleT >::sumSqErr ( const ParticleT &  p  )  const [pure virtual]

returns the sum squared error between this particle and p

This is only used to compute the confidence of the particle filter, you may want to weight some dimensions differently if they tend to have smaller values or are more important. How you interpret ParticleFilter::confidence() depends on how this function is implemented.

Implemented in LocalizationParticle.


Member Data Documentation

template<class ParticleT>
float ParticleBase< ParticleT >::weight

indicates the 'health' of the particle -- the bigger the value, the better this particle

Generally weights are indicative of probability, but are often unnormalized since the normalization factor is constant across particles and thus doesn't affect matters of relative comparison.

Further, weights tend to be very small as the accumulation of a number of sensor values tend to be each somewhat unlikely, and taken together the particle's weight shrinks exponentially. Thus it useful to work in log space to avoid numeric underflow on the range of a floating point value. This also has the advantage of transforming multiplication operations to slightly quicker addition operations. The default LowVarianceResamplingPolicy has a logWeights member so you can indicate whether weight values should be interpreted logarithmically (i.e. negative values) or linearly (e.g. positive (and generally very small) values). (default is logarithmic)

Definition at line 68 of file ParticleFilter.h.

Referenced by CameraShapeEvaluator::computeLikelihood(), operator<<(), LocalShapeEvaluator::updateWeight(), and ParticleFilter< LocalizationParticle >::weightLess().


The documentation for this class was generated from the following file:

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:13 2016 by Doxygen 1.6.3