kriswiner / MPU9250

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

Gyro drift related to sensor movement #466

Open richard9999999999 opened 3 years ago

richard9999999999 commented 3 years ago

Hello Kris,

I am playing with MPU9250 and your library (BTW thanks much for your great effort). Generally it works well however I experience a weird thing.. I will speak about raw gyro/accel data only in the next: they seems to be correct, startup calibration works e.t.c. so when I am turning board on various edges I see 1g on one axis and 0g on another two, gyros seems to report correct angular speed in degrees/s on all 3 axes.. However I noticed strange thing in raw gyro data: When I am moving the sensor (in straight move) e.g. along Y axis, I see a drift in X axis gyro output (and similar with another two axes). The drift is positive when moving one direction vs. negative for opposite direction. The drift looks not be related to acceleration (it seems to be rather related to velocity (?) or related change of acceleration (?) ) So let's say when I am moving whole board to left (along sensor's Y axis) in straight direction by cca 0.2m/s, I see up to 10deg/s drift of X axis gyro.. What could be a reason? A defective MPU9250? Haven't you seen that before?

Thanks much Richard

kriswiner commented 3 years ago

I would say this is normal, but I haven't explicitly looked for this behavior before.

The sensors have to be calibrated to get anything sensible out of them. At least remove the offset bias. But even then there will be cross axis bias, axes scale error, etc. Plus the sensors are subject to interference from vibrations during motion, etc. So the behavior you describe is likely normal.

It should be easy to test other units to make sure.

But these are inertial sensors so any motion is likely to affect the individual sensor readings. The true test is the stability of the absolute orientation estimation (quaternions) you can get from the properly calibrated sensor data. We haven't had any trouble getting ~4 degree rms heading accuracy out of the MPU9250 when mounted on a UAV, so whatever gyro drift is caused by motion does not affect its use as navigation tool.

On Thu, Aug 26, 2021 at 5:29 AM richard9999999999 @.***> wrote:

Hello Kris,

I am playing with MPU9250 and your library (BTW thanks much for your great effort). Generally it works well however I experience a weird thing.. I will speak about raw gyro/accel data only in the next: they seems to be correct, startup calibration works e.t.c. so when I am turning board on various edges I see 1g on one axis and 0g on another two, gyros seems to report correct angular speed in degrees/s on all 3 axes.. However I noticed strange thing in raw gyro data: When I am moving the sensor (in straight move) e.g. along Y axis, I see a drift in X axis gyro output (and similar with another two axes). The drift is positive when moving one direction vs. negative for opposite direction. The drift looks not be related to acceleration (it seems to be rather related to velocity (?) or related change of acceleration (?) ) So let's say when I am moving whole board to left (along sensor's Y axis) in straight direction by cca 0.2m/s, I see up to 10deg/s drift of X axis gyro.. What could be a reason? A defective MPU9250? Haven't you seen that before?

Thanks much Richard

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/466, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKXZ44S6THJMXF42CJDT6YXTRANCNFSM5C3H5OTA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

richard9999999999 commented 3 years ago

I have one unit only at the moment (purchased locally however origin is in China for sure). This "crosstalk" between accelerometer and gyro seems to be fairly high and I think it draws the device unusable for any a bit more precision task. I will try to obtain another one and check.. Thank you for the answer.

kriswiner commented 3 years ago

You should expect gyro drift of 1 or a few dps per minute even when standing still...is this what you see? The accel's jhob (and mag) is to compensate for gyro drift. If there were no gyro drift, absolute heading estimation would be a lot easier and more accurate.

On Thu, Aug 26, 2021 at 9:13 AM richard9999999999 @.***> wrote:

I have one unit only at the moment (purchased locally however origin is in China for sure). This "crosstalk" between accelerometer and gyro seems to be fairly high and I think it draws the device unusable for any a bit more precision task. I will try to obtain another one and check.. Thank you for the answer.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/466#issuecomment-906549906, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKSZDRDR5TDVFWZXRNTT6ZRZXANCNFSM5C3H5OTA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

richard9999999999 commented 3 years ago

