Chapter 11 · Estimate robot state, localize honestly, and measure uncertainty
Today in the field story
One problem, then the next
The courier’s x position is not one magic number. Represent a range of plausible positions, then use mean and spread to summarize only what they can support. Compare covariance between x and heading with actual errors against ground truth; they are different quantities. The night route includes a fork where two locations remain plausible, showing why one Gaussian ellipse can be a convenient approximation rather than the entire belief.
- Why now
Filters communicate confidence through distributions and covariance, so those outputs must be read before being trusted.
- Ignore today
Ignore formal probability proofs; use small tables, plots, and physical interpretations.
- Unlocks next
A belief representation that can widen, narrow, correlate axes, and be checked for coverage.
Understand
Build the physical picture first
A probability distribution is a cloud of plausible answers; its centre summarizes the guess, while its width and tilt record how uncertainty is spread and coupled.
A single best pose hides alternatives. A belief distribution assigns probability to plausible states, so two estimators can report the same mean position while expressing very different confidence. A narrow bell-shaped belief says values near the mean are much more plausible under the model. A broad belief says the evidence cannot distinguish a larger region. Probability describes belief under assumptions; it does not promise where the physical robot must be.
Variance measures average squared distance from the mean. If position is measured in metres, position variance is in square metres; standard deviation is the square root and returns to metres. Squaring prevents positive and negative errors from canceling. A small variance can be honestly precise, or dangerously overconfident when bias, wrong frames, stale time, or an unmodeled failure shifts every sample together.
For several state dimensions, covariance records both individual spreads and paired movement. Positive x-y covariance means x and y errors tend to move above or below their means together; negative covariance means they tend to move in opposite directions. A covariance ellipse turns the matrix into a picture: its long axis shows the weakly known direction, and its tilt shows coupling. Covariance must use compatible state ordering and units.
Mean and covariance do not describe every belief. A robot in a repeated corridor may plausibly be near either of two identical doors; one mean between them can land inside a wall where no good hypothesis exists. Particle and grid beliefs can preserve several modes. Before using a Gaussian ellipse, inspect whether the actual errors form one roughly oval cluster and whether claimed intervals contain truth at the expected rate.
Words you need
Name each idea precisely
- Belief distribution
A probability assignment over the states the estimator currently considers plausible.
Physical example:After losing lidar, a rover's possible x positions spread along the aisle instead of remaining one exact point.
- Mean
The probability-weighted centre of a distribution, often used as one summary estimate.
Physical example:Errors of -1, 0, and 1 cm have a mean of 0 cm even though two readings are not zero.
- Variance
The mean squared spread around the mean, expressed in the square of the original unit.
Physical example:Position samples in metres produce position variance in m².
- Standard deviation
The square root of variance, restoring the original measurement unit for a spread scale.
Physical example:A variance of 0.04 m² has a standard deviation of 0.20 m.
- Covariance
A matrix describing per-variable spread and how pairs of state errors vary together.
Physical example:A diagonal corridor makes longitudinal x error grow together with y error, tilting the position ellipse.
- Multimodal belief
A distribution with more than one separate region of high probability.
Physical example:Two identical warehouse bays produce two believable lidar-based pose clusters.
Visual model
See the relationship
Math, one line at a time
Work through today’s relationship
Prerequisite rescue · optionalProbability, variance, and Kalman weighting
State estimation combines predictions and measurements according to uncertainty.
- μ
- best current estimateUnit: state unit
- σ²
- variance, or squared uncertainty spreadUnit: state unit squared
- K
- Kalman gain, the measurement weightUnit: unitless
Prediction is 10 m. Measurement is 12 m. Let K = 0.25.
Innovation is 12 − 10 = 2 m.
Updated estimate = 10 + 0.25×2 = 10.5 m; the lower-trust measurement only shifts the estimate partway.
It is a weighted merge like resolving two data sources, but the weights come from modeled uncertainty.
Prediction 5 m, measurement 7 m, K = 0.5. What is the update?
5 + 0.5×(7−5) = 6 m.
For errors , the mean is and the population variance is
In , a larger prior uncertainty relative to measurement uncertainty gives a larger gain. Covariance still needs calibration checks.
Build a two-dimensional covariance from three error samples
Three synchronized x-y position-error samples in metres are (-1, -0.5), (0, 0), and (1, 0.5). Use population covariance because these three rows are the complete teaching set.
Compute the x mean: (-1 + 0 + 1) / 3 = 0 m, and the y mean: (-0.5 + 0 + 0.5) / 3 = 0 m.
Compute x variance: ((-1)² + 0² + 1²) / 3 = 2/3 ≈ 0.667 m².
Compute y variance: ((-0.5)² + 0² + 0.5²) / 3 = 0.5/3 ≈ 0.167 m².
Multiply paired deviations and average: ((-1)(-0.5) + 0 + (1)(0.5)) / 3 = 1/3 ≈ 0.333 m².
Assemble the symmetric matrix with variances on the diagonal and covariance off diagonal: [[0.667, 0.333], [0.333, 0.167]] m².
Interpret before trusting: the positive off-diagonal value and exact y = 0.5x pattern make a thin rising ellipse, but three designed samples do not validate a real sensor model.
The belief is much more spread in x than y and the errors are strongly positively coupled; a tilted ellipse communicates information that two independent error bars omit.
Covariance has state order, squared units, and geometry; it is not a free confidence number that can be copied between variables.
Physical examples
Where this appears in real life
Same centre, different scatter
Two groups of washers are placed around the same centre mark. One group fits inside a small circle; the other spreads across most of the paper.
Both groups can have the same mean, but the wider group has larger variance and should support a less confident position claim.
Tilted cloud on graph paper
Pairs of x-y error marks lie mainly along a rising diagonal, so points with positive x error also tend to have positive y error.
The cloud's tilt represents positive covariance; separate x and y error bars would hide the coupled weak direction.
Hands-on exercise
Make the idea observable
Use graph paper plus a spreadsheet or Python with 30 synthetic x-y error samples. Keep the random seed and generation settings.
Generate one tight circular error cloud centred at zero and one wide cloud with the same centre; calculate mean, variance, standard deviation, and covariance for each.
Generate a third cloud using y error approximately equal to 0.5 times x error plus small noise, then calculate the off-diagonal covariance.
Plot all three with identical axis scales and draw or compute their one-standard-deviation ellipse directions.
Add a constant 0.40 m x bias to the tight cloud and compare its small spread with its now-large mean error.
Check how often independent zero truth falls inside a declared interval across the samples instead of judging confidence from ellipse size alone.
Save the seed, raw rows, formulas, plots, units, and one sentence distinguishing covariance belief from independently measured error.
Changing spread changes covariance, coupling tilts the cloud, and adding constant bias can leave covariance nearly unchanged while making every estimate wrong.
The three plots and matrices agree, units are correct, and the report refuses to call the biased tight cloud accurate merely because it looks confident.
Build today
Use the frozen Week 8 artifacts to fuse odometry and IMU, explain scan matching, loop closure, and AMCL, then rerun the unchanged scenarios and compare error, uncertainty coverage, transform age, dropout recovery, and navigation success.
Evidence to save
DONE when “Probability distributions and covariance intuition” runs from one documented command and the nominal plus boundary outputs are attached.
Common mistakes
Catch the wrong mental model
Reporting variance in the original measurement unit.
Variance uses squared units such as m² or rad²; report standard deviation when a spread value in metres or radians is easier to interpret.
Treating covariance as measured pose error.
Covariance is the estimator's modeled uncertainty; calculate actual error against an independent reference in the same frame and time.
Averaging two separate pose modes and calling the mean the likely pose.
Inspect the full belief; a grid or particle representation can preserve separate hypotheses that one Gaussian mean would hide.
Job connection
How this becomes employable evidence
Audit pose covariance and measured localization errors for an AMR release, identifying a directionally weak estimate and a confidently biased configuration before navigation consumes it.
Relevant target roles
- Robotics Software Engineer — ROS 2 / AMR
- Robotics Deployment, Integration & Validation Engineer
Chapter 11 interview drill
Interview questions: Probability distributions and covariance intuition
Practise a 60–90 second answer: define the idea, connect it to a physical robot, state assumptions, frames, and units when relevant, then finish with the failure signal or evidence you would inspect.
Primary interview scenario
Two localizers have identical mean error, but one reports a tilted covariance ellipse and the other a tiny circle. Explain covariance, bias, multimodality, and the tests needed before choosing either.
Answer shape: clarify the situation → trace the physical and software path → test the most likely boundaries → name the evidence that would confirm the result.
Technical follow-up questions
Q1What are the units of variance for x measured in metres?
Square metres, m²; the corresponding standard deviation is in metres.
Q2What does positive x-y covariance say?
Relative to their means, x and y errors tend to rise or fall together.
Q3Can a small covariance prove small localization error?
No. Bias or a wrong model can produce a tight but incorrect belief; compare with independent truth and coverage.