Robotics StackExchange | Archived questions

How to interface an Arduino with ROS?

I'm trying to control a few Arduinos (Uno and Leonardo) from ROS. What's the "right" way to do this?

I started with Rosserial, by following the simple Blink tutorial. It installed and compiled just fine, but much to my surprise, Rosserial simply doesn't work. First, the compiled hex file consumes almost 75% of the Arduino's memory...so I'd have almost nothing left for my application code. Second, it can't actually communicate with the host. Attempting to run serial_node.py fails with the error:

Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

My PC is a fresh install of Ubuntu 14.04 with Indigo, so I'm sure it's not a version mismatch. Googling this error shows it's a bug in Rosserial related to it being unable to handle certain Arduino USB interfaces, which has gone unresolved for years and has several open bug reports filed for it.

I spent six hours trying to figure this out, and got nowhere. So then I tried implementing the same "blink" functionality with a simple pure Arduino+Python interface using Pyserial....and got it to work in 10 minutes.

Unfortunately, this has been my experience with ROS in general. It claims to make your life easier, but it has a huge learning curve and even after you read through all the docs and follow all the steps without error...it still doesn't work very well. Am I missing something here? If ROS can't even blink and LED, why should I rely on it for anything more complicated?

Asked by Cerin on 2015-12-14 10:00:08 UTC

Comments

hi, have you rebuild and installed the ros_lib for arduino http://wiki.ros.org/rosserial_arduino/Tutorials/Arduino%20IDE%20Setup

Asked by inflo on 2015-12-14 10:37:51 UTC

No, I tried that, but catkin_make through a ton of errors, so I just installed the ubuntu packages for indigo.

Asked by Cerin on 2015-12-14 16:52:19 UTC

is there a reason not to use jade?

Asked by inflo on 2015-12-14 17:13:47 UTC

Yes, I'm using Ubuntu 14.04 and am not in a position to upgrade my entire computer just to tinker around with ROSSerial.

Asked by Cerin on 2015-12-14 18:49:07 UTC

Just an FYI: Jade is supported on Trusty (see REP-003). There is no need to upgrade your OS.

Asked by gvdhoorn on 2015-12-18 03:17:54 UTC

Answers

Look into ros_arduino_bridge . It uses a lot less memory on the arduino.

Asked by robotSamir on 2015-12-18 01:38:59 UTC

Comments

Try specifying the serial port using the ~port parameter:

rosrun rosserial_python serial_node.py _port:=/dev/ttyUSB0

(I updated the wiki to reflect this several years ago, but it looks like someone reverted my change)

Asked by ahendrix on 2015-12-18 01:58:09 UTC

Comments

That was one of the first things I tried. Neither ttyUSB0 nor ttyACM0 worked.

Asked by Cerin on 2015-12-19 11:17:27 UTC

Trying ports at random is not the correct strategy. Which port is associated with your arduino?

Asked by ahendrix on 2015-12-21 19:15:23 UTC