-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Magnetometer calibration expected result could not achieved #41
Comments
Not sure what the problem is exactly. The response surfaces after
correction look spherical and are centered on the origin.
…On Mon, May 6, 2019 at 1:18 AM DavidKric ***@***.***> wrote:
Hey Kris,
First of all, many thanks for sharing your work and knowledge about the
IMU sesnor fusion.
i'm hoping to get your advice about an issue i'm dealing when calibration
the mpu9250 magnetometer.
As i'm developing an application based on the MPU9250 i used your
magnetometer calibration routine as shown and explained here:
https://github.com/kriswiner/MPU6050/wiki/Simple-and-Effective-Magnetometer-Calibration
my Issue is that i cant meet the expected result after calibrating the
magnetometer data, i'm getting ellipsoid centered around 0,0 (photos
attached).
i read here in some issue comments about the importance of the rotation of
the sensor while collecting the data. i used tera-term to collect the mag
adc values, and then preforming the calibration on the recorded data. i
collected the data very carefully and kept rotating the sensor in sphere 3D
shape, steady as i can.
the result are:
plotting the ADC values as is:
[image: raw_data]
<https://user-images.githubusercontent.com/39348533/57213599-fdf3f000-6fef-11e9-9356-feafb1034ca5.png>
plotting the values after hard iron offset removal:
[image: after_hard_iron_removal]
<https://user-images.githubusercontent.com/39348533/57213600-fdf3f000-6fef-11e9-97a6-11e6d5f26146.png>
plotting the values after hard iron offset removal and soft iron removal:
[image: fully_calibrated]
<https://user-images.githubusercontent.com/39348533/57213601-fdf3f000-6fef-11e9-9a68-60c2b9d637ae.png>
as i get nice ellipses i suspect that the soft iron offset is not handled
well.
the code used to find the scale value for the soft iron calibration:
double temp_scale[3] = {0};
mag_scale[0] = (mag_max[0] - mag_min[0])/2;
mag_scale[1] = (mag_max[1] - mag_min[1])/2;
mag_scale[2] = (mag_max[2] - mag_min[2])/2;
qDebug() << "Mag bias applied on all vectors done!";
double avg_rad = mag_scale[0] + mag_scale[1] + mag_scale[2];
avg_rad /= 3.0;
temp_scale[0] = avg_rad/mag_scale[0];
temp_scale[1] = avg_rad/mag_scale[1];
temp_scale[2] = avg_rad/mag_scale[2];
for(ii = 0; ii < m_x.size() ; ii++)
{
// x axis
m_x[ii] *= temp_scale[0];
}
for(ii = 0; ii < m_y.size() ; ii++)
{
// y axis
m_y[ii] *= temp_scale[1];
}
for(ii = 0; ii < m_z.size() ; ii++)
{
// z axis
m_z[ii] *= temp_scale[2];
}
Many Thanks in advance!
David
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#41>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABTDLKSKDSK73ZLAJHMPGETPT7SW5ANCNFSM4HK6A7LA>
.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey Kris,
First of all, many thanks for sharing your work and knowledge about the IMU sesnor fusion.
i'm hoping to get your advice about an issue i'm dealing when calibration the mpu9250 magnetometer.
As i'm developing an application based on the MPU9250 i used your magnetometer calibration routine as shown and explained here:
https://github.com/kriswiner/MPU6050/wiki/Simple-and-Effective-Magnetometer-Calibration
my Issue is that i cant meet the expected result after calibrating the magnetometer data, i'm getting ellipsoid centered around 0,0 (photos attached).
i read here in some issue comments about the importance of the rotation of the sensor while collecting the data. i used tera-term to collect the mag adc values, and then preforming the calibration on the recorded data. i collected the data very carefully and kept rotating the sensor in sphere 3D shape, steady as i can.
the result are:
plotting the ADC values as is:
plotting the values after hard iron offset removal:
plotting the values after hard iron offset removal and soft iron removal:
as i get nice ellipses i suspect that the soft iron offset is not handled well.
the code used to find the scale value for the soft iron calibration:
double temp_scale[3] = {0};
Many Thanks in advance!
David
The text was updated successfully, but these errors were encountered: