kriswiner / LSM9DS0

LSM9DS0 9DOF sensor AHRS sketch
39 stars 16 forks source link

Different question about serious drift #12

Closed mmarkell closed 3 weeks ago

mmarkell commented 7 years ago

Hello!

First of all, thank you for the code you've written for the LSM9DS0. It's taught me a lot and I am very grateful!

However, sadly, something is going very wrong with my LSM9DS0 measurement drift.

Basically, let's say I hold the device at rest. The yaw, pitch, and roll start at some value (arbitrary seeming, definitely not zeroed for a flat and upward facing orientation, for instance.)

Next, they drift, slowly at first, and then in very large jumps. Within a few minutes, the yaw pitch and roll I'm calculating might go in complete circles, even though the device is stationary.

It's not totally inaccurate - it measures acceleration quite well from point A to point B, and knows in general which way I am turning the device. However, the drift over time is pretty insane.

Steps I have taken: I am using a mahony filter, and recently implemented the calLSM9DS0 method from your code.

I would appreciate any advice you may have - do you think my device is faulty?

Thank you for your help!

kriswiner commented 7 years ago

Likely you need to caliubrate the magnetometer.

https://github.com/kriswiner/MPU-6050/wiki/Simple-and-Effective-Magnetometer-Calibration

On Sun, Apr 9, 2017 at 7:12 PM, Michael Markell notifications@github.com wrote:

Hello!

First of all, thank you for the code you've written for the LSM9DS0. It's taught me a lot and I am very grateful!

However, sadly, something is going very wrong with my LSM9DS0 measurement drift.

Basically, let's say I hold the device at rest. The yaw, pitch, and roll start at some value (arbitrary seeming, definitely not zeroed for a flat and upward facing orientation, for instance.)

Next, they drift, slowly at first, and then in very large jumps. Within a few minutes, the yaw pitch and roll I'm calculating might go in complete circles, even though the device is stationary.

It's not totally inaccurate - it measures acceleration quite well from point A to point B, and knows in general which way I am turning the device. However, the drift over time is pretty insane.

Steps I have taken: I am using a mahony filter, and recently implemented the calLSM9DS0 method from your code.

I would appreciate any advice you may have - do you think my device is faulty?

Thank you for your help!

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

mmarkell commented 7 years ago

Taking a look now.

I was looking at https://github.com/kriswiner/MPU-9250/blob/master/MPU9250_BMP280_BasicAHRS_t3.ino and I noticed that you have float magCalibration[3] = {0, 0, 0}; // Factory mag calibration and mag bias Then, you use this as a multiplicative factor in numerous equations. However, you never set it to anything other than 0,0,0. Then, wouldn't any operation being multiplied simply equal 0? Maybe I'm missing something

[image: Brown logo] http://brown.edu/ Michael Markell ‘18 B.S. Computer Science Candidate 302 229 0419

On Sun, Apr 9, 2017 at 10:19 PM, Kris Winer notifications@github.com wrote:

Likely you need to caliubrate the magnetometer.

https://github.com/kriswiner/MPU-6050/wiki/Simple-and- Effective-Magnetometer-Calibration

On Sun, Apr 9, 2017 at 7:12 PM, Michael Markell notifications@github.com wrote:

Hello!

First of all, thank you for the code you've written for the LSM9DS0. It's taught me a lot and I am very grateful!

However, sadly, something is going very wrong with my LSM9DS0 measurement drift.

Basically, let's say I hold the device at rest. The yaw, pitch, and roll start at some value (arbitrary seeming, definitely not zeroed for a flat and upward facing orientation, for instance.)

Next, they drift, slowly at first, and then in very large jumps. Within a few minutes, the yaw pitch and roll I'm calculating might go in complete circles, even though the device is stationary.

It's not totally inaccurate - it measures acceleration quite well from point A to point B, and knows in general which way I am turning the device. However, the drift over time is pretty insane.

Steps I have taken: I am using a mahony filter, and recently implemented the calLSM9DS0 method from your code.

I would appreciate any advice you may have - do you think my device is faulty?

Thank you for your help!

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kriswiner/LSM9DS0/issues/12#issuecomment-292834102, or mute the thread https://github.com/notifications/unsubscribe-auth/AKYxm2npZxBGA6_FTuZufws0bTtmp-wNks5ruZGbgaJpZM4M4PzV .

kriswiner commented 7 years ago

Yeah, your missing the mag calibration functions. One is in initAK8963 and one is in magcalibration. But try this instead anyway:

https://github.com/kriswiner/LSM9DS0/blob/master/Teensy3.1/LSM9DS0-MS5637/LSM9DS0_MS5637_Mini_Add_On.ino

On Sun, Apr 9, 2017 at 7:41 PM, Michael Markell notifications@github.com wrote:

Taking a look now.

I was looking at https://github.com/kriswiner/MPU-9250/blob/master/MPU9250_ BMP280_BasicAHRS_t3.ino and I noticed that you have float magCalibration[3] = {0, 0, 0}; // Factory mag calibration and mag bias Then, you use this as a multiplicative factor in numerous equations. However, you never set it to anything other than 0,0,0. Then, wouldn't any operation being multiplied simply equal 0? Maybe I'm missing something

[image: Brown logo] http://brown.edu/ Michael Markell ‘18 B.S. Computer Science Candidate 302 229 0419 <(302)%20229-0419>

On Sun, Apr 9, 2017 at 10:19 PM, Kris Winer notifications@github.com wrote:

Likely you need to caliubrate the magnetometer.

https://github.com/kriswiner/MPU-6050/wiki/Simple-and- Effective-Magnetometer-Calibration

On Sun, Apr 9, 2017 at 7:12 PM, Michael Markell < notifications@github.com> wrote:

Hello!

First of all, thank you for the code you've written for the LSM9DS0. It's taught me a lot and I am very grateful!

However, sadly, something is going very wrong with my LSM9DS0 measurement drift.

Basically, let's say I hold the device at rest. The yaw, pitch, and roll start at some value (arbitrary seeming, definitely not zeroed for a flat and upward facing orientation, for instance.)

Next, they drift, slowly at first, and then in very large jumps. Within a few minutes, the yaw pitch and roll I'm calculating might go in complete circles, even though the device is stationary.

It's not totally inaccurate - it measures acceleration quite well from point A to point B, and knows in general which way I am turning the device. However, the drift over time is pretty insane.

Steps I have taken: I am using a mahony filter, and recently implemented the calLSM9DS0 method from your code.

I would appreciate any advice you may have - do you think my device is faulty?

Thank you for your help!

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kriswiner/LSM9DS0/issues/12#issuecomment-292834102, or mute the thread https://github.com/notifications/unsubscribe-auth/AKYxm2npZxBGA6_ FTuZufws0bTtmp-wNks5ruZGbgaJpZM4M4PzV .

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