How to handle node shutdown in java code?
I am trying to work out how to gracefully shutdown my node, without ctrl C. I assume that "rosnode kill" should close down the node, but it doesn't. I have the code below in my node but it is never called. Though when I run "rosnode kill" I do see in the log this "Shutdown requested by /rosnode with message "user request"".
So how should shutdown be handled in the code?
public class PCTControl extends AbstractNodeMain { ... @Override public void onShutdown(Node node) { final Log log = node.getLog(); log.info("onShutdown called."); super.onShutdown(node); } }