0
$\begingroup$

Rosanswers logo

Hi,

I'm using this idiom for checking that the node in my python script is working

while not rospy.is_shutdown():
   do some work

but when I kill the node with rosnode kill the while loop does not exit. I suppose rosnode kill triggers the flag associated with is_shutdown(), but maybe I'm wrong.

Could anyone please clarify me on the issue of finishing nodes and the processes that hold them properly? I've checked previous answers, but maybe I've missed a complete example with code on how to catch and handle the related signals.

Thank you very much in advance


Originally posted by chcorbato on ROS Answers with karma: 202 on 2012-07-05

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

That should work.

Node termination notification can be quite slow to arrive. Maybe you didn't wait long enough.

If you invoke a bunch of nodes using roslaunch, typing ^C in that terminal sends the interrupt signal to all of them fairly quickly.


Originally posted by joq with karma: 25443 on 2012-07-06

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by Lorenz on 2012-07-06:
roslaunch sends a sigint I think. rosnode kill uses an xmlrpc request. But anyway, I just did a test and can confirm that the above while loop is perfectly fine for both, C-c and the xmlrpc request.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.