The worksheetDownload the PDF
Answers

7.4 The kicker

Hands and feet · Robot club · about 15 min

BugBotLab

What this lesson is about

kick(): aiming, and how far the ball goes.

Questions 7 marks in all

  1. [1 mark]The kicker's servo is a continuous-rotation servo. What does servo(1, 90) do to it?

    1. AStops it turning
    2. BTurns it to the 90 degree position
    3. CSpins it at full speed
    4. DFires one kick
    Answer: A. For this kind of servo 90 means stop. Numbers further from 90 turn it faster.
  2. [1 mark]Every kick goes about 45 cm. How do you change where the ball ends up?

    1. AChange where you kick from and which way you face
    2. BPass a power, such as kick(30)
    3. CUse servo(1, 180) for a harder kick
    4. DWait longer before calling kick()
    Answer: A. A spring has one strength, so there is no power to choose. Position and heading are what you control.
  3. [1 mark]Put the three steps that kick() does underneath in order.

    Number the lines 1 to 3 to put them in the right order.

    1. servo(1, 90)
    2. wait(1)
    3. servo(1, 91)
    Answer:
    servo(1, 91)
    wait(1)
    servo(1, 90)

    Start the servo turning, let it make one turn (which fires the lever), then stop it before it fires again.

  4. [1 mark]Which of these are true about the kicker?

    Tick every answer that is true.

    1. AIt fires straight ahead, along the way the robot faces
    2. BIt works on a ball held in the jaws
    3. CIt aims itself at the nearest ball
    4. DLeft to keep turning, it fires again every turn
    5. EIt sends the ball about 45 cm
    Answer: A, B, D, E. The kicker does not aim: aiming is turning the robot. It will kick a held ball out of the jaws, and kick() stops after one turn so it fires once.
  5. [1 mark]What does this program print?

    width = 23
    print(round(4 * 92 / width), "cm")
    Answer:
    16 cm

    A 4 cm ball that looks 23 pixels wide is 4 x 92 / 23 = 16 cm from the camera.

  6. [1 mark]The robot faces up the mat. The target zone is 30 degrees to its left. Which line aims the kick?

    1. Aturn_left(30, angle=30)
    2. Bturn_right(30, angle=30)
    3. Cservo(1, 30)
    4. Dkick() then turn_left(30, angle=30)
    Answer: A. The ball flies the way the robot faces, so turn first, then kick. Turning after the kick is too late.
  7. [1 mark]One turn of the kicker takes about 1 s and fires once, half a second in. You run servo(1, 91), wait 3 s, then servo(1, 90). How many times does it fire?

    Answer: 3. It fires at about 0.5, 1.5 and 2.5 s. That is why kick() stops the servo after one turn.

The task: kick it

The ball lies 8 cm away, straight towards the green zone, but you are facing 30 degrees to the right of it, so it is not in front of the kicker yet. Turn to face the zone, then kick so the ball stops in it. Do not drive.

# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()

# kick: one turn of the kicker winds the spring and lets it go
kick()
# pause 4 s (the robot keeps doing what it was told)
wait(4)

The hint students can ask for: The ball lies 8 cm away, straight towards the green zone, but you are facing 30 degrees right of it, so the kicker cannot reach it yet. Turn to face the zone, then kick: a kick goes about 45 cm. Do not drive.

A solution

from bugbot import *
connect()
turn_left(30, angle=30)
kick()
wait(5)

Any program that meets the task's checks is marked correct in the simulator; this is one way, not the only way.