Aside from designing algorithms to vacuum the floor, we have had to tackle a few other problems. Two of those problems are the inaccuracy of dead reckoning, and the difficulty of short distance obstacle avoidance using only the sonar readings of the Pioneer robot.
Dead Reckoning. The Saphira software keeps an estimate of the robot's global position. While good enough to correlate sonar readings over time, this estimate is not sufficiently accurate to keep the robot's position on a map over a long interval. Our code extends the accuracy of this estimate by comparing sonar readings with the arrangement of items near the robot on a map. First, the program attempts to fit a straight line to the point locations of recent sonar readings. It discards points until the remaining data can be fit with acceptably small error. If a fit is found without discarding too many points, the program assumes that a wall has been detected. It then scans the map, trying to find a line segment with position and orientation, relative to the robot's estimated situation, most similar to that of the observed line. If the map segment found is similar enough, it is assumed to correspond to the observed segment. Any disparity between the two is therefore assumed to represent the difference between the actual and estimated position of the robot, and the estimate is adjusted accordingly.
Close-range obstacle avoidance. We found that the sonar sensors provided with the robot were insufficient to reliably detect objects within one foot of the robot. We decided to add visible light sensors based on photo resistors, instead of infrared, because of cost considerations. Eight sensor modules are attached to the robot, two per side. Each sensor module consists of three photo resistors, three standard resistors, a light source, two comparators, and an OR gate. All components are mounted on a vertical member attached to the side of the robot. One photo resistor is mounted facing up on the top of assembly. The other two photo resistors are mounted facing horizontally, at the top and bottom. The light is mounted horizontally in the middle. The components are then connected as detailed in Figure 2. (Photo Resistors A, B, and C correspond to vertical, top, and bottom.) Under standard lighting conditions this assembly can sense walls up to four inches away, under half light, the range extends to one foot.