Kinematics and frames · University · about 30 min
The useful direction: a velocity in the world, a heading, and the command that produces it.
[1 mark]The robot faces east, heading 90, and you want it to move due north at 12 cm/s. With V_MAX = 20 and V_LAT = 15, what does this print?
import math
V_MAX, V_LAT = 20.0, 15.0
h = math.radians(90)
wx, wy = 0.0, 12.0
vx = wx * math.cos(h) - wy * math.sin(h)
vy = wx * math.sin(h) + wy * math.cos(h)
print("fwd:", round(100 * vy / V_MAX), "lat:", round(100 * vx / V_LAT))[1 mark]The robot is at heading 180, facing -y. You want a world velocity of 12 cm/s due east (+x), with V_LAT = 15. What lat command does the inverse kinematics give?
[1 mark]In which order does the inverse kinematics work?
[1 mark]The inverse kinematics asks for fwd = 150 and lat = 60. This scales the command down the way the lesson does. What does it print?
fwd, lat, rot = 150.0, 60.0, 0.0 worst = max(abs(fwd), abs(lat), abs(rot), 100.0) fwd, lat, rot = fwd * 100 / worst, lat * 100 / worst, rot * 100 / worst print(fwd, lat, rot)
[1 mark]The same request, fwd = 150 and lat = 60, is instead clipped axis by axis to 100 and 60. What does the robot do?
[1 mark]Which request can a differential drive, with only a left and a right wheel speed, not satisfy?
The robot faces east. Get it into the green zone to the north without turning: heading must still be within 15 degrees of 90 at the end. Use the inverse kinematics.
from bugbot import * import math connect() V_MAX, V_LAT = 20.0, 15.0
Plan your program here, then type it in and press Run.
world_drive() and ask for 40 cm/s. Does the robot still go in the right direction?