ICM-20948 Adjusting For Drift

Hey everyone!

In the SparkFun Arduino Library for the ICM-20948 it mentioned on Line 582 That…

// Q0 value is computed from this equation: Q20 + Q21 + Q22 + Q23 = 1.
// In case of drift, the sum will not add to 1, therefore, quaternion data need to be corrected with right bias values.
// The quaternion data is scaled by 2^30.

Though based off the research I’ve done I haven’t found any elaboration on how I might accomplish this issue. Do you guys have any ideas or experience with mitigating this. We currently have our edges cases covered with if-else statements for the exception, but wondered if there was something that I wasn’t seeing.

Thanks!

If there is a consistent drift, it might be due to bias in the sensor data. In such cases, it’s useful to implement a bias correction algorithm, such as Kalman filter.

It doesn’t sound like the drift is consistent, and the drift itself it quite minimal. It’s just sometimes it’ll throw an exception and we wanted to see if there was some in-built function for handling this drift that we didn’t know about. Regardless a Kalman Filter is a good idea, though we have a lot of rapidly changing data and I’m almost worried about putting filters on top of that.

Though just thinking about it, we might be able to just filter out the quaternion data at specific intervals with something like a Kalman or Averaging Filter so it would be unlikely that something like that would happen.

If the math is correct, the drift is due to the gyro and other sensor offsets, which can be greatly reduced by calibration (a fairly simple procedure that is required in any case).

The offsets are temperature dependent, so large changes in temperature will lead to drift or other errors, even in a well calibrated setup.

No filter can remove systematic errors, such as those due to sensor offsets.