Lesson 12: Follow the tape
此页面需较新浏览器(支持 SharedArrayBuffer)。请升级 Chrome、Edge、Firefox 或 Safari 至最新版本。
English
Robots in a factory
- Many factory robots follow tape on the floor. People can change the route with a roll of tape, not with new code.
- The down eye under the robot sees the colour of the floor. On the tape
down_eye.detect(BLACK)isTrue. - The eye only sees the spot under the middle of the robot. So the robot cannot see a corner coming: it notices the corner when the tape is gone.
Words for this lesson
| Word | Meaning |
|---|---|
| tape | a long strip stuck on the floor |
| loading bay | the place where goods are put on a lorry |
| corner | where the tape changes direction |
| guess | try one way without knowing if it is right |
| trial and error | try, look, go back if you were wrong |
English
Black or not black?
from vexcode_vr import *
def main():
drivetrain.drive_for(FORWARD, 300, MM)
if down_eye.detect(BLACK):
brain.print("on the tape")
else:
brain.print("no tape here")
vr_thread(main)
- Here the floor is empty, so the robot prints
no tape here. On a task map, try it at the start of the tape.
English
How the robot finds a corner
- On black: drive 25 mm, then look again.
- Not black: the robot has gone past the corner. Drive back 50 mm: the eye is on the corner again.
- Turn and go on along the new piece of tape.
- Short steps are slower, but the robot can never go far off the tape.
难度 3/5 · 今日首次完成可获 200 金币及少量额外奖励
In the factory, black tape on the floor shows the way to the green loading bay. On these maps the tape only turns left. While the down eye sees black, drive 25 mm. When the robot loses the tape, it has gone past a corner: drive back 50 mm and turn left 90°.
点击“运行”查看此处输出。
难度 4/5 · 今日首次完成可获 280 金币及少量额外奖励
Now the tape turns left and right. At a corner, try left first: turn left 90° and drive 100 mm. If the eye sees black, you found the tape. If not, drive back 100 mm and turn right 180°. Reach the green bay on every map.
点击“运行”查看此处输出。