Particle filter playground

Turn GPS off, add noise, and watch a particle filter keep track of a vehicle crossing hilly terrain. Everything runs in your browser.

LIVE DEMO · PARTICLE FILTER

GNSS UNAVAILABLE

Contour map of terrain with a dashed flight track and clouds of particles that start widely spread, tighten at each update and converge at the end, with a profile chart below comparing terrain height with radar altitude minus barometric altitude.
  • true route
  • estimate
  • particles

Illustrative

CONTROLS

500
Medium
1×
POSITION ERROR
± 12 m
HEADING
040°
EFFECTIVE PARTICLES
312 / 500

Simulated, with illustrative synthetic terrain. Runs locally; nothing is sent anywhere.

Assumptions behind the figures
  • The terrain is a made-up height field, not real elevation data
  • The robot measures the height under it with noise, and its own motion with a small error
  • With GNSS on, a noisy position fix is also used
  • Particles are resampled (systematic resampling) when the effective number drops below half

HOW IT WORKS

Three steps, repeated many times a second

  1. Step 1: Predict

    Move every particle using the vehicle’s speed and heading, plus a little random noise.

  2. Step 2: Weight

    Compare each particle with the latest measurement. Particles that agree get more weight.

  3. Step 3: Resample

    Keep the likely particles, drop the unlikely ones. The cloud closes on the truth.

TRY THIS

Things to try

  • Turn GNSS off and watch the cloud spread out
  • Drop to 50 particles and see the filter lose track
  • Increase sensor noise and compare the heading error
  • Hide the true route and guess where the vehicle went

MORE

Other demos