error connection rosserial via bluetooth arduino notebook
Can not run rosserial via bluetooth.
Arduino Uno
Blutooth module HC-06
Notebook with bluetooth Ubuntu 12.04 Ros Hydro
Arduino sketch:
#include <ros.h>
#include <std_msgs/String.h>
ros::NodeHandle nh;
std_msgs::String str_msg;
ros::Publisher chatter("chatter", &str_msg);
char hello[13] = "hello world!";
void setup()
{
nh.getHardware()->setBaud(9600);
nh.initNode();
nh.advertise(chatter);
}
void loop()
{
str_msg.data = hello;
chatter.publish( &str_msg );
nh.spinOnce();
delay(1000);
}
In terminal:
sudo rfcomm connect 0 98:D3:31:20:03:19 1
Connection is established, the red LED on the Bluetooth lit.
In new terminal:
$ rosrun rosserial_python serial_node.py _port:=/dev/rfcomm0
[INFO] [WallTime: 1401040615.342558] ROS Serial Python Node
[INFO] [WallTime: 1401040615.353809] Connecting to /dev/rfcomm0 at 9600 baud
[ERROR] [WallTime: 1401040632.468633] Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino
How to fix this error? If connecting by the usb cable, everything works.
Does serial over bluetooth work when you're not using a rosserial sketch? Is the baud rate on your bluetooth module set correctly?
Yes I used to work with this Bluetooth module via serial data is transferred. Baud rate correct.
Have you solve this? I'm having the same problem now. its annoying!
Actually I've solve my problem. It truns out that my bluetooth chip is a china made cheap one and not a real HC-06. And there is something like only a single post in some unkown forum that provides the datasheet. Generally speaking, it's the fault of baud rate (not usable if exceed certain rate).
I uploaded the this code on my arduino nano to have a serial communication with the ros via Hc-05 bluetooth module. It worked only with the 9600 baudrate (not 57600).