Ask Your Question

how to edit move_base in turtlebot3 to not use dijkstra and use other algorithms like A* search or carrot planner

asked 2021-11-20 02:14:28 -0500

Victor_Kash gravatar image

I am new to ROS and I recently learned about the navigation stack and SLAM on turtlebot3. The regular navfn of turtlebot3 uses dijkstra algorithm. By simply setting the use_dijkstra=false the behavior of the global planner can be changed to use A* search instead.

I am having trouble finding the code or the file where I can actually make changes to the script and set use_dijkstra to false.

I'm not sure but i believe these changes must be made to move_base.launch

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-11-20 07:38:59 -0500

osilva gravatar image

global_planner provides an implementation of a fast, interpolated global planner for navigation. This class adheres to the nav_core::BaseGlobalPlanner interface specified in the nav_core package.

use_dijkstra is one of the parameters of this global_planner


move_base is also part of Navigation stack but it provides an implementation of an action (see the actionlib package) that, given a goal in the world, will attempt to reach it with a mobile base. The move_base node links together a global and local planner to accomplish its global navigation task. It supports any global planner adhering to the nav_core::BaseGlobalPlanner interface.


For turtlebot3 implementation, take a look at this example: Notice the initial parameters:

GlobalPlanner:                                  # Also see:
  old_navfn_behavior: false                     # Exactly mirror behavior of navfn, use defaults for other boolean parameters, default false
  use_quadratic: true                           # Use the quadratic approximation of the potential. Otherwise, use a simpler calculation, default true
  use_dijkstra: true                            # Use dijkstra's algorithm. Otherwise, A*, default true
  use_grid_path: false                          # Create a path that follows the grid boundaries. Otherwise, use a gradient descent method, default false

And how the launch file calls for those parameters:

  <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
    <rosparam file="$(find turtlebot_navigation)/param/costmap_common_params.yaml" command="load" ns="global_costmap" />
    <rosparam file="$(find turtlebot_navigation)/param/costmap_common_params.yaml" command="load" ns="local_costmap" />   
    <rosparam file="$(find turtlebot_navigation)/param/local_costmap_params.yaml" command="load" />   
    <rosparam file="$(find turtlebot_navigation)/param/global_costmap_params.yaml" command="load" />
    <rosparam file="$(find turtlebot_navigation)/param/dwa_local_planner_params.yaml" command="load" />
    <rosparam file="$(find turtlebot_navigation)/param/move_base_params.yaml" command="load" />
    <rosparam file="$(find turtlebot_navigation)/param/global_planner_params.yaml" command="load" />
    <rosparam file="$(find turtlebot_navigation)/param/navfn_global_planner_params.yaml" command="load" />
    <!-- external params file that could be loaded into the move_base namespace -->
    <rosparam file="$(arg custom_param_file)" command="load" />
edit flag offensive delete link more



@Victor_Kash standard ros has multipe "global planner" implementations: two of the implementations are named navfn and global_planner. I believe that navfn does not implement the A* algorithm. So first you will need to change the move_base configuration to use global_planner, then you would change the global_planner configuration to use A*.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-11-20 13:41:39 -0500 )edit

thanks that works but upon setting use_dijkstra to falseit shows it weird wall sticking behavior like this

Victor_Kash gravatar image Victor_Kash  ( 2021-11-21 08:10:47 -0500 )edit

You will need to review some of your parameters. Dijkstra and A* are similar but not the same.

osilva gravatar image osilva  ( 2021-11-21 08:18:39 -0500 )edit

yeah tweaking the neutral_cost seems to have solved the problem

Victor_Kash gravatar image Victor_Kash  ( 2021-11-25 07:46:06 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2021-11-20 02:14:28 -0500

Seen: 34 times

Last updated: Nov 20 '21