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

Unable to sync with device (arduino uno)

asked 2014-10-29 06:11:28 -0600

squiq gravatar image

Hello guys,

Im trying to connect my Arduino Uno to Gazebo simulator via ROS to control a robot model.

I set up the installation of rosserial according to the tutorial and moved on to the hello world tutorial. However when I want to connect my arduino Uno with:

rosrun rosserial_python serial_node.py _port:=/dev/ttyACM0 (Im sure I have the correct serial port)

I get the following message:

[INFO] [WallTime: 1414579866.487628] ROS Serial Python Node
[INFO] [WallTime: 1414579866.493390] Connecting to /dev/ttyACM0 at 57600 baud

/home/max/catkin_ws/install/lib/python2.7/dist-packages/rosserial_python/SerialClient.py:336: SyntaxWarning: The publisher should be created with an explicit keyword argument 'queue_size'. Please see http://wiki.ros.org/rospy/Overview/Publishers%20and%20Subscribers for more information.
  self.pub_diagnostics = rospy.Publisher('/diagnostics', diagnostic_msgs.msg.DiagnosticArray)

[ERROR] [WallTime: 1414579883.599380] Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

I already reinstalled rosserial, but that didn't help.

Anyone with an idea?

Thanks in advance!

edit retag flag offensive close merge delete

Comments

Can you please specify which version of ROS you are using and also have you made sure that you have right the serial port settings on your sketchbook (i.e, have you selected the right board, have you checked the serial port you are using etc...) ?

MKI gravatar image MKI  ( 2014-10-29 06:44:37 -0600 )edit

hi can u help me to how to interface with arduino

gowtham raja gravatar image gowtham raja  ( 2019-11-26 04:03:21 -0600 )edit

7 Answers

Sort by ยป oldest newest most voted
1

answered 2014-10-29 06:53:50 -0600

MKI gravatar image

updated 2014-10-29 06:58:00 -0600

Hi,

Looking at the error message, I see that you are using a mismatched version of rosserial!! please make sure to clone the right version into your pc. i.e. if your are using hydro ROS then you use this source code and if you are using groovy you should this one here and for indigo its this one. and then you can follow the Arduino setup tutorial here to get the rosserial to work. After you do this, It should work without any problem. Hope this helps.

edit flag offensive delete link more

Comments

Thanks a lot for you response. Do you mean that in stead of:

git clone https://github.com/ros-drivers/rosserial.git

I should use the link you provided? I use indigo so:

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

Because that gives an error: not found

squiq gravatar image squiq  ( 2014-10-29 07:37:10 -0600 )edit

not exactly! you can download the .zip for the older versions from the links I have given. instead of git clone ... just extract this .zip file and continue to build.

MKI gravatar image MKI  ( 2014-10-29 08:41:15 -0600 )edit

you will find it the right corner of your screen, just below the http clone url ... .. you can clone it this way too git clone --branch groovy-devel https://github.com/ros-drivers/rosserial.git ... but you have to be sure you have the right version of the code. I found .zip to be the easy way.

MKI gravatar image MKI  ( 2014-10-29 08:42:56 -0600 )edit

Thanks a lot for your help, the serial communication works! You saved my day!

squiq gravatar image squiq  ( 2014-10-29 10:23:30 -0600 )edit

This answer helped me too :) Thanks MKI

Karz gravatar image Karz  ( 2015-10-08 02:16:23 -0600 )edit

i've tried this, but still got that error.. should i remove the package first before reinstall the new one? because i just replaced the direc of rosserial from <ws>/src/ to somewhere.

adelleodel gravatar image adelleodel  ( 2016-05-25 06:12:10 -0600 )edit

Thanks MKI !!! I just want to mention one more thing. Don't forget to reinstall "ros_lib" into the Arduino Environment after you reinstall rosserial according to your ROS version. Then upload your code again to Arduino using the new installation. Hope it helps :)

Kibria gravatar image Kibria  ( 2018-01-20 14:22:14 -0600 )edit
2

answered 2017-01-08 20:17:23 -0600

shawnysh gravatar image

updated 2017-01-08 20:18:16 -0600

I came across this problem too. In my case, it was because I did not use spinOnce() function to let ROS have a chance to take control so that rosserial_arduino can make contact with arduino.

