We are using sonar as the primary method of obstacle detection. The sonar is mounted at the top of the robot.

When the sonar works properly, our robot wanders around the libra complex without too many problems.

If we have bad batteries in the sonar, or the batteries run out, our robot wanders into walls.

Our wandering algorithm works on three basic conditions:

The turning behavior and emergency behavior have two states - a normal state and an alternate state for when the normal state doesn't work. In the turning behavior, the alternate state is used to straighten the robot to move along the corridor if it is repeatedly running into a wall. In the emergency behavior, the robot turns in small increments looking for an escape route in case it is cornered.

At present, the wandering algorithm does not actively look for openings to go into or use any non-random method to determine which way to turn, but it is structured so as to make these things easy to implement.

The pseudocode we created to do this

Our wandering code can be found here. As we described above, the robot's wandering behavior has been broken up into several subcategories:

Top Level

Normal Behavior To Find a Left Wall To Align To The Left Wall Notes: