Hi all,

I'm building a balancing robot. I have an inertial measurement unit that I've successfully filtered with a complementary filter. It combines a high-pass filter on the gyro input with a low-pass filter on the accelerometer input.

The filter looks like this:

`angle = a*(angle + gyro_input * dt) + (1 - a)*(accelerometer_input)`

where a is determined by the equation:

`(a*dt) / (1-a) = T`

where T is the time cutoff under which you want to trust the gyro and above which you want to trust the accelerometer.

The good news is that this filter successfully eliminates gyroscopic drift and provides a reliable angle, even when the accelerometer is inside an accelerating reference frame

*vis a vis* the earth.

The bad news is that (I wrote a visualization program that looks like a speedometer) the measured angle takes a loooong time to catch up to the actual angle. :~

The even worse news is that I'm considering switching to a Kalman filter despite not knowing how it works, which I feel ethically opposed to.

Does anybody have success stories to share about using the Kalman filter? Can anybody provide a working implementation of one that I don't have to rip out of somebody's program? Can anybody talk about how to find the constants used in the algorithm? Do I really have to measure the physical system and determine my covariance matrix based on the characteristics of my vehicle?