rosnode kill doesn't kill a node
I have created a rosnode in C++. It will not be killed by rosnode kill <nodename>.
Can anyone tell me why this might this might be happening?
Thanks, Paul.
I have created a rosnode in C++. It will not be killed by rosnode kill <nodename>.
Can anyone tell me why this might this might be happening?
Thanks, Paul.
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}')
If you're using roslaunch
to start your nodes and rosnode kill <my_node>
isn't working, try re-roslaunching first. This will replace the existing nodes with freshly-launched ones, which you should be able to kill.
roslaunch <my_package> <launch_file>
rosnode kill <my_node>
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2011-11-01 12:27:47 -0500
Seen: 7,249 times
Last updated: Jan 11 '19
Weird rqt_graph when running turtlesim
How can I use rosnode to see nodes within other nodes?
How to modify a model plugin to publish data to a rostopic or ros node?
How to find if nodes are running on the same machine?
Node not found after being initialized