locusrobotics / robot_navigation

Spiritual successor to ros-planning/navigation.
450 stars 148 forks source link

[Question] I want to add a hook for switching local planner #42

Open ompugao opened 5 years ago

ompugao commented 5 years ago

thank you for your great package.

Just a question. I know that pluginmux has an ability to add a callback before switching plugin. But there is no api for the user of 'locomotor' library to add some hooks before switching local planner, because setSwitchCallback is called inside constructor and local_plannermux is protected. https://github.com/locusrobotics/robot_navigation/blob/master/locomotor/src/locomotor.cpp#L65

Is it correct to create a new class which inherets 'Locomotor' to achieve that?

ompugao commented 5 years ago

If yes, I'm happy if this member variable is std::shared_ptr and I can assign a customized Locomotor instance to it. https://github.com/locusrobotics/robot_navigation/blob/master/locomotor/src/double_thread_locomotor.cpp#L195

DLu commented 4 years ago

So generally, yes, I think the approach would be to extend the class.

However, is the goal to add hooks for before the planner is switched via the ROS service switching? Because otherwise I would just modify the behavior when useLocalPlanner is called.