FixTheRobot Explore Robotics / Probability for Robotics

Course · 46 lessons · 10 labs

Probability for Robotics

From the rules of probability to the filters and maps that run on real robots: how a robot represents uncertainty, models noisy motion and noisy sensors, updates a belief, estimates its state and builds a probabilistic map.

All 46 theory lessons and all 10 labs are open. Course status: complete. Start with M1-T1: Why Robots Need Probability.

How the course works

Every lesson explains an idea in words first, then defines it, derives it, works a numeric example and shows where a robot uses it. Every lab is a bench test on Rover, a small differential-drive robot in a teaching lab: you see a problem, experiment with the parameters, diagnose the cause, fix the code and are graded on hidden randomized scenarios.

Labs use robotprob, a small plain-Python library written for this course. It runs in your browser, with no NumPy, and every numerical routine in it is checked against NumPy and SciPy by the site's tests. The course is for robotics students and engineers who work with mobile robots, SLAM, drones or humanoids. It assumes school algebra and basic Python; matrices and derivatives are reviewed where they are first needed.

Stage 1: Probability foundations

Module 1 · Complete

Introduction to Probability in Robotics

Why a robot cannot know its state exactly, what a probability means physically, the rules every later module rests on, and how to study a random system by simulating it many times.

Before this module: School algebra and fractions. Basic Python (functions, loops, lists).

Completion criteria
  • A learner can name the sources of uncertainty in a robot, state the three axioms and use them, and estimate a probability from repeated simulated runs with a stated error.
  • Every lesson has objectives, an intuitive explanation, definitions, a derivation, a worked numeric example reproduced by a test, robotics applications, misconceptions, takeaways and exactly three knowledge checks.
  • Every lab runs in the browser: its starter code fails with a teachable message, its reference solution passes on hidden randomized scenarios, and the data given to learner code carries no ground truth.
  • Every numeric routine the module adds to robotprob is validated against NumPy or SciPy under CPython, and runs unchanged under Brython.
  • Relevant automated tests and the build pass, pages work in light and dark mode at phone and desktop width, and no known blocking defect remains.

Module 2 · Complete

Random Variables and Probability Distributions

Numbers that depend on chance: probability mass functions and densities, the cumulative distribution, the Gaussian and why it appears, and the distributions real sensors actually follow.

Before this module: module 1. Sums and the idea of area under a curve. Integrals are explained when they first appear.

Completion criteria
  • A learner can read a probability from a mass function, a density or a cumulative distribution, fit a Gaussian to samples, and recognise bias, heavy tails and outliers in sensor data.
  • Every lesson has objectives, an intuitive explanation, definitions, a derivation, a worked numeric example reproduced by a test, robotics applications, misconceptions, takeaways and exactly three knowledge checks.
  • Every lab runs in the browser: its starter code fails with a teachable message, its reference solution passes on hidden randomized scenarios, and the data given to learner code carries no ground truth.
  • Every numeric routine the module adds to robotprob is validated against NumPy or SciPy under CPython, and runs unchanged under Brython.
  • Relevant automated tests and the build pass, pages work in light and dark mode at phone and desktop width, and no known blocking defect remains.

Module 3 · Complete

Conditional Probability and Bayes' Rule

How evidence changes a probability: joint, marginal and conditional distributions, Bayes' rule with its four named parts, independence and the Markov assumption, and repeated updating.

Before this module: modules 1, 2. Fractions and tables. No calculus.

Completion criteria
  • A learner can compute a posterior from a prior and a sensor model, explain the difference between a likelihood and a probability, and say when two measurements may be multiplied.
  • Every lesson has objectives, an intuitive explanation, definitions, a derivation, a worked numeric example reproduced by a test, robotics applications, misconceptions, takeaways and exactly three knowledge checks.
  • Every lab runs in the browser: its starter code fails with a teachable message, its reference solution passes on hidden randomized scenarios, and the data given to learner code carries no ground truth.
  • Every numeric routine the module adds to robotprob is validated against NumPy or SciPy under CPython, and runs unchanged under Brython.
  • Relevant automated tests and the build pass, pages work in light and dark mode at phone and desktop width, and no known blocking defect remains.

Module 4 · Complete

Expectation, Variance and Covariance

Summaries of a distribution and what they mean physically: the mean, the variance, the covariance matrix and its ellipse, how uncertainty passes through a transformation, and how two Gaussian estimates are fused.

Before this module: modules 2, 3. Vectors and 2-by-2 matrices: product, transpose, inverse, eigenvectors. Partial derivatives for the last two lessons. Each is reviewed where it is first used.

