Kinematics and frames · University · about 25 min
From the command to the body velocity to the path over the ground.
[1 mark]Put the stages of forward kinematics in order, from what you send to where the robot ends up.
Number the lines 1 to 4 to put them in the right order.
world velocityposition over timebody velocity, in cm/scommand, in percentcommand, in percent body velocity, in cm/s world velocity position over time
Scale by each axis's full scale, rotate by the current heading, then integrate.
[1 mark]The forward kinematics predict a 3 s run at forward(70) for a robot at heading 30, with V_MAX = 20. What does this print?
import math
V_MAX = 20.0
fwd, seconds, h_deg = 70, 3.0, 30
v = (fwd / 100) * V_MAX
h = math.radians(h_deg)
print("predicted x:", round(v * math.sin(h) * seconds, 1))
print("predicted y:", round(v * math.cos(h) * seconds, 1))predicted x: 21.0 predicted y: 36.4
v = 0.7 × 20 = 14 cm/s, so 42 cm in 3 s. Of that, 42 sin 30 = 21.0 goes along x and 42 cos 30 = 36.4 along y.
[1 mark]With W_MAX = 120 deg/s, how many degrees does drive(0, 0, 25) turn the robot in 3 s, by the forward kinematics?
[1 mark]A forward kinematics prediction of a straight run is close but not exact. Which of these does the lesson say the model leaves out?
Tick every answer that is true.
[1 mark]A turning robot's position is predicted by x += wx * dt using the heading at the start of each step. When does the choice between that and the exact arc matter?
[1 mark]In stage two, which heading should rotate the body velocity into the world?
Before driving, print where the forward kinematics say the robot will end up, as predicted x: and predicted y:. Then drive it and see. The robot does not start facing along an axis, so the rotation matters.
from bugbot import * import math connect() # predict first, then drive
The hint students can ask for: Work out the body velocity you are about to ask for, rotate it into the world with the heading you are at, multiply by how long you will drive, and print that before you drive. Then drive it.
from bugbot import *
import math
connect()
v = 14.0 # roughly what 70 percent gives this drive
seconds = 3.0
h = math.radians(heading())
px = v * math.sin(h) * seconds
py = v * math.cos(h) * seconds
print("predicted x:", round(px, 1))
print("predicted y:", round(py, 1))
forward(70)
wait(seconds)
stop()
wait(0.6)
print("actually", position())
Any program that meets the task's checks is marked correct in the simulator; this is one way, not the only way.