going through an opening

When the TriBot comes to an opening in the wall, it should turn and go through the opening. You’ll need to modify the code to recognize an opening in the wall and then turn the robot to move into the opening. Once through the opening, the TriBot should continue to follow the wall on its right.

The code you wrote earlier works well for following a straight wall, and it’s helpful to see how it behaves when the TriBot reaches an opening. The existing program may fail, crashing the robot into the wall opposite the opening or sending the robot wandering in circles. But it’s also possible that the program will work, following the wall around the corner of the opening and continuing to explore the maze. Seeing how the program ...

Get The Art of LEGO MINDSTORMS NXT-G Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.