0
$\begingroup$

Rosanswers logo

Hi all,

I am trying serial communication between the Arduino and ROS using rosserial (http://wiki.ros.org/rosserial). It works perfectly with the default parameter for the baud rate:

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

but when I give a different baud rate using this:

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

I get the following error:

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

I have rosserial-indigo-devel installed and the ROS version is indigo. The above error comes only when you specify a baud rate other than 57600 (default baud rate).
I also looked into serial_node.py and changed the default baud rate to 9600 but then also, it only works with the baud rate of 57600 and gives error if some other baud rate is specified.

Does anyone know what can be the problem?

Thanks in advance.
Naman Kumar


Originally posted by Naman on ROS Answers with karma: 1464 on 2015-04-09

Post score: 1

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

You can set the baud rate in your Arduino code by using nh.getHardware()->setBaud(BAUD) before you initialize the node. BAUD would be 9600 in your case.


Originally posted by tonybaltovski with karma: 2549 on 2015-04-09

This answer was ACCEPTED on the original site

Post score: 9


Original comments

Comment by kwiesz91 on 2015-08-11:
Thank you so much! I have been wondering how to do this!

Comment by Ameer Hamza Khan on 2017-12-31:
Is it also possible to specify the serial port e.g. Serial1, Serial2 for Arduino mega or a software serial port?

$\endgroup$
0
$\begingroup$

Rosanswers logo

So..rosserial_arduino was always setting the baud rate of arduino as 57600. So, for rosserial_python, only the baud rate of 57600 was working.I made rosserial_arduino run at the baud rate of 9600 (or 19200, etc.) by editing ArduinoHardware.h in <sketchbook>/libraries/ros_lib and then specified the same baud rate for rosserial_python and it is working now.
Just make sure to change the baud rates for both rosserial_arduino and rosserial_python if you want to use a non-default baud rate.


Originally posted by Naman with karma: 1464 on 2015-04-09

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.