0
$\begingroup$

Rosanswers logo

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!


Originally posted by squiq on ROS Answers with karma: 41 on 2014-10-29

Post score: 4


Original comments

Comment by MKI on 2014-10-29:
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...) ?

Comment by gowtham raja on 2019-11-26:
hi can u help me to how to interface with arduino

$\endgroup$

4 Answers 4

0
$\begingroup$

Rosanswers logo

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.


Originally posted by MKI with karma: 246 on 2014-10-29

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by squiq on 2014-10-29:
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

Comment by MKI on 2014-10-29:
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.

Comment by MKI on 2014-10-29:
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.

Comment by squiq on 2014-10-29:
Thanks a lot for your help, the serial communication works! You saved my day!

Comment by Karz on 2015-10-08:
This answer helped me too :) Thanks MKI

Comment by adelleodel on 2016-05-25:
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 /src/ to somewhere.

Comment by Kibria on 2018-01-20:
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 :)

$\endgroup$
0
$\begingroup$

Rosanswers logo

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!


Originally posted by Karthikeya Parunandi with karma: 78 on 2016-05-27

This answer was NOT ACCEPTED on the original site

Post score: 2


Original comments

Comment by jayess on 2017-01-07:
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'

$\endgroup$
0
$\begingroup$

Rosanswers logo

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.


Originally posted by mbdpqw with karma: 21 on 2017-01-04

This answer was NOT ACCEPTED on the original site

Post score: 2


Original comments

Comment by xy1zzz on 2017-07-03:
nh.getHardware()->setBaud(115200);

Comment by aissa360 on 2018-05-09:
it worked for me after adding the _baud:=115200 to the command line thank you,

$\endgroup$
0
$\begingroup$

Rosanswers logo

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.

Originally posted by shawnysh with karma: 339 on 2017-01-08

This answer was NOT ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.