BjarneBitscrambler / OrientationSensorFusion-ESP

Files for performing orientation sensor fusion using NXP version 7 algorithm, ported to Espressif platforms.
BSD 3-Clause "New" or "Revised" License
23 stars 12 forks source link

Add method to correct for Magnetic Deviation #23

Closed BjarneBitscrambler closed 3 years ago

BjarneBitscrambler commented 3 years ago

@DanielG86 suggested adding a means for correcting the compass readings for Deviation. After the built-in magnetic calibration routine runs, there will likely be some residual error. If this error is repeatable then we should be able to correct for it, similarly to using a deviation table with a physical compass.

Depending on the type of error, the correction might be one or more of:

BjarneBitscrambler commented 3 years ago

In the example main.cpp I inserted two transforms: AngleCorrection and CurveInterpolator The first is the most straightforward - it adds a constant offset in radians to the heading value before it is output as Magnetic Heading. The second transform allows one to define an arbitrary set of points that are used to re-map the input to the output values, using interpolation.

Both transforms are able to be edited using the sensor's web interface.