The data were acquired using the 12 element calibration of a LSM9DS1 IMU
The 12 element calibration was obtained using a collection of raw data points taken at many different orientations, and processed using am Excel spreadsheet and the solver function to fit the data to a spherical surface. This method is discussed further in the following conversation link. (note a long cable was used to minimize the IMU from the magnetic fields of the table and computer) http://forum.espruino.com/conversations/298287/
The following code was used to apply the calibrations:
//Use 12 element calibration on raw count magnetometer data
function cal8G(S){
var i;
var mm=[0,0,0];
var scale=8;
var mres=[
[0.970972836,0.171154738,-0.000344029],
[-0.095223453,0.956653319,-0.000125418],
[0.017179224,0.005190024,1],
];
var moff=[1057.176483,120.7727841,549.551664];
for(i=0;i<3;i++) S.m[i] -=moff[i];
for(i=0;i<3;i++)
mm[i]=S.m[0]*mres[i][0]+S.m[1]*mres[i][1]+S.m[2]*mres[i][2];
for(i=0;i<3;i++)S.m[i]=mm[i]*scale/32768;
}//end cal8G(S)
function readall(W){
var heading,dip;
var pirate=180/Math.PI;
if(W.magAvailable()){
W.readMag();
W.readAccel();
cal8G(W);
W.m[2]=-W.m[2];
heading=pirate*Math.atan2(W.m[0],-W.m[1]);
if(heading<0)heading +=360;
dip=pirate*Math.atan(W.m[2]/Math.sqrt(W.m[0]*W.m[0]+W.m[1]*W.m[1]));
console.log(W.a,',',W.m,',',heading,',',dip);
}//endif
}//end readall
The dataset
The following dataset was obtained using the above calibration with the IMU approximately level starting at 0 and proceeding by approximate 45 degree steps.
(360, 315, 270 ,225 ,180 ,135 ,90 ,45)
ax
ay
az
mx
my
mz
heading
dip
0.005221328
0.038883267
0.965721486
-0.017482972
-0.152165638
0.420466182
353.4457781
69.98441706
0.053742128
0.060580467
0.998802538
0.008982245
-0.163318019
0.411716107
3.148009986
68.333274
0.045889728
0.061932867
1.00154912
0.004620515
-0.160749845
0.421310071
1.646428435
69.10788548
0.086792528
0.069459267
0.973839161
0.009863154
-0.162452582
0.419266816
3.474393718
68.78469698
0.065286328
0.019067667
0.963829397
-0.073864097
-0.105995351
0.43284815
325.1288376
73.38107377
0.122655728
0.030180867
0.982750293
-0.064172881
-0.109797951
0.430729882
329.6952783
73.5503905
0.090484328
0.042881667
0.982628223
-0.064828213
-0.112110436
0.429526044
329.9612166
73.22163288
0.113982928
0.052818867
0.973839161
-0.061649354
-0.118602017
0.424600681
332.5345796
72.5255674
0.088491928
0.053877267
0.991661425
-0.11020607
-0.019251924
0.432085705
279.9090234
75.48383928
0.075717128
0.041294067
0.982750293
-0.108910915
-0.016052224
0.429125695
278.3843782
75.61167923
0.088609128
0.061932867
0.987999316
-0.112078203
-0.016217852
0.423323378
278.2336196
75.02319545
0.073373128
0.057581667
0.966453908
-0.105814424
-0.010888918
0.434674039
275.875387
76.24886152
0.110994328
0.038648067
0.951927543
-0.033200414
0.097015611
0.435331124
198.8918302
76.74596353
0.092652528
0.022419267
0.965721486
-0.040103186
0.098880808
0.435206472
202.0760467
76.22399812
0.073490328
0.031886067
0.982994434
-0.038122585
0.091081115
0.432258614
202.7120608
77.13311516
0.090367128
0.019302867
0.952232718
-0.042207576
0.093858834
0.4357436
204.2130729
76.71158587
-0.023316872
0.080160867
0.985924121
-0.015551534
0.110731677
0.43034586
187.994526
75.43470381
-0.021148672
0.067577667
0.980675098
-0.015549808
0.106691785
0.433040365
188.2921962
76.01869954
-0.038845872
0.075339267
0.973656056
-0.01500844
0.109727365
0.427652799
187.7885496
75.48110246
-0.045819272
0.058287267
0.963463186
-0.021450093
0.110121715
0.429476292
191.0223588
75.35988506
0.124589528
0.022713267
0.963829397
0.145392752
0.077359058
0.413377119
118.0160836
68.27734928
0.138946528
0.005249667
0.934837701
0.160771714
0.068957421
0.404331212
113.2152255
66.60400467
0.133613928
-0.020328333
0.927330377
0.16788097
0.076340165
0.401990206
114.4526189
65.35553348
0.188404928
-0.017505933
0.954918265
0.177739414
0.073471827
0.40011101
112.4586468
64.32722696
-0.098676472
-0.003393933
1.005028123
0.093650207
0.005196927
0.424718089
93.17625478
77.54674095
-0.021090072
-0.030912333
0.975548146
0.103647753
0.004453889
0.423075824
92.46056617
76.22222377
-0.038787272
-0.009861933
0.991112109
0.100384753
-0.005683938
0.417053226
86.75928569
76.4454667
-0.064454072
-0.001747533
0.942222954
0.100278956
-0.021119951
0.424901951
78.10664105
76.44022583
-0.021617472
-0.017564733
1.003990526
0.020143978
-0.104996777
0.423349642
10.86041872
75.8270026
-0.021793272
-0.080892333
0.974083302
0.030669343
-0.092007227
0.423620563
18.43509874
77.10486344
0.019871328
-0.071307933
0.95082891
0.039384256
-0.090485263
0.423949378
23.52137433
76.89631367
0.003053128
-0.116231133
0.946007133
0.051640347
-0.086696446
0.42372145
30.77995151
76.60433025
Using the Dip Angle Statistic to Determine Axis Signs
The data were then processed using the Rodrigues.js module into datasets where various combinations of the signs of the X, Y , and Z axis were manipulated. The following table shows the statistics of the Dip angle as the signs of the X, Y amd Z data were changed. Compare the Dip Range
Statistic
Raw
x,y,z
x,y,-z
x,-y,-z
Mean
73.68802652
-73.39285194
73.27452467
72.29268725
Standard Error
0.683692412
1.227276358
0.898702904
0.23150967
Median
75.48247087
-75.00020203
73.83858428
72.20170648
Mode
#N/A
#N/A
#N/A
#N/A
Standard Deviation
3.867548323
6.94252348
5.083831342
1.309616458
Sample Variance
14.95793003
48.19863227
25.84534112
1.715095267
Kurtosis
0.028460278
1.561952363
-0.906235772
-0.460864552
Skewness
-1.151317713
1.323796746
0.029464285
0.276014742
Range
13.21951399
29.10003759
17.46765933
4.930872778
Minimum
64.32722696
-83.15527605
64.49625552
70.01846639
Maximum
77.54674095
-54.05523846
81.96391485
74.94933917
Sum
2358.016849
-2348.571262
2344.784789
2313.365992
Count
32
32
32
32
Code used to apply the Rodrigues.js module
The follwing code was used to apply the Rodrigues.js module.
function test(){
FF=require("Rodrigues").connect();
var i;
for(i=0;i<Adata.length;i++){
// for(i=0;i<4;i++){
A=FF.Setup(Adata[i],[0,0,1]);
Theta=FF.theta;
Kn=FF.Kn;
A=FF.An;
// Mdata[i][0]=-Mdata[i][0];
// Positive x, negate y and z to minimize dip range
// z was negated in acquisition program
Mdata[i][1]=-Mdata[i][1];
B=FF.RotVector(Mdata[i]);
An=FF.An;
heading=pirate*Math.atan2(B[1],B[0]);
if(heading<0)heading +=360;
dip=pirate*Math.atan(B[2]/Math.sqrt(B[0]*B[0]+B[1]*B[1]));
console.log(i,',',A,',',Kn,',',An,',',B,',',
Theta,',',heading,',',dip);
}//next i
}
The Results
The final output using positive X and negative Y and Z follows:
( ais accelerometer, k is rotation axis, m raw data, m1 is processed data; vectors have been Normed to unit vectors)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Software Gimbaled Compass
The data were acquired using the 12 element calibration of a LSM9DS1 IMU
The 12 element calibration was obtained using a collection of raw data points taken at many different orientations, and processed using am Excel spreadsheet and the solver function to fit the data to a spherical surface. This method is discussed further in the following conversation link. (note a long cable was used to minimize the IMU from the magnetic fields of the table and computer)
http://forum.espruino.com/conversations/298287/
The following code was used to apply the calibrations:
The dataset
The following dataset was obtained using the above calibration with the IMU approximately level starting at 0 and proceeding by approximate 45 degree steps.
(360, 315, 270 ,225 ,180 ,135 ,90 ,45)
Using the Dip Angle Statistic to Determine Axis Signs
The data were then processed using the Rodrigues.js module into datasets where various combinations of the signs of the X, Y , and Z axis were manipulated. The following table shows the statistics of the Dip angle as the signs of the X, Y amd Z data were changed. Compare the Dip Range
Code used to apply the Rodrigues.js module
The follwing code was used to apply the Rodrigues.js module.
The Results
The final output using positive X and negative Y and Z follows:
( ais accelerometer, k is rotation axis, m raw data, m1 is processed data; vectors have been Normed to unit vectors)
1 Attachment