|
Re: Anything better than a gyro?
Try a complimentary filter - it biases measurements depending on the frequency of the input. The gyro would be useful for high-frequency measurements, but will quickly drift in a low-frequency environment. An encoder, likewise, will probably be susceptible to wheel slippage at high speeds, but will work well when speed is slow. A very, very simple two-tap complimentary filter is simply to do:
total_rotation = 0.5*gyro_new - 0.5*gyro_old + 0.5*enc_new + 0.5*enc_old;
gyro_old = gyro_new;
enc_old = enc_old;
This is essentially a high-pass filter on the gyro with a low-pass filter on the encoder. This has the inherent flaw that it allows high-frequency noise from the gyro to enter the system, so a low-pass with a higher cutoff than the highpass filter might be required for the gyro first.
Hope this is useful.
Sparks
|