Occupancy Grid

This entry is part 3 of 3 in the series Python Robotics Simulator

The easiest way for a robot to map its environment is using an occupancy grid. As the robot moves through its environment, the readings returned from its laser range finder (LRF) at different angles around it are marked off on a map. As a spot is marked more than once, its probability increases. This simulation shows the creation of an occupancy grid map. However, in the real world, odometry is not perfect and the robot’s position (as estimated by odometry) drifts from its real position, resulting in a skewed map. Hence, the requirement for a loop-closing technique like SLAM (Simultaneous Localization & Mapping) that corrects for this error when the robot doubles back on itself and visits a previously known location.

Occupancy Grid Simulation


See the simulation here:

Particle Filter Localization for a Simulated Mobile Robot

This entry is part 2 of 3 in the series Python Robotics Simulator

This simulation shows a robot (red) moving through a simulated environment and a Particle Filter (PF) trying to localize it in that environment. Initially, the particles (shown in different shades of grey indicating their probabilities) do not know the location of the robot and try and localize the robot from scratch. This is called global localization. After the robot moves about in its environment, the particles coalesce on the robot’s correct position. Thereafter, it is easier for the PF to track the position of the robot and this is called position tracking. Note that the environment is quite symmetric and this is why the PF has difficulty in finding the robot in the beginning, but gets there in the end.

Particle Filter Localization for a Simulated Mobile Robot


The measurements are simulated laser range finder readings (see previous post: Simulated Laser Range Finder Readings Using Python & OpenCV).
The code is written in Python using the OpenCV library (wrapper for python). It is adapted from PF code written by Juan Carlos Kuri Pinto and the Udacity team over at Udacity University’s online Autonomous Driving class (http://www.udacity-forums.com/cs373/questions/14131/unit-3-graphical-demo-of-ro­bot-localization-based-on-particle-filters).

See the video of the simulation here:

I’ll put the code up as soon as I’ve tidied it up a bit.