Rapidly-exploring Random Trees (RRT) is an algorithm for path planning and exploration. It is useful for navigating spaces in complex environment. Bidirectional RRT & RRT* are variation/extended versions of regular RRT. The nodes sampled by RRT can be used by other searched-based path planning algorithm e.g. Astar, to obtain paths for other start-goal pairs
RRT repeatly perform the steps below until a path is found from the start to goal or a specified number of iterations is reached.
- Randomly samples point in the space
- Extends tree towards it
- Checks for collisions
Bidirectional RRT grows two tree, one from start and one from goal, simultaneosly.
RRT* optimizes the path by performing rewiring during node sampling. Rewiring of sampled node ensure it is connected to a parent of lowest cost and it will be the best parent to other nodes. RRT* can improve the path with more nodes sampled.
Process other path query by searching up the map generated by RRT.
rrt_simulate.py
run rrt on a random simulated environment returning the path & path cost,pylab
plot visualization allowed, you can specify the arguments in command line as shown below.
usage: rrt_simulate.py [-h] [-x X] [-y Y] [-o O] [--seed SEED] [--len LEN] [--bias BIAS] [--iter ITER] [--bidir] [--star] [--max] [--ani]
RRT Path Planning Simulation Arguments
options:
-h, --help show this help message and exit
-x X Environment X size
-y Y Environment Y size
-o O Number of obstacles
--seed SEED Random seed
--len LEN Max distance allowed for node expansion
--bias BIAS Percentage of biased-sampled goal
--iter ITER Max sampling iteration
--bidir Use bidirectional RRT
--star Use RRT*
--max Sampling for max iteration
--ani Disable animated visualization
interactive.py
run rrt first, likerrt_simulate.py
. After rrt finish planning the first path query, you can pressspacebar
key to change a random path query, the program use astar to find the path solution, the process are visualized on thepylab
plot. Exit by pressingCtrl+C
or cross out the plot window.
cd /path/to/your/directory
git clone https://github.com/bk1021/RRT_PathPlanning.git
pip install -r requirements.txt
utils/environment_2d.py
is from open source robotics course: https://www.osrobotics.org/osr/- The visualization method for RRT path planning is inspired by this video https://www.youtube.com/watch?v=QR3U1dgc5RE