Friday, March 4, 2011

AVC Bot: Fixing Problems

When things do go to crap, sometimes you just have to go to bed and try again tomorrow.

This wasn't one of those times.

I took a deep breath, dove in, and start hacking and slashing at the problems one by one.

Better GPS Data
I yanked the dead LS20031 and installed the iGPS-500 in its place. I'm glad I put pin headers on the motherboard for both my GPS modules. After a few code tweaks, I did a test run with the new GPS. Here's the track plot.

Now that's more like it.
While there's several feet worth of error in the GPS position, that's better than several blocks' worth of error! This kind of data I can at least work with.

Overall, I'm feeling a lot better about the iGPS-500 than I did about the Locosys module. I don't know what it was, bad juju? I've just not had good luck with 'em so far. To be fair, poor mounting was probably causing most of the problems.

Hopefully the SiRF III can handle the urban canyon and trees at the SFE building almost as well as the Locosys' MTK chip.

It doesn't have to be perfect; I plan to supplement the GPS with other sensors that the robot can rely on more heavily when the GPS signal craps out.

The 1Hz update rate isn't bad and I guess I can live with 4800bps. Funny how all the "must haves" turn into "who cares?" when you're getting desperate.

Check out the speed plot.  Though I can't cross check the speed, the numbers are far more plausible than the those from the Locosys, and the shape of the curve looks approximately right given the maneuvers I was doing with the truck.

Far more realistic speed plot. Top speed 20mph downhill!
The GPS was seeing 1.2-1.8 HDOP which isn't bad. It's not great, but the important part here is that I'm getting decent heading, speed, and position data.

Calibrating the Compass
Next up, I figured I better calibrate the HMC6352 compass I added (more on that in another post). The mbed library that's available for the device is very fully featured including a method to enter or exit the calibration mode.

I wrote up some quick code to calibrate the compass and performed the calibration.  Heading data was already looking better in the basement here. The test run is even better yet:

Gyro and Compass now agree. GPS is close, but delayed
Notice how the compass and gyro heading estimate readings track pretty closely.  The only gyro calibration I've done is just by trial and error eyeballing the plots so I should be able to improve gyro accuracy even further.

And it looks like the compass is pretty responsive, meaning I can use the compass for turning as well as steady state.

Data Logging
I switched from logging to a microSD card to logging to the built-in mbed filesystem / USB drive.  It seems to be working reliably so far.

The reason I didn't use the built-in drive to begin with was because uSD logging on Arduino was so easy, because it has less storage space, and the mbed LocalFilesystem library warning scared me.

But there's no need to fear. Recovering the drive is easy. I've done it twice now. :)

The built-in disk is easy, reliable*, and more convenient than the SD card. Just plug the mbed into the computer's USB and there are your files.

Hydra Heads
Another problem came up. My gyro stopped working. I must have introduced some problem with the main AVC code but was able to fix it after updating and republishing my ADC128S mbed library. I hate these problems that come out of nowhere and invariably burn up an hour or two. But it comes with the territory I guess.

*I had problems crop up with the built-in disk again and so I revised the logging code slightly and it seems to be reliable again. We'll see. It's incredibly frustrating to waste lots of time capturing data only to find out you captured exactly bupkis.

Maiden Voyage, Take Two
Now maybe I can finally get back to collecting some usable data.

I have to because the maiden voyage is rescheduled for March 12!

Looking Up?
In summary, I'm not totally screwed anymore. Although I really wished I hadn't bricked my $60 GPS. And I still have a ton to get done.

I take it back. The LS20031 is alive and well! The GPS module's backup battery was complete drained (I probably shorted it out while resoldering the shield). After recharging for awhile, it is back to normal and getting a good, multi-satellite, 3d fix. WHEW!


  1. Hey Michael, great improvements since last time. How are you planning to fuse all the sensors together?

    Also you could use some filtering on your data (some smoothing and spike removal). I recently wrote a quick post on median filtering that you can check out in case you don't know.

    Overall great progress! Well done. I wish we also had some competitions to attend to in my country :/

  2. Michael,

    Good to see you are sticking with it and made great progress on your data. That graph is looking way more usable than the last one. Thanks for sharing your experiences.



Note: Only a member of this blog may post a comment.