This repository provides some main algorithms of path planning and implements those algorithms on ROS platform using AMCL localization. A path planning algorithm is composed of two parts:
-
Global Path Planner: Based on algorithms of the global path planner, the robot searches an optimal path to travel from departure to destination with no conflicts.
-
Local Path Planner: Based on the results of the global path planner, the local path planner divides the path into segments and finds the best travelling path on each segment.
-
Dependencies Installation:
Update your software package first. Make sure to choose the appropriate server from
Software & Updates
on your Ubuntu.$ sudo apt-get update $ sudo apt-get upgrade
Note: Make sure you are installing ROS and its dependencies with the appropriate versions when you type following commands, which now actually fits ROS Noetic only.
$ sudo apt install python-is-python3 $ sudo apt install ros-noetic-amcl $ sudo apt install ros-noetic-base-local-planner $ sudo apt install ros-noetic-map-server $ sudo apt install ros-noetic-move-base $ sudo apt install ros-noetic-navfn
-
Compile the project and Run (rename the root folder as
ros_motion_planning
first)$ cd ros_motion_planning/ $ catkin_make
-
Execute the project.
$ cd ./src/sim_env/scripts/ $ sudo ./main.sh
Note: If you meet some errors that are hard to solve when you run
sudo ./main.sh
, try running commands ofmain.sh
step by step in your terminal, like:$ cd ./src/sim_env/scripts/ $ source ../../../devel/setup.bash $ python ../../third_party/dynamic_xml_config/main_generate.py user_config.yaml $ roslaunch sim_env main.launch
-
Use 2D Nav Goal to select the goal. Succeed!
-
Automatically send a goal to your robot if you want to.
to be conducted ...
ros_motion_planner
└── src
├── planner # algorithms mainly
│ ├── global_planner
│ ├── local_planner
│ └── utils
├── sim_env # simulation environment
│ ├── config
│ ├── launch
│ ├── maps
│ ├── meshes
│ ├── models
│ ├── rviz
│ ├── scripts
│ ├── urdf
│ └── worlds
├── third_party
│ ├── dynamic_rviz_config
│ ├── dynamic_xml_config
│ ├── gazebo_plugins
│ └── rviz_plugins
└── user_config # user configuration file
Change configs through modifying the ./src/user_config/user_config.yaml
. For example, you can change the global_planner and local_planner as you want. When you run commands in main.sh
, the python script will regenerate .launch
, .world
and so on, according to your configs in that file.
Below is an example of user_config.yaml
:
map: "warehouse"
world: "warehouse"
rviz_file: "sim_env.rviz"
robots_config:
- robot1_type: "turtlebot3_waffle"
robot1_global_planner: "rrt"
# Graph Planner Options: a_star, jps, gbfs, dijkstra, d_star, lpa_star, d_star_lite, theta_star, lazy_theta_star, voronoi
# Sample Planner Options: rrt, rrt_star, informed_rrt, rrt_connect
# Intelligent Planner Options: aco
robot1_local_planner: "dwa"
# pid dwa static apf
robot1_x_pos: "0.0"
robot1_y_pos: "0.0"
robot1_z_pos: "0.0"
robot1_yaw: "0.0"
# plugins:
# pedestrians: "pedestrian_config.yaml"
# obstacles: "obstacles_config.yaml"
# map_layers: "maps_config.yaml"
Explanation:
map
: static map,located insrc/sim_env/map/
, ifmap: ""
, map_server will not publish map message which often used in SLAM.world
: gazebo world,located insrc/sim_env/worlds/
.rviz_file
: RVIZ configuration.robots_config
: robotic configuration.type
: robotic type,such asturtlebot3_burger
,turtlebot3_waffle
andturtlebot3_waffle_pi
.global_planner
: global algorithm.local_planner
: local algorithm.xyz_pos and yaw
: initial pose.
plugins
: other applications using in simulation.pedestrians
: configure file to add dynamic pedestrians.obstacles
: configure file to add static obstacles.
Except for the above mentioned, you can use pedestrians and obstacles by cancelling code annotation in user_config.yaml
and modifying configuration files although there is no need to do so to run this project successfully.
To be conducted. FYI, following is some information which may be useful.
We use another gazebo simulation as an example, like we have a robot which has the capacity of localization, mapping and navigation (using move_base).
-
Download and compile this repository.
$ cd <your_workspace>/ $ git clone https://github.com/ai-winter/ros_motion_planning.git $ cd ros_motion_planning/ $ catkin_make
-
Download and compile the 'real robot' software.
$ cd <your_workspace>/ $ git clone https://github.com/ZhanyuGuo/ackermann_ws.git $ cd ackermann_ws/ $ # ---- IMPORTANT HERE, reasons in NOTE ---- $ source <your_workspace>/ros_motion_planning/devel/setup.bash $ catkin_make
Note: Sourcing other workspaces before
catkin_make
will make the currentsetup.bash
contain former sourced workspaces, i.e. they are also included when you only source this current workspace later.Remember: Remove the old
build/
anddevel/
of current workspace before doing this, otherwise it will not work. -
Change the base_global_planner and base_local_planner in real robot's
move_base
as you need.<?xml version="1.0"?> <launch> <!-- something else ... --> <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen"> <!-- something else ... --> <!-- Params --> <!-- for graph_planner --> <rosparam file="$(find sim_env)/config/planner/graph_planner_params.yaml" command="load" /> <!-- for sample_planner --> <rosparam file="$(find sim_env)/config/planner/sample_planner_params.yaml" command="load" /> <!-- for dwa_planner --> <rosparam file="$(find sim_env)/config/planner/dwa_planner_params.yaml" command="load" /> <!-- for pid_planner --> <rosparam file="$(find sim_env)/config/planner/pid_planner_params.yaml" command="load" /> <!-- Default Global Planner --> <!-- <param name="base_global_planner" value="global_planner/GlobalPlanner" /> --> <!-- GraphPlanner --> <param name="base_global_planner" value="graph_planner/GraphPlanner" /> <!-- options: a_star, jps, gbfs, dijkstra, d_star, lpa_star, d_star_lite --> <param name="GraphPlanner/planner_name" value="a_star" /> <!-- SamplePlanner --> <!-- <param name="base_global_planner" value="sample_planner/SamplePlanner" /> --> <!-- options: rrt, rrt_star, informed_rrt, rrt_connect --> <!-- <param name="SamplePlanner/planner_name" value="rrt_star" /> --> <!-- Default Local Planner --> <!-- <param name="base_local_planner" value="teb_local_planner/TebLocalPlannerROS" /> --> <param name="base_local_planner" value="pid_planner/PIDPlanner" /> <!-- <param name="base_local_planner" value="dwa_planner/DWAPlanner" /> --> <!-- something else ... --> </node> <!-- something else ... --> </launch>
-
Run! But maybe there are still some details that you have to deal with...
- Our algorithms, robot and world models are mainly from ros_motion_planning, Dataset-of-Gazebo-Worlds-Models-and-Maps and aws-robomaker-small-warehouse-world. Thanks for these open source repos sincerely.
The source code is released under GPLv3 license.
Feel free to contact us if you have any question.