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

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

Probability for Robotics · Introduction to Probability in Robotics · M1-L1 · Beginner

Noisy Robot Motion Simulator

Bench log · Rover in the teaching lab

09:10. Rover is told to drive 2.00 m straight ahead and stop on its charging dock, a square 20 cm wide. The command is the same every time. The result is not: the wheels slip, so the distance is a little off, and the first turn towards the dock is never exact, so the heading is a little off.

The team has to decide how good a heading sensor to buy, and the numbers on the whiteboard disagree: a report claims 91% docking, the lab says fewer than nine runs in ten work, and the simulator somebody wrote sends Rover in every direction. You will settle it with experiments, a repaired simulator, an honest estimate with an error bar, and a plan for how many real runs are enough.

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 experiment: the same command produces a distribution of outcomes, and a probability of success is a number you estimate from runs, so it has its own error. You choose a heading specification, and see why a handful of runs cannot tell 85% from 95%. Stage 2 is the Monte Carlo simulator and a unit bug that every robotics team meets: a standard deviation given in degrees used as radians. Stage 3 turns logged runs into a probability and a standard error, and makes you say exactly which end points belong to the event "docked". Stage 4 inverts the standard error: how many runs for a given accuracy, and why a tenfold better answer costs a hundred times the runs.

    Grading is statistical: the spread of the end points of your simulator is compared with the exact moments of the model on hidden scenarios, counts are compared exactly, and the number of runs is compared with the formula. The random numbers come from the same generator in JavaScript and Python, so a seed means the same thing in both.

    Theory for this lab

    Introduction to Probability in Robotics labs

    1. M1-L1: Noisy Robot Motion Simulator: this lab.

    Educational simplification: Rover turns to its heading with a Gaussian error, then drives one straight line whose length has a Gaussian error proportional to the distance. The two errors are independent and the floor is flat. A real drive also curves while it moves, slips differently on each wheel, and has errors that are not Gaussian; module 5 builds the full odometry model.

    Get the next lab

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