Completion criteria
  • A learner can compute a covariance matrix from samples, draw and read its ellipse, propagate a covariance through a linear or linearized map, and fuse two Gaussian estimates.
  • Every lesson has objectives, an intuitive explanation, definitions, a derivation, a worked numeric example reproduced by a test, robotics applications, misconceptions, takeaways and exactly three knowledge checks.
  • Every lab runs in the browser: its starter code fails with a teachable message, its reference solution passes on hidden randomized scenarios, and the data given to learner code carries no ground truth.
  • Every numeric routine the module adds to robotprob is validated against NumPy or SciPy under CPython, and runs unchanged under Brython.
  • Relevant automated tests and the build pass, pages work in light and dark mode at phone and desktop width, and no known blocking defect remains.

Stage 2: Probabilistic robotics

Module 5 · Complete

Probabilistic Motion and Observation Models

The two conditional distributions every estimator needs: where the robot may be after a command, and what a sensor may read from a given state. How to sample them, evaluate them and find their parameters.

Before this module: modules 3, 4. Trigonometry of a planar pose (x, y, heading). Matrix products.

Completion criteria
  • A learner can write a motion model and an observation model as conditional densities, sample from them, evaluate a likelihood, and estimate noise parameters from logged data.
  • Every lesson has objectives, an intuitive explanation, definitions, a derivation, a worked numeric example reproduced by a test, robotics applications, misconceptions, takeaways and exactly three knowledge checks.
  • Every lab runs in the browser: its starter code fails with a teachable message, its reference solution passes on hidden randomized scenarios, and the data given to learner code carries no ground truth.
  • Every numeric routine the module adds to robotprob is validated against NumPy or SciPy under CPython, and runs unchanged under Brython.
  • Relevant automated tests and the build pass, pages work in light and dark mode at phone and desktop width, and no known blocking defect remains.

Module 6 · Complete

Bayesian Filtering and Belief Estimation

The recursive estimator behind every later filter: a belief, a prediction with the motion model, a correction with the measurement. Derived once, then implemented exactly on a grid.

Before this module: modules 3, 5. Sums over a discrete state. The integral form is given beside the sum.

Completion criteria
  • A learner can derive the Bayes filter from the Markov assumptions, implement a histogram filter, and explain global localization, ambiguity and the kidnapped robot.
  • Every lesson has objectives, an intuitive explanation, definitions, a derivation, a worked numeric example reproduced by a test, robotics applications, misconceptions, takeaways and exactly three knowledge checks.
  • Every lab runs in the browser: its starter code fails with a teachable message, its reference solution passes on hidden randomized scenarios, and the data given to learner code carries no ground truth.
  • Every numeric routine the module adds to robotprob is validated against NumPy or SciPy under CPython, and runs unchanged under Brython.
  • Relevant automated tests and the build pass, pages work in light and dark mode at phone and desktop width, and no known blocking defect remains.

Module 7 · Complete

Kalman Filter

The Bayes filter when everything is linear and Gaussian. Built first in one dimension from the fusion of two Gaussians, then derived in matrix form, then tuned and checked for consistency.

Before this module: modules 4, 6. Matrix products, transpose and inverse. Completing the square is shown step by step.

Completion criteria
  • A learner can implement a Kalman filter, explain every term of the gain, tune the process and measurement noise, and test a filter for consistency with the innovation.
  • Every lesson has objectives, an intuitive explanation, definitions, a derivation, a worked numeric example reproduced by a test, robotics applications, misconceptions, takeaways and exactly three knowledge checks.
  • Every lab runs in the browser: its starter code fails with a teachable message, its reference solution passes on hidden randomized scenarios, and the data given to learner code carries no ground truth.
  • Every numeric routine the module adds to robotprob is validated against NumPy or SciPy under CPython, and runs unchanged under Brython.
  • Relevant automated tests and the build pass, pages work in light and dark mode at phone and desktop width, and no known blocking defect remains.

Module 8 · Complete

Extended and Unscented Kalman Filters

What to do when motion or measurement is nonlinear: linearize with Jacobians (EKF) or push carefully chosen points through the function (UKF), and how to tell when neither is good enough.

Before this module: module 7. Partial derivatives and Jacobian matrices. The Cholesky factor is introduced for the sigma points.

Completion criteria
  • A learner can derive and implement an EKF for a range-bearing robot, implement the unscented transform, and show on one problem where the two differ.
  • Every lesson has objectives, an intuitive explanation, definitions, a derivation, a worked numeric example reproduced by a test, robotics applications, misconceptions, takeaways and exactly three knowledge checks.
  • Every lab runs in the browser: its starter code fails with a teachable message, its reference solution passes on hidden randomized scenarios, and the data given to learner code carries no ground truth.
  • Every numeric routine the module adds to robotprob is validated against NumPy or SciPy under CPython, and runs unchanged under Brython.
  • Relevant automated tests and the build pass, pages work in light and dark mode at phone and desktop width, and no known blocking defect remains.

Stage 3: Probabilistic estimation and mapping

Module 9 · Complete

Particle Filters and Monte Carlo Localization

A belief as a cloud of samples: importance weights, the sequential importance resampling filter, why resampling is needed and what it costs, and the practical Monte Carlo localization used on real robots.

