Make your own free website on

Step 1.   Exiting the arbitrary start room.   This is the first step executed after either the tone or manual switch starts the robot.

A.    Operating case 7 pivots the robot and scans the walls.  The robot has 4 Sharp GP2D12 IR range sensors pointed laterally.  Two on the left side and two on the right.  With one on the front on each side and one on the back.  For the purpose of finding a nearby wall in this case, only the right side sensors are used.  This is because the robot pivots clockwise, and when the direction to a wall on the right side is detected, the robot only has to pivot an additional 90 degrees to point toward the wall.

    The direction to a wall is determined by comparing the distance measurements of the right front and rear sensors.  When a wall is perpendicular to the right side, the two measurements will be equal.  Unfortunately, the measurements can also be equal when the robot is at a 90 degree angle to a corner; such that the two sensors are looking at different wall; or, if furniture is used, the sensors might be looking at a furniture and a wall which happen to be at the same distance.

    One measurable characteristic of a REAL wall is that, as the sensor sweeps by the wall, the measurement smoothly decreases to a minimum value and then slowly increases.  As the sensor goes by a corner or a furniture, its measurements change rapidly.  So equal measurements accompanied by rapid changes are ignored.

After pointing toward a wall,  an assessment is made of how close the robot is to any adjacent walls; so that it doesn't accidentally bump into a nearby wall on the side as it attempts to get closer or farther from the wall in front.  If it is close to a nearby wall, it does some maneuvers to get away from the wall.

    Whatever maneuvering may be necessary  to get safely away from a very close wall, a final operation is to pivot such that the robot is parallel to the wall on its right side.  With the previous maneuvering, it should be parallel and approximately 9 inches from the wall (measured from the center of the robot).  This is the normal tracking distance for the robot as it is the equivalent of the center of the hallways where each wall is 9 inches from the center of the robot.

    The operation which pivots is basically a 90 degree pivot to the left (since the robot was pointed toward the wall).  However, since the original point toward the wall is not always very accurate, this 90 degree pivot also assesses the angle of the robot to the wall and continues the pivot until the robot is parallel.

    At this time, the robot goes into a wall following mode based on the right wall.  It follows the wall until either a wall appears ahead of the robot, or the wall disappears (indicating a doorway).  If a wall appears ahead, the robot approaches the wall to a distance of 9 inches.  Then the robot performs another 90 degree pivot to the left until it is parallel to the new wall.  It then continues in wall following mode and continues this way until the doorway is found.

    When the doorway is found, the robot must determine which room it is exiting.  This can be done by measurements taken just before or after reaching the doorway.  If, after making a 90 degree left pivot, the robot's right front side looking IR ranger does not see a wall, it must be in room 4.   If, just before reaching the doorway, the robot has seen both the left and right walls for some time, it must be leaving room 3.  (note that the wall does not disappear leaving room three until reaching the central intersection; a couple feet after leaving the door of room 3).  This doesn't matter as the robot still knows where it is; and had to go this way anyway.

    If neither room 3 or room 4 was determined, the robot proceeds forward about 10 inches to the center of the hall.  If leaving room 1, it will be in the center of the hall right outside room 1 pointed toward the opposite wall.   If it has left room 2, it will not lose the wall until reaching the doorway of room 1.  And after proceeding forward 10 inches, it will be in the center of the hall outside room 1 but pointed down the hall toward room 4.  So, if it sees a wall 9 inches ahead, it left room #1.  If not, it left room 2.

    Based on the decision above, the software branches to a list of instructions which will navigate to the other three rooms. 

Data out of this section:   known location & store start room number.