The A* (pronounced "A-star") algorithm is a widely used path planning algorithm in robotics, which is employed for pathfinding and graph traversal, particularly in scenarios where the goal is to find the shortest path between two nodes in a graph. The work below is the implementation of A-star algorithm both in 2-D and 3-D (Gazbeo Simulation) using Python and ROS Noetic.
- Use the "Part1/vinay_anuj_part1.py" file from folder and open any Python IDE or terminal
- If Python IDE is used, please click on the run button Note : Before running please make sure whether these libraries are installed in the system : numpy,cv2,matplotlib,time. Any Library not present can be by typing below command in terminal window using pip: pip install numpy
# Test Case 1 :
Enter the clearance of the robot (0-50 mm)
50
Enter the Left RPM of the motor
30
Enter the Right RPM of the motor
60
Enter the x-coordinate of start node
20
Enter the y-coordinate of start node
20
Initial Orientation of start node of robot(Angle in multiple of 30)
30
Enter the x-coordinate of goal node
300
Enter the y-coordinate of goal node
170
# Test Case 2 :
Enter the clearance of the robot (0-50 mm)
50
Enter the Left RPM of the motor
80
Enter the Right RPM of the motor
80
Enter the x-coordinate of start node
20
Enter the y-coordinate of start node
20
Initial Orientation of start node of robot(Angle in multiple of 30)
30
Enter the x-coordinate of goal node
230
Enter the y-coordinate of goal node
80
- Once the code is run, a few information about the code is printed on the console and the cv2 visualisation video is recorded and saved
- Video will be saved under the name "A-Star.avi". Alternatively, you can find the video in below links
- If Using, VSCode or Spyder you will also see a final plot of the map using Opencv and Matplotlib
The results can be viewed from results folder. The video below shows the A-Star planning executed in 2-D
Figure: A-Star Planning in 2-D
#Test Case
Enter the clearance of the robot (0-50 mm)
20
Enter the Left RPM of the motor
30
Enter the Right RPM of the motor
30
Enter the x-coordinate of start node
20
Enter the y-coordinate of start node
20
Initial Orientation of start node of robot(Angle in multiple of 30)
0
Enter the x-coordinate of goal node
100
Enter the y-coordinate of goal node
20
- First, download the folder from below path after extracting the zip
- Part2/a_star_turtlebot
- Keep this folder "a_star_turtlebot" inside the source folder of your respective ros workspace.
- Perfrom below set of commands now on the terminal window
- cd ~/catkin_ws
- catkin_make
- source devel/setup.bash
- roslaunch a_star_turtlebot a_star_turtlebot.launch
- A new terminal window will be opened where you need to enter the coordinates as in Test Case.
- The turtlebot keeps moving to its goal point. The video link for the same is below:
- Anuj Zore
- Vinay Krishna Bukka