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

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

Probability for Robotics · Extended and Unscented Kalman Filters · M8-L1 · Advanced

EKF versus UKF

Bench log · Rover in the teaching lab

13:15. The EKF reports a tight covariance while Rover is a metre away from where it says it is. The bench test turns out to be the culprit: a sensor with a wide bearing noise looking at a pole straight ahead, the textbook case in which a tangent is a poor stand-in for a curve.

You will see where the Jacobian stops being enough, write the EKF correction (and meet the angle bug that only shows when a landmark is behind the robot), write the unscented transform, and measure both against a cloud of Monte Carlo samples.

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 the failure of linearisation: the mean of the EKF is off by about rσ²/2 and its ellipse is the wrong shape. Stage 2 implements the EKF correction with the range-bearing Jacobian and angle wrapping. Stage 3 implements the unscented transform with five sigma points and its weights. Stage 4 compares the two with Monte Carlo samples by the distance between means and the ratio of covariances, and shows that an overconfident covariance is the more dangerous failure.

    Grading uses the exact filter equations on hidden cases (including a landmark behind the robot), the exact unscented transform, and Monte Carlo comparisons; every number is checked.

    Theory for this lab

    Extended and Unscented Kalman Filters labs

    1. M8-L1: EKF versus UKF: this lab.

    Educational simplification: one range and one bearing with independent Gaussian noise are converted to x and y; the exact moments of that conversion are known, so the methods can be judged against the truth. Real filters face the same effect with more dimensions and correlated inputs.

    Get the next lab

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