ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

On the rosnode page, it states that rosnode kill is not guaranteed to succeed. If your node is set to "respawn", rosnode kill won't kill it properly. The other (more likely) cause of this problem is that your node is "hanging". What this means is that you're trapped in some infinite loop that does not check for the continued existence of ROS.

For example, instead of

while (1) {}

use

while (ros::ok()) {}

I've also run into problems with nodes hanging due to socket connections that fail to close properly.

On the rosnode page, it states that rosnode kill is not guaranteed to succeed. If your node is set to "respawn", rosnode kill won't kill it properly. The other (more likely) cause of this problem is that your node is "hanging". What this means is that you're trapped in some infinite loop that does not check for the continued existence of ROS.

For example, instead of

while (1) {}

use

while (ros::ok()) {}

I've also run into problems with nodes hanging due to socket connections that fail to close properly.

In the case that you must shut down a node immediately, you can use the following command to kill it less nicely (provided that you're on a *Nix operating system):

kill $(ps aux | grep your_node | grep -v grep | awk '{print $2}')