The mapping behaviour on board the robot is very basic given the processor and in particular memory constrains. The on-board mapping behaviour is designed to determine the path of least resistance and point the robot in that direction.
The behaviour checks each of the front and side sonar measurements and compares them to the centre sonar measurement. If it finds that another sonar is measuring a distance a configurable percentage (69% currently) greater than the current forward sonar then it will command the robot to turn so that the front sonar then faces that direction.
To prevent miscalculations the mapping algorithm ensures that the candidate sonar returns similar readings on two consecutive occasions before committing itself to driving the robot in that direction. This number is the same as the number of times the Stall Behaviour has to detect a stall condition.