Introduction to robot motion

Two wheels, one moving robot

The robot can now spin each of its two wheels using ROS 2 Control. This page is only an introduction to what comes next: how the speed of two wheels makes a robot go straight, turn on the spot or follow a curve, and why it is better to command the robot than each wheel. The equations are left for the next chapter. Every step has a simulator: a two wheel driving arena, a straight line test, an in-place spin, a robot command converter, a puzzle to find the wheel speeds, and a game on the two kinds of kinematics. All numbers on the page are teaching values.

Words used on this page (open this if a word is new)
differential driveA robot with two driven wheels, one on each side. Its motion comes only from the speeds of the two wheels.
motorThe part that makes a wheel turn.
wheel speedHow fast a wheel turns. It is measured in radians per second (rad/s).
radian per second (rad/s)A way to say how fast something turns. One full turn is about 6.28 radians.
metre per second (m/s)A way to say how fast something moves. 1 m/s means one metre every second.
clockwiseTurning the way clock hands turn, seen from above. Counter-clockwise is the other way.
in-place rotationTurning on the spot, with the middle of the robot staying where it is.
velocity commandA message that tells a motor, or a robot, how fast to go.
robot commandA velocity command for the whole robot, such as “forward at 1 m/s”.
kinematicsThe branch of mathematics that describes motion, without asking what forces cause it.
direct (forward) kinematicsWorking out the robot speed when the wheel speeds are known.
inverse kinematicsWorking out the wheel speeds when the wanted robot speed is known.
ROS 2 ControlThe library that lets the program control each wheel motor.
joystickA hand controller with a stick. Pushing it tells the robot where to go.
01

Two wheels, two motors

The robot can now be controlled with the ROS 2 Control library. Each of the two wheels is moved separately. To activate a wheel, a velocity command is sent to it. Everything the robot can do, moving forward or backward, turning in place and so on, comes from just two motors. So the only way to make the robot perform any movement is to control these two motors, and to combine their speed and their direction of rotation properly. Play with both wheels below.

Key idea. Two motors, two numbers. All robot movements are made by combining the speed and the direction of the two wheels.
02

Same speed: a straight line

To make the robot move on a straight line, the speed of each wheel must be the same. Both wheels cover the same distance, so neither side gets ahead.

Key idea. Straight line: the same velocity command on both wheels.
03

Same value, opposite sign: turning in place

To make the robot perform an in-place rotation, the velocity command sent to the two wheels has the same value but opposite sign. The two wheels rotate at the same speed in opposite directions.

Key idea. In-place rotation: same value, opposite sign.
04

Commanding the robot instead of the wheels

In the next chapter, the logic is built that calculates the velocity of the robot from the velocity of its wheels, and also the reverse: the wheel velocities from the overall robot velocity. Then velocity commands can be sent directly to the robot and not to its wheels. For example “move forward at one metre per second” or “rotate clockwise at 0.5 radians per second”. These commands are converted automatically into commands for each wheel. Here is a first look at how that will feel.

Key idea. The goal: command the robot (“forward at 1 m/s”), and let a conversion produce the command for each wheel.
05

The question: which speed for each motor?

Say the robot should start rotating clockwise at 0.5 radians per second. At what speed should the motor of the left wheel rotate, and at what speed the motor of the right wheel? This is a common problem in robotics. Try to solve it by hand here. The next chapter shows how mathematics solves it every time.

Key idea. A wanted robot motion must be turned into a speed for each motor. This is a common problem in robotics, and mathematics solves it.
06

Two kinds of kinematics

The branch of mathematics that helps here is called kinematics. It gives a simple set of equations that relate the rotational speed of the motors to the overall speed of the robot in two dimensional space. Two types of equations will be studied: direct (forward) kinematics, which gives the robot speed from the motor speeds, and inverse kinematics, which gives the motor speeds from the robot speed.

Key idea. Direct kinematics: wheels to robot. Inverse kinematics: robot to wheels.
07

Summary and quiz

Key takeaways

  1. The two wheels can be controlled separately with ROS 2 Control, by sending a velocity command to each.
  2. Straight line: the same speed on both wheels.
  3. In-place rotation: the same value with opposite sign.
  4. All robot movements come from combining the speed and direction of just two motors.
  5. It is easier to command the robot, such as “forward at 1 m/s”, and convert that to wheel commands.
  6. Kinematics connects wheel speeds and robot speed: direct (wheels to robot) and inverse (robot to wheels).

Coming in the next chapter

The equations of direct kinematics and inverse kinematics, and the logic that lets a joystick drive the robot. This page showed the idea. The next chapter shows the math behind it.

Quiz