ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

navigation2 switching planners and controllers dynamically

asked 2020-11-11 16:29:58 -0600

I need to switch in runtime between different planners and controllers. I used to do that in ROS1 navigation stack using the dynamic_reconfigure server.

Is this functionality available in navigation2. How could I do that?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2021-07-18 08:53:28 -0600

updated 2021-07-18 08:56:33 -0600

Since planner and control servers are implemented with the use of actions in navigation2, you can specify the planner_id or controller_id to specify a particular one in run time by specifying related fields in action definition. for instance you will see a planner_id field, fill that programmatically on run time.

#goal definition
geometry_msgs/PoseStamped goal
geometry_msgs/PoseStamped start
string planner_id
bool use_start # If true, use current robot pose as path start, if false, use start above instead
#result definition
nav_msgs/Path path
builtin_interfaces/Duration planning_time

Take a look at how to configure planners here, you will need to append the array of strings that refers to names of planner plugins

    expected_planner_frequency: 20.0
    planner_plugins: ['GridBased1', 'GridBased2']
      plugin: 'nav2_navfn_planner/NavfnPlanner'

      plugin: 'some_planner/SomePlanner'

Then in the action call you would specify planner_id as one of ['GridBased1', 'GridBased2'] same should apply to the controllers.

edit flag offensive delete link more

Question Tools



Asked: 2020-11-11 16:29:58 -0600

Seen: 261 times

Last updated: Jul 18 '21