Mayitzin / ahrs

Attitude and Heading Reference Systems in Python
https://ahrs.readthedocs.io/
MIT License
550 stars 88 forks source link

Yaw static error #55

Open AliaChe opened 2 years ago

AliaChe commented 2 years ago

Hello,

Thank you for this very useful code.

I'm facing an issue with the yaw estimation using Madgwick/Mahony filters.

I povide ideal sensors measures in ENU frame :

Where n is the number of samples set to:

With these inputs, I get null roll, pitch and yaw. I assume then both filters are providing the orientation in ENU frame.

The issue starts when I add some noise to the gyroscope measures, a noise of mean zero and standard deviation of 0.01: gX += np.random.normal(0, 0.001, n) gY += np.random.normal(0, 0.001, n) gZ += np.random.normal(0, 0.001, n)

The estimated yaw presents a static error of -pi/2 with Madgwick and pi/2 with Mahony. Tuning the filters doesn't fix the issue.

Any ideas?

Thank you

dapowan commented 2 years ago

The same to me. Madgwick/Mahony has significant yaw errors when adding noises to gyroscope. And the EKF filter cannot output the same results even when all gyroscope measurements are equal to 0. The quaternion keeps changing over time.

AliaChe commented 2 years ago

Hello,

Found out what I was doing wrong:

Mayitzin commented 2 years ago

I think your last bulletpoint is something I have to take a look at. All the algorithms have been developed independently by their authors and might have different reference frames, as you point out. I will have to think of a way to deal with it. Thanks for bringing it up!