kriswiner / MPU9250

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

Strange AHRS results #220

Open nitrosalat opened 6 years ago

nitrosalat commented 6 years ago

Hi, i'm sorry if this question is asked before.

When mpu9250 module accelerates along x-axis and not rotates around y-axes pitch value shouldn't change. But in my case pitch value changes. What am I doing wrong?

kriswiner commented 6 years ago

Did you calibrate all thre sensors?

On Fri, Dec 29, 2017 at 4:25 PM, Mark Nitrosalat notifications@github.com wrote:

Hi, i'm sorry if this question is asked before.

When mpu9250 module accelerates along x-axis and not rotates around y-axes pitch value shouldn't change. But in my case pitch value changes. What am I doing wrong?

— 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/220, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qgeFLvRwYt5q8Azu7kwsYprrgvcgks5tFYLjgaJpZM4RPdoy .

nitrosalat commented 6 years ago

Yes, i did

kriswiner commented 6 years ago

Are you passing sensor data to the Madgwick filter in the proper order?

On Fri, Dec 29, 2017 at 4:55 PM, Mark Nitrosalat notifications@github.com wrote:

Yes, i did

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/220#issuecomment-354518304, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qre4HhbvgDR6SKo6jRTh7guc02TCks5tFYnngaJpZM4RPdoy .

nitrosalat commented 6 years ago

Yes, i tried Madgwick and Mahony filters and i'm passing sensor data in proper order. The acceleration still affects the Euler angles.

kriswiner commented 6 years ago

What is the order?

If it correct, and I assume your sensors are properly calbrated, only other possiblity apart from a faulty sensor breakout would be man-made magnetic fields.

On Fri, Dec 29, 2017 at 5:04 PM, Mark Nitrosalat notifications@github.com wrote:

Yes, i tried Madgwick and Mahony filters and i'm passing sensor data in proper order. The acceleration still affects the Euler angles.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/220#issuecomment-354518873, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qsPj7g3h5H9R1-8wg_mSRAKeFmtBks5tFYwFgaJpZM4RPdoy .

nitrosalat commented 6 years ago

ax, ay, az, gx, gy, gz, mx, my, mz, deltat

kriswiner commented 6 years ago

No, needs to be NED.

On Fri, Dec 29, 2017 at 5:38 PM Mark Nitrosalat notifications@github.com wrote:

ax, ay, az, gx, gy, gz, mx, my, mz, deltat

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/220#issuecomment-354520575, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qhaXcYBVxTeIMVBGx9jGVwGhWDmcks5tFZQEgaJpZM4RPdoy .

nitrosalat commented 6 years ago

In static position(without accelerations) pitch, roll angles are correct but if i accelerate the module along one of axes WITHOUT rotation pitch and roll are changing. I think it is not a problem with sensor data pass order to filter.

kriswiner commented 6 years ago

" I think it is not a problem with sensor data pass order to filter."

You are wrong.

Choose which accel axis you want to point North. Figure out which gyro and mag axes point in the same direction. Then figgure out which oint East, and which point Down. If you look at the data sheet you should be able to see immediately why this is necessary; i..e.,Az = -Mz in terms of direction.

Feed the Madgwick filter as so:

(AN, AE, AD, GN, GE, GD, MN, ME, MD)

It cannot be as you had it above.

On Fri, Dec 29, 2017 at 7:45 PM, Mark Nitrosalat notifications@github.com wrote:

In static position(without accelerations) pitch, roll angles are correct but if i accelerate the module along one of axes WITHOUT rotation pitch and roll are changing. I think it is not a problem with sensor data pass order to filter.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/220#issuecomment-354525376, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qvgkV9vszuz_zF21Ye7jw4Undohcks5tFbHfgaJpZM4RPdoy .

nitrosalat commented 6 years ago

Ok, i'm feeding the madgwick filter in order ax, ay, az, gx, gy, gz, my, mx, -mz but pitch and roll values are still changing while the module accelerates along x-axis or along y-axis. Btw, when i use madgwick filter, pitch and roll less react on acceleration than mahony filter.

kriswiner commented 6 years ago

What kind of MCU are you using? What is the fusion rate?

On Sat, Dec 30, 2017 at 9:06 AM, Mark Nitrosalat notifications@github.com wrote:

Ok, i'm feeding the madgwick filter in order ax, ay, az, gx, gy, gz, my, mx, -mz but pitch and roll values are still changing while the module accelerates along x-axis or along y-axis. Btw, when i use madgwick filter, pitch and roll less react on acceleration than mahony filter.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/220#issuecomment-354556709, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qvcPcDWSyg_kkI2tWy1BwVLHPSMrks5tFm2mgaJpZM4RPdoy .

nitrosalat commented 6 years ago

ATmega328P(arduino nano)

kriswiner commented 6 years ago

Yeah, 8 or 16 MHz AVR is not going to give you very good results. You might get 100 Hz fusion rates, you really need 1 kHz or better.

See: https://github.com/kriswiner/MPU6050/wiki/Affordable-9-DoF-Sensor-Fusion

Teensy 3.2 or, better, this https://www.tindie.com/products/TleraCorp/ladybug-stm32l432-development-board/ would be more appropriate.

On Sat, Dec 30, 2017 at 9:33 AM, Mark Nitrosalat notifications@github.com wrote:

ATmega328P(arduino nano)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/220#issuecomment-354558204, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qrF88t49N6DWhwM32RRQo5dK9id-ks5tFnP5gaJpZM4RPdoy .

nitrosalat commented 6 years ago

Thanks, Kris :)

kriswiner commented 6 years ago

Sorry there is no quick fix.

Accurate absolute orientation is hard and there are no short cuts, unfortunately ;<

On Sat, Dec 30, 2017 at 9:51 AM, Mark Nitrosalat notifications@github.com wrote:

Thanks, Kris :)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/220#issuecomment-354559183, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qpQdYkJD3KVhevZUqX4K1cck_xNcks5tFngigaJpZM4RPdoy .