Exercise 4
Create a “wall following” function. To follow a wall, your function should include these three steps:
- Move forward in a curved path (curving to the left or right) until an obstacle is detected.
- Move straight back a short distance.
- Rotate in the opposite direction (45° to 90°).
To test your function, write a program that calls it repeatedly. You will need to adjust the distances and angles in your function to make your robot perform well. Your program should be able to handle corners as well as straight sections of wall. Test your program on your classroom wall, or construct a small maze out of cardboard!