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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.