ros-drivers / rosserial

A ROS client library for small, embedded devices, such as Arduino. See: http://wiki.ros.org/rosserial
508 stars 527 forks source link

serial_node.py fail to terminate when user press ctrl+c #535

Open SeanGuoXuan opened 3 years ago

SeanGuoXuan commented 3 years ago

serial_node.py is working as expected when I execute: rosrun rosserial_python serial_node.py /dev/ttyACM0 I can terminate this programme by typing ctrl+z. However, if I type ctrl+c, programme throw exception and reconnect stm32 with message:

**^C[INFO] [1608027123.675505]: Send tx stop request [WARN] [1608027123.676797]: Unexpected Error.<type 'exceptions.SystemExit'> Exception in thread Thread-4: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 754, in run self.__target(*self.__args, **self.__kwargs) File "/home/sean/sean/sdv_v2/src/ulti/rosserial/rosserial_python/src/rosserial_python/SerialClient.py", line 786, in processWriteQueue self._write(data) File "/home/sean/sean/sdv_v2/src/ulti/rosserial/rosserial_python/src/rosserial_python/SerialClient.py", line 750, in _write self.port.write(data) File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 531, in write raise portNotOpenError SerialException: Attempting to use a port that is not open

Can someone confirm this bug and explain how to fix it?

Cheers