I have implemented a Monte Carlo Localization program with a PC and NXJ program communicating over Bluetooth. The Monte Carlo localization method is an example of the particle filtering algorithm. It is described in Chapter 25 of the book: "Artificial Intelligence: A Modern Approach" - see http://aima.cs.berkeley.edu/.
You produce a map of the room or other closed environment that you want your robot to explore and put the robot down in a random position. It then works out where it is by moving about randomly, making range measurements to the walls with the ultrasonic sensor, and comparing them with the map.
The way the algorithm works is to spread a set of particles with random "pose" (position and angle) across the interior of the mapped area. Whenever the robot takes range readings, they are used to produce a "weight" for each particle. The particles are then resampled with those with higher weights being more likely to be selected. The new sample includes many particles at the same location. The graphic display shows the particles thinned out with only those with a reasonably high probability of being in the robot's location being shown. When the robot makes a random move it is applied with random noise to each particle. This makes the partcles spread out into clusters.
As the algorithm proceeds the display shows the particles converging into little clusters showing the possible location of the robot. After a while there is a single cluster showing the robot's true position.
The robot needs to be a wheeled vehicle that support the Pilot class and has an ultrasonic sensor mounted above its center of rotation. It runs the Respond program - see http://homepage.ntlworld.com/lawrie.gri ... espond.zip.
The code for the PC Localization program is at http://homepage.ntlworld.com/lawrie.gri ... zation.zip.
