This repository implements the RRT* (Rapidly-exploring Random Tree Star) algorithm for path planning in a 2D environment. The project integrates with ROS (Robot Operating System) and uses Turtlesim to visualize the planned path.
- RRT Algorithm*: Efficient path planning with obstacle avoidance.
- Turtlesim Integration: Moves a turtle along the planned path in the Turtlesim simulator.
- Image-based Environment: Reads start, goal, and obstacles from an input image.
- Visualization: Displays the RRT* tree and the final path using OpenCV.
Image1.pngandImage2.png: Sample images defining the environment. Green represents the start point, red represents the goal, and black represents obstacles.move_turtle.py: ROS node to move the Turtlesim turtle along the planned path.RRT_Star.py: Implements the RRT* algorithm and publishes the planned path.turtle_rrt.launch: ROS launch file to start the Turtlesim node and the path planning nodes.
- ROS (Robot Operating System) installed on your system.
- Python 3.x with the following libraries:
numpyopencv-pythonPillow
- Turtlesim package installed in ROS.
- Clone the Repository:
git clone https://github.com/Dheeraj-yellapu/Path-Creation-on-an-Image-Using-RRT-Algorithm
- Prepare the Environment: Ensure ROS is sourced and the required Python libraries are installed:
pip install numpy opencv-python Pillow
- Run the Launch File: Use the provided launch file to start the simulation:
roslaunch turtle_rrt.launch
- Modify the Image: Update the image_path in RRT_Star.py to point to your custom environment image.
- Visualize the Path: The RRT* algorithm will display the tree and the final path in an OpenCV window. The turtle in Turtlesim will follow the planned path.
-
Environment Setup: The environment is defined by an image where:
Green pixel ([34, 177, 76]) represents the start point. Red pixel ([237, 28, 36]) represents the goal point. Black pixels ([0, 0, 0]) represent obstacles.
-
Path Planning: The RRT* algorithm generates a tree of possible paths and finds the optimal path to the goal while avoiding obstacles.
-
Path Execution: The planned path is published as a ROS topic (/rrt_star_path), and the move_turtle.py node subscribes to this topic to move the turtle.