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

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

Probability for Robotics · Bayesian Filtering and Belief Estimation · M6-L1 · Intermediate

Histogram Localization

Bench log · Rover in the teaching lab

16:50. Rover is switched on in the east corridor of the depot: three identical doors, no idea where it is. It counts doors and drives one cell per command, but its wheels sometimes slip and its door detector sometimes cries wolf.

You will first see what a filter does when it trusts its models too much, then write the two steps of the histogram filter, and finally rescue it after a human picks Rover up and puts it down somewhere else without telling it.

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 is the cost of overconfidence: a model that calls a real event impossible destroys the true hypothesis with a single multiplication. Stage 2 implements the prediction step as a push of probability from each cell, with walls at the ends, and exposes the classic negative-index bug. Stage 3 implements the measurement update with its normalisation. Stage 4 combines both into a full filter and adds a uniform floor so that it can recover from a kidnapping.

    Grading is exact for predict and update (against the exact filter on random corridors) and behavioural for the kidnapping (the filter must be on the true cell again within 15 readings on hidden runs).

    Theory for this lab

    Bayesian Filtering and Belief Estimation labs

    1. M6-L1: Histogram Localization: this lab.

    Educational simplification: a one-dimensional corridor of cells, motion that is exact, short or long with fixed probabilities, a door detector with fixed hit and false-alarm rates, and a known map. Real motion and detector errors depend on the floor, the speed, the distance and the light.

    Get the next lab

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