ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Catching a 'rosnode kill -a'

asked 2016-07-29 07:24:42 -0600

curranw gravatar image

updated 2016-07-29 07:25:26 -0600

I have a bit of code that outputs data when the core dies. This works fine in all situations, except when the user uses 'rosnode kill -a'. The PR2 runs this command when stopping the robot, so it's a larger issue with specific robots than with ROS itself.

I believe this particular command is running a SIGKILL on all ROS nodes. These cannot be caught. Is there some other signal ROS sends out right before it dies that I can take advantage of?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-07-29 12:04:11 -0600

ahendrix gravatar image

I don't think rosnode kill is sending SIGKILL. (If it is, there's nothing you can do).

I'm reasonably certain that rosnode kill uses the node's XMLRPC API to request that the node shutdown cleanly; in C++ you can check for this with ros::ok() or ros::isShuttingDown(), as described on the roscpp initialization and shutdown page.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-07-29 07:24:42 -0600

Seen: 858 times

Last updated: Jul 29 '16