rosserial icon indicating copy to clipboard operation
rosserial copied to clipboard

[rosserial_python] Use rospy.on_shutdown in SerialClient shutdown

Open 708yamaguchi opened this issue 2 years ago • 1 comments

When I use serial_node.py from roslaunch, we cannot kill serial_node.py by Ctrl-c.

This is because serial_node.py does not catch SystemExit exception caused by sys.exit(0) in txStopRequest. https://github.com/ros-drivers/rosserial/blob/c169ae2173dcfda7cee567d64beae45198459400/rosserial_python/nodes/serial_node.py#L94-L109

In this PR, I used rospy.on_shutdown instead of signal.signal(signal.SIGINT, self.txStopRequest), following 8fb7954 (#508) and https://github.com/ros-drivers/rosserial/pull/551 This change enables to kill serial_node.py by Ctrl-c.

Thank you very much for your help, @sktometometo

708yamaguchi avatar Jul 18 '22 13:07 708yamaguchi

Thanks for this PR @708yamaguchi!

Hommus avatar Feb 24 '23 02:02 Hommus