Re: [ros-users] nodelet shutdown/unload itself, requestShutd…

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: User discussions
Subject: Re: [ros-users] nodelet shutdown/unload itself, requestShutdown
Hi Felix,

On Fri, Jul 8, 2011 at 1:13 AM, Felix Ruess <> wrote:

> Hi,
>
> 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


> 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.

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

Tully