mirror of
https://github.com/YikeStone/ros_arduino_bridge.git
synced 2025-08-05 20:14:07 +05:30
Close serial port on exit
This commit is contained in:
parent
6d6390fa53
commit
c15c0be2a8
@ -477,7 +477,7 @@ class ArduinoROS():
|
|||||||
rospy.sleep(0.2)
|
rospy.sleep(0.2)
|
||||||
|
|
||||||
# Close the serial port
|
# Close the serial port
|
||||||
#self.device.serial_port.close()
|
self.device.close()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
@ -486,7 +486,9 @@ if __name__ == '__main__':
|
|||||||
try:
|
try:
|
||||||
myArduino.device.serial_port.close()
|
myArduino.device.serial_port.close()
|
||||||
except:
|
except:
|
||||||
|
rospy.logerr("Serial exception trying to close port.")
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
except SerialException:
|
except SerialException:
|
||||||
|
rospy.logerr("Serial exception trying to open port.")
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user