Obstacle Avoidance Vocabulary
Word Bank
| sensor | UltrasonicSensor |
distance |
if |
else |
condition |
while loop |
wait |
trigger distance |
| millimeter | sensor data | DriveBase |
Fill In the Blanks
- A measures something about the world and reports it as a number.
- The distance sensor’s reading comes from , and it returns 2000 mm when nothing is in front of it.
- The unit the distance sensor uses is the .
- An runs its code only when the condition is true.
- The part runs when the
ifcondition is false. - The true-or-false test an
ifchecks, likeeyes.distance() < 200, is the . - A keeps repeating;
while True:repeats forever. - When the robot does something unexpected, that’s — it did exactly what the code said.
Quick Checks
-
Circle the unit used by
distance():
degrees/millimeters/seconds -
The sensor has nothing in front of it. What number does
distance()give?
Circle one:0/200/2000 -
The robot stops too far from the wall. Should you make the trigger number bigger or smaller?
Circle one:bigger/smaller -
A
while True:loop runs forever. How do you stop it?
Stretch: Read the Code
What will this robot do? Write it in plain words.
while True:
if eyes.distance() < 200:
robot.straight(-100)
robot.turn(90)
else:
robot.drive(150, 0)
wait(10)
It will: