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

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

Probability for Robotics · Expectation, Variance and Covariance · M4-L1 · Intermediate

Robot Uncertainty Visualizer

Bench log · Rover in the teaching lab

14:40. The localisation filter publishes a 2 × 2 matrix of numbers with every pose. Nobody on the team can read it, and the planner keeps a fixed one-metre safety margin because nobody trusts it either. A pole detector sometimes matches the wrong pole.

You will turn the matrix into something you can see: compute it from samples, draw its ellipse, follow it through the conversion from range and bearing to world coordinates, and use it as a gate that accepts plausible detections and rejects the rest.

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 computes a covariance from samples and shows why the means must be subtracted. Stage 2 turns a covariance into the ellipse of points at k standard deviations with a closed-form eigen-decomposition. Stage 3 propagates a covariance through the nonlinear range-bearing map with the Jacobian, and then into the world frame by a rotation: the bearing error becomes a sideways error proportional to range. Stage 4 uses the Mahalanobis distance as a gate, which respects correlation where a per-axis test does not.

    Grading compares your matrices, axes and gate decisions with the exact values on hidden random covariances.

    Theory for this lab

    Expectation, Variance and Covariance labs

    1. M4-L1: Robot Uncertainty Visualizer: this lab.

    Educational simplification: the position estimate is a two-dimensional Gaussian; propagation is to first order with the Jacobian (the unscented transform and its advantages come in module 8); the chi-square threshold for the gate is given.

    Get the next lab

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