Before this module: modules 5, 6. Sums and weighted averages. No matrices are needed.

Completion criteria
  • A learner can implement a particle filter with low-variance resampling, monitor the effective sample size, and make it recover from a wrong initial belief.
  • Every lesson has objectives, an intuitive explanation, definitions, a derivation, a worked numeric example reproduced by a test, robotics applications, misconceptions, takeaways and exactly three knowledge checks.
  • Every lab runs in the browser: its starter code fails with a teachable message, its reference solution passes on hidden randomized scenarios, and the data given to learner code carries no ground truth.
  • Every numeric routine the module adds to robotprob is validated against NumPy or SciPy under CPython, and runs unchanged under Brython.
  • Relevant automated tests and the build pass, pages work in light and dark mode at phone and desktop width, and no known blocking defect remains.

Module 10 · Complete

Occupancy Grid Mapping and Probabilistic Mapping

A map as a field of probabilities: each cell a binary Bayes filter in log-odds form, the inverse sensor model that feeds it, and what breaks when the poses themselves are uncertain.

Before this module: modules 3, 6. Logarithms. Ray geometry on a grid.

Completion criteria
  • A learner can derive the log-odds update, implement an inverse sensor model for a range beam, and explain why mapping with wrong poses smears the map.
  • Every lesson has objectives, an intuitive explanation, definitions, a derivation, a worked numeric example reproduced by a test, robotics applications, misconceptions, takeaways and exactly three knowledge checks.
  • Every lab runs in the browser: its starter code fails with a teachable message, its reference solution passes on hidden randomized scenarios, and the data given to learner code carries no ground truth.
  • Every numeric routine the module adds to robotprob is validated against NumPy or SciPy under CPython, and runs unchanged under Brython.
  • Relevant automated tests and the build pass, pages work in light and dark mode at phone and desktop width, and no known blocking defect remains.

Theory (3)

  1. M10-T1Occupancy Grids and the Binary Bayes FilterTheory
  2. M10-T2Inverse Sensor ModelsTheory
  3. M10-T3Mapping with Uncertain PosesTheory

Labs (0)

This module has no lab of its own: its ideas are practised in the lab of the next module.

Module 11 · Complete

Maximum Likelihood, MAP and Factor Graphs

Estimation as optimization: the likelihood as a function of the unknowns, the prior that turns it into MAP, the least-squares problem Gaussian noise produces, and the factor graph that organises it.

Before this module: modules 4, 7. Gradients, linear systems and the normal equations. Gauss-Newton is derived from a first-order expansion.

Completion criteria
  • A learner can derive weighted least squares from a Gaussian likelihood, draw the factor graph of a small SLAM problem, and solve a pose graph by Gauss-Newton.
  • Every lesson has objectives, an intuitive explanation, definitions, a derivation, a worked numeric example reproduced by a test, robotics applications, misconceptions, takeaways and exactly three knowledge checks.
  • Every lab runs in the browser: its starter code fails with a teachable message, its reference solution passes on hidden randomized scenarios, and the data given to learner code carries no ground truth.
  • Every numeric routine the module adds to robotprob is validated against NumPy or SciPy under CPython, and runs unchanged under Brython.
  • Relevant automated tests and the build pass, pages work in light and dark mode at phone and desktop width, and no known blocking defect remains.

Stage 4: Advanced topics

Module 12 · Complete

Uncertainty on Manifolds, Error-State Filtering, Smoothing and POMDPs

Four topics that open the research literature: uncertainty of angles and rotations, the error-state Kalman filter used in inertial navigation, smoothing with future measurements, and deciding what to do when the state is only a belief.

Before this module: modules 8, 11. Rotation matrices and the exponential map are introduced in the first lesson. The other lessons use the matrix tools of modules 7, 8 and 11.

Completion criteria
  • A learner can average and difference angles correctly, explain the error-state formulation, run a Rauch-Tung-Striebel smoother, and write a small POMDP belief update with a one-step value comparison.
  • Every lesson has objectives, an intuitive explanation, definitions, a derivation, a worked numeric example reproduced by a test, robotics applications, misconceptions, takeaways and exactly three knowledge checks.
  • Every lab runs in the browser: its starter code fails with a teachable message, its reference solution passes on hidden randomized scenarios, and the data given to learner code carries no ground truth.
  • Every numeric routine the module adds to robotprob is validated against NumPy or SciPy under CPython, and runs unchanged under Brython.
  • Relevant automated tests and the build pass, pages work in light and dark mode at phone and desktop width, and no known blocking defect remains.

Theory (4)

  1. M12-T1Uncertainty on Manifolds: Angles and RotationsTheory
  2. M12-T2The Error-State Kalman FilterTheory
  3. M12-T3Smoothing: Using Future MeasurementsTheory
  4. M12-T4POMDPs: Acting on a BeliefTheory

Labs (0)

This module has no lab of its own: its ideas are practised in the lab of the next module.