Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

ParticleBase Class Reference

#include <ParticleFilter.h>

Inheritance diagram for ParticleBase:

List of all members.


Detailed Description

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 39 of file ParticleFilter.h.


Public Member Functions

 ParticleBase ()
 constructor
virtual ~ParticleBase ()
 destructor
template<typename ParticleT>
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

ParticleBase::ParticleBase (  )  [inline]

constructor

Definition at line 42 of file ParticleFilter.h.

virtual ParticleBase::~ParticleBase (  )  [inline, virtual]

destructor

Definition at line 44 of file ParticleFilter.h.


Member Function Documentation

template<typename ParticleT>
float ParticleBase::sumSqErr ( const ParticleT &  p  )  const [inline, 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.

A template is used so you can assume the argument type is that of your own particle type. (it doesn't really make sense to compare the distance between particles of different types.)

Implemented in LocalizationParticle.


Member Data Documentation

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 71 of file ParticleFilter.h.

Referenced by operator<<().


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

Tekkotsu v4.0
Generated Thu Nov 22 00:58:35 2007 by Doxygen 1.5.4