Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

ParticleFilter< ParticleT >::LowVarianceResamplingPolicy Class Reference

This class provides a generic, default ResamplingPolicy. It is based on the low variance resampling policy algorithm found in "Probabilistic Robotics" by Sebastian Thrun, Wolfram Burgard, Dieter Fox. More...

#include <ParticleFilter.h>

Inheritance diagram for ParticleFilter< ParticleT >::LowVarianceResamplingPolicy:

Detailed Description

template<typename ParticleT>
class ParticleFilter< ParticleT >::LowVarianceResamplingPolicy

This class provides a generic, default ResamplingPolicy. It is based on the low variance resampling policy algorithm found in "Probabilistic Robotics" by Sebastian Thrun, Wolfram Burgard, Dieter Fox.

This class is called "low variance" because it will maintain particle modalities in the face of uniform weighting. This means that if resamples are triggered when no new information is available, every particle is resampled for the next generation. This prevents the eventual convergence of particle clusters over time.

However, this implementation provides a varianceScale parameter for adding variance to the particle's state on each generation, which can be useful for more rapidly exploring the state space around a "winning" particle. Ideally, it is better to use a very low resampling variance, and rely on noise in the motion model and a broad probability distribution in the sensor model to allow particles to spread. varianceScale is really a crutch to manage an overconfident sensor model (one which weights "correct" particles with sharply higher values).

The varianceScale parameter defaults to a negative value, which indicates the resampling variance will be scaled with particle weight to provide broader sampling when particle weights are poor, and tighten sampling when particles are tracking accurately. This requires setting a value for minAcceptableWeight, described next.

The other trick this implementation provides is specification of a minimum acceptable particle weight (minAcceptableWeight). If the best particle's weight is below this value, new, randomly generated particles will be created, up to maxRedistribute percent of the particles on a round of resampling. This handles situations where the actual state has somehow jumped out of the region being sampled by the particles, and the filter is "lost". Without some further information (i.e. fixing the MotionModel to predict the "kidnapping"), this can provide automatic re-acquisition of the position in state space (at the cost of spawning new modalities).

Finally, resampleDelay is provided to limit actual resampling to one in every resampleDelay attempts. This allows you to only resample at a lower frequency than the sensor model, without having to manually track the number of sensor samples and pass a parameter to the ParticleFilter::updateSensors() to limit resampling yourself. The reason you would want to limit the resampling frequency is to better evaluate the particles before selecting them for replication or pruning -- if your sensors are noisy and you resample too often, bad values will kill off good particles on a regular basis, causing the filter to continually be "lost".

This policy can interpret weights in either "log space" or "linear space". It defaults to "log space", but if your sensor model is providing linear weights, set logWeights to false.

Definition at line 282 of file ParticleFilter.h.

List of all members.

Public Member Functions

 LowVarianceResamplingPolicy ()
 constructor
virtual void resample (particle_collection &particles)
 the particle filter will call resample() when the particles have been evaluated and are ready to be selected
bool nextResampleIsFull ()
 returns true if the next call to resample will trigger a "real" resampling (is resampleCount greater than resampleDelay?)

Public Attributes

float varianceScale
 If non-negative, passed to the DistributionPolicy's jiggle() for replicated particles; otherwise an "automatic" value is used which inversely scales with the best particle weight.
float maxRedistribute
 A percentage (0-1) of the particles which can be randomly re-distributed on a single resampling if the best particle's weight is below minAcceptableWeight.
float minAcceptableWeight
 The lowest weight per resample attempt to consider "acceptable".
bool logWeights
 This controls the interpretation of particle weights. If true, they are interpreted as "log space", otherwise "linear space".
unsigned int resampleDelay
 This indicates how many resampling attempts should be skipped before actually doing it. See class notes for rationale.

Protected Attributes

particle_collection newParticles
 temporary scratch space as particles are created
unsigned int resampleCount
 the number of resampling attempts which have occurred.

Constructor & Destructor Documentation

template<typename ParticleT>
ParticleFilter< ParticleT >::LowVarianceResamplingPolicy::LowVarianceResamplingPolicy (  ) 

constructor

Definition at line 285 of file ParticleFilter.h.


Member Function Documentation

template<typename ParticleT>
bool ParticleFilter< ParticleT >::LowVarianceResamplingPolicy::nextResampleIsFull (  ) 

returns true if the next call to resample will trigger a "real" resampling (is resampleCount greater than resampleDelay?)

Definition at line 292 of file ParticleFilter.h.

template<typename ParticleT >
void ParticleFilter< ParticleT >::LowVarianceResamplingPolicy::resample ( particle_collection particles  )  [virtual]

the particle filter will call resample() when the particles have been evaluated and are ready to be selected

Implements ParticleFilter< ParticleT >::ResamplingPolicy.

Definition at line 495 of file ParticleFilter.h.


Member Data Documentation

template<typename ParticleT>
bool ParticleFilter< ParticleT >::LowVarianceResamplingPolicy::logWeights

This controls the interpretation of particle weights. If true, they are interpreted as "log space", otherwise "linear space".

Definition at line 307 of file ParticleFilter.h.

Referenced by ParticleFilter< ParticleT >::LowVarianceResamplingPolicy::resample().

template<typename ParticleT>
float ParticleFilter< ParticleT >::LowVarianceResamplingPolicy::maxRedistribute

A percentage (0-1) of the particles which can be randomly re-distributed on a single resampling if the best particle's weight is below minAcceptableWeight.

Definition at line 299 of file ParticleFilter.h.

Referenced by ParticleFilter< ParticleT >::LowVarianceResamplingPolicy::resample().

template<typename ParticleT>
float ParticleFilter< ParticleT >::LowVarianceResamplingPolicy::minAcceptableWeight

The lowest weight per resample attempt to consider "acceptable".

This is scaled by resampleDelay when being compared to particle weights, so that you don't have to adjust this parameter when you increase resampleDelay. As the best particle weight drops below this value, more particles will be randomly redistributed, up to maxRedistribute.

Definition at line 305 of file ParticleFilter.h.

Referenced by ParticleFilter< ParticleT >::LowVarianceResamplingPolicy::resample().

template<typename ParticleT>
particle_collection ParticleFilter< ParticleT >::LowVarianceResamplingPolicy::newParticles [protected]

temporary scratch space as particles are created

Definition at line 311 of file ParticleFilter.h.

Referenced by ParticleFilter< ParticleT >::LowVarianceResamplingPolicy::resample().

template<typename ParticleT>
unsigned int ParticleFilter< ParticleT >::LowVarianceResamplingPolicy::resampleCount [protected]
template<typename ParticleT>
unsigned int ParticleFilter< ParticleT >::LowVarianceResamplingPolicy::resampleDelay

This indicates how many resampling attempts should be skipped before actually doing it. See class notes for rationale.

Definition at line 309 of file ParticleFilter.h.

Referenced by ParticleFilter< ParticleT >::LowVarianceResamplingPolicy::nextResampleIsFull(), and ParticleFilter< ParticleT >::LowVarianceResamplingPolicy::resample().

template<typename ParticleT>
float ParticleFilter< ParticleT >::LowVarianceResamplingPolicy::varianceScale

If non-negative, passed to the DistributionPolicy's jiggle() for replicated particles; otherwise an "automatic" value is used which inversely scales with the best particle weight.

A negative value is still used to control the maximum magnitude of the resampling variance. It's better to keep this small (or zero) and rely on the sensor and motion model's noise parameters

Definition at line 297 of file ParticleFilter.h.

Referenced by ParticleFilter< ParticleT >::LowVarianceResamplingPolicy::resample().


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

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