Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unload a nodelet from within its own code #33

Open
mjschuster opened this issue Aug 18, 2015 · 1 comment
Open

unload a nodelet from within its own code #33

mjschuster opened this issue Aug 18, 2015 · 1 comment

Comments

@mjschuster
Copy link

Looks like there is no official and clean way to shut down (unload) a nodelet from within its nodelet code without killing the manager.

Something like

#include <nodelet/NodeletUnload.h>
nodelet::NodeletUnload unload_service;
unload_service.request.name = getName();
ros::service::call(ros::this_node::getName() + "/unload_nodelet", unload_service);

might work, though I experienced problems when loading and unloading the samle nodelet more than once (however this might have been problems related to that particular nodelet's cleanup). In addition, as far as I can see, the service is not available in case the nodelet is started standalone. In the standalone case, a ros::shutdown(); or ros::requestShutdown(); might be OK? Is there any way to figure out if a nodelet is started standalone from within the nodelet code? st checking the aforementioned service call a safe way to do it or can it fail for other reasons? E.g., is

#include <nodelet/NodeletUnload.h>
nodelet::NodeletUnload unload_service;
unload_service.request.name = getName();
if(false == ros::service::call(ros::this_node::getName() + "/unload_nodelet", unload_service)) {
    ros::shutdown();
}

a good way to go?

It would be nice to have a consistent and obvious way (i.e. one function call that works no matter how the nodelet is started) to unload a nodelet from within its own code.

The request is not really new, see also http://ros-users.122217.n3.nabble.com/nodelet-shutdown-unload-itself-requestShutdown-td3151148.html
In addtion, there seems to have been a trac ticket https://code.ros.org/trac/ros-pkg/ticket/4431, which I neither can access nor locate on github - has it ever been migrated?

@HWiese1980
Copy link

Anything new and worth mentioning about this? Is there an official way by now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants