risherlock / Magnetometer-Calibration

Implementations of different magnetometer calibration algorithms.
25 stars 11 forks source link

About the ambiguity of the solution #1

Open zhang12300 opened 1 year ago

zhang12300 commented 1 year ago

Hi, I am a phD candidate John. When I tested your code "main_sensor_calibration.m" , I found that there is a obvious rotation between previous measurement and the calibrated measurement. I assume there exists some kind of ambiguity of the solution, which means if the calibrated measurement on a sphere multiplies a rotation matrix, it is still locates on the same sphere.

risherlock commented 1 year ago

Hi John. Were you expecting the rotation matrix to transform the calibrated measurement back to the sensor readings before calibration? I am not sure if I get the idea of ambiguity, and would appreciate if you make it more clear to me. Thank you.

zhang12300 commented 1 year ago

Hi, I just run the "Magnetometer-Calibration-master\ellipsoid_fitting\main_sensor_calibration.m" without any change. And I use this code to perform a visualization. ` figure; subplot(1,2,1); j = 0; for i = 1 : 100 : length(x_m) plot(x_m(i), y_m(i), '.', 'markersize', 20, 'color', ... [i / length(x_m), 0, 1 - i / length(x_m)]); hold on; j = j + 1; text(x_m(i), y_m(i), num2str(j)); end title('Before Calibration'); xlabel('x m'); ylabel('y m');

subplot(1,2,2); j = 0; for i = 1 : 100 : length(x_m) plot(x_hat(i), y_hat(i), '.', 'markersize', 20, 'color', ... [i / length(x_m), 0, 1 - i / length(x_m)]); hold on; j = j + 1; text(x_hat(i), y_hat(i), num2str(j)); end title('After Calibration'); xlabel('x hat'); ylabel('y hat'); ` What I found is that the spatial distribution of the magnetic measurements were totoally changed (see the figure as follows) image

I assume this should not happen, since I think that the magnetometer calibration should just adjust magnetic measurements a little. And also I tested your code with my AHRS measurements (Xsens Mti 630). The direction generated by calibrated measurments was wrong, and the maximum error reached even more than 90 degree.

I think the variable 'matrix' in your code should be approach a scalar matrix with a little change,but in the results of your code, the 'matrix' is [0.000473140069992286 -0.000418188761840885 0.00212837476027808 0.00200956076862249 0.000562744512903578 -0.000336158041802008 -0.000463077938170439 0.00194322016204891 0.000484751830779333] which is abnormal. This means that 'matrix' include a very obvious rotation matrix that may rotate the measurements by more than 50 degree.

zhang12300 commented 1 year ago

Looking forward to your reply. Thank you!

risherlock commented 1 year ago

Hello John. Thank you for elaborate explanation. I had been very busy. I will be checking into the problem and get to you soon.