Reducing Drift in KOP Gyroscope

If you make some modifications to the WPIlib Gyro class code you can add the ability to re-calibrate the gyro via a button press on the driver station during the Disabled state before the match starts. All MEMS gyros are sensitive to heat, and they self-heat once they are on. If you turn on the robot and the MC takes a while to start the match, there is a good chance that the initial calibration will be quite a ways off by the time the match starts. Recalibrate at the last possible moment, and also zero the accumulated heading at this time, and you’ll be in good shape.

Averaging multiple gyros can help, but not eliminate, the drift issue. Pretend you have N identical gyros on the robot. As N approaches infinity, you can basically eliminate any random errors that accumulate over time. But, you cannot remove systemic errors (errors that are common to all of the gyros). Systemic errors include nonlinearities, thermal sensitivities, cross-axis sensitivities, alignment errors, etc. To reduce systemic errors, you generally need a better gyro. There is a reason (well, multiple reasons) that NASA does not use the FRC KOP gyro on their spacecraft. With inertial sensors, you often get what you pay for. The good news is that, for FRC applications, the KOP gyro is usually fine for 15 seconds of autonomous mode. If you want to do field-centric control for a holonomic drivetrain, it might be worth spending $50 or so on a superior gyro.

Fusing a gyro with encoders (via a Kalman filter or other techniques) helps in a few specific cases. Namely, you gain the ability to do a “zero velocity reset”. In other words, if you KNOW you aren’t moving (because the encoders aren’t changing state), you can disregard any gyro movements during these periods. In general, though, the complexity of an extended/unscented Kalman filter will outweigh the benefits in 99%+ of cases.