Ask Your Question
0

I am making a custom global planner, I want to switch to the default global planner when the custom global fails to make a plan. Can you guys help me out on this?

asked 2018-08-23 04:20:30 -0500

chandra8992 gravatar image

I tried setting the parameter "/move_base/base_global_planner" as "global_planner/GlobalPlanner" when my custom planner fails to make a plan and return false in the function "makePlan" . But still keeps calling the same custom planner instead of the "global_planner/globalPlanner".

I have written below a piece of code from my custom global planner in the makePlan function,

    bool success = client.call(srv);
    if (!success)
    {
        ROS_ERROR_STREAM_THROTTLE(1, "Failed to call service planner");
        n.setParam("move_base/base_global_planner","global_planner/GlobalPlanner");
        return false;
    }

Please help me out on this, or any other alternative ways of switching the global planner.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-08-23 15:55:05 -0500

fergs gravatar image

You can't do this by setting a parameter -- you need to use dynamic_reconfigure to change the planner at runtime.

edit flag offensive delete link more

Comments

thanks, but actually I want to switch the global planner automatically, so is there any other way. I guess using dynamic reconfigure we can only change it manually. Please update on this.

chandra8992 gravatar image chandra8992  ( 2018-08-24 02:38:43 -0500 )edit

You can programmatically call dynamic_reconfigure -- it has an API -- it's just a service call underneath. You would simply replace your n.setParam() line with the proper call to the dynamic_reconfigure interface.

fergs gravatar image fergs  ( 2018-08-24 13:15:07 -0500 )edit

Thanks. I will try it out.

chandra8992 gravatar image chandra8992  ( 2018-08-25 01:14:39 -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

Stats

Asked: 2018-08-23 04:20:30 -0500

Seen: 187 times

Last updated: Aug 23 '18