| Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
ParticleFilter< ParticleT > Class Template Reference#include <ParticleFilter.h>
Detailed Descriptiontemplate<typename ParticleT>
Implements a particle filter with support for a variety of applications through the usage of arbitrary combination of a variety of models and policies.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Public Types | |
| typedef ParticleT | particle_type |
| redefinition here allows reference to the particle type even if the template parameter may be abstracted away due to a typedef | |
| typedef std::vector< particle_type > | particle_collection |
| the collection type we'll be using to store the particles | |
| typedef particle_collection::size_type | index_t |
| index type for refering to particles within the collection | |
Public Member Functions | |
| ParticleFilter (unsigned int numParticles, MotionModel *mm=NULL, ResamplingPolicy *rs=new LowVarianceResamplingPolicy) | |
| Constructor for the particle filter, specify number of particles and optionally pass a motion model and resampling policy. | |
| virtual | ~ParticleFilter () |
| Destructor. | |
| virtual MotionModel * | getMotionModel () const |
| Returns the current motion model (motion). | |
| virtual void | installMotionModel (MotionModel *mm) |
| Reassigns the motion model, deleting the old one; motion model can be NULL. | |
| virtual ResamplingPolicy * | getResamplingPolicy () const |
| Returns the current resampling policy (resampler). | |
| virtual void | installResamplingPolicy (ResamplingPolicy *rs) |
| Reassigns the resampling policy, deleting the old one; resampling policy can be NULL (although not recommended...). | |
| virtual void | setResampleDelay (unsigned int d) |
| Sets the resampling policy's resampleDelay, which controls how many sensor updates to process before resampling the particles; policy must be a LowVarianceResamplingPolicy. | |
| virtual void | setMinAcceptableWeight (float w) |
| Sets the resampling policy's minimum acceptable weight for a particle; policy must be a LowVarianceResamplingPolicy. | |
| virtual void | setMaxRedistribute (float r) |
| virtual void | setVarianceScale (float s) |
| virtual void | updateMotion () |
| Allows you to manually request a position update -- you might want to call this before using getBestParticle's state information. | |
| virtual void | updateSensors (SensorModel &sm, bool updateMot=true, bool doResample=true) |
| Applies the sensor model's evaluation to the particles, optionally updating the motion model and resampling first. | |
| virtual void | resample () |
| A manual call to trigger resampling. | |
| virtual void | resetWeights (float w) |
| Assigns the specified weight value to all of the particles. | |
| virtual void | resetFilter (float w) |
| Requests that the resampler's distribution policy randomly distribute all of the particles, and reset weights to w. | |
| virtual index_t | getBestIndex () const |
| Returns the index of the best particle in particles. | |
| virtual const particle_type & | getBestParticle () const |
| Returns a reference to the best particle in particles. | |
| virtual particle_collection & | getParticles () |
| Returns a reference to particles itself (if you want to modify the particles, generally better to formulate it in terms of a sensor model or motion model for consistency). | |
| virtual const particle_collection & | getParticles () const |
| Returns a reference to particles itself (if you want to modify the particles, generally better to formulate it in terms of a sensor model or motion model for consistency). | |
| virtual void | setPosition (const particle_type &pos, float variance=0) |
| if you know the position in state space, pass it here, along with a positive varianceScale if you want some jiggle from the distribution policy | |
| virtual float | getConfidenceInterval () const |
| Returns a confidence interval based on the particle_type's sumSqErr implementation (see ParticleBase::sumSqErr()). | |
| virtual void | resizeParticles (unsigned int numParticles) |
| Adjusts the size of the particle collection -- more particles gives better coverage, but more computation. | |
Static Protected Member Functions | |
| static bool | weightLess (const particle_type *a, const particle_type *b) |
| < used for sorting particles in resizeParticles() to drop the least weighted particles first | |
Protected Attributes | |
| particle_collection | particles |
| storage of the particles (no particular order) | |
| index_t | bestIndex |
| index of the currently highest-rated particle | |
| MotionModel * | motion |
| motion model, can be NULL if you have no control or knowledge of changes in the system | |
| ResamplingPolicy * | resampler |
| resampling policy refocuses filter on "good" particles, can be NULL but filter won't work well without a resampler | |
| bool | hasEvaluation |
| set to true following each call to updateSensors, and false following resample() or resetWeights(); avoids repeated resamplings | |
Private Member Functions | |
| ParticleFilter (const ParticleFilter &) | |
| don't call (copy constructor) | |
| ParticleFilter & | operator= (const ParticleFilter &) |
| don't call (assignment operator) | |
Classes | |
| class | DistributionPolicy |
| A distribution policy provides the ability to randomize ("redistribute") or tweak the values of a group of particles. More... | |
| class | 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. More... | |
| class | MotionModel |
| A motion model is retained by the particle filter to query before evaluating sensor measurements so all known influences are accounted for before testing the particles. More... | |
| class | ResamplingPolicy |
| The resampling policy focuses the particle filter on those particles which are performing well, and dropping those which are poorly rated. More... | |
| class | SensorModel |
| A sensor model is used to update particle weights to account based on each particle's ability to explain observations taken from the system. More... | |
| ParticleFilter< ParticleT >::ParticleFilter | ( | unsigned int | numParticles, | |
| MotionModel * | mm = NULL, |
|||
| ResamplingPolicy * | rs = new LowVarianceResamplingPolicy | |||
| ) | [inline, explicit] |
Constructor for the particle filter, specify number of particles and optionally pass a motion model and resampling policy.
The particle filter assumes responsibility for eventual deallocation of the motion model and resampling policy
Definition at line 322 of file ParticleFilter.h.
| virtual void ParticleFilter< ParticleT >::resetFilter | ( | float | w | ) | [inline, virtual] |
Requests that the resampler's distribution policy randomly distribute all of the particles, and reset weights to w.
You might want to do this if you believe you have been "kidnapped" by some unmodeled motion to a new area of state space, and need to restart the filter to determine the new location.
Definition at line 414 of file ParticleFilter.h.
Referenced by ParticleFilter< ParticleT >::ParticleFilter().
| virtual void ParticleFilter< ParticleT >::resizeParticles | ( | unsigned int | numParticles | ) | [inline, virtual] |
Adjusts the size of the particle collection -- more particles gives better coverage, but more computation.
You may wish to shrink the number of particles when the confidence interval is small or particle weights are high, and increase particles when the filter is getting "lost".
Definition at line 443 of file ParticleFilter.h.
| virtual void ParticleFilter< ParticleT >::updateSensors | ( | SensorModel & | sm, | |
| bool | updateMot = true, |
|||
| bool | doResample = true | |||
| ) | [inline, virtual] |
Applies the sensor model's evaluation to the particles, optionally updating the motion model and resampling first.
If you are applying a group of sensor readings, you probably only want to update motion for the first one (since no motion is occuring between the readings if they were taken at the same time), and may want to hold off on resampling until the end (so the particles are better evaluated). If using the default LowVarianceResamplingPolicy, see also LowVarianceResamplingPolicy::resampleDelay.
Definition at line 389 of file ParticleFilter.h.
|
Tekkotsu v3.0 |
Generated Fri May 11 20:08:30 2007 by Doxygen 1.4.7 |