Recommended source: ROS navigation tuning guide by Kaiyu Zheng, original here: https://kaiyuzheng.me/documents/navguide.pdf
Local path planner produces twist messages.
Need to define min and max velocities in the yaml config file, e.g.
$ roscd turtlebot3_navigation
$ cd param
$ nano dwa_local_planner_params_waffle.yaml
max velocities:
- translation: move forward then echo odom
- rotation: mave robot tunr in place then echo odom
max accels:
- measure time to reach max speed using time stamps then divide to calculate accel
- measure time to reach max rotational speed using time stamps then divide to calculate rotation accel
min velocities: negative so the robot can backtrack to become unstuck
y-velocity: 0 for non-holonomic robots
Global path planners in ROS must implement the interface nav core::BaseGlobalPlanner
-
initialize
method -
2
makePlan
methods -
destructor
Tutorial to write a path planner: http://wiki.ros.org/navigation/Tutorials/Writing%20A%20Global%20Path%20Planner%20As%20Plugin%20in%20ROS
3 built-in global planners in ROS:
carrot_planner
simplest but inappropriate for complex environments. Tries to reach goal even if it is unreachable.navfn
implements Dijkstra or A* algorithmsglobal_planner
replacesnavfn
but has more options
Local path planners in ROS must implement the interface nav core::BaseLocalPlanner
-
initialize
method executed once -
isGoalReached
method -
computeVelocityCommands
method -
setPlan
method -
destructor
dwa_local_planner
package.
DWA algorithm:
- generate a random set of sample twists (pairs of linear and angular velocities)
- for each sample twist simulate the resulting short-term trajectory (circle arcs)
- evaluate each trajectory using an objective function that considers e.g. speed and proximity to obstacles, the goal, and the global path
- discard illegal trajectories (e.g. colliding with obstacles)
- select the twist resulting in the highest scoring trajectory and send it to the robot
- repeat until robot reaches goal or gets stuck
Requires cost maps: global costmap contains only static obstacles, the local costmap contains also the dynamic ones detected by the laserscan.
sim_time
need a balance: longer simulation times may improve performance but require heavier computation and use more battery. Typical 3<sim_time
<5.
objective function to minimize:
cost = p_dist * distance from endpoint to global path + g_dist * distance from endpoint to goal + occdist * max cost along trajectory
path_distance_bias
weight that controls how close to global path should local planner stay
goal_distance_bias
weight that controls how much to prioritize distance to goal regardless of the ppath
occdist_scale
how much should robot avoid obstacles. Too high makes robot indecisive and stuck
(Terminal 1) $ roslaunch turtlebot3_gazebo turtlebot3_house.launch
(Terminal 2) $ roslaunch turtlebot3_navigation turtlebot3_navigation.launch map_file:=/home/mhered/catkin_ws/ROS-notes/assets/sources/mymap2.yaml
Parameters can be edited directly in the yaml config file e.g. dwa_local_planner_params_waffle.yaml
or dynamically with rqt_reconfigure
that allows to edit live the parameter server:
(Terminal 3) $ rosrun rqt_reconfigure rqt_reconfigure