A Python implementation of the A* algorithm coupled with a particle filter for localization.
This project is a python simulation for a rover exploring a planet. The world is simulated by a 2D black and white image.
A big assumption used here is the fact that the rover has a prior knowledge of this world (a necessary condition for the A* algorithm). Yet, we implement some obstacles (in white) that the rover doesn't know.
Once the rover has planned its path, it will travel along it. Noise is added for every action the rover makes. When it moves, a Gaussian noise is added to its speed and to its rotation. A sensing noise is also added to the measurements that the rover makes on the landmarks.
At every step, the rover estimates its position using the particle filter. Based on this estimated position and the path it needs to follow, it will compute its next control input for the following step.
Everytime a new obstacle is discovered, the rover will recompute its path, taking into account the new landscape.
A few python packages are necessary to run the code:
- OpenCV (cv2)
- matplotlib
- numpy
Note that Python 3.10 is required.
In order to save the animation, the program also use FFMPEG.
Once the repo is cloned, and you have installed the dependencies, you can directly run the code with:
$ python main.py
Some map examples are provided in the images folder, you can also easily create one you like using a software like GIMP.