0

NXP 9-DOF Pitch/Roll drift when accelerating/braking
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

NXP 9-DOF Pitch/Roll drift when accelerating/braking

by Ppaing126 on Tue Jul 27, 2021 9:54 pm

Hi, I have been testing the:

Adafruit Precision NXP 9-DOF Breakout Board - FXOS8700 + FXAS21002
PRODUCT ID: 3463

extensively with the RtimuLib.

So far it works well for pitch yaw and roll when vehicle is stationary or steady speed.
But one unwanted thing I notice is: When accelerating or decelerating the car, the pitch shows up to +18 degrees, what is not real.
I admit the car has a change on pitch due to suspension but not that much!

Say it goes up to +18 when accelerating, or -18 when braking. After settle on zero speed, the pitch sometimes gets closer to zero but mostly of the times it keeps at negative or positive 2/4 degrees.

How is this error called..?
Is there a way to correct for this acceleration error?

Looking for you expertise to give a hand on this to sort out the error type (dynamic acceleration, linear acceleration, etc) and try to find a fix.

Thank You!

Ppaing126
 
Posts: 22
Joined: Mon Jun 19, 2017 12:58 pm

Re: NXP 9-DOF Pitch/Roll drift when accelerating/braking

by sj_remington on Tue Jul 27, 2021 10:19 pm

The accelerometer measurements are assumed to represent the "down" direction by most, if not all 3D orientation fusion filters. It is not possible to distinguish between the acceleration due to gravity, and accelerations due to other forces, so engine acceleration, braking and turns introduce large orientation errors.

3D sensor fusion algorithms such as RTIMUlib use the gyro measurements in the attempt to correct for this, but the gyro measurements are noisy, offer only a partial correction, and the weights on the various sources of orientation information are rarely optimized. The Mahony and Madgwick fusion filters are rather different alternatives to the generic Kalman filter built into RTIMUlib, so if you can find a version that works with your IMU sensor, try it out.

Alternatively, try using another sensor for which Mahony and Madgwick filters are already coded. The LSM9DS1 9DOF sensor is state of the art among consumer grade sensors and works quite well.

sj_remington
 
Posts: 133
Joined: Mon Jul 27, 2020 4:51 pm

Re: NXP 9-DOF Pitch/Roll drift when accelerating/braking

by Ppaing126 on Wed Jul 28, 2021 3:50 pm

Thank You for the advice!

I have prepared a list of different libraries to test; also have ordered a couple of LSM9DS1 to try.
Because Adafruit do not have currently in stock I have ordered from Mouser.

The libraries to try, between others:

- RTImulib (currently under the issue). Need also to play with the gyro weighting value...
- Ardu-Imu
- Pololu MiniIMUahrs
- NXP Sensor Fusion
- Adafruit AHRS (Mahoney/Magdwick/Nxp)

Some other good you recommend...?

Ppaing126
 
Posts: 22
Joined: Mon Jun 19, 2017 12:58 pm

Re: NXP 9-DOF Pitch/Roll drift when accelerating/braking

by sj_remington on Wed Jul 28, 2021 9:50 pm

This Mahony fusion filter works well for the LSM9DS1, and since I wrote it, I can help if there are issues.
https://github.com/jremington/LSM9DS1-AHRS

There are two versions of the Mahony filter: the standard one written by Madgwick, and a new one (MahonyUW_AHRS.ino) that uses a different set of reference directions, yet still based on the accelerometer and magnetometer data. My test show that the new one works a bit better than the standard one.

It is essential to properly calibrate both the gyro and the magnetometer. The accuracy of the filter will be slightly improved if you calibrate the accelerometer as well, but that is not required.

sj_remington
 
Posts: 133
Joined: Mon Jul 27, 2020 4:51 pm

Re: NXP 9-DOF Pitch/Roll drift when accelerating/braking

by Ppaing126 on Fri Jul 30, 2021 8:47 am

Appreciated, Thank You!

Yesterday I almost completed adapting the Adafruit fxas/fxos 9dof with Arduimu library.
Will test this weekend; only noticed the orientation is 90 deg rotated respect to the board at the resulting angles but I think have been able to make it work.

Waiting for the LSM9DS1 to arrive to give a try with your library.

Ppaing126
 
Posts: 22
Joined: Mon Jun 19, 2017 12:58 pm

Please be positive and constructive with your questions and comments.