FixTheRobot Explore Robotics / Probability for Robotics / M7 / M7-L1

This lab works on phones, but writing code is much easier on a laptop.

Probability for Robotics · Kalman Filter · M7-L1 · Intermediate

1D Kalman Filter

Bench log · Rover in the teaching lab

09:40. Rover drives along a 30 m rail. Its wheels slip, its position sensor is noisy, and the filter that fuses them has never been tuned: its estimate lags behind the real robot and claims to be accurate to a centimetre while it is off by ten.

You will tune the two noise numbers, write the filter itself, and learn the check that works on a real robot, where the true position is unknown: the innovations. They tell you whether the filter is overconfident, too cautious, or missing something.

Your task

    Simulation
    solution.pyLoading Python…
    Ctrl+Enter runs
    What Python can I use?

    Plain Python with math and the course library robotprob (for example from robotprob import Rng, mean, gaussian_pdf). NumPy is not available in the browser. Your code runs in a background worker: an endless loop is stopped after a few seconds and the page stays usable. It runs in your browser and is never sent anywhere.

    Hints

    What this lab teaches

    Stage 1 shows what Q and R do: a small Q makes the filter stubborn and overconfident, and the average NIS is the number that says so. Stage 2 implements predict and update, with the unit mistake (a standard deviation where a variance belongs) that makes the filter copy the sensor. Stage 3 computes the normalised innovation squared. Stage 4 turns innovations into a verdict: the NIS band that depends on the length of the run, and the whiteness test that finds what no tuning of noise numbers can fix.

    Grading compares your means, variances and gains with the exact filter, the NIS with its exact value, and the verdicts with the rule on hidden logs.

    Theory for this lab

    Kalman Filter labs

    1. M7-L1: 1D Kalman Filter: this lab.

    Educational simplification: one-dimensional motion with a commanded step, Gaussian slip and Gaussian sensor noise. Real systems have biases, drift and non-white noise; stage 4 uses coloured noise to show how that looks in the innovations.

    Get the next lab

    Get notified when new robotics labs are released. One email per new lab, nothing else.