Hands and feet · Robot club · about 20 min
See it, approach it, grip it, bring it home.
[1 mark]Put the stages of a fetch in order.
Number the lines 1 to 5 to put them in the right order.
Stop and close the jaws once the ball is in reachSteer towards the blob, slowing as distance() fallsOpen the jawsSpin until a red blob is in viewDrive home with go_to, holding the ball[1 mark]What does this program print?
def bearing_of(cx):
return (cx - 160) * 120 / 320
print(bearing_of(240))
print(bearing_of(100))[1 mark]What does this program print?
for d, error in [(30, 4), (30, 25), (8, 2)]:
speed = 15 if d < 10 else (45 if abs(error) < 10 else 20)
print(d, error, speed)[1 mark]Why does fetch slow to 15 for the last few centimetres?
[1 mark]Inside fetch, the jaws close but holding() is None. What happens next?
[1 mark]fetch has used all 250 ticks without holding the ball. What does it do?
[1 mark]fetch waits 0.1 s each tick for up to 250 ticks. Ignoring the time spent gripping, what is the longest it can take, in whole seconds?
Find the red ball, fetch it, and leave it in the home zone.
Plan your program here, then type it in and press Run.
fetch gives up after 250 ticks, but find_ball spins forever if no ball is in view. Make both give up after 10 seconds, with fetch returning False.