The aim of the project is to investigate the function of graph-based algorithms, especially the A* search algorithm. It should be implemented in Matlab and its functionality should be demonstrated on a few examples. In the end, the algorithm should be implemented in ROS - ideally with a simulation of autonomous robot navigation though an environment in Gazebo. As it was my first project in ROS, it should serve as an introduction into this system and could hopefully be useful for other programmers eager to explore its functions.
-
Install ROS melodic or make sure that you have one installed
-
Clone Github repository
-
Copy map files:
'model.config','model.sdf'from maps folder to your Gazebo models folder
Attention: This folder is probably only root-accesible, so usesudosudo cp -r ~/catkin_ws/src/robot_navigation_project/maps/map1 /usr/share/gazebo-9/models sudo cp -r ~/catkin_ws/src/robot_navigation_project/maps/map1-closed /usr/share/gazebo-9/models -
catkin_makerun this command in the 'catkin_ws' workspace to build your code -
rocoreto start the ros core server -
Setup robot model variable
Turtlebot3will be user with available models:burger, waffle, waffle_pihttp://emanual.robotis.com/docs/en/platform/turtlebot3/navigation/#run-navigation-nodes
Export command:
export TURTLEBOT3_MODEL=burger -
Launch the environment
roslaunch robot_navigation_project robot_navigation.launch -
Run the python scripts you like. In the src folder, there are:
/movement functions - basic robot movement, see details below
/a_star_python_algorithm - separate codes and maps for small algorithm tests, also with visual input/output
path_planer_client.py - client sending two types of requests to the server:
SetOccupancyGrid.srvfor saving the map on the serverCalculatePath.srvfor request of path calculation between A and Bpath_planner_server.py - server which receives the requests and either saves the map or calculates the path
StatusMsg.msgis returned when map is successfully saved The map is saved inMatrix2D.msgmessage type...a_star.py - the algorithm in python
- Reset the robot to initial position
rosservice call /gazebo/reset_world
- Keyboard control
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
- rotate 90 deg with 10 deg/s clockwise
rosrun robot_navigation_project rotate.py 10.0 90.0 True
- move forward at 0.1 m/s
rosrun robot_navigation_project move_forward.py 0.1
- distance, speed, forward-direction
rosrun robot_navigation_project move_distance.py 1.0 0.1 True
- print robot pose with rate 5 Hz
rosrun robot_navigation_project pose_observer.py 5
- Allow the execution of the scripts (pythonscript obviously has to be changed to the specific name)
chmod +x pythonscript.py
| Command | Description |
|---|---|
rosnode list |
- display list of running ROS nodes |
rostopic list |
- display list of topics in the package |
rosnode info <<nodeName>> |
- display info about the given node |
rosmsg show <<messageName>> e.g. --> rosmsg show geometry_msgs/Twist |
- display info about a message type (custom or standard) |
rostopic echo <<topicName>> |
- keep printing the data of the topic |
roservice list |
- list of available ROS services |
rosservice info <<serviceName>> |
- details about a service |
rossrv info <<messageType>> |
- info about server request message type |
rosservice call <<serviceName>> |
- call a service |
rossrv show <<serviceName>> |
- check that a service is ready for being called |
rosrun rqt_graph rqt_graph |
- graph of the package nodes and topics |
rostopic pub -1 <<topicName>> <<messageType>> -- '<<parameters>>' e.g. rostopic pub -1 /turtle1/cmd_vel geomtery_msgs/Twist -- '[x y z]''[x y z]' where x y z are to be replaced by the desired velocities (first linear, then rotation) |
- publish once a topic and finish |
- Installation https://www.theconstructsim.com/how-to-install-ros-on-ubuntu/
- Udemy course https://www.udemy.com/course/ros-essentials/
- Launch files in Gazebo http://gazebosim.org/tutorials?tut=ros_roslaunch
- Gazebo in 5 minutes tutorial https://www.youtube.com/playlist?list=PLK0b4e05LnzbHiGDGTgE_FIWpOCvndtYx
- All available Gazebo models https://bitbucket.org/osrf/gazebo_models/src/default/
- Moving a robot in Gazebo (Odometry topic) https://www.youtube.com/watch?v=eJ4QPrYqMlw
- Path planning tutorial https://husarion.com/tutorials/ros-tutorials/7-path-planning/
- Map creation https://www.youtube.com/watch?v=mYwIu4OVMR8
- Other A* implementation in ROS https://realitybytes.blog/2018/08/17/graph-based-path-planning-a/
- http://hades.mech.northwestern.edu/index.php/V-REP_Introduction
- http://hades.mech.northwestern.edu/index.php/A*_Graph_Search_Project
- https://www.youtube.com/watch?v=9U6GDonGFHw
- https://www.geeksforgeeks.org/a-search-algorithm/
- https://www.redblobgames.com/pathfinding/a-star/implementation.html
- https://rosettacode.org/wiki/A*_search_algorithm#Python
- https://realitybytes.blog/2018/08/17/graph-based-path-planning-a/
- https://www.growingwiththeweb.com/2012/06/a-pathfinding-algorithm.html
- https://medium.com/@nicholas.w.swift/easy-a-star-pathfinding-7e6689c7f7b2