ROS xbee debugging and other ramblings

This is not a terribly interesting post, but I just wanted to share some of my progress on my RC car hacking. I didn't get a whole lot done last weekend because I was busy with many other more social things.

Other Ramblings First

I did spend a little bit of time on last Saturday to learn more songs for the cover EP I intend to work on and also some arrangements, but not too much progress on that front unfortunately.

Xbee Stuff

So I soldered up my old xbee shield that I got from ages ago, and made the mistake of realizing I probably should have used stackable headers, but I think it may be too late for that now. I think I'll have a work around later for wiring things up later. I first wanted to do a sort of blink test to make sure I could get comms between my laptop and my Arduino. I did basically a sort of version of this tutorial.

The set up was basically as follows.
  • sparkfun xbee explorer with xbee controller id 0
  • arduino with xbee shield id 1
I used an example code block from the ROS Arduino Examples. So starting up the following commands I was able to blink the embedded LED on the Arduino:
  • roscore
  • rosrun rosserial_xbee xbee_network.py /dev/ttyUSB0 1
  • rostopic pub -r 2 /toggle_led std_msgs/Empty

Fascinating photo... I know


Lessons Learned
The previous steps really simplified how much effort this took however. Ideally this should have been a simple process, but I ended up having to spend quite a bit of time configuring my xbees. Since I had not touched my xbees in quite a while I didn't know the state they were in and I basically wanted to do a factory reset. I downloaded the xtcu program from Digi to do just that. As mentioned in the tutorial they mentioned that you can use
  • rosrun rosserial_xbee setup_xbee.py -C /dev/ttyUSB0 0
  • rosrun rosserial_xbee setup_xbee.py /dev/ttyUSB0 1
for example to set up the xbee configurations on fresh from the factory xbees. Unfortunately,  this didn't work as intended, and I got errors. I then tried to manually configure them using the xtcu tool. Also no dice. I imagine that the problem is that I was failing to set some parameters that the setup script would be able to do. I did some more investigating to find out that the setup script expects the xbee to be in 57600 mode. So after doing a factory reset again then setting the xbees to 57600 baud, I was finally able to use the setup scripts as described in the tutorial.

Comments