kriswiner / MPU9250

Arduino sketches for MPU9250 9DoF with AHRS sensor fusion
1.03k stars 472 forks source link

Altitude drifts over time #109

Open evinramadeen opened 7 years ago

evinramadeen commented 7 years ago

Hey Kris, I have read in a lot of posts that the yaw tends to drift over time but this has not been an issue for me using your code, I have however noticed a slow drift upward in the altitude. I can't figure out what would cause that. The only thing I could think of is I am sending my different accel gyro and magnetometer values into the quarternion update function with the wrong polarity but I have not seen anything to suggest that I am correct in thinking this. Do you have an idea of what causes the altitude to drift?

kriswiner commented 7 years ago

Yaw won't drift for a 9DoF solution (that's what the magnetometer is for) as long as your sensors are properly calibrated.

By altitude I assume you mean the altitude derived from the barometer. of course, this will drift due to changes in the weather or even someone opening a door or window. If altitude estimation stability is important to your application you can use a Kalman filter to combine the accel and barometer to drift stabilize the altitude. This amounts to rejecting changes in altitude if the accel doesn't also detect z-axis accelerations. This is a more advanced topic not the subject of open-source solutions AFAIK.

On Thu, Jan 5, 2017 at 5:32 PM, evinramadeen notifications@github.com wrote:

Hey Kris, I have read in a lot of posts that the yaw tends to drift over time but this has not been an issue for me using your code, I have however noticed a slow drift upward in the altitude. I can't figure out what would cause that. The only thing I could think of is I am sending my different accel gyro and magnetometer values into the quarternion update function with the wrong polarity but I have not seen anything to suggest that I am correct in thinking this. Do you have an idea of what causes the altitude to drift?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU-9250/issues/109, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qjrgFZMou8mUzvNW6wZuDgSTnGsaks5rPZnIgaJpZM4LcUQB .

evinramadeen commented 7 years ago

Yes, I am currently required to do a project for my Bsc that needs this. I am required to create an Open Source Quadcopter control platform that must be able to perform indoor navigation based on hard coded inputs. That is, I am to hard code a flight plan that the quadcopter must follow so the altitude being read by the sensor needs to be accurate to ensure that unnecessary adjustments are not made by my flight controller and sent to my ESCs. Thanks for the suggestion, I will look into Kalman filtering using the accel and barometer data. or possibly even try to just accept change in altitude only if accelerometer z axis changes as well. That was a great idea. Thanks