Chapter 61: wheel odometry

Robot Speed from Wheel Encoders From two encoder readings to V and ω

The encoders on the wheels report angles. This page turns those angles into the speed of each wheel, and the wheel speeds into how fast the whole robot drives and turns. Small steps, real numbers from the BumperBot (wheel radius 0.033 m, wheels 0.17 m apart) and a picture to move in every section.

Words used on this page (open this if a word is new)
W_rThe wheel radius, 0.033 m here.
W_sThe wheel separation, the distance between the two wheels, 0.17 m here.
φ̇R, φ̇LHow fast the right and the left wheel turn, in rad/s.
VHow fast the middle of the robot moves forward, in m/s.
ω (omega)How fast the robot turns, in rad/s, left is positive.
matrixA table of numbers; times a column: multiply along each row and add.
inverse matrixThe matrix that undoes another one.
radian (rad)Angle unit: the arc is as long as the radius. One turn = 6.28 rad.
encoderA sensor on the wheel that reports its angle.
φR, φLThe angle of the right and the left wheel, counted from the start.
t0, t1The start moment and the moment now.
Δ (delta)The change of something: end value minus start value.
ΔφR, ΔtHow much the right wheel turned, and how much time passed.
substitutePut one thing in place of another equal to it.
01

A quick reminder: the matrix

The differential kinematics link the two wheel speeds to how the robot moves. A short revision first, row by row. Use Next and Back, the sliders and the buttons. Point at a coloured word to light up its part of the picture.

Key idea. V and ω come from one matrix times the two wheel speeds, and the matrix only holds the robot sizes W_r and W_s. Its inverse turns wanted speeds into motor commands; the matrix as it is turns measured wheel speeds into the real robot speed, which is what odometry needs.

Quick check

02

Speed is distance divided by time

The encoders do not report speeds. They report angles. To turn angles into speeds, one everyday rule is enough. Use Next and Back, the sliders and the buttons. Point at a coloured word to light up its part of the picture.

Key idea. Speed = distance ÷ time. A wheel angle is measured in radians (one turn = 6.28 rad), the encoder reports it at any moment, and the angle turned divided by the time taken gives the wheel speed in rad/s.

Quick check

03

Two moments on the plane

To measure a change, two moments are needed: when the motion started and now. Use Next and Back, the sliders and the buttons. Point at a coloured word to light up its part of the picture.

Key idea. At t0 the robot is at x0, y0 and at t1 at x1, y1. At the same two moments the encoders give the wheel angles φR0, φR1, φL0 and φL1. Those readings and the two times are everything the wheel speed formula needs.

Quick check

04

Change, written Δ, and the wheel speed

With the readings from two moments, the speed of each wheel is one division. Use Next and Back, the sliders and the buttons. Point at a coloured word to light up its part of the picture.

Key idea. Δ means end minus start. The right wheel speed is φ̇R = (φR1 − φR0) ÷ (t1 − t0) = ΔφR ÷ Δt, and the left wheel speed is φ̇L = ΔφL ÷ Δt. On a graph of angle against time it is the steepness of the line.

Quick check

05

Robot speed from encoder readings

Last step: put the wheel speed formula into the matrix. Use Next and Back, the sliders and the buttons. Point at a coloured word to light up its part of the picture.

Key idea. V = (W_r ÷ 2) × ΔφR ÷ Δt + (W_r ÷ 2) × ΔφL ÷ Δt and ω = (W_r ÷ W_s) × ΔφR ÷ Δt − (W_r ÷ W_s) × ΔφL ÷ Δt. From two encoder readings the robot knows how fast it drives and turns, the starting point for the full odometry in the next chapter.

Quick check

06

Summary and quiz

Key takeaways

  1. V and ω come from one matrix times the wheel speeds: V = (W_r ÷ 2) × φ̇R + (W_r ÷ 2) × φ̇L and ω = (W_r ÷ W_s) × φ̇R − (W_r ÷ W_s) × φ̇L.
  2. The inverse of the matrix gives motor commands from wanted speeds. The matrix as it is gives the real robot speeds from measured wheel speeds.
  3. Speed = distance ÷ time. For a wheel the distance is the angle turned, in radians; one turn = 2 × π ≈ 6.28 rad.
  4. The encoder reports the angle of each wheel at any moment.
  5. Two moments, t0 and t1, give the readings φR0, φR1, φL0, φL1. Δ means end minus start: ΔφR = φR1 − φR0, Δt = t1 − t0.
  6. Wheel speeds: φ̇R = ΔφR ÷ Δt and φ̇L = ΔφL ÷ Δt. Read often, so Δt is short.
  7. Put together: V = (W_r ÷ 2) × ΔφR ÷ Δt + (W_r ÷ 2) × ΔφL ÷ Δt and ω = (W_r ÷ W_s) × ΔφR ÷ Δt − (W_r ÷ W_s) × ΔφL ÷ Δt.
  8. Example: 0.6 rad and 0.4 rad in 0.1 s give V = 0.165 m/s and ω = 0.388 rad/s, the starting point for the full odometry.

Quiz