Pattern matching in occupancy grid.
Robot has to have been here before Take a 360 sonar scan and store it in a temporary occupancy grid (called a "local" map).
You know how far the robot could have deviated on the map due to odometer accuracy. The robot thinks it is at X,Y according to odometer, but could actualy be at X+-Error, y+-Error.
Error becomes larger the more the odometers turn (IE, the more the robot turns it's wheels). When you localize, you reset Error to zero.
to localize, you consider all cells x+-error, Y+-error.
take the 360 scan, store it temp local map.
now to compare local occupancy grid to global occupancy grid.
start on cell X-error, Y-error in the global map. compare which cells match in local map compared to this reference point. Store the number of matches in an array.
next cell is X-error+1,Y-error. Compare which cells match in local map compared to this reference point. Store the number of matches in array.
once done with all Cells in global map (x+-error, Y+-error), cycle through the array of number of matches. The cell with the highest number of matches between global/local maps is the cell that the robot is most likely to be located at.
I don't think that this is exactly what you want, but it does compare room information (gathered on previous explorations) to a sonar scan, and will figure out if you are in a room....
You could turn the robot off, move it to another room, switch back on, and tell it to "localize"...
Error would be infinite, so all cells in the global map would be checked. It would take a much larger ammount of time to localize without a specified Error, but can be done (works with my software, but I've only done it a few times for novelty)
Rich