Skip to content
Tactiverge

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

Text
All chapters and search
  1. 1. Sense, think, act
  2. 2. Actuators and drives
  3. 3. Vectors and frames
  4. 4. Rotations and transforms
  5. 5. Forward kinematics
  6. 6. Inverse kinematics
  7. 7. Motion and trajectories
  8. 8. Where am I? Drift, uncertainty and fusion

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.

Two uncertain guesses, one better one44.64.384K = 0.64 · σ = 0.24 m
Figure 8.1. Two uncertain guesses, one better one. Three bell curves: odometry says 4 m with σ 0.4 m, a beacon says 4.6 m with σ 0.3 m. Fusing them with gain K = 0.64 gives 4.384 m with σ 0.24 m, a narrower curve than either source.

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.

Open the full lesson: Accurate, precise, both or neither →

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.

Open the full lesson: Dead reckoning and why it drifts →

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.

Open the full lesson: The predict–update cycle →

8.4 Navigation uncertainty ellipses and budgets

'Within 5 km' is not one number. Along the track you may know 4 km; across it, 1.5 km; and the two errors may be linked. Draw that and you get an ellipse.

Covariance to ellipse

Position error [eₓ, e_y] has covariance Σ = [[σₓ², ρσₓσ_y], [ρσₓσ_y, σ_y²]]. Contours of equal probability are ellipses whose axes are Σ's eigenvectors and whose 1σ semi-axes are √(eigenvalues). With ρ = 0 they line up with x and y; correlation tilts them.

Choosing the probability

For a 2-D Gaussian, the probability inside the ellipse scaled by k is p = 1 − e^(−k²/2), so k = √(−2 ln(1 − p)): k = 1 → 39%, 2 → 86%, 2.45 → 95%, 3.03 → 99%. Always state which ellipse you mean: '3σ' and '99%' are different in 2-D.

Budgets and zones

A navigation budget combines contributions (in each axis, by RSS if independent) into Σ. The design check: the p-ellipse must fit inside the safe zone with margin. If it does not, either shrink the uncertainty (more fixes, better sensors) or choose a bigger, safer zone.

Common mix-ups

  • 2σ means 95% in any number of dimensions.
    ✓ Only in 1-D. In 2-D, 2σ holds about 86%; 95% needs about 2.45σ.
  • A small σ in one direction means the position is well known.
    ✓ The ellipse is only as useful as its longest axis allows; and correlation can make the worst direction diagonal.

Open the full lesson: Navigation uncertainty ellipses and budgets →

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

Figure 8.2 from Dead reckoning and why it driftsStart with only 3% slip bias and no heading drift: double the steps and check the error doubles. Now set slip to 0 and heading drift to 0.1° per step: double the steps and watch the error roughly quadruple. Finally use noise only, and compare how slowly random error grows.
Can't use the interactive? Read a description instead

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 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.

Figure 8.3 from The predict–update cycleStep predict → update ten times in clear skies and watch the band settle to a steady width. Reset, switch on dust, and step again: note how wide the band gets during the gaps. Check after each update that the green truth line stays inside the ±2σ band most of the time.
Can't use the interactive? Read a description instead

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.

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.

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.

Practice 1

Readings: 49.1, 50.8, 48.7, 51.5, 49.9 for a true value of 50. Which describes them?

Practice 2

A 20.0 cm gauge block measures 20.6, 20.4, 20.5, 20.5 cm. What is the bias, in cm?

cm

Practice 3

Odometry over-reads distance by 4% because of slip. After 250 m, what is the along-track error, in metres?

m

Practice 4

With a constant gyro DRIFT RATE (heading error growing steadily), doubling the drive time at constant speed makes the cross-track error…

Practice 5 · a fresh version every time

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?

Practice 6

In simulation, the true position leaves the filter's ±2σ band on 40% of steps. The most likely problem is…

Practice 7 · a fresh version every time

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
  1. 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
  2. A 20.0 cm gauge block measures 20.6, 20.4, 20.5, 20.5 cm. What is the bias, in cm? (cm)
  3. Odometry over-reads distance by 4% because of slip. After 250 m, what is the along-track error, in metres? (m)
  4. 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
  5. 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?
  6. 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
  7. 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.

Builds intuition for estimating what you can't measure directly when your sensors are noisy.

6 min 47 s · captions on YouTube · source

Nothing loads from YouTube until you press play.

A quick official look at how a rover works out where it is with no GPS, using its own images.

1 min 35 s · captions on YouTube · source

Nothing loads from YouTube until you press play.

Walks through the predict and update equations of the Kalman filter one line at a time, including what the gain and covariances mean.

Length: see YouTube · captions on YouTube · source

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.