The answersDownload the PDF
Worksheet

U3.8 Twists and the exponential

Odometry and drift · University · about 35 min

BugBotLab
NameClassDate

What this lesson is about

A steady command is a twist, a turn about one point. The exact odometry step, the matrix exponential behind it, and the logarithm that plans one smooth arc.

The task: land on the spot in one arc

The green square is 25 cm to the robot's right and 30 cm ahead of it. The robot must arrive in it facing 120 degrees (a third of a turn clockwise), using one steady drive() command held for T = 3 seconds, then stop(). Work out the twist with the logarithm, print it as a line starting twist: with w = ..., vx = ... and vy = ... (deg/s and cm/s), turn it into a command with the full-scale speeds below, and drive it. The printed twist is checked against the logarithm, to a tenth.

from bugbot import *
import math
connect()

V_MAX, V_LAT, W_MAX = 20.0, 15.0, 120.0     # the design's full-scale speeds: cm/s forward, cm/s sideways, deg/s
DX, DY, TURN = 25.0, 30.0, 120.0            # where to end up, in the start's body frame, and how far to turn
T = 3.0                                     # how long to hold the command, s

Plan your program here, then type it in and press Run.

QR code
Do it on the robot
www.bugbotlab.com/learn/u3-8-twists-and-the-exponential/
The simulator checks it and tells you when it passes. Nothing to install, no account.

Challenges

  1. The robot lands a little short of the arc, because of the quarter second of lag at the start. Hold the command for a little longer to make up for it. How much longer, and does the landing get better? (Watch the heading as well as the position.)
  2. Finite motions do not commute. Twists themselves add like vectors, but the motions they produce, their exponentials, do not: exp(A) exp(B) is not exp(B) exp(A) in general. Turn 90 degrees and then drive 20 cm, or drive 20 cm and then turn 90 degrees: work out both end poses with exact_step, then drive both. Why are they different, and which pairs of moves give the same answer in either order?
  3. Replace the Euler step in your U3.2 odometry with exact_step and repeat the long lap from the project. How much of the final error was the integration?