Following a Wall with Dynamic Alignment

Our first algorithm to follow a wall had the robot continue to go forward as it was correcting alignment problems.

• The robot does not lose any extra time in aligning to the wall.

• The robot is always trying to correct its situation as it was a few moments earlier. This lag time in the robot's response to its environment meant that the robot was unable to navigate effectively through the maze.

Making a 90° Turn with Sensors

We originally worked on a turn procedure that was entirely dependent upon sensor readings. When the front sensor detected a wall (indicated by the sensor reading crossing a certain threshold), it signaled the robot to begin its turn. The robot continued to turn until the front sensor reading indicated that there was no longer a wall directly in front of the robot (determined by another threshold value), i.e., that the robot had completed the turn and should now go forward again. It then returned to the wall-following procedure.

• We liked the idea of relying solely on sensor readings to make a turn, instead of any sort of dead-reckoning method (such as a timed turn), because we thought it would be less likely to vary with changes in the environment.
• This procedure involved a great deal of experimentation with threshold values, but we did finally get it to work relatively consistently. The robot was then able to follow a wall down the hallway and, when it reached the end of the hallway, turn the corner.

• If the environment changed significantly, the thresholds that we settled on may no longer be valid.
• Since the turn was entirely dependent upon sensor readings, ensuring that it would always work would require predicting every possible combination of sensor readings, which simply is not feasible for us to do.

And indeed, when we returned from Spring Break, it no longer worked. Unable to quickly determine the cause of the problem, recognizing the inherent imprecision of the procedure, and with the competition approaching quickly, we opted in favor of a timed turn.

Making a 90° Timed Turn

When the front sensor detects a wall (indicated by the sensor reading crossing a certain threshold), it signals the robot to begin its turn. The robot continues to turn for a specified period of time, aligns itself with the new wall, and then returns to the wall-following procedure.

• This method does not rely on the sensor readings. This is good because we can't always know exactly what the alignment of the robot is simply from the sensor readings.

• We discovered that the amount the robot turns in a timed turn is dependent upon two factors: the specified time, and the strength of the battery (which varies, relative to how recently it has been replaced). Because the only way to control for the second variable was by changing the amount of time the robot turns for, this seemed like a bad idea. (For example, we would have to lower all the timed turn values when we replace the battery, and incrementally increase them as the battery wears down.)

This procedure involved some experimentation with the threshold value for detecting the wall, and also with the amount of time needed for the turn. After we realized that the thresholds which we came up with would not always be accurate we decided to try another method for making a 90° turn.