[ros-users] nodelet shutdown/unload itself, requestShutdown

Felix Ruess felix.ruess at gmail.com
Mon Jul 11 08:30:56 UTC 2011

Hi Tully,

>> how can I cleanly shutdown/unload a nodelet from within the nodelet
>> code under diamondback?
> There is not currently a way to do this cleanly, it's ticketed as an
> enhancement at https://code.ros.org/trac/ros-pkg/ticket/4431

Ok, hopefully we'll have a good solution for this soonish...

>> In the onInit() function of the nodelet I instantiate a class, which
>> will immediately return from the constructor if a parameter file is
>> not found and the nodelet should be shutdown/unloaded.
>> What I did so far is to call ros::requestShutdown before returning
>> from the constructor, is this the correct way of doing this?
>> At least this seems to partially work, the nodelet destructor is
>> called and the process finishes cleanly after a time.
>> I'm wondering why it is taking so long for the process to finish
>> cleanly after the nodelet destructor was already called? Does this get
>> detected via some timeout of bind?
>> The actual problem though is that after the nodelet is destroyed I
>> can't seem to reach the nodelet manager anymore to load new nodelets.
>> Even trying to shut it down normally via CTRL-C doesn't quite work,
>> after a while I get an "escalating to SIGTERM" message.
>> What's the correct way to do this?
> This is not a good way to take down a nodelet, because requestShutdown is
> taking down the entire Node, aka all ROS in the process, including the
> manager and any other nodelets.

Ok, I was half expecting this. Thanks for clearing it up.

> The best solution right now is to call the unloadNodelet service on the
> manager.

Since I don't know the name of the manager it is running in, I can't
call the unloadNodelet service from within the nodelet itself,
correct? Or is there some way around this?

I have the same problem with a I2C driver nodelet, if I can't get the
device I have to unload/shutdown the nodelet cleanly somehow.


More information about the ros-users mailing list