xioTechnologies / Fusion

MIT License
927 stars 230 forks source link

FusionCalibrationInertial vs FusionOffsetUpdate #79

Closed ladislas closed 1 year ago

ladislas commented 1 year ago

In our project, we've implemented the Advanced example provided, that you can see here:

https://github.com/leka/LekaOS/blob/develop/spikes/lk_sensors_imu_lsm6dsox_fusion_calibration/main.cpp

We have followed the following protocol:

1. Calculate static accel + gyro offsets

2. Apply previously obtained offsets

Using then apply the offsets using FusionCalibrationInertial.

As a side note, only using FusionCalibrationInertial reduces the yaw drift greatly.

3. Apply runtime gyroscope offset correction

Using FusionOffsetUpdate we apply runtime calibration to the gyroscope, as explained here


During code review, one our team member tried using only FusionOffsetUpdate without using FusionCalibrationInertial.

He said the effect seemed to be the same: reduce yaw drift to almost zero giving us stable values over time when the device is not moving.

He then asked the following question:

What's the difference between the two? Why do we need both? Would using FusionOffsetUpdate be enough?

My answer was "trust the experts and follow the canonical example first, before trying to do things differently. Then we can experiment".

But I was not happy with my answer, so I'd like to add more information.

What would you say in that situation?

xioTechnologies commented 1 year ago

As stated in the README, "the gyroscope offset correction algorithm provides run-time calibration of the gyroscope offset to compensate for variations in temperature and fine-tune existing offset calibration that may already be in place". The inertial calibration model just subtracts whatever offset is specified by the user, usually a constant value.