kriswiner / MPU9250

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

Magnetometer calibration and differents issues #48

Open alex934 opened 8 years ago

alex934 commented 8 years ago

Hi Kris, I'm trying to run the AHRS with the new NUCLEO cortex M7. The fusion rate is around 8000Hz. But I'm still not able to get any results usable. I calibrated the magnetometer with your magCalibration+ magScale, but I don't understand when I plot my sphere, the resultat is not well centred as you can see: spheremag I'm in 8Hz magneto rate. So It results that the pitch and roll seems correct but the yaw is never correct. During the calibration you said to wawe the device in a figure eight until done, this means that the MPU9250 should lay flat on the table? At the begining I thought It was my µC which was not enough fast for the fusion, but now with the cortexM7 it's couldn't be that, so what do you suggest? It's hard to believe this algo could be run for a camera stabilization, when there is an acceleration on axe X, Y or Z the angles changes or swing, is that the same for you?

Thank you very much Kris

kriswiner commented 8 years ago

When you calibrate the gyro and accel, the sensor should be flat and motionless on a table. But when you calibrate the mag, it should be waved around in a figure eight motion so the sensor can sample as much of the 3D response surface as possible. Your mag is not calibrated. When you plot the response surface it should be centered on the origin and reasonably spherical.

-----Original Message----- From: Alekyakoi [mailto:notifications@github.com] Sent: March 7, 2016 1:00 PM To: kriswiner/MPU-9250 Subject: [MPU-9250] Magnetometer calibration (#48)

Hi Kris, I'm trying to run the AHRS with the new NUCLEO cortex M7. The fusion rate is around 8000Hz. But I'm still not able to get any results usable. I calibrated the magnetometer with your magCalibration+ magScale, but I don't understand when I plot my sphere, the resultat is not well centred as you can see in attachment. I'm in 8Hz magneto rate. So It results that the pitch and roll seems correct but the yaw is never correct. During the calibration you said to wawe the device in a figure eight until done, this means that the MPU9250 should lay flat on the table? At the begining I thought It was my �C which was not enough fast for the fusion, but now with the cortexM7 it's couldn't be that, so what do you suggest? It's hard to believe this algo could be run for a camera stabilization, when there is an acceleration on axe X, Y or Z the angles changes or swing, is that the same for you?

Thank you very much Kris

� Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/48 . https://github.com/notifications/beacon/AGY1qmc4RgqQpIjz7dW__yY5HRauZ56Wks5 prJHjgaJpZM4HrK-x.gif

alex934 commented 8 years ago

Thank you very much for your quick answer, after calibration, when you display the sphere you move the sensor on all axis? My missunderstanding is that during calibration we move only on X and Y axis, but after that to display the sphere I turn my sensors in all orientation.

Alex

kriswiner commented 8 years ago

You must expose the mag to the entire 3D response surface during calibration, otherwise the Euler angles will be wrong, especially Yaw or heading.

-----Original Message----- From: Alekyakoi [mailto:notifications@github.com] Sent: March 7, 2016 2:33 PM To: kriswiner/MPU-9250 Cc: Kris Winer Subject: Re: [MPU-9250] Magnetometer calibration and differents issues (#48)

Thank you very much for your quick answer, after calibration, when you display the sphere you move the sensor on all axis? My missunderstanding is that during calibration we move only on X and Y axis, but after that to display the sphere I turn my sensors in all orientation.

Alex

Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/48#issuecomment-193486079 . https://github.com/notifications/beacon/AGY1qnN7kLgMEkaRd4R2cxft3OWdk1EGks5 prKeBgaJpZM4HrK-x.gif

alex934 commented 8 years ago

Hi Kris, Finally I got a calibrated magnetometer: calib

the fusion works well, but when I translate on a axe, my angle change (due to acceleration of the acceleromter), Do you know how can I neutralize the effect of accelerometers in the angle estimation?

Thx

kriswiner commented 8 years ago

Did you also remove the gyro and accel offset bias? It also looks like there is residual scale bias in the mag response (+/- 200 on x, y versus +/- 300 on z)

alex934 commented 8 years ago

What do you mean? I let the calibration for the gyro and accel: mpu9250.calibrateMPU9250(gyroBias, accelBias); // Calibrate gyro and accelerometers, load biases in bias registers

What the link between gyro and accel offset bias and the mag response? Thx

kriswiner commented 8 years ago

There is a link between offset bias and Euler angle response.

-----Original Message----- From: Alekyakoi [mailto:notifications@github.com] Sent: March 22, 2016 7:34 AM To: kriswiner/MPU-9250 Cc: Kris Winer Subject: Re: [MPU-9250] Magnetometer calibration and differents issues (#48)

What do you mean? I let the calibration for the gyro and accel: mpu9250.calibrateMPU9250(gyroBias, accelBias); // Calibrate gyro and accelerometers, load biases in bias registers

What the link between gyro and accel offset bias and the mag response? Thx

You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/48#issuecomment-199840780 https://github.com/notifications/beacon/AGY1qmIN8baXiDVl-wvYjg5hATEfuwOlks5 pv_3SgaJpZM4HrK-x.gif

alex934 commented 8 years ago

So what do you recommend?

Luhung300897 commented 7 years ago

Hi Alex, can you tell me how to plot the magnetometer calibration data?

alex934 commented 7 years ago

Hi, I don't know what is your config but I used to save my magnetometer's data X,Y,Z then use matlab 3-D plot https://www.mathworks.com/help/matlab/ref/plot3.html?s_tid=gn_loc_drop

2017-09-22 15:14 GMT-04:00 Luhung300897 notifications@github.com:

Hi Alex, can you tell me how to plot the magnetometer calibration data?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/48#issuecomment-331536279, or mute the thread https://github.com/notifications/unsubscribe-auth/AEXHfsk1sD3m6xckHenMU3bkSoFs1DzMks5slAcKgaJpZM4HrK-x .

-- Alexis Maslyczyk Ing., M.Sc.A. Professionnel de recherche / Research Professionnal Laboratoire de commande et de robotique / Control and Robotics Laboratory École de technologie supérieure (ÉTS), Montréal, Québec, Canada (514) 608 0278 <(514)%20608-0278> (CANADA) +33 6 58500283 <+33%206%2058%2050%2002%2083> (FRANCE)