Lesson 8 · Implementing the Navigator Class — Knowledge ChecksAnswer key
How does the Navigator control the robot's motors?
The Navigator asks LineTrack to turn and follow lines; LineTrack (built in Module 2) owns the DifferentialDrive. That's delegation — reusing code you already wrote.
Why does desired_heading() use self.position instead of a 'current' parameter?
A class bundles data with behavior. The Navigator stores its position, so its methods can read it directly instead of having it passed in every time.
Why drive straight(8) before track_until_cross() only when going straight ahead?
When turning, turn_right() already moves off the cross. Going straight, the robot is parked on the cross — without clearing it, the sensors detect it immediately and stop early.
The path from Manhattan is [(1,0),(2,0),(2,1)]. How many times does drive_path call track_until_cross()?
drive_path loops once per element in the path, and each pass ends with a track_until_cross() to reach that intersection. Three elements → three calls. The start isn't in the path.