Skip to the lesson
FixTheRobot Explore Robotics / Robot Foundations / Module 3 / Lesson 2

Robot Foundations · Module 3: Making a Robot Move

How a Two-Wheeled Robot Drives

Two wheels, two speeds. Their average moves the robot forward and their difference turns it.

  • Lesson 2 of 4
  • Beginner
  • No code
  • About 8 minutes

Pip has no steering wheel and nothing that swivels. It has two wheels side by side, each with its own motor, and that is enough to go anywhere on a floor. A wheelchair steers the same way, and so does a tank. This arrangement is called differential drive, and it is the most common design for indoor robots because it is simple, cheap and can turn on the spot.

What you will be able to do

  • Predict whether a differential-drive robot goes straight, curves or spins from its two wheel speeds.
  • Compute the forward speed v and turning speed ω from the wheel speeds.
  • Compute the two wheel speeds that produce a wanted v and ω.
  • State what a differential-drive robot cannot do.

The idea

Call the speed of the left wheel over the floor vL and that of the right wheel vR, both in m/s. (Each is the wheel's radius times how fast it spins, from the previous lesson.) Three cases cover everything.

Three ways a two-wheeled robot movesThree panels, each showing the robot from above facing up the page, with green arrows for the speed of each wheel. In the first, both wheels run forward at the same speed and the robot goes straight. In the second, the right wheel runs faster than the left and the robot curves to the left. In the third, the right wheel runs forward and the left wheel backward at the same speed, and the robot spins to the left on the spot.Straight left 0.4right 0.4Curve to the left left 0.2right 0.4Spin on the spot left -0.4right 0.4
Green arrows: the speed of each wheel in m/s. Orange: the motion that results. The robot always turns toward its slower wheel.
  • Equal speeds: both sides cover the same ground. The robot goes straight.
  • Different speeds: the faster side covers more ground and swings around the slower side. The robot curves toward the slower wheel.
  • Equal and opposite: one side goes forward as much as the other goes back. The centre stays put and the robot spins.

Two wheel speeds become v and ω

In the lesson Speed, Time and Small Steps the robot's motion was described by a forward speed v and a turning speed ω. Here is where those come from.

The forward speed is the average of the two wheel speeds.

v = (vR + vL) ÷ 2

The centre of the robot is half way between the wheels, so it moves at the average of their speeds.

The turning speed is the difference of the wheel speeds divided by the distance between the wheels.

ω = (vR − vL) ÷ L

L is the distance between the two wheels, called the wheel base. For Pip, L = 0.3 m. The result is in radians per second, and it is positive (a left turn) when the right wheel is faster.

Why divide by L? The difference in wheel speeds is how fast one side gets ahead of the other. Wheels close together turn the robot sharply for a given difference. Wheels far apart turn it gently. A narrow robot is nimble, and a wide one is steady.

Four pairs of wheel speeds on Pip and the motion they produce
CasevL (m/s)vR (m/s)v (m/s)ω (rad/s)Motion
Equal speeds0.40.40.40 (0° per second)Straight ahead
Right wheel faster0.20.40.30.67 (38° per second)Curves to the left
Equal and opposite-0.20.201.33 (76° per second)Spins on the spot, to the left
Right wheel stopped0.400.2-1.33 (-76° per second)Curves to the right

Average of the wheel speeds: how fast forward. Difference of the wheel speeds: how fast it turns.

The other direction: from v and ω to wheel speeds

A program usually decides what it wants in terms of v and ω ("go forward at 0.4 m/s while turning left at 1 rad/s") and must then work out what to tell each motor. Turning the two formulas around gives:

Each wheel runs at the forward speed, plus or minus half of what the turn needs.

vR = v + ω × L ÷ 2
vL = v − ω × L ÷ 2

To turn left (positive ω), the right wheel speeds up and the left wheel slows down by the same amount.

What it cannot do

A differential-drive robot cannot move sideways. Its wheels roll forward and backward and do not slide sideways (if they did, they would not grip). To reach a spot directly to its left it must turn, drive, and turn back, like a car parking. The motion model has no "sideways speed" for this reason: v, along the heading, and ω are all there is.

In the first lab you command v and ω directly, and the simulated robot converts them to wheel speeds with the formulas above.

Words to know

Differential drive
A robot steered by two side-by-side wheels driven at independent speeds. On Pip: its whole drive system.
Wheel base (L)
The distance between the two drive wheels. (Some texts call it the track width.) On Pip: 0.3 m.
Forward speed (v)
The speed of the robot's centre along its heading: the average of the wheel speeds. On Pip: at most 0.5 m/s.
Turning speed (ω)
How fast the heading changes: the wheel speed difference divided by L. Left is positive. On Pip: zero when the wheel speeds are equal.
Turning radius
The radius of the circle the robot drives around: v ÷ ω. Zero when it spins on the spot. On Pip: 0.6 m in the worked example.
Kinematics
The study of how wheel or joint motion becomes motion of the robot, without asking about forces. On Pip: the formulas of this lesson are its kinematics.

A worked example: both directions

From wheel speeds to motion. Pip's left wheel runs at 0.3 m/s and its right wheel at 0.5 m/s.

  1. Forward speed. v = (0.5 + 0.3) ÷ 2 = 0.4 m/s.
  2. Turning speed. ω = (0.5 − 0.3) ÷ 0.3 = 0.2 ÷ 0.3 = 0.67 rad/s. That is about 38° every second, to the left because the right wheel is faster.
  3. Turning radius. v ÷ ω = 0.4 ÷ 0.67 = 0.6 m. Pip drives around a circle 1.2 m across.

From wanted motion to wheel speeds. The program wants v = 0.4 m/s and ω = 1 rad/s.

  1. Half of what the turn needs. ω × L ÷ 2 = 1 × 0.3 ÷ 2 = 0.15 m/s.
  2. Right wheel. 0.4 + 0.15 = 0.55 m/s.
  3. Left wheel. 0.4 − 0.15 = 0.25 m/s.
  4. Check. Average: (0.55 + 0.25) ÷ 2 = 0.4. Difference over L: (0.55 − 0.25) ÷ 0.3 = 1. Both match what was asked for.

One more thing to notice: the right wheel must run at 0.55 m/s, which is above Pip's top wheel speed of 0.5 m/s. The motor cannot deliver it, so Pip will not do what was asked. Turning uses up some of the speed available for going forward. A robot cannot have its top forward speed and a sharp turn at once.

Try it yourself

Hold two pencils upright on a table about 20 cm apart: they are the two wheels, and you are looking down at the robot. (a) Push both forward at the same speed. (b) Push the right one twice as fast as the left. (c) Push one forward and pull the other back. Describe the path of the mid-point each time. Then compute v and ω for Pip with vL = 0.5 and vR = 0.1 m/s. Which way does it turn?

Answer

(a) A straight line. (b) A curve bending to the left, around a point on the left side. (c) The mid-point stays still and the pair rotates. For the numbers: v = (0.1 + 0.5) ÷ 2 = 0.3 m/s. ω = (0.1 − 0.5) ÷ 0.3 = -1.33 rad/s. Negative ω means a right turn, which fits: the right wheel is the slower one, and the robot turns toward its slower wheel.

Common mistakes

"To turn left, speed up the left wheel."

The robot turns toward the slower wheel. To turn left the right wheel must be faster.

"If both wheels get the same command, the robot goes straight."

Only if the two motors, gearboxes and wheels are identical, which they never quite are. Equal commands usually give a slow curve. The next lesson is about exactly this.

"ω is in degrees per second."

With speeds in m/s and L in metres, the formula gives radians per second. Multiply by about 57.3 for degrees per second.

Remember this

  1. A differential-drive robot steers with the difference between its two wheel speeds.
  2. v = (vR + vL) ÷ 2 and ω = (vR − vL) ÷ L.
  3. In reverse: vR = v + ω L ÷ 2 and vL = v − ω L ÷ 2.
  4. It can spin on the spot and cannot move sideways.

Check yourself

Three questions. Write an answer in your own words, then reveal the explanation. Nothing you type leaves your browser.

Question 1

Pip (L = 0.3 m) runs its left wheel at 0.2 m/s and its right wheel at 0.2 m/s. What are v and ω, and what does it do?

Explanation

v = (0.2 + 0.2) ÷ 2 = 0.2 m/s. ω = (0.2 − 0.2) ÷ 0.3 = 0. It drives straight ahead at 0.2 m/s.

Question 2

Pip must spin on the spot to the left at 2 rad/s. What wheel speeds are needed?

Explanation

v = 0, so vR = 0 + 2 × 0.3 ÷ 2 = 0.3 m/s and vL = 0 − 0.3 = −0.3 m/s. The right wheel runs forward and the left wheel backward at the same speed.

Question 3

Two robots are given the same wheel speeds, 0.3 and 0.5 m/s. One has its wheels 0.2 m apart and the other 0.4 m apart. Which turns faster, and by how much?

Explanation

ω = 0.2 ÷ L. The narrow robot turns at 0.2 ÷ 0.2 = 1 rad/s and the wide one at 0.2 ÷ 0.4 = 0.5 rad/s. Halving the wheel base doubles the turning speed. Both move forward at the same 0.4 m/s.

What’s next

You can now compute exactly what Pip should do for any pair of wheel commands. The next lesson is about why it does not.

Next lesson

Commands Are Not Motion

Give three reasons a robot does not end up where its commands say, and explain what open-loop control means.

The lab of this module (after lesson 4)

Make Your First Robot Move

Drive a robot by hand, read its state, compute the error to a target and write the loop that drives it there. About 25–35 minutes.

Where this goes on the site

Nothing below is needed to continue this course. These pages take the topic of this module further, and most assume more mathematics or Python than this course does.