ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Problem with rosserial arduino and python serial

asked 2018-10-19 12:02:42 -0500

NeoM gravatar image

updated 2018-10-25 01:13:34 -0500

gvdhoorn gravatar image

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!

edit retag flag offensive close merge delete

Comments

1

Try playing around with arduino baudrate. maybe it is baudrate issue.

KinWah gravatar image KinWah  ( 2018-10-20 22:17:14 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-10-24 12:18:17 -0500

NeoM gravatar image

Nevermind, I solve the issue following a solution in the comments of this website: https://answers.ros.org/question/2940...

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."

edit flag offensive delete link more

Comments

2

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.

gvdhoorn gravatar image gvdhoorn  ( 2018-10-25 01:14:46 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-10-19 12:02:42 -0500

Seen: 2,884 times

Last updated: Oct 25 '18