jremington / LSM9DS1-AHRS

Mahony 3D fusion filter and tilt compensated compass, with sensor calibration code
42 stars 11 forks source link

Trouble with deltat while performing other op on arduino nano #2

Closed Mixou26 closed 2 years ago

Mixou26 commented 2 years ago

Hello jremington, Thanks for the code, it is really interessting and it's working directly, which is nice :) I'm experiencing some issue with yaw calculation as soon as I try to perform other task with arduino (calculate average yaw, doing other stuff). I think the problem comes from the using of deltat for the quaternion. For exemple, if I print yaw with nothing else: works fine, yaw value is constant If I add delay(500), the yaw value is just not stable and shows large variations. Have you experienced such an issue? Do you think there is a simple way to deal with this? Thanks Best regards Mix

jremington commented 2 years ago

Glad it worked out of the box!

The loop update time has to be short, otherwise the numerical integration becomes extremely inaccurate. You can't even print every update cycle!

If you want to do a significant amount of "other stuff" between sensor reads and quaternion update, you will need a faster processor. Or, just use the Nano for orientation, and do the other stuff on another processor.