Implementation of a basic RRT algorithm in Python.
This script makes use of the following libraries which can be installed using the pip command.
- Treelib
- Scipy
- Numpy
- Matplotlib
pip install treelib
pip install numpy
pip install scipy
pip install matplotlib
As numpy and scipy are dependencies of treelib, they should automatically install. Ensure that the python3-tk package is installed.
sudo apt install python3-tk
Download the RRT.py script and run it from the terminal (Linux) or in Python 3 (Windows).
python3 RRT.py
In case it does not run (for Linux), navigate to the directory where RRT.py is stored and run in Terminal:
chmod +x RRT.py
and then run
python RRT.py
The scripts prompts the following input information:
- Dimensions of the configuration space
- (x,y) of the starting point
- (x,y) of the destination point
- Number of obstacles, and their dimensions.
- Number of nodes to be generated by the RRT algorithm.
There are 2 paramters that can be tinkered with, according to the application.
- Tolerance - the radius around the destination location, within which a node is accepted as the destination node.
- Qdel - the step size, higher the step size, wider the spread of nodes
The RRT map is generated in blue and the obstacles are in red
- If the goal is reached, the terminal prints Goal Reached! and the path is highlighted in Green.
- If the goal is not reached, there is no path highlighted in green. The number of nodes or qdel must be altered to get a path.
- If the destination or start point is unreachable, an error message is displayed.