At first, I supposed I just wrote a publisher so that I did not need to use spinOnce() function at all, but it was wrong. Now I know why the official tutorial for writing a publisher) says this:

> Calling ros::spinOnce() here is not necessary for this simple program, because we are not receiving any callbacks. However, if you were to add a subscription into this application, and did not have ros::spinOnce() here, your callbacks would never get called. So, add it for good measure.
edit flag offensive delete link more
2

answered 2017-01-04 03:15:35 -0600

mbdpqw gravatar image

If you are sure that you are using the same version for Arduino and rosserial and still getting the same error try the instruction below.

Add line nh.getHardware->setBaud(115200); before nh.init().

This worked for me with an indigo rosserial and an Arduino Uno which uses ROS libraries generated by ros-indigo-rosserial.

edit flag offensive delete link more

Comments

nh.getHardware()->setBaud(115200);

xy1zzz gravatar image xy1zzz  ( 2017-07-03 10:21:43 -0600 )edit

it worked for me after adding the _baud:=115200 to the command line thank you,

aissa360 gravatar image aissa360  ( 2018-05-09 14:58:43 -0600 )edit
2

answered 2016-05-27 04:43:54 -0600

Karthikeya Parunandi gravatar image

Hi! I also encountered the same problem and fixed it finally. It displays "Connecting to /dev/ttyACM0 at 57600 baud" while the baud rate in my Arduino code was set to be 115200. Hence, set the baud rate as it was in your arduino code (In my case it is 115200) by adding _baud:=X (where 'X' is the baud rate between your computer and the Arduino) to the same command as follows:

rosrun rosserial_python serial_node.py _port:=/dev/ttyACM0 _baud:=115200

The other reason could be that your port is different from that of the above command. For example, check if your port to which the Arduino is connected, is as entered in the above command i.e, ttyACM0 or ttyACM1 etc . Hope this helps!

edit flag offensive delete link more

Comments

1

I don't think that wrong port specification is the issue. When the incorrect port is specified I get this error Error opening serial: could not open port /dev/ttyACM0: [Errno 2] No such file or directory: '/dev/ttyACM0'

jayess gravatar image jayess  ( 2017-01-07 14:39:54 -0600 )edit
0

answered 2017-01-07 14:37:37 -0600

jayess gravatar image

updated 2017-01-07 14:41:04 -0600

I've gotten this issue several times despite the fact that I am using the correct version. I found that this usually due to a connection issue and ROS not being able to connect with the Arduino. Usually the solution is to disconnect and reconnect the Arduino or to restart my computer. This usually solves the problem.

edit flag offensive delete link more
0

answered 2016-04-28 23:57:12 -0600

john_gao gravatar image

Dear Sir, I follow the link: http://wiki.ros.org/rosserial_arduino... You can install rosserial for Arduino by running: sudo apt-get install ros-indigo-rosserial-arduino sudo apt-get install ros-indigo-rosserial and then: cd /src git clone https://github.com/ros-drivers/rosser... cd catkin_make catkin_make install and when test helloworld, see the same error message: [ERROR] [WallTime: 1461904599.861522] Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino I follow the answer in this thread to download indigo zip file. remove the old source, rebuild the new source, and rm ros_lib and run: cd /libraries rm -rf ros_lib rosrun rosserial_arduino make_libraries.py . But I still see the same errors: [ERROR] [WallTime: 1461904599.861522] Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino How do we claern the old libaray. I had redo start from reinstall ros-indigo-rosserial-arduino, the result is the same.

I use arduino Yun, when I complier and upload the image, I get warning: Low memory available, stability problems may occur.

I don't know the issue is I did not clean it, or the issue is the system did not stable? Could somebody help to answer? Thank you very much! John

edit flag offensive delete link more

Comments

Hi, Didi u got it to work??

rupendra gravatar image rupendra  ( 2018-12-10 02:28:03 -0600 )edit
0

answered 2020-10-16 08:27:48 -0600

willhunt gravatar image

I have encountered this problem a few times and the solutions were:

  1. Check baudrate is set to 115200 (as others have pointed out)
  2. Check that you are advertising the topic before you attempt to publish it

    ros::Publisher my_pub("my_topic", &my_msg);
    nh.advertise(my_pub); // <--- I forgot this this and it caused the described problem
    my_pub.publish();

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-10-29 06:11:28 -0600

Seen: 16,527 times

Last updated: Jan 08 '17