Calling service to UR I/O while performing shutdown

asked 2018-07-17 08:03:50 -0600

Fiddle gravatar image

updated 2018-07-17 09:34:19 -0600

Hi, I am wondering if I can detect shutdown (for example by pressing ctrl+c) and send service before it closes down. I have a light connected to ur5's controller I/O and at the start of my program i am turning it on by using rosservice call /ur_driver/set_io via the launchfile on the correct port. When I want to close the program before it ends, or if it closes by itself (for example by estop/protective stop) this output port is still set to true so the light still works. I want to do it so that it will turn off together with the robot. Is there a clean way to implement this? I have a quite large program, so adding watch to one of its steps seems unreasonable.

EDIT: Ok, so I've managed to make a node that should send the service via rospy.on_shutdown method. The problem is that the ur node is killed before my node so it doesn't have access to the ios. Is there any way to set order of killing the nodes?

edit retag flag offensive close merge delete