Particle filter is a Monte Carlo algorithm used to solve statistical inference problems. In this project, the turtle location and heading direction in maze was inferred using particle filter. The green turtle is the actual location while the orange turtle is the estimated location. The arrows are particles. Blue arrows stand for low probability particles while red arrows stand for high probability particles. There are four sensors installed on the front, back, left and right of the turtle. The sensors measure its perpendicular distances to the closest walls in four directions, possibly bounded by some sensor limit.
- Python 3.6
- Numpy 1.14
The following parameters could be adjusted for the particle filter.
$ python main.py --help
To run particle filter using default parameters, simply run the following command in terminal:
$ python main.py
$ python main.py --num_particles 1000 --kernel_sigma 500 --random_seed 200
Some of the code in this project were revised from the Beacon Based Particle Filter project. But the robot environment is totally different and the sensor measure mechanism is also totally different. The robot in this project could be more clumsy compared to the robot used in the Beacon Based Particle Filter project, but the particle filter still inferred the correct location and heading direction.
I found that if the number of particles is not sufficiently large, particularly for some complicated environment, such as the maze which looks quite similar in many local regions, and when the sensor is not perfect, sometimes it will take much longer time, after many rounds of particle re-initializations, to get the right location of the turtle. So the number of particles is definitely the most important parameters for particle filter. However, it slows down the computations.
If the number of particles is not sufficiently large, sometimes adjusting the standard deviation of Gaussian kernel might make it converges faster.
Although theoretically it is true, it is amazing to see that the particle filter could infer the heading direction of turtle correctly even if the sensor measurements do not contain direction information directly.
Particle Filter Online: An interesting online particle filter that uses similar designs to mine.