Ask Your Question
3

rosserial arduino can't connect (Arduino micro)

asked 2014-05-13 02:30:31 -0600

Daniel_2210 gravatar image

updated 2014-05-20 04:47:30 -0600

Hi all,

I have a problem with rosserial_arduino. The demo hello world program compiles fine in the arduino IDE.

#include <ros.h>
#include <std_msgs/String.h>

ros::NodeHandle  nh;

std_msgs::String str_msg;
ros::Publisher chatter("chatter", &str_msg);

char hello[13] = "hello world!";

void setup()
{
  nh.initNode();
  nh.advertise(chatter);
}

void loop()
{
  str_msg.data = hello;
  chatter.publish( &str_msg );
  nh.spinOnce();
  delay(1000);
}

The problem that I have is that ros can't connect to the arduino.

When I run this "rosrun rosserial_python serial_node.py /dev/ttyACM0" I get the error:

[INFO] [WallTime: 1399983521.604184] ROS Serial Python Node
[INFO] [WallTime: 1399983521.617853] Connecting to /dev/ttyACM0 at 57600 baud
[ERROR] [WallTime: 1399983538.726124] Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

When I run this "rosrun rosserial_server serial_node /dtyACM0" I get these messsages:

[ INFO] [1399983906.306684433]: Opening serial port.
[ INFO] [1399983906.306988104]: Starting session.
[ WARN] [1399983907.309690537]: Sync with device lost.

I also have added my user to the usergroups dialout and tty. That fixes the problem that I can access the port without admin(sudo) right.

I use this in combination with an Arduino Micro but it's the same as an Arduino Uno but then a bit smaller.

I hope you can help me with my problem.

edit retag flag offensive close merge delete

Comments

I have already reinstalled ROS now and that still didn't fixed it.

Daniel_2210 gravatar imageDaniel_2210 ( 2014-05-20 04:47:58 -0600 )edit

4 Answers

Sort by ยป oldest newest most voted
9

answered 2014-05-21 01:28:22 -0600

Daniel_2210 gravatar image

I have fixed it. What you need to do is.

The "Hello World" example seems to be working fine. The only change you must to your Arduino code on Micro or just the normal one, I only have a Micro is to add

#define USE_USBCON

just before

#include <ros.h>

That's it.

edit flag offensive delete link more

Comments

Solved my problem! Thanks!

JP_TCC gravatar imageJP_TCC ( 2014-05-24 14:07:29 -0600 )edit
2

i dont understand the micro define usbcon that you mention. can please explain in more details?

dmngu9 gravatar imagedmngu9 ( 2015-06-30 06:56:57 -0600 )edit

I can confirm that this solution work in my case as well. My system is Ubuntu 14.04, ROS Indigo and Arduino Micro. I followed the tutorial @ http://wiki.ros.org/rosserial_arduino...

ozsln gravatar imageozsln ( 2016-06-27 22:59:59 -0600 )edit

This works. Thank you.

webvenky gravatar imagewebvenky ( 2016-07-12 11:38:00 -0600 )edit

Found out why this works. See line 54 of Arduinohardware.h : http://docs.ros.org/jade/api/rosseria... . We're suppose to specify the connection type associated with the hardware that rosserial is communicating with.

kev1nnsays gravatar imagekev1nnsays ( 2016-07-17 12:00:51 -0600 )edit

Thanks! We were going nuts when we switched to Micro and started getting an unrelated error about version incompatibility between the ROS lib and rosserial.

toddsampson gravatar imagetoddsampson ( 2017-01-10 13:15:23 -0600 )edit
0

answered 2017-04-13 10:10:18 -0600

ChuiV gravatar image

For those that found this thread looking to get the Arduino Due working: For me using the programming port on the Due, I had to change line 72 in ArduinoHardware.h from iostream = &Serial1; to iostream = &Serial; (remove the '1'). After that, It worked like a charm!

Hope that helps somebody.

edit flag offensive delete link more
0

answered 2015-06-24 17:41:55 -0600

The very same problem happened to me using an arduino duemillanove w\ atmega168.

Then I swapped the AVR with an atmega328. And it worked!

edit flag offensive delete link more

Comments

1

hi, what do you think the problem was? i have the same problem at the moment

dmngu9 gravatar imagedmngu9 ( 2015-06-30 06:56:16 -0600 )edit
0

answered 2015-07-27 03:48:02 -0600

stan gravatar image

Hey, I recently had the same problem. For me this was solved by downgrading the rosserial packages to indigo. I removed the repository version and compiled the indigo branch by hand:

git clone  --branch indigo-devel https://github.com/ros-drivers/rosserial.git
catkin_make

Then, don't forget to rebuild the arduino libraries:

rosrun rosserial_arduino make_libraries.py

This fixed it for me. Hope this helps someone!

edit flag offensive delete link more

Comments

Daniel_2210, thank you very much. That fixed my problem.

Kiran Prakash gravatar imageKiran Prakash ( 2015-12-02 17:01:21 -0600 )edit

#define USE_USBCON helped me fix the similar problem with micro. Thank you Daniel_2210

Kiran Prakash gravatar imageKiran Prakash ( 2015-12-02 17:02:25 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2014-05-13 02:30:31 -0600

Seen: 9,181 times

Last updated: Dec 02 '15