Problem with rosserial arduino and python serial
I'm using ROS Kinetic on an ErleBrain3 trying to connect it with an Arduino UNO. I'm trying to follow the rosserial tutorials but after running:
rosrun rosserial_python serial_node.py /dev/ttyUSB0
I get the following error:
[INFO] [WallTime: 1539967951.033639] ROS Serial Python Node
[INFO] [WallTime: 1539967951.062010] Connecting to /dev/ttyACM0 at 9600 baud
Traceback (most recent call last):
File "/home/erle/catkin_ws/src/rosserial/rosserial_python/nodes/serial_node.py", line 88, in <module>
client = SerialClient(port_name, baud, fix_pyserial_for_test=fix_pyserial_for_test)
File "/home/erle/catkin_ws/src/rosserial/rosserial_python/src/rosserial_python/SerialClient.py", line 358, in __init__
self.port = Serial(port, baud, timeout=self.timeout, write_timeout=10)
TypeError: __init__() got an unexpected keyword argument 'write_timeout'
I have the 2.7 python serial package which I think is the recommended for these tutorials. I'm very new to ROS and Linux please give me easy to understand answers. Thank you!
Asked by NeoM on 2018-10-19 12:02:42 UTC
Answers
Nevermind, I solve the issue following a solution in the comments of this website: https://answers.ros.org/question/294056/connecting-ros-to-arduino-serial-port/
I followed one of the comments which says " cd catkin_ws/src/rosserial/rosserial_python/src/rosserial_python/SerialClient.py file and on line 356 and 358, I changed it from write_timeout to writeTimeout. That did the trick."
Asked by NeoM on 2018-10-24 12:18:17 UTC
Comments
Thanks for reporting back.
According to #q294056 this is due to using Python 3, as rosserial_python
targets 2.7.x and some methods have changed.
It would have been good to mention that you were / are running Python 3.
Asked by gvdhoorn on 2018-10-25 01:14:46 UTC
Comments
Try playing around with arduino baudrate. maybe it is baudrate issue.
Asked by KinWah on 2018-10-20 22:17:14 UTC