I see much less gyro drift than1dps per minute (device running in the desk, occasional moves).. Of course now I am not speaking about effect I described above. I am trying to make an attitude indicator for aircraft. Have used Madgwick filter and it seems it performs well when trying to move/rotate the device in hands (magnetometer is calibrated by your routine (lazy 8-ths)) and results are stored into serial EEPROM and read/used on each startup, gyros/accelerometers are calibrated on each startup ). However when I tested the device in car, it reacts on car's turns (turn pure on Z axis) besides correct heading change also as a roll/tilt(X axis) and on acceleration/braking as a change of pitch (Y axis) When I tested the device in aircraft, it almost doesn't indicate tilt(roll) in proper turn (turn with acceleration forces towards device bottom).. On ground in hands the reaction is correct on first view (with the exception I am getting roll indicated when moving the device left/right without tilt).. OK, I suppose the filter is not tuned for the purpose (slow changes) and probably more advanced fusion algorithm should be used here however I supposed it will work better. I think the reason is could be that "gyro drift with move" effect I observe?

kriswiner commented 3 years ago

More likely hard iron offsets from the vehicles.

Plus if used in an aircraft or any vehicle where inertial forces approach or exceed gravity, all IMYU-based orientation estimation is fubar.

On Thu, Aug 26, 2021 at 11:39 AM richard9999999999 @.***> wrote:

I see much less gyro drift than1dps per minute (device running in the desk, occasional moves).. (Of course now I am not speaking about effect I described above. I am trying to make an attitude indicator for aircraft. Have used Madgwick filter and it seems it performs well when trying to move/rotate the device in hands (magnetometer is calibrated by your routine (lazy 8-ths)) and results are stored into serial EEPROM and read/used on each startup, gyros/accelerometers are calibrated on each startup ). However when I tested the device in car, it reacts on car's turns (turn pure on Z axis) besides correct heading change also as a roll/tilt(X axis) and on acceleration/braking as a change of pitch (Y axis) When I tested the device in aircraft, it almost doesn't indicate tilt(roll) in proper turn (turn with acceleration forces towards device bottom).. On ground in hands the reaction is correct on first view (with the exception I am getting roll indicated when moving the device left/right without tilt).. OK, I suppose the filter is not tuned for the purpose (slow changes) and probably more advanced fusion algorithm should be used here however I supposed it will work better. I think the reason is could be that "gyro drift with move" effect I observe?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/466#issuecomment-906649936, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKWBGVKFYGDA7VITGNDT62C6DANCNFSM5C3H5OTA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

richard9999999999 commented 3 years ago

I don't think the problem is based on magnetometer disturbance. It will cause just incorrect heading indication. I tried also version of filter without magnetometer input and I see about the same..

Plus if used in an aircraft or any vehicle where inertial forces approach or exceed gravity, all IMYU-based orientation estimation is fubar.

Please, could you explain above? What is IMYU? For sure MEMS gyro/accelometer based IMUs are used to cotrol UAV-s, quadrocopters, RC helicopters, and those sensors (probably higher grade ones) are used in some commercial aircraft attitude indicators where probably extended Kalman filter with fusion of GPS and/or airspeed data (instead of magnetometer) is used.

kriswiner commented 3 years ago

IMU

On Thu, Aug 26, 2021 at 1:12 PM richard9999999999 @.***> wrote:

I don't think the problem is based on magnetometer disturbance. It will cause just incorrect heading indication. I tried also version of filter without magnetometer input and I see about the same..

Plus if used in an aircraft or any vehicle where inertial forces approach or exceed gravity, all IMYU-based orientation estimation is fubar. Please, could you explain above? What is IMYU? For sure MEMS gyro/accelometer based IMUs are used to cotrol UAV-s, quadrocopters, RC helicopters, and those sensors (probably higher grade ones) are used in some commercial aircraft attitude indicators where probably extended Kalman filter with fusion of GPS and/or airspeed data (instead of magnetometer) is used. …

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/466#issuecomment-906710789, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKTKK7GWEPXXFAJS2S3T62NZJANCNFSM5C3H5OTA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.