Wired up the gyro and made a couple tiny alterations to the code and turned it on. WOW! The gyro is ultra sensitive and with the motors it LOCKS the robot's attitude (amount of tilt). Aside from the inevitable drift, which I'll fix with the accelerometer, the robot resists tilt very actively. It wants to stay exactly where it is. Me happy!
Just after taking this pic I took off the two resistors serving as a voltage divider and feeding a 2.5V VREF+ to the PIC and connected the VREF+ to the precision 2.5V reference on the gyro.
I did some research on kalman filtering. OMG!!! I don't think I'll ever understand either the math or the code.
I tried a bunch of low tech ways of fitting gyro/accel together. No success. Just weirdness.
So I'm trying to find a good piece of "black box" kalman filter code that I can just use without understanding. **broken link removed** is the best candidate so far.