How to catch nodelet shutdown signal?
I created a new thread in a nodelet which runs some task until the nodelet is shutdown. But I don't know how to let the new thread know when the nodelet is shutting down, so for now it will make the whole nodelet_manager crash when I only wants to end that nodelet.
I tried to use getPrivateNodeHandle() to get the ros::NodeHandle instance, and use nodehandle.ok() to test whether the new thread should stop, sometimes it works, but sometimes not.