Textbooks/Robotics From First Principles/Chapter 8Lite (plain text) version
8Where am I? Drift, uncertainty and fusion
Version 1 · Technically checked (automated checks only) · 4 source lessons · 7 practice items
Introduction
Counting wheel turns tells a robot how far it has gone, until a wheel slips. Dead reckoning drifts, and the error only grows. A beacon or camera fix is noisy but does not drift. The answer is to keep a belief with an uncertainty attached, predict it forward with the motion model, and correct it with each measurement, weighting each source by how much it can be trusted. That is the predict–update cycle.
Explanation
This chapter is built from 4 School lessons. Each part below is the lesson's own explanation; open the lesson for its predict-and-discover activities.
8.1 Accurate, precise, both or neither
Five readings that agree to the millimetre can all be 3 cm wrong. How would you ever know?
Two different questions
Accuracy: is the average reading close to the true value? Precision: do repeated readings agree with each other? They are independent. A bathroom scale that always reads 2 kg heavy is precise and inaccurate; a cheap thermometer whose readings jump around a correct average is accurate on average and imprecise.
Bias moves, noise spreads
A systematic error (bias) shifts every reading the same way: a zero offset, a mis-set gain, a sensor warmed by its own electronics. A random error scatters readings unpredictably: electrical noise, vibration, quantisation. Bias damages accuracy; noise damages precision.
You need the truth to see bias
You can measure precision from the readings alone: just look at their spread. Accuracy needs a reference: a known weight, a measured distance, a calibrated instrument. Without one, a biased sensor looks perfectly healthy. This is why calibration rigs exist.
Common mix-ups
- Precise readings must be accurate.
✓ A tight group can sit far from the truth. Only a reference reveals bias. - Averaging fixes every kind of error.
✓ Averaging shrinks random error. Bias survives any amount of averaging.
8.2 Dead reckoning and why it drifts
Count every wheel turn perfectly and you still end up metres from where you think you are. Where does the error come from, and how fast does it grow?
Integration accumulates
Dead reckoning adds up measured steps: x[k] = x[k−1] + d[k]·cos θ[k], y[k] = y[k−1] + d[k]·sin θ[k]. Any error in d or θ is added in and never removed. The estimate's uncertainty can only grow until an absolute measurement arrives.
Three growth laws
A scale bias (wheels over-reading by fraction s) gives along-track error s·d: linear in distance. A constant heading error θ₀ gives cross-track error d·sin θ₀: also linear. A heading drift rate b (gyro bias) makes the heading error grow with time, so cross-track error grows like ½·v·b·t². Independent random step errors grow only like √n.
Living with drift
The cure is not a perfect wheel but an occasional absolute fix: a landmark, a sun sensor, an orbital image. A drift model tells you the spacing: if heading drift adds 1 m of error every 100 m and the corridor allows 2 m, fix at least every 200 m, with margin.
Common mix-ups
- Better wheel encoders fix dead reckoning.
✓ Encoders count turns; slip and heading drift are errors in what the turns mean. Only absolute references remove accumulated error. - All odometry error grows like √n.
✓ Random error does. Biases grow linearly or faster, and they dominate long drives.
8.3 The predict–update cycle
Drive a metre: your uncertainty grows. See a landmark: it shrinks. Repeat forever. That rhythm is the whole idea of a filter.
Predict
Push the estimate through the model: x⁻ = x + u (here, the commanded move) and P⁻ = P + Q. Q is the variance the model adds each step: wheel slip, gusts, anything unmodelled. Prediction always increases uncertainty.
Update
When a measurement z with variance R arrives, compute the innovation z − x⁻, the gain K = P⁻/(P⁻ + R), then x = x⁻ + K(z − x⁻) and P = (1 − K)P⁻. This is the conjugate normal update from week 13 with the prediction as prior.
Checking a filter honestly
In simulation you know the truth, so measure RMSE of x − x_true. Also check consistency: about 95% of errors should fall within ±2√P. If the truth often leaves the band, the filter is overconfident (Q or R too small); if it never comes close to the edge, it is too cautious.
Common mix-ups
- A low RMSE proves the filter is right.
✓ It must also be consistent: its own σ should match its actual errors, or downstream decisions will be over- or under-cautious. - The update step can increase uncertainty.
✓ For a correct linear-Gaussian model P = (1 − K)P⁻ is always smaller than P⁻. A surprising measurement moves x a lot, but P still shrinks.
Worked examples
Accurate, precise, both or neither: example 1
A 100.0 g reference mass is weighed five times: 101.9, 102.1, 102.0, 101.8, 102.2 g. Describe accuracy and precision.
Solution
Mean = 102.0 g, so bias = +2.0 g (poor accuracy). Readings span only 0.4 g, so precision is good. Fix: subtract 2.0 g, then re-check with another reference.
Dead reckoning and why it drifts: example 1
Wheels over-read by 3%. Distance 100 m. Along-track error?
Solution
0.03 × 100 = 3 m. The rover thinks it is 3 m further along than it is.
The predict–update cycle: example 1
x = 0, P = 1 m². Drive u = 1 m with Q = 0.25 m². Fix z = 1.6 m with R = 0.5 m². Predict and update.
Solution
x⁻ = 1, P⁻ = 1.25. K ≈ 0.714. x ≈ 1.43 m, P ≈ 0.357 m² (σ ≈ 0.60 m).
Navigation uncertainty ellipses and budgets: example 1
σₓ = 4 km, σ_y = 1.5 km, independent. Will the 95% ellipse fit a zone 20 km long by 10 km wide?
Solution
k = 2.448. Half-extents 9.79 km (≤ 10) along and 3.67 km (≤ 5) across: it fits, with only 0.21 km to spare along track.
Interactive figures
Interactive figure (online). Description: The drift rover draws the straight true track and the dead-reckoned track; the readout states the final error and the bias-only predictions for along-track and cross-track error.
Interactive figure (online). Description: The Kalman stepper plots truth, landmark fixes and the estimate with a ±2σ band over 20 steps. Each button press updates a text readout with the estimate, σ, truth, error and gain.
Laboratory
Everything runs in your browser. No kit, nothing mains-powered. Simulations are simplified educational models.
Simulation OS experiment
Simulation OS: Two-sensor fusion
Fuse drifting odometry with a camera that drops out and compare the fused error with each sensor alone.
Open Simulation OS: Two-sensor fusion →Playground lab
Playground: Sensor fusion
Change one sensor's noise and predict which way the fused estimate moves before you look.
Open Playground: Sensor fusion →BUILD level
BUILD: Planetary rover, level 3
Decide which sensor to trust on sand and which on firm ground, and justify each choice.
Open BUILD: Planetary rover, level 3 →
Guided practice
Answers are checked on the server; wrong answers get a hint and another try. Signed in, solved items also count towards the source lesson.
- Readings: 49.1, 50.8, 48.7, 51.5, 49.9 for a true value of 50. Which describes them?
- Accurate and precise
- Accurate on average, not very precise
- Precise but biased
- Neither
- A 20.0 cm gauge block measures 20.6, 20.4, 20.5, 20.5 cm. What is the bias, in cm? (cm)
- Odometry over-reads distance by 4% because of slip. After 250 m, what is the along-track error, in metres? (m)
- With a constant gyro DRIFT RATE (heading error growing steadily), doubling the drive time at constant speed makes the cross-track error…
- About 4× larger
- 2× larger
- √2× larger
- Unchanged
- After predicting, a 1-D Kalman filter's variance is P = 1 m². The camera measurement variance is R = 2 m². What is the Kalman gain K?
- In simulation, the true position leaves the filter's ±2σ band on 40% of steps. The most likely problem is…
- Q and/or R are set too small: the filter is overconfident
- Q and R are too large
- The filter is working perfectly
- The truth is wrong
- A landing-position error budget has four independent 1σ contributions: entry navigation 2 km, atmosphere 4 km, aerodynamics 5 km and timing 1.5 km. What is the combined 1σ error (root-sum-square), in km? (km)
Engineering applications
Phones and cars
Phone maps blend satellite fixes, motion sensors and wheel or step counts. In a tunnel the satellite fixes vanish and the estimate coasts on motion sensors, with its uncertainty growing until the next good fix.
Mars rovers
Rovers cannot ask Earth where they are in real time. They combine wheel odometry, inertial sensors and visual matching of the terrain, and stop to re-localise when slip makes odometry untrustworthy.
Watch
Optional verified videos. Nothing loads from YouTube until you press play.
- Why Use Kalman Filters? | Understanding Kalman Filters, Part 1 (MATLAB)
- How Perseverance Learned to ‘Self-Locate’ on Mars (NASA Jet Propulsion Laboratory)
- Optimal State Estimator Algorithm | Understanding Kalman Filters, Part 4 (MATLAB)
Chapter summary
- Dead reckoning integrates motion, so small errors accumulate and the position drifts.
- Keep an estimate together with its uncertainty, not a bare number.
- Predict with the motion model (uncertainty grows), then update with a measurement (uncertainty shrinks).
- The gain weights each source by its trust: K = P / (P + R) for a single quantity.
Glossary
- Odometry
- Odometry estimates a robot's position and heading by adding up how far its wheels have turned since a known start.
- Encoder counts and resolution
- A rotary encoder reports rotation as a count of ticks. Its resolution is the number of counts per revolution (CPR), often four times the pulses per revolution with quadrature decoding.
- IMU (inertial measurement unit)
- An IMU combines an accelerometer, which measures acceleration including gravity, and a gyroscope, which measures angular velocity; some add a magnetometer.
- Random and systematic error
- Random errors scatter readings unpredictably above and below the true value; systematic errors shift every reading the same way.
- Standard deviation
- Standard deviation measures how spread out values are around their mean: the square root of the average squared distance from the mean.
Definitions from the Field Guide.
Project: A one-dimensional localiser
Simulate a robot driving along a corridor with noisy wheel odometry and a beacon that gives a noisy position every few seconds. Implement the predict–update cycle for position alone, plot the estimate and its uncertainty band against the truth, and report how the error compares with odometry alone.
Deliverables
- The simulation and filter code with fixed random seeds
- A plot of truth, odometry and fused estimate with its band
- Error statistics for both methods and an honest limitation
Keep your work in your Engineering Journal; it stays private unless you choose to share it.
References
- Sebastian Thrun et al. (2005). Probabilistic Robotics. MIT Press.
- R. E. Kalman (1960). "A New Approach to Linear Filtering and Prediction Problems". Journal of Basic Engineering 82(1), 35–45.
- Roland Siegwart et al. (2011). Introduction to Autonomous Mobile Robots, 2nd edition. MIT Press.
Publication record
- Version
- 1
- Status
- Technically checked (automated checks only)
- Technical review
- Automated checks only, last run 2026-11-29. No human, educator or mentor review is claimed.src/content/textbooks/textbooks.test.ts: schema, every lesson, diagram, practice item, video, Field Guide entry, lab and reference resolves; figure numbers recomputed; no practice answers in client payloads.
- Written by
- Compiled and written by the Tactiverge team with AI assistance, from Tactiverge School lessons that were themselves written with AI assistance.
- Licence
- All rights reserved by the founders unless a licence is approved.
- Corrections
- None recorded yet.Spotted a mistake? Use “Report a problem” on any chapter, or see the corrections page.