0
$\begingroup$

Rosanswers logo

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


Originally posted by Pi Robot on ROS Answers with karma: 4046 on 2011-11-20

Post score: 2

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by fergs with karma: 13902 on 2011-11-20

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Pi Robot on 2011-11-21:
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.

Comment by fergs on 2011-11-21:
You did change the baud rate for the sketch right? Default is 57600...

Comment by Pi Robot on 2011-11-21:
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).

$\endgroup$

Your Answer

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