|
Re: Got Gyro drift? Try Sensor Fusion !
Phil -
You might like this ... I developed a new vi to constantly re-calibrate the gyro while the robot is in Disabled Mode. It is integrated into this updated IMU Demo Project, see the True case within the IMU Read Loop for the new vi "IMU ZeroBias". Alternatively, you could use this vi within the Disabled.vi if you like, I just implemented it all within Periodic tasks. Here, you would simply use the existing "Robot Mode" variable to drive the case structure within the IMU Read Loop.
IMU ZeroBias will read a sample set of measurements from each axis for Gyro calibration. Samples are placed into a circular buffer to maintain the most recent period of samples, used to compute the most current zero rate bias. The intent is to constantly update the Gyro rate bias (during Disabled Mode, which is assumed to satisfy the condition that the sensor is not moving). This ensures we have the best possible calibration available immediately prior to the termination of Disabled Mode (DM), effectively dealing with the Gyro's thermal stabilization and the uncertainty in the variation of how long DM may persist from one match to the next - this way you always start with a 'fresh' cal even if it takes 10 minutes for a field start.
If excessive variation in the circular buffer's dataset is detected, the gyro calibration is not updated, and automatically retains the last good calibration until the situation improves. In this way the code will logically adapt to both the delay before match start and any errant movement while Disabled that would otherwise spoil the cal - and your 32 point Autonomous. You can watch the IMU ZeroBias Front Panel to observe this behavior ... watch the constant calibration updates during DM, then bump it to see it freeze on the last good cal until both the physical disturbance is over and the bad data is removed from the circular buffer.
So ... this is the best way I can think of, for the moment. A repeating IMU Open is probably no-go since the I2C bus needs to be closed first.
Only caveat is I haven't been able to test this as much as I normally would like ... see it if works for you and let me know if you see any issues. See you at Chesapeake?
Last edited by Richard100 : 22-03-2015 at 20:01.
|