0
$\begingroup$

Rosanswers logo

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.


Originally posted by chandra8992 on ROS Answers with karma: 1 on 2018-08-23

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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


Originally posted by fergs with karma: 13902 on 2018-08-23

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by chandra8992 on 2018-08-24:
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.

Comment by fergs on 2018-08-24:
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.

Comment by chandra8992 on 2018-08-25:
Thanks. I will try it out.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.