🔍🔩 Parts bench
19 lessons

Odometry: Navigation by Counting Your Steps

Two encoders and arithmetic give a live position estimate for free — one that starts perfect and rots with every metre, because wheels lie a little and integration believes them completely.

lesson 1 of 3 in this unit

Builds on: 2.3 The Complementary Filter: One Truth from Two Liars1.3 Gears: Trading Speed for Strength

Same idea, other course:Vector: position as integrated velocity

Dead reckoning on two wheels

A differential-drive robot — two driven wheels, one caster — knows its wheel rotations to a fraction of a degree, thanks to encoders. Multiply ticks by wheel circumference: distance travelled per wheel. From the pair, everything:

distance = (d_L + d_R) / 2 · turn = (d_R − d_L) / trackaverage moves you forward; difference turns you — ‘track’ is the distance between the wheels

Update heading, advance position along it, repeat every loop tick — and the robot carries a live (x, y, θ) estimate computed entirely from its own step-counting. This is odometry, the navigational sibling of the gyro’s integration, and it inherits the family curse.

The rot

Wheels lie a little: they slip on dust, squash under load, and are never exactly the diameter on the datasheet. Each lie is tiny; integration keeps them all. Distance errors grow steadily — but heading errors are the killers, because a heading error rotates every metre that follows: drive ten metres with a one-degree heading lie and you arrive 17 cm sideways of your estimate. After three trips around the room, the odometry says you are in the hallway.

The failure pattern deserves its name: locally excellent, globally rotten. Over a second, odometry is the best sensor you own — smooth, fast, millimetre-fine. Over a building, it is fiction. The complementary-filter instinct from Unit 2 should be tingling: a drift-free but slower witness is needed to anchor it. That witness is next lesson’s map.

Calibration buys time

Before fighting drift with fusion, shrink it at the source: drive a measured straight line and scale the wheel diameter until reported matches real; spin ten full turns in place and trim the track width until the heading agrees. Called UMBmark in the literature, it is an afternoon’s work that cuts drift severalfold — and it still only postpones the rot. Integration always wins in the end.

The oldest trade in navigation

Sailors called it dead reckoning: log-line speed × time on a compass bearing, and a growing circle of doubt around the pencilled position — until a lighthouse fixed it to truth. Replace lighthouse with lidar and you have Unit 5’s remaining two lessons.

⚗️ Lab — The Doubt Circle

Drive a robot around a marked course. Ghost robot: where odometry believes it is. Sliders for wheel slip and calibration error.

  • Drive one lap with perfect wheels: ghost and robot dance as one. Now add 2% slip and watch them separate — slowly, then not slowly.
  • Add a small track-width miscalibration and turn in place a few times: heading rot beats distance rot, every time.
  • Watch the doubt circle grow with distance travelled. Note it never shrinks — nothing in odometry can un-lie.
2.0 %
1.0 %
After one lap
9 cm and 3.6° of fiction
Pattern
locally excellent, globally rotten
Cure
calibrate first — then anchor to a map

Work it by hand — 0 / 2

No multiple choice here: compute the value and type it. Suffixes like 2.5k or 20m are understood; answers within ±2% count.

1. A robot's wheels (circumference 20 cm) turn: left 12.0 turns, right 12.0 turns. How far did it drive, in metres?
2. A robot drives 8 m with an undetected heading error of 2°. How far sideways of its estimate does it arrive, in cm? (offset ≈ d · sin θ)

Check your understanding

1. In differential-drive odometry, the robot turns when…

2. Why do heading errors damage odometry so much more than distance errors?

3. 'Locally excellent, globally rotten' means odometry is…

4. Calibrating wheel diameter and track width (UMBmark-style)…