Kinematics and frames · University · about 25 min
The first useful controller: a vector to the target, straight through the inverse kinematics.
[1 mark]The go-to-point controller sets its speed from the gap to the target. What does this print?
for gap in (60.0, 28.0, 10.0, 3.0):
speed = min(14.0, max(4.0, 0.5 * gap))
print(gap, speed, "stop" if gap < 4 else "drive")[1 mark]The target is 30 cm east and 40 cm north of the robot. What does this print?
import math dx, dy = 30.0, 40.0 gap = math.hypot(dx, dy) speed = min(14.0, max(4.0, 0.5 * gap)) wx, wy = speed * dx / gap, speed * dy / gap print(gap, speed, round(wx, 1), round(wy, 1))
[1 mark]A student writes wx, wy = speed * dx, speed * dy, leaving out the division by gap. What goes wrong?
[1 mark]How should the stopping threshold, gap < 4, be chosen?
[1 mark]The robot starts at world (60, 60), and position() counts from where it started. How far is a target at world (100, 45) from the start, in cm to one decimal place?
[1 mark]This controller reads position(), which U1.3 called the lab's overhead camera. Why is that acceptable here?
Drive to world (140, 150) and stop within 10 cm of it. The robot starts at (60, 60) facing the wrong way, and position() counts from where it started.
from bugbot import * import math connect() V_MAX, V_LAT = 20.0, 15.0 TX, TY = 80.0, 90.0 # the target, in cm from the start
Plan your program here, then type it in and press Run.
position() with odometry() and run it again. How close does it get now, and how much worse does it get on a longer run?