The simulated robot uses beam sensors like sonar or IR range sensors. Consequently a probabilistic beam model for range finders is used. The details of this model can be found in section 3.2.2 of Laaksonen's Bachelor's thesis or in the book Probabilistic Robotics. The model is made of of four components:
- A normal distribution around the correct range (measurement noise): phit
- An exponential distribution cut off at the correct range to model unexpected objects like people that lead to shorter then expected measurement values: pshort
- Failures resulting in measurements that reflect the maximum range measurable by the sensor (e.g., caused by specular reflection): pmax
- Random, unexplainable measurements modeled as a uniform distribution from zero to the maximum measurement range: prand
Finally the contribution of these four components is controlled by the weighing factors zhit, zshort, zmax, zrand adding up to one. The beam model is implemented in the class BeamModel which uses the WeighingFactors class.The resulting probability distribution is shown on the Beam Model tab of the application.
The various parameters of the model are shown below the graph.
In the case of a real robot the actual measurements would obviously come from the physical sensors. However, since we simulate the robot we need to sample the beam model distribution. The sampling logic is implemented in the BeamModelSampler class. It leverages Stefan Troschuetz's useful Troschuetz.Random library to handle normal and exponential distributions.
Finally we need to define the physical arrangement of the sensors on the robot and simulate sensor measurements based on the pose of the robot within a map. This is covered by the Sensors tab:
As before the robot is drawn as a blue circle. The controls in the lower section of the tab can be used to modify the pose of the robot within the map. Clicking on the Measure Noisy Distance button simulates real measurements by first calculating the real distance from the map for each sensor and then sampling from the beam model to get realistic, noisy measurement values. Currently the simulation assumes a robot with five sensors (this can easily be changed in the Robot class). The measurements (heading and distance) are visualized as red rays. The screenshot clearly shows the (intended) inaccuracy of the simulated measurements. Three of the sensors yield distances that a slightly too far, one sensor provides a value that is too short, and one sensor (the one pointing to the upper right) yields a max range value since the distance to the next wall is too far.
Armed with a motion model and a perception model we are now ready to discuss the Monte Carlo Localization implementation.