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

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

Probability for Robotics · Maximum Likelihood, MAP and Factor Graphs · M11-L1 · Advanced

Occupancy Grid and Pose Graph SLAM

Bench log · Rover in the teaching lab

17:20. The map of the lab has a doubled wall where the loop should close. Rover drove once around the central pillar, scanning all the way, and the map built from its own odometry shows the room twice and the pillar as a smudge.

You will build the grid in log odds, find out what is wrong with the odometer, tie the end of the loop to its start with a pose graph, and rebuild the map from the corrected path: the whole of graph SLAM in miniature.

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 builds the occupancy grid cell by cell in log odds, with the free update on the cells a beam crosses and the occupied update on the cell where it ends. Stage 2 diagnoses a smeared map: a systematic odometer drift that accumulates along the loop. Stage 3 solves the pose graph with a loop closure by weighted least squares: weights are inverse variances, and the loop closure spreads its correction over the whole path. Stage 4 joins the pieces: dead-reckon, optimise, and map again.

    Grading is exact for the grid (cell by cell) and for the optimised positions (against the exact least-squares solution), and behavioural for the final map (how many occupied cells lie far from the real walls, and how much of the walls is covered).

    Theory for this lab

    Maximum Likelihood, MAP and Factor Graphs labs

    1. M11-L1: Occupancy Grid and Pose Graph SLAM: this lab.

    Educational simplification: a closed loop around a pillar in a 10 m by 8 m room; the heading is known, only the position drifts (a constant drift per step and random noise), so the pose graph is linear in the positions and is solved in one step. Real pose graphs include headings and are solved by Gauss–Newton on rotations (lesson M11-T4).

    Get the next lab

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