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

rosserial communication between bluetooth and arduino

asked 2012-07-15 06:28:57 -0600

sgwhack gravatar image


I am trying to communicate wirelessly between an Arduino with a bluetooth shield and my computer using rosserial. When I use rosserial through the USB cable, everything works fine, but nothing works wirelessly. Also, I can send regular serial messages sometimes to Putty using the Arduino serial functions, Serial.begin(), Serial.Write(), etc. I just can't seem to make the Arduino a ROS node through bluetooth (though, as mentioned before it does work with a USB serial connection).

I setup my bluetooth connection using: sudo rfcomm bind 0 00:00:01:08:01:65 1

There is an LED on the shield that indicates when the bluetooth is connected, however the messages that I get from the terminal are:

rosrun rosserial_python /dev/rfcomm0 _baud:=9600

[INFO] [WallTime: 1342369406.985011] ROS Serial Python Node

[INFO] [WallTime: 1342369406.987303] Connected on /dev/rfcomm0 at 9600 baud

[ERROR] [WallTime: 1342369421.988484] Lost sync with device, restarting...

I have tried playing around with the baud rates to no avail.

Does anyone know how I can make this work?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-08-09 22:52:03 -0600

PaulBouchier gravatar image

rosserial_arduino sets the baud rate to 57600 on the arudino. You'll have to configure your bluetooth shield to run at 57600 on both ends, and use 57600 on rosserial_python.

Alternatively, you can get rosserial_arduino to run at 9600 baud by editing ArduinoHardware.h in <sketchbook>\libraries\ros_lib and changing the baud rate defaults in the constructors. Remember to restart the Arduino IDE after changing libraries.

edit flag offensive delete link more


If you want to change the baudrate of your Arduino's UART, you do not necessarily have to edit `ArduinoHardware.h`. Instead, call e.g. `nh.getHardware()->setBaud(115200);` in the `setup()` function of your sketch before `nh.initNode()`. In my example, `nh` is the NodeHandle.

Tones gravatar image Tones  ( 2014-03-27 03:09:52 -0600 )edit

Question Tools

1 follower


Asked: 2012-07-15 06:28:57 -0600

Seen: 4,525 times

Last updated: Aug 09 '12