Tutorial: Particle Filter Internals

From Tekkotsu Wiki

Jump to: navigation, search

This tutorial describes the organization of Tekkotsu's particle filter, used by the Pilot for localization.


Directory Structure

Shared subdirectory

The particle base class ParticleBase<ParticleT> and particle filter base class ParticleFilter<ParticleT> are defined in Tekkotsu/Shared/ParticleFilter.h. Particle filters can be used for many types of search and estimation problems, which is why these classes are in the Shared directory rather than the Localization directory, but their most common use in robotics is localization.

A particle filter includes the following components:

  • A collection of particles of the specified type.
  • A motion model that drags the particles around based on odometry inputs. There are several choices:
    • The holonomic motion model simply integrates velocity over time.
    • The Create motion model uses the Create's hardware odometry and tries to model its error.
  • A sensor model that adjusts particle weights based on sensor readings.
  • A resampling policy that generates new particles from old ones, based on their weights.
  • A distribution policy that generates new random particles.

Localization subdirectory

The LocalizationParticle class in Tekkotsu/Localization/LocalizationParticle.h defines x, y, and theta data members to represent the robot's 2D position and heading.

The HolonomicMotionModel and CreateMotionModel classes define motion models for use with particle filters. The DeadReckoningBehavior class combines a holonomic motion model with a locomotion event listener so that the motion model automatically responds to every velocity change.

The ShapeSensorModel class provides a sensor model that looks at DualCoding shapes in the camera and local shape spaces (cameraShS and localShS) to evaluate particles.

The ShapeBasedParticleFilter class in Tekkotsu/Localization/ShapeBasedParticleFilter.h bundles a motion model and a shape sensor model. It selects which motion model to use based on the robot type. This is the type of particle filter currently used by the Pilot.

DualCoding subdirectory

The Pilot's particle filter is defined in Tekkotsu/DualCoding/VRmixin.h.