Lesson 2-8 · Detecting Intersections — Knowledge ChecksAnswer key
Why test is_at_cross() with a straight drive before using it in the line follower?
One new piece at a time. When the test program has only is_at_cross() and a straight drive, a failure points at exactly one place. Put it inside the follower first and a problem could be in either.
What makes track_to_intersection() stop?
The while condition is not is_at_cross(). The moment both sensors see the tape of a cross, the loop ends and the robot stops — however long that took.
In track_to_intersection(), where is the intersection detected?
The loop condition asks is_at_cross() every pass. The body never mentions the cross: it reads, computes, steers. Each part has one job, which is what makes each one testable.
Why does track_to_intersection() end by driving 8.75 cm rather than driving for half a second?
The course avoids timing-based movement everywhere. Distances and sensor readings describe the world; a duration describes a guess about the motors.