Odometry and drift · University · about 25 min
Predicting how far out you will be before you drive, which is what covariance is for.
[1 mark]This adds up the lesson's error budget for a 2 m run with a calibrated gyro, then again with the noise term removed. What does it print?
import math
pieces = {"heading": 0.4, "scale": 6.0, "noise": 0.7, "slip": 2.0}
total = math.sqrt(sum(v * v for v in pieces.values()))
print("total:", round(total, 1), "cm")
print("without noise:", round(math.sqrt(total ** 2 - 0.7 ** 2), 1), "cm")total: 6.4 cm without noise: 6.3 cm
0.4² + 6² + 0.7² + 2² = 40.65, whose square root is 6.4. Removing the 0.7 cm noise term leaves 6.3: the total moves by less than half a millimetre, so a term much smaller than the largest is not worth working on.
[1 mark]Two independent errors of 3 cm each. What is the total, in cm to one decimal place?
[1 mark]An uncalibrated gyro bias of 0.19 deg/s acts for 10 s while the robot drives 200 cm at a steady speed, so the heading error grows steadily from 0 to 1.9 degrees. Using d × e with the average heading error, how far to the side does it end up, to the nearest cm?
[1 mark]Flow noise contributes 0.7 cm over a run of 100 steps. Following the random walk, what does it contribute over 400 steps, in cm?
[1 mark]With the gyro calibrated, the budget reads heading 0.4 cm, scale 6 cm, noise 0.7 cm and slip 2 cm. What should be worked on next?
[1 mark]For that calibrated budget after a long straight run, what shape is the region the robot is likely to end up in?
Print what you expect the dead reckoning error to be over your run, as predicted error:, before you drive. Then drive at least 90 cm and print actual error:, the real gap between odometry() and position().
from bugbot import * import math connect() DISTANCE = 100.0
The hint students can ask for: A rough budget is enough: a heading error of e degrees over a run of d centimetres puts you about d times e in radians off to one side, and the scale error adds a few percent of d. Print the number you expect before you drive, then the number you got.
from bugbot import *
import math
connect()
DISTANCE = 100.0
HEADING_ERR = 0.7 # degrees: 0.19 deg/s over the 7 s drive, averaged
SCALE_ERR = 0.03 # the flow sensor reads about 3 percent high
sideways = DISTANCE * math.radians(HEADING_ERR)
along = DISTANCE * SCALE_ERR
print("predicted error:", round(math.hypot(sideways, along), 1))
forward(75)
wait(7.0)
stop()
wait(0.6)
ox, oy, oh = odometry()
tx, ty = position()
print("actual error:", round(math.hypot(ox - tx, oy - ty), 1))
Any program that meets the task's checks is marked correct in the simulator; this is one way, not the only way.