This repository was archived by the owner on Aug 25, 2023. It is now read-only.

Description
I have an MPU-9250 and I'm trying to use the Mahony filter to get better Pitch, Roll and linear acceleration. However, after I run mpu.calibrateAccelGyro() to calibrate the sensor (or even if I don't run it), while it's sitting still horizontally, Roll is -179º. It actually goes from -179º to +179º simply by tilting slightly. I'm not an expert on Roll, but while I understand its interval is [-180,+180º], is there a way to "calibrate" it to zero and also avoid this weird "wrap around" of -179º turning into +179º? Because linear acceleration will also be affected (mpu.getLinearAccZ() returns 19.6m/s^2 instead of 0m/s^2, when mpu.getAccZ() is 9.8m/s^2).
If I use QuatFilterSel.NONE, then the Roll is 0, as expected.
Could someone explain what I'm doing wrong? Thank you!