Ask Your Question
2

rosserial "Lost sync" over Arduino Uno XBee connection

asked 2011-11-20 00:56:35 -0500

Pi Robot gravatar image

Hello,

I have run through the rosserial tutorials on my Arduino Uno and everything works perfectly over a hard line USB connection to my PC (Ubuntu 10.04 and the latest ROS Electric debs).

Now I am trying to get things to work over an XBee connection. (NOTE: I am not using the rosserial_xbee method since I have only two XBee radios and I am using them in transparent mode.) With the rosserial "Hello World" example loaded on the Arduino and my XBee radios set at 9600 baud, I turn on the Arduino + XBee shield for at least 10 seconds, then on the PC I run:

$ rosrun rosserial_python serial_node.py /dev/ttyUSB0 _baud:=9600
[INFO] [WallTime: 1321800497.336925] ROS Serial Python Node
[INFO] [WallTime: 1321800497.340397] Connected on /dev/ttyUSB0 at 9600 baud
[ERROR] [WallTime: 1321800512.341590] Lost sync with device, restarting...
[ERROR] [WallTime: 1321800527.345303] Lost sync with device, restarting...
[ERROR] [WallTime: 1321800542.350331] Lost sync with device, restarting...
etc.

If instead of rosserial, I simply load a sketch that does a Serial.println("Hello World!"), then I do see the message over the XBee link via the Arduino Serial Monitor. So I know the basic wireless connection is working.

I am using this XBee shield and a pair of non-Pro XBee radios.

Anyone know how I can fix this?

Thanks!
patrick

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2011-11-20 15:09:39 -0500

fergs gravatar image

Is it possible that your communication is only working in one direction? The println("Hello World") confirms that your arduino can send to the computer -- but, if the PC can't talk to the Arduino then the "request for sync" from the PC to the Arduino would never get through (and thus we would never actually connect).

We should probably add a check that decides whether we have "lost sync" or "never synced" as is probably your case.

edit flag offensive delete link more

Comments

Communication is working in both directions. To confirm, I used minicom to talk to the radio on the explorer attached to the PC using baud rate 9600 and device /dev/ttyUSB0. I then powered up the Arduino with XBee shield and loaded the loopback test program listed here http://forums.trossenrobotics.com/tutorials/how-to-diy-128/xbee-basics-3259. Entering a number or letter in minicom returned the correct result (e.g. 5 returns 6, x returns y).
Pi Robot gravatar imagePi Robot ( 2011-11-21 01:19:09 -0500 )edit
You did change the baud rate for the sketch right? Default is 57600...
fergs gravatar imagefergs ( 2011-11-21 08:35:20 -0500 )edit
Yes I had changed it to 9600 using Serial.begin(9600). After further experimentation, even when using the hard line USB connection to the Arduino Uno, the only baud rate that works for serial_node.py is 57600. Any other baud rate fails with "Lost sync" even though I can see that the baud rate is getting passed properly to SerialClient.py. And it doesn't matter if I use Serial.begin() in the sketch to match the baud rate I am trying with serial_node.py. (I am using pyserial 2.3 and Python 2.6.5 in case that matters.) But at least now I have a working solution at 57600 which works for both a direct connection and an XBee link after setting both radios to 57600.
Pi Robot gravatar imagePi Robot ( 2011-11-21 11:30:00 -0500 )edit
0

answered 2013-02-27 23:45:54 -0500

priths gravatar image

it works with only xbee series1 y not with series 2.. what changes are to be made.. or is it not possible to use it with series 2. any code for series 2 is available?????

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2011-11-20 00:56:35 -0500

Seen: 1,301 times

Last updated: Feb 27 '13