Kinematics and frames · University · about 40 min
Drive a square in world coordinates while the robot spins, which only a holonomic drive can do.
[1 mark]Put the structure of the spinning square in order.
Number the lines 1 to 6 to put them in the right order.
apply the inverse kinematics with the heading you have nowset the speed in proportion to the gap, cappedadd the rotation term, all the way roundfor each corner of the square:until close to that corner:work out the vector to the corner, in the world[1 mark]world_drive is asked for 10 cm/s due east at three headings the spinning robot passes through. With V_MAX = 20 and V_LAT = 15, what does this print (heading, fwd, lat)?
import math
V_MAX, V_LAT = 20.0, 15.0
for h_deg in (0, 90, 180):
a = math.radians(h_deg)
wx, wy = 10.0, 0.0
vx = wx * math.cos(a) - wy * math.sin(a)
vy = wx * math.sin(a) + wy * math.cos(a)
print(h_deg, round(100 * vy / V_MAX), round(100 * vx / V_LAT))[1 mark]The robot spins as it should, but instead of heading east its path curls round in circles. What is the likely bug?
[1 mark]Along one side of the spinning square, which of these change from tick to tick?
Tick every answer that is true.
[1 mark]world_drive(10, 0, 25) is called every 0.1 s for 40 ticks. Ideally, how far east does the robot travel, in cm?
[1 mark]The whole square is driven with odometry() instead of position(). Why is the fourth corner the least square?
Visit the four corner zones in order, east then north then west then home, with a rotation term running all the way round.
from bugbot import * import math connect() V_MAX, V_LAT = 20.0, 15.0 # the corners, in cm from where the robot started CORNERS = [(40, 0), (40, 60), (-20, 60), (-20, 0)]
Plan your program here, then type it in and press Run.
odometry() instead of position(). How square is it by the fourth corner?