0
$\begingroup$

Rosanswers logo

Hi,

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 serial_node.py /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?


Originally posted by sgwhack on ROS Answers with karma: 73 on 2012-07-15

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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 \libraries\ros_lib and changing the baud rate defaults in the constructors. Remember to restart the Arduino IDE after changing libraries.


Originally posted by PaulBouchier with karma: 300 on 2012-08-09

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by Tones on 2014-03-27:
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.

$\endgroup$

Your Answer

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