kriswiner / MPU9250

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

Madgwick-Filter-ODR / Filtered-Magnetometer-Data #23

Open RayBreslin opened 8 years ago

RayBreslin commented 8 years ago

Hey Kris,

after some nicely spent vacation time I am now back to put all my effort into my little sensor-project and I do have a few more questions I would like to discuss with you.

I pretty much got your MPU9250-template set up for a CSR1010-MPU9250-combo-board and a smartphone as receiver/mc. For some reason I am not seeing any nice and stable roll, pitch and yaw angles which freaks me out...

Ok I have to admit that through my never ending researches for calibration approaches, madgwick fixes (s-parameters, inv-sqrt, ...) and other things I might have made too many adjustments and tweaks along the way! So now its „almost“ back to the start, taking your work as baseline and take it on from there (again)...

Now to the questions:

  1. How is the function-call-frequency of your loop()-routine determined? Is there a start-skript somewhere or does it get called automatically? In other words how do you get/calculate a filter ODR of 145 hz?
  2. If I am sampling my sensor data at 50 hz continuously, what kind of filter ODR would you propose? Should it always be at least 200 hz? (Currently doing just 50 hz when the data is coming in, which doesnt seem to do that well...)
  3. What readout-frequency you use for your magnetometer? If I saw it correctly its always just 8 hz instead of 100 hz – only due to the readout-latency?
  4. How does all the calibration data from the magnetometer calibration needs to be applied to the raw sensor data?

Heres my approach:

scaledData[Tag.MAGNETOMETER][i] = (rawData[Tag.MAGNETOMETER][i] \* magResolution \* currCalibrationData.magSensitivity[i] - currCalibrationData.magBias[i] \* magResolution \* currCalibrationData.magSensitivity[i]) \* currCalibrationData.magScale[i]; 
Legend:
i   ~   x-, y-, z-axis
currCalibrationData.magSensitivity[i] = (((rawSensitivityAdjustmentValue[i] - 128.0f) \* 0.5f) / 128.0f + 1.0f);
magResolution = 10.0f \* 4912.0f / 32760.0f;
I would very much appreciate your help! Thanks in advance Ray
kriswiner commented 8 years ago

Hi Ray,

The Madgwick (and Mahony) filters are iterative, so ideally we would like 4 or 5 iterations on the filter solution for every new data sample. This means if you run at a 200 Hz data rate, you want to run the sensor fusion at ~1 kHz or so. It is possible to force this rate but I just use a Teensy 3.X at 72 MHz and I get it "for free", meaning that in my sketch I just query whatever fusion rate I get and it turns out to be > 1 kHz, which is fine. The way the code is set up, I loop through and check every time whether there is new data for each sensor. I so great, I use it in the next Madgwick call. If not, I just call Madgwick with the old data and iterate again. The code in practice will iterate on the same data 6 or 8 times which will produce a converged solution. This is the advantage of using fast processor. With a 16 MHz AVR processor running the fusion at 200 Hz you will not get a converged solution, ever, unless you run with < 50 Hz data rates, which you can do. But if your motion is "faster" than 50 Hz, you will experience latency. The other parameter is the bandwidth. Generally, you want the bandwidth to be 10 - 20% of the sample rate. For 200 Hz sample rates, I usually use 40 Hz bandwidth (low-pass filter). This smooths out transient and jitter to be expected with a 16-bit ADC. If you run with a sample rate of 50 Hz, your bandwidth has to be ~10 Hz, which is kind of low. Lastly, the sensors have to be sufficiently calibrated, as you know. The calibration algorithm you show looks OK to me. How are you collecting and averaging the mag bias?

Kris

-----Original Message----- From: RayBreslin [mailto:notifications@github.com] Sent: October 3, 2015 10:02 AM To: kriswiner/MPU-9250 Subject: [MPU-9250] Madgwick-Filter-ODR / Filtered-Magnetometer-Data (#23)

Hey Kris,

after some nicely spent vacation time I am now back to put all my effort into my little sensor-project and I do have a few more questions I would like to discuss with you.

I pretty much got your MPU9250-template set up for a CSR1010-MPU9250-combo-board and a smartphone as receiver/mc. For some reason I am not seeing any nice and stable roll, pitch and yaw angles which freaks me out...

Ok I have to admit that through my never ending researches for calibration approaches, madgwick fixes (s-parameters, inv-sqrt, ...) and other things I might have made too many adjustments and tweaks along the way! So now its "almost" back to the start, taking your work as baseline and take it on from there (again)...

Now to the questions:

  1. How is the function-call-frequency of your loop()-routine determined? Is there a start-skript somewhere or does it get called automatically? In other words how do you get/calculate a filter ODR of 145 hz?
  2. If I am sampling my sensor data at 50 hz continuously, what kind of filter ODR would you propose? Should it always be at least 200 hz? (Currently doing just 50 hz when the data is coming in, which doesnt seem to do that well...)
  3. What readout-frequency you use for your magnetometer? If I saw it correctly its always just 8 hz instead of 100 hz - only due to the readout-latency?
  4. How does all the calibration data from the magnetometer calibration needs to be applied to the raw sensor data?

Heres my approach:

scaledData[Tag.MAGNETOMETER][i] = (rawData[Tag.MAGNETOMETER][i] magResolution * currCalibrationData.magSensitivity[i] - currCalibrationData.magBias[i] * magResolution currCalibrationData.magSensitivity[i]) * currCalibrationData.magScale[i]; Legend:

i ~ x-, y-, z-axis

currCalibrationData.magSensitivity[i] = (((rawSensitivityAdjustmentValue[i]

magResolution = 10.0f * 4912.0f / 32760.0f;

I would very much appreciate your help!

Thanks in advance

Ray

Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/23 . https://github.com/notifications/beacon/AGY1qo_6D5OLDM54sf6PVJeBGKSoQ56Mks5 o4AGZgaJpZM4GIc1_.gif

RayBreslin commented 8 years ago

Oh thank you for this fast response! :)

The calibration data is collected just by your example coding, but the results seem a little confusing...

Heres an overview over the past 4 calibrations I did with my sensor-board:

1.: accSen: 16384.0, accBias: [-361.0 / 402.0 / 418.0], gyrSen: 131.0, gyrBias: [113.0 / 112.0 / 4.0], magSen: [1.1914063 / 1.203125 / 1.15625], magBias: [-23.0 / 84.0 / -352.0], magScale: [1.0050505 / 1.2134147 / 0.8468085]
2.: accSen: 16384.0, accBias: [-342.0 / 412.0 / 454.0], gyrSen: 131.0, gyrBias: [117.0 / 112.0 / 5.0], magSen: [1.1914063 / 1.203125 / 1.15625], magBias: [-6.0 / 84.0 / -370.0], magScale: [0.98286605 / 1.2825203 / 0.831357]
3.: accSen: 16384.0, accBias: [-339.0 / 418.0 / 427.0], gyrSen: 131.0, gyrBias: [124.0 / 112.0 / -2.0], magSen: [1.1914063 / 1.203125 / 1.15625], magBias: [-6.0 / 94.0 / -374.0], magScale: [1.0046729 / 1.2356322 / 0.83657587]
4.: accSen: 16384.0, accBias: [-367.0 / 402.0 / 433.0], gyrSen: 131.0, gyrBias: [122.0 / 113.0 / 5.0], magSen: [1.1914063 / 1.203125 / 1.15625], magBias: [-6.0 / 94.0 / -373.0], magScale: [1.0046729 / 1.2356322 / 0.83657587]
The bias values of acc and gyr still need to be divided by the sensitivity-factor, while the bias value of the magnetometer needs to be multiplied with the sensitivity-factor and the mag-resolution (like in my code example above). Is that calculation for the mag-bias even correct since you simply subtract it right away - if im not mistaken? What worries me is the insanely huge scale-factor thats nowhere near your results for the scale biases of 0.96, 1.01, and 1.03... PS: I adjusted the filter-ODR to 1 khz now, which gives me alot smoother angle-convergence - still flickering alot around the pitch-singularity and for yaw pretty much in all positions!
kriswiner commented 8 years ago

Hi Ray,

This all seems OK to me. By insanely huge do you mean 1.28 instead of 1.03?

Kris

-----Original Message----- From: RayBreslin [mailto:notifications@github.com] Sent: October 3, 2015 11:49 AM To: kriswiner/MPU-9250 Cc: Kris Winer Subject: Re: [MPU-9250] Madgwick-Filter-ODR / Filtered-Magnetometer-Data (#23)

Oh thank you for this fast response! :)

The calibration data is collected just by your example coding, but the results seem a little confusing...

Heres an overview over the past 4 calibrations I did with my sensor-board:

1.: accSen: 16384.0, accBias: [-361.0 / 402.0 / 418.0], gyrSen: 131.0, gyrBias: [113.0 / 112.0 / 4.0], magSen: [1.1914063 / 1.203125 / 1.15625], magBias: [-23.0 / 84.0 / -352.0], magScale: [1.0050505 / 1.2134147 / 0.8468085]

2.: accSen: 16384.0, accBias: [-342.0 / 412.0 / 454.0], gyrSen: 131.0, gyrBias: [117.0 / 112.0 / 5.0], magSen: [1.1914063 / 1.203125 / 1.15625], magBias: [-6.0 / 84.0 / -370.0], magScale: [0.98286605 / 1.2825203 / 0.831357]

3.: accSen: 16384.0, accBias: [-339.0 / 418.0 / 427.0], gyrSen: 131.0, gyrBias: [124.0 / 112.0 / -2.0], magSen: [1.1914063 / 1.203125 / 1.15625], magBias: [-6.0 / 94.0 / -374.0], magScale: [1.0046729 / 1.2356322 / 0.83657587]

4.: accSen: 16384.0, accBias: [-367.0 / 402.0 / 433.0], gyrSen: 131.0, gyrBias: [122.0 / 113.0 / 5.0], magSen: [1.1914063 / 1.203125 / 1.15625], magBias: [-6.0 / 94.0 / -373.0], magScale: [1.0046729 / 1.2356322 / 0.83657587]

The bias values of acc and gyr still need to be divided by the sensitivity-factor, while the bias value of the magnetometer needs to be multiplied with the sensitivity-factor and the mag-resolution (like in my code example above). Is that calculation for the mag-bias even correct since you simply subtract it right away - if im not mistaken?

What worries me is the insanely huge scale-factor thats no where near your results for the scale biases of 0.96, 1.01, and 1.03...

Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/23#issuecomment-145277301 . https://github.com/notifications/beacon/AGY1qrRG5a4Ym3zXi2XArqQGr-8Uqzs0ks5 o4BqXgaJpZM4GIc1_.gif

RayBreslin commented 8 years ago

Yes that was my feeling... or am I just exaggerating? :O

kriswiner commented 8 years ago

It's a little larger than I would have expected. Are you executing the figure eight motion when you accumulate mag bias data?

-----Original Message----- From: RayBreslin [mailto:notifications@github.com] Sent: October 3, 2015 12:01 PM To: kriswiner/MPU-9250 Cc: Kris Winer Subject: Re: [MPU-9250] Madgwick-Filter-ODR / Filtered-Magnetometer-Data (#23)

Yes that was my feeling... or am I just exaggerating? :O

Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/23#issuecomment-145278941 . https://github.com/notifications/beacon/AGY1qpahhU0xcvsYR0z1KDF8XqBas53xks5 o4B16gaJpZM4GIc1_.gif

RayBreslin commented 8 years ago

Thats precisely what I am doing and even after doing another 50 testruns, the picture remains the same. For some reason the mag-scale is off limits...

Could it be an error coming from the hardware-setup itself? I use a CSR1010-board with coin-cell-holder and a MPU9250-drotek board which I strapped to its back. Maybe the coin-cell or the power-consumption during the data-sampling is causing this...

A second thought might be, that I do the figure-8-movement wrong without accounting for all the possible rotation...

What would you say?

PS: I can produce a small 2 min MP4-video (6-8 MB) showing you exactly the results im seeing after each rotation. Would that help?

kriswiner commented 8 years ago

What would be better is to plot x mag vs y mag or x mag vs z mag from the figure eight motion bias accumulation data to see the response surface. You should be able to confirm the bias offset and get some idea of how spherical the response surface is. The exact motion is not important as long as you are sampling enough of the phase space.I doubt it has anything to do with your hardware set up. Are you sure you are scaling the mag data properly?

RayBreslin commented 8 years ago

Well my magnetometer calibration is done in 2 steps:

1. CSR1010-Board:

-> Collection of the raw magnetometer data during figure-8-motion

// Calculation of environmental x-, y- and z-axis correction in milliGauss
while(ii < ak8963_package_clbn_count)
{
    // Read the raw data from magnetometer including the status-register
    //(status-register important, otherwise data wont be updated)
    ak8963_calibration_check[12] = i2c_read_register(I2C_AK8963_ADDR, REG_MAGN_XOUT_L, &data[0], 7);

```
mag_tmp[0] = (int16) (((uint16) data[1] << 8u) | (uint16) data[0]);
mag_tmp[1] = (int16) (((uint16) data[3] << 8u) | (uint16) data[2]);
mag_tmp[2] = (int16) (((uint16) data[5] << 8u) | (uint16) data[4]);

for (jj = 0; jj < 3; jj++)
{
    if(mag_tmp[jj] > mag_max[jj])
    {
         mag_max[jj] = mag_tmp[jj];
    }// if(mag_tmp[jj] > mag_max[jj])
    if(mag_tmp[jj] < mag_min[jj])
    {
         mag_min[jj] = mag_tmp[jj];
    }// if(mag_tmp[jj] < mag_min[jj])
}// for (jj = 0; jj < 3; jj++)

ii++;
```

}// while(ii < ak8963_package_clbn_count) 
-> Preparation of the calibration data before transfer to smartphone (all done in integer-format since fpu is missing)
// Get hard iron correction (mag bias in counts)
magn_bias[0]  = (mag_max[0] + mag_min[0])/2;
magn_bias[1]  = (mag_max[1] + mag_min[1])/2;
magn_bias[2]  = (mag_max[2] + mag_min[2])/2;
// Get soft iron correction estimate (max chord length in counts)
magn_scale[0]  = (mag_max[0] - mag_min[0])/2;
magn_scale[1]  = (mag_max[1] - mag_min[1])/2;
magn_scale[2]  = (mag_max[2] - mag_min[2])/2;
-> Maybe this preparation step causes some error, since im losing the accuracy while operating only on integer!? But then again it just follows your algorithm... #2. Smartphone: --> Calculation of proper mag-scale and mag-sensitivity-factor
avgRawMagScale = rawMagScale[0] + rawMagScale[1] + rawMagScale[2];
avgRawMagScale /= 3.0f;
newCalibrationData.magScale[0] = avgRawMagScale / rawMagScale[0];
newCalibrationData.magScale[1] = avgRawMagScale / rawMagScale[1];
newCalibrationData.magScale[2] = avgRawMagScale / rawMagScale[2];
newCalibrationData.magSensitivity[0] = (((rawMagSensitivity[0] - 128.0f) \* 0.5f) / 128.0f + 1.0f);
newCalibrationData.magSensitivity[1] = (((rawMagSensitivity[1] - 128.0f) \* 0.5f) / 128.0f + 1.0f);
newCalibrationData.magSensitivity[2] = (((rawMagSensitivity[2] - 128.0f) \* 0.5f) / 128.0f + 1.0f);
In general im thinking that any preparation of the bias data done on the CSR1010-board is causing me a loss of accuracy. Same goes for this - actually im using the same data-types in every step like in your algorithm... Take a look at this uncalibrated data (zero-motion) for example:
acc (-0,012;0,144;0,989) / gyr (0,976;0,549;0,610) / mag (67,473;-10,496;328,366)
acc (-0,012;0,142;0,992) / gyr (1,037;0,488;0,549) / mag (47,980;-5,998;332,864)
acc (-0,012;0,143;0,992) / gyr (0,976;0,549;0,549) / mag (62,974;-17,993;338,862)
acc (-0,013;0,142;0,995) / gyr (0,976;0,366;0,610) / mag (56,977;-8,996;323,868)
acc (-0,013;0,143;0,995) / gyr (0,976;0,854;0,610) / mag (68,972;-11,995;341,861)
Now with calibration data (not from same measurement - just in principle):
accSen: 16384.0, accBias: [-235.0 / 411.0 / 423.0], gyrSen: 131.0, gyrBias: [132.0 / 120.0 / 4.0], magSen: [1.1914063 / 1.203125 / 1.15625], magBias: [-23.0 / 85.0 / -345.0], magScale: [0.986532 / 1.2208333 / 0.8567251]
acc (-0,003;0,001;1,010) / gyr (-0,154;-0,001;0,030) / mag (-128,650;28,630;298,541)
acc (-0,001;-0,001;1,011) / gyr (-0,154;-0,001;0,030) / mag (-135,699;46,249;301,511)
acc (-0,004;0,001;1,008) / gyr (-0,215;0,060;-0,092) / mag (-123,363;22,023;308,938)
acc (-0,004;0,000;1,011) / gyr (-0,215;-0,001;0,030) / mag (-121,600;28,630;310,423)
acc (-0,002;0,001;1,010) / gyr (-0,154;-0,001;0,091) / mag (-123,363;35,237;314,879)
The accelerometer data seems to reach your expected interval of 0,0,1 - depending on the axis - with an average deviation of +-10mg. For the gyro theres still some bigger bias error of more then +-60 mdps present - not as your expected +-10 mdps deviation...
kriswiner commented 8 years ago

Yes, the gyro is higher than I would expect, but more worrying is the very large (factor of two) changes in your mag reading. In general I would recommend the following construction of the signed integer data:

temp[0] = (int16_t) ( ( (int16_t) data[1] << 8 ) | data[0]);

Here's how I typicall do it:

destination[0] = ((int16_t)rawData[0] << 8) | rawData[1] ;

This works well even without the leading (int16_t) as long as the destination array is already defined as int16_t.

No need to cast the LSByte and you should use int16_t not uint16_t. Don't know if this is your problem but integer cast problems are common.

RayBreslin commented 8 years ago

Hm... I will definitely check that out!

The uint16_t comes from the underlying i²c-function I2cRawRead() which is defined as the following:

/*_I2cRawRead
 */
//Read data from the I2C bus, ACKing received bytes and NACKing the last byte.
//This command assumes the I2C slave device has been put into a state where
//it is ready to transmit bytes. The function will block until the read
//operation has completed, and all bytes have been read.
//  \param data     Pointer to storage for the bytes that are read.
//  \param length   The number of bytes to read.
//  \return Status of operation
extern sys_status I2cRawRead(uint8_ data, uint16 length);
So I do think doing all bit-operations with (uint16_t)-casts is correct and only in the last step when saving into the int16_t-result-variable I do the (int16_t)-cast... Ill keep you updated!
RayBreslin commented 8 years ago

Hey Kris,

I have been running tests for the last 2 days now and I kind off hit a wall...

Some of my adjustments I tried to do are listed below:


Now heres the picture (taken from 4 test-runs I did earlier):

(Apologies for the amount of text here, but for some reason the upload of my txt-files failed!)

Legend: timestamp;acc_x;acc_y;acc_z;gyr_x;gyr_y;gyr_z;mag_x;mag_y;mag_z;pkg_id

1. Test

accSen: 16384.0, accBias: [-112.0 / 949.0 / 374.0], gyrSen: 131.0, gyrBias: [138.0 / 110.0 / 0.0], magSen: [1.1914063 / 1.203125 / 1.15625], magBias: [51.0 / 198.0 / -260.0], magScale: [0.8894646 / 2.2008548 / 0.70355195]
10,664948;-0,001;0,002;1,010;-0,139;-0,108;-0,061;-88,980;-170,720;284,196;  1
10,678642;-0,001;0,002;1,007;-0,017;-0,047;0,061;-88,980;-162,780;281,757;  2
10,714985;0,000;0,000;1,007;-0,078;-0,047;0,061;-92,158;-154,839;289,075;  3
10,717145;-0,001;0,002;1,011;-0,078;-0,047;0,000;-79,446;-154,839;281,757;  4
10,717801;0,000;0,001;1,007;-0,261;0,014;-0,061;-79,446;-202,482;284,196;  5
10,761346;0,001;0,001;1,010;-0,139;0,014;0,061;-85,802;-162,780;276,878;  6
10,762520;-0,000;0,000;1,007;-0,139;-0,108;0,061;-90,569;-127,048;278,098;  7
10,809990;-0,003;0,002;1,013;-0,139;-0,169;0,061;-93,746;-182,631;278,098;  8
10,816403;-0,000;0,000;1,012;-0,200;-0,047;0,061;-71,502;-158,809;285,416;  9
10,857050;-0,002;0,001;1,007;-0,200;0,014;-0,061;-88,980;-162,780;279,317; 10
10,863018;-0,001;-0,000;1,012;-0,139;0,014;0,061;-87,391;-182,631;282,977; 11
10,866376;0,001;0,000;1,008;-0,200;0,014;0,000;-90,569;-174,690;287,855; 12
10,905561;0,002;0,000;1,010;-0,139;0,014;0,000;-79,446;-186,601;284,196; 13
10,906882;0,000;0,002;1,008;-0,139;0,014;0,000;-95,335;-194,542;276,878; 14
10,955384;-0,002;0,000;1,005;-0,139;0,014;-0,061;-92,158;-154,839;276,878; 15
10,957602;-0,002;0,002;1,010;-0,078;-0,047;0,000;-73,090;-170,720;284,196; 16
10,958234;0,000;-0,001;1,011;-0,078;-0,047;0,061;-82,624;-138,958;281,757; 17
11,003816;-0,002;0,001;1,006;-0,017;-0,047;-0,122;-74,679;-174,690;285,416; 18
11,005399;0,000;0,001;1,009;-0,078;-0,047;0,061;-88,980;-162,780;293,954; 19
11,052965;-0,000;0,002;1,010;-0,017;0,014;0,000;-87,391;-166,750;287,855; 20
11,054173;-0,001;-0,000;1,007;-0,078;-0,047;0,122;-98,513;-186,601;284,196; 21
11,054871;-0,001;0,000;1,007;-0,078;0,075;0,000;-95,335;-154,839;284,196; 22
11,102535;-0,002;-0,000;1,009;-0,139;-0,047;-0,061;-82,624;-162,780;286,636; 23
11,103263;0,000;0,001;1,007;-0,139;0,014;0,000;-96,924;-134,988;280,537; 24
11,152168;-0,001;-0,001;1,010;-0,017;0,014;-0,061;-82,624;-170,720;281,757; 25
11,153137;-0,001;0,001;1,006;-0,078;0,014;0,000;-87,391;-142,929;282,977; 26
11,199829;0,001;0,000;1,008;-0,200;0,014;-0,061;-79,446;-154,839;284,196; 27
11,203604;-0,001;0,002;1,008;-0,078;-0,047;-0,061;-84,213;-150,869;282,977; 28
11,213362;-0,001;0,002;1,009;-0,139;-0,047;0,122;-84,213;-158,809;282,977; 29
11,247793;0,000;0,002;1,011;-0,200;-0,047;0,000;-79,446;-154,839;289,075; 30
11,249409;-0,001;0,001;1,009;-0,078;-0,047;-0,061;-95,335;-178,661;286,636; 31
11,298275;-0,000;0,001;1,009;-0,139;-0,047;0,000;-66,735;-146,899;281,757; 32
11,300446;-0,000;0,002;1,008;-0,139;-0,047;0,000;-93,746;-166,750;280,537; 33
11,301467;-0,001;0,000;1,005;-0,078;-0,047;0,000;-77,857;-150,869;290,295; 34
11,344402;-0,001;0,001;1,009;-0,139;-0,047;-0,061;-95,335;-131,018;276,878; 35
11,345439;-0,000;0,003;1,005;-0,139;-0,047;0,061;-84,213;-174,690;278,098; 36
11,393688;-0,001;0,001;1,010;-0,200;-0,047;0,061;-92,158;-146,899;286,636; 37
11,395046;0,000;0,000;1,008;-0,139;0,014;-0,061;-73,090;-138,958;286,636; 38
11,395289;-0,001;0,000;1,011;-0,139;-0,047;0,000;-73,090;-131,018;276,878; 39
11,443390;-0,001;0,000;1,009;-0,139;0,014;0,061;-69,913;-186,601;284,196; 40
11,444089;-0,001;0,001;1,007;-0,078;0,075;-0,061;-82,624;-170,720;284,196; 41
11,491633;0,000;0,000;1,009;-0,139;0,014;0,000;-76,268;-186,601;291,515; 42
11,494356;0,000;-0,000;1,009;-0,139;0,014;0,122;-88,980;-146,899;279,317; 43
11,495200;0,000;0,000;1,007;-0,139;0,014;-0,122;-79,446;-178,661;286,636; 44
11,542672;-0,001;-0,000;1,009;-0,139;0,014;0,000;-79,446;-146,899;291,515; 45
11,543580;-0,001;0,000;1,008;-0,139;-0,047;0,000;-85,802;-162,780;279,317; 46
11,589454;0,000;-0,001;1,008;-0,200;-0,047;-0,061;-88,980;-186,601;289,075; 47
11,591401;0,001;0,001;1,010;-0,200;-0,047;0,061;-92,158;-170,720;281,757; 48
11,638449;0,000;0,000;1,007;-0,078;0,075;-0,061;-90,569;-134,988;273,219; 49
11,640416;0,000;0,002;1,012;-0,078;-0,047;0,000;-93,746;-127,048;280,537; 50
...
281,669067;-0,002;0,001;1,011;-0,322;0,014;0,000;-81,035;-166,750;287,855;  1
281,716705;-0,003;0,001;1,010;-0,200;-0,108;-0,061;-66,735;-154,839;276,878;  2
281,717133;-0,003;0,001;1,012;-0,200;-0,047;0,000;-96,924;-150,869;278,098;  3
281,718750;-0,001;-0,000;1,009;-0,261;-0,108;0,000;-87,391;-134,988;275,658;  4
281,771301;-0,002;0,000;1,008;-0,200;-0,047;0,000;-95,335;-154,839;281,757;  5
281,771545;-0,004;0,001;1,010;-0,200;-0,108;0,000;-77,857;-150,869;278,098;  6
281,814270;-0,002;0,001;1,009;-0,139;-0,047;-0,061;-76,268;-138,958;271,999;  7
281,814728;-0,001;0,002;1,009;-0,139;-0,047;-0,061;-84,213;-150,869;285,416;  8
281,816254;-0,002;0,000;1,005;-0,261;-0,047;0,000;-84,213;-142,929;285,416;  9
281,863007;-0,002;-0,000;1,009;-0,139;0,014;0,061;-85,802;-154,839;281,757; 10
281,864410;0,000;0,001;1,010;-0,200;-0,047;0,000;-85,802;-123,077;281,757; 11
281,911743;-0,001;0,001;1,010;-0,078;-0,047;-0,122;-81,035;-166,750;282,977; 12
281,913116;-0,004;0,000;1,010;-0,139;-0,047;0,000;-90,569;-166,750;278,098; 13
281,960602;-0,004;0,001;1,009;-0,139;0,075;0,000;-79,446;-131,018;281,757; 14
281,961029;-0,002;-0,000;1,009;-0,139;-0,047;0,000;-68,324;-127,048;273,219; 15
281,962555;-0,004;0,001;1,010;-0,200;-0,108;0,061;-82,624;-146,899;276,878; 16
282,009277;-0,002;0,003;1,009;-0,200;-0,047;-0,122;-81,035;-150,869;282,977; 17
282,010742;-0,003;-0,001;1,009;-0,139;0,075;0,000;-84,213;-119,107;292,734; 18
282,058075;-0,003;0,000;1,010;-0,200;-0,047;0,000;-90,569;-182,631;280,537; 19
282,058380;-0,002;-0,001;1,011;-0,200;-0,047;0,061;-96,924;-158,809;280,537; 20
282,060028;-0,003;-0,001;1,010;-0,200;-0,108;0,000;-82,624;-154,839;279,317; 21
282,106689;-0,002;0,001;1,006;-0,139;-0,108;0,000;-73,090;-154,839;289,075; 22
282,108124;-0,002;0,002;1,009;-0,200;0,014;-0,061;-88,980;-131,018;274,438; 23
282,155457;-0,001;0,001;1,007;-0,078;-0,108;-0,061;-90,569;-158,809;280,537; 24
282,155975;-0,004;-0,000;1,009;-0,078;-0,047;0,000;-81,035;-158,809;275,658; 25
282,157501;-0,002;0,001;1,005;-0,139;0,014;-0,061;-92,158;-170,720;274,438; 26
282,204285;-0,002;0,001;1,009;-0,322;-0,047;-0,061;-81,035;-158,809;282,977; 27
282,205688;-0,001;0,002;1,008;-0,261;0,014;0,122;-88,980;-131,018;286,636; 28
282,253021;-0,001;0,000;1,010;-0,200;-0,108;0,000;-84,213;-142,929;280,537; 29
282,253387;-0,002;0,000;1,012;-0,139;0,014;-0,061;-79,446;-162,780;286,636; 30
282,255035;-0,003;0,001;1,011;-0,261;0,014;0,000;-93,746;-174,690;285,416; 31
282,301880;-0,002;-0,000;1,012;-0,078;-0,047;-0,061;-88,980;-131,018;286,636; 32
282,306549;-0,003;0,002;1,011;-0,200;-0,047;0,000;-93,746;-150,869;275,658; 33
282,350464;-0,002;0,002;1,010;-0,261;-0,047;-0,061;-79,446;-154,839;289,075; 34
282,351929;-0,002;-0,001;1,011;-0,139;-0,047;0,000;-85,802;-162,780;291,515; 35
282,399597;-0,002;-0,002;1,009;-0,261;-0,047;0,000;-79,446;-138,958;281,757; 36
282,399841;-0,002;0,001;1,010;-0,200;-0,108;0,000;-73,090;-162,780;281,757; 37
282,401306;-0,002;0,000;1,010;-0,139;0,014;0,000;-85,802;-186,601;284,196; 38
282,448212;-0,004;-0,001;1,008;-0,200;0,014;-0,061;-81,035;-166,750;282,977; 39
282,449432;-0,001;0,002;1,009;-0,139;0,014;-0,061;-79,446;-138,958;286,636; 40
282,496735;-0,004;-0,000;1,008;-0,139;-0,047;0,000;-82,624;-178,661;279,317; 41
282,497162;-0,003;0,001;1,007;-0,139;0,014;-0,061;-85,802;-170,720;284,196; 42
282,498749;-0,003;0,000;1,009;-0,261;0,014;-0,061;-88,980;-131,018;284,196; 43
282,545563;-0,003;0,001;1,010;-0,261;-0,047;0,061;-87,391;-166,750;285,416; 44
282,546936;-0,005;0,001;1,010;-0,139;-0,047;0,061;-81,035;-150,869;278,098; 45
282,594330;-0,002;0,001;1,011;-0,200;-0,108;0,061;-84,213;-142,929;280,537; 46
282,594727;-0,002;0,002;1,008;-0,261;-0,108;0,000;-69,913;-162,780;281,757; 47
282,596313;-0,004;0,001;1,007;-0,261;-0,169;0,000;-90,569;-150,869;280,537; 48
282,643066;-0,003;0,001;1,010;-0,200;-0,047;-0,061;-77,857;-166,750;280,537; 49
282,644531;-0,002;-0,001;1,012;-0,078;0,014;-0,061;-87,391;-174,690;278,098; 50
#2. Test
accSen: 16384.0, accBias: [-133.0 / 952.0 / 396.0], gyrSen: 131.0, gyrBias: [127.0 / 100.0 / 3.0], magSen: [1.1914063 / 1.203125 / 1.15625], magBias: [-340.0 / 649.0 / -439.0], magScale: [0.8996598 / 2.2320673 / 0.6942257]
10,700227;-0,001;-0,002;1,010;-0,177;0,029;0,038;-94,821;-169,115;298,482;  1
10,749319;0,001;0,001;1,007;-0,177;0,090;-0,084;-101,250;-185,221;303,297;  2
10,750302;-0,001;-0,001;1,007;-0,177;0,090;0,038;-114,107;-185,221;288,854;  3
10,797502;-0,000;0,000;1,010;-0,177;0,029;0,099;-110,892;-201,327;293,668;  4
10,798131;-0,001;0,001;1,009;-0,177;0,090;0,038;-112,499;-148,982;290,057;  5
10,798736;-0,000;0,000;1,010;-0,299;-0,032;-0,023;-102,857;-189,248;299,686;  6
10,846427;-0,000;0,000;1,006;-0,055;0,090;-0,023;-107,678;-161,062;298,482;  7
10,847512;0,001;0,001;1,008;-0,177;0,090;0,038;-123,749;-177,168;293,668;  8
10,894043;-0,001;-0,001;1,010;-0,116;0,090;0,099;-109,285;-165,088;297,279;  9
10,895294;0,001;0,002;1,008;-0,177;0,090;-0,084;-109,285;-157,035;302,093; 10
10,896149;0,000;0,000;1,009;-0,116;0,029;0,038;-109,285;-173,141;285,243; 11
10,943202;-0,001;-0,001;1,009;-0,177;0,029;-0,023;-114,107;-169,115;298,482; 12
10,944060;-0,001;0,002;1,010;-0,177;0,090;0,038;-106,071;-181,194;299,686; 13
10,991744;0,001;0,001;1,011;-0,116;0,029;0,038;-114,107;-177,168;298,482; 14
10,999605;-0,000;-0,001;1,009;-0,055;-0,032;0,038;-114,107;-185,221;288,854; 15
11,003575;-0,000;0,001;1,008;-0,177;0,090;-0,023;-101,250;-201,327;293,668; 16
11,088140;-0,001;0,002;1,007;-0,116;-0,093;-0,023;-106,071;-165,088;294,872; 17
11,088720;0,000;0,001;1,009;-0,177;0,029;-0,023;-104,464;-169,115;300,889; 18
11,089665;-0,001;0,002;1,008;-0,177;0,029;-0,023;-123,749;-136,902;291,261; 19
11,090998;0,000;0,002;1,006;-0,055;0,029;-0,023;-107,678;-177,168;298,482; 20
11,138515;0,001;0,002;1,006;-0,116;0,090;0,038;-109,285;-148,982;290,057; 21
11,139768;0,001;0,000;1,010;-0,116;0,029;0,038;-109,285;-181,194;292,465; 22
11,140611;-0,002;-0,000;1,008;-0,055;0,029;0,038;-102,857;-181,194;302,093; 23
11,186987;0,001;0,002;1,008;-0,238;0,029;0,038;-110,892;-161,062;288,854; 24
11,187895;-0,001;0,001;1,010;-0,177;0,029;-0,084;-99,642;-181,194;299,686; 25
11,235576;-0,001;0,001;1,006;-0,177;0,029;0,099;-96,428;-148,982;287,650; 26
11,237465;-0,001;0,001;1,010;-0,177;0,090;0,099;-118,928;-157,035;302,093; 27
11,238333;0,001;0,000;1,010;-0,177;-0,032;0,038;-110,892;-177,168;291,261; 28
11,285094;0,001;0,000;1,005;-0,116;0,151;0,038;-109,285;-189,248;299,686; 29
11,287310;-0,000;0,001;1,005;-0,177;-0,032;-0,084;-104,464;-136,902;303,297; 30
11,333586;0,000;0,001;1,010;-0,116;0,029;-0,023;-109,285;-165,088;304,500; 31
11,333858;-0,001;0,000;1,011;-0,177;0,090;-0,023;-107,678;-136,902;303,297; 32
11,338475;-0,000;0,002;1,006;-0,177;0,151;-0,023;-107,678;-144,956;305,704; 33
11,381445;-0,001;0,001;1,008;-0,177;0,090;-0,084;-94,821;-161,062;303,297; 34
11,382468;0,000;0,000;1,008;-0,116;0,090;0,038;-107,678;-161,062;298,482; 35
11,430288;0,000;0,002;1,010;-0,055;0,029;-0,084;-102,857;-189,248;294,872; 36
11,433200;-0,001;0,000;1,008;-0,116;0,029;0,099;-101,250;-169,115;284,040; 37
11,434052;-0,001;0,000;1,006;-0,299;0,029;-0,023;-106,071;-197,301;294,872; 38
11,487048;0,000;-0,001;1,010;-0,116;0,090;0,038;-101,250;-153,009;300,889; 39
11,487947;-0,000;0,001;1,010;-0,177;0,090;-0,023;-107,678;-144,956;288,854; 40
11,528996;-0,001;0,000;1,006;-0,055;-0,032;-0,023;-106,071;-132,876;302,093; 41
11,531507;-0,001;0,000;1,008;-0,116;0,029;0,038;-117,321;-153,009;303,297; 42
11,575746;-0,002;0,000;1,009;-0,116;0,029;0,099;-106,071;-173,141;294,872; 43
11,577482;0,000;0,002;1,009;-0,116;0,090;0,038;-91,607;-161,062;288,854; 44
11,577921;-0,001;0,001;1,010;-0,055;0,029;-0,023;-107,678;-193,274;296,075; 45
11,624427;-0,001;0,001;1,012;-0,116;0,090;0,038;-99,642;-148,982;294,872; 46
11,625615;0,001;0,001;1,009;-0,055;0,029;0,038;-107,678;-185,221;293,668; 47
11,673472;-0,002;0,000;1,008;-0,116;0,029;0,038;-98,035;-136,902;291,261; 48
11,673741;-0,001;0,000;1,008;-0,055;0,029;0,038;-112,499;-140,929;297,279; 49
11,674731;-0,002;0,000;1,009;-0,116;0,090;0,038;-94,821;-169,115;296,075; 50
...
629,791565;0,000;0,000;1,008;-0,116;0,090;-0,023;-94,821;-169,115;293,668;  1
629,793213;0,000;0,001;1,008;-0,116;0,029;0,038;-114,107;-153,009;296,075;  2
629,839966;0,000;0,001;1,007;-0,116;-0,032;-0,084;-99,642;-181,194;309,314;  3
629,841492;-0,001;0,001;1,010;-0,177;-0,032;0,038;-112,499;-197,301;299,686;  4
629,888672;-0,002;0,002;1,008;-0,177;-0,032;-0,023;-106,071;-173,141;292,465;  5
629,889038;0,001;0,001;1,009;-0,116;0,090;0,038;-120,535;-136,902;296,075;  6
629,890564;-0,000;0,001;1,010;-0,055;0,029;-0,023;-102,857;-181,194;306,907;  7
629,937622;-0,001;0,002;1,006;-0,116;-0,032;-0,023;-106,071;-157,035;299,686;  8
629,938721;-0,000;0,002;1,007;-0,116;-0,032;-0,084;-114,107;-201,327;308,111;  9
629,987488;0,001;0,003;1,010;-0,299;0,090;0,038;-101,250;-161,062;296,075; 10
629,987732;-0,001;0,001;1,009;-0,177;0,029;-0,084;-118,928;-181,194;297,279; 11
630,034790;-0,000;0,002;1,007;-0,238;-0,032;-0,023;-98,035;-177,168;298,482; 12
630,035156;-0,000;0,001;1,007;-0,238;0,090;-0,023;-107,678;-136,902;300,889; 13
630,036743;-0,001;0,002;1,005;-0,299;0,029;0,099;-107,678;-185,221;293,668; 14
630,083557;-0,001;-0,000;1,008;-0,238;0,090;-0,023;-102,857;-189,248;306,907; 15
630,084900;0,000;0,002;1,010;-0,116;0,090;0,038;-101,250;-177,168;296,075; 16
630,132690;-0,000;0,003;1,009;-0,116;0,029;0,038;-114,107;-161,062;300,889; 17
630,133179;-0,000;0,000;1,008;-0,177;-0,032;0,038;-106,071;-148,982;304,500; 18
630,134338;-0,001;0,002;1,010;-0,055;-0,032;0,038;-107,678;-169,115;298,482; 19
630,181152;0,000;0,000;1,009;0,006;-0,032;-0,023;-102,857;-189,248;306,907; 20
630,182312;0,001;0,000;1,006;-0,055;0,029;-0,023;-96,428;-157,035;302,093; 21
630,230164;0,002;0,001;1,005;-0,116;0,029;0,038;-101,250;-209,380;303,297; 22
630,230408;-0,000;0,002;1,008;0,006;-0,032;-0,084;-106,071;-189,248;306,907; 23
630,231812;-0,002;0,000;1,007;-0,055;0,090;0,038;-110,892;-177,168;303,297; 24
630,278931;-0,001;0,001;1,007;-0,055;0,090;0,038;-118,928;-165,088;302,093; 25
630,279907;-0,002;0,001;1,007;-0,116;0,090;-0,023;-106,071;-197,301;297,279; 26
630,328003;0,002;0,001;1,008;-0,116;0,029;-0,084;-112,499;-189,248;299,686; 27
630,329163;-0,002;0,001;1,005;-0,177;0,029;-0,145;-98,035;-193,274;298,482; 28
630,376404;-0,001;0,003;1,006;-0,116;0,090;-0,084;-106,071;-173,141;297,279; 29
630,376648;0,002;0,002;1,007;-0,116;-0,032;0,038;-110,892;-177,168;296,075; 30
630,378418;-0,001;0,002;1,010;-0,177;0,029;-0,023;-94,821;-161,062;293,668; 31
630,424866;0,002;0,001;1,007;-0,238;0,090;-0,023;-110,892;-161,062;303,297; 32
630,426208;0,001;0,001;1,006;-0,177;0,151;-0,023;-94,821;-169,115;293,668; 33
630,473572;-0,002;0,003;1,007;-0,238;0,090;-0,023;-104,464;-128,849;305,704; 34
630,474182;-0,001;0,002;1,007;-0,238;0,029;0,038;-109,285;-165,088;304,500; 35
630,475830;-0,001;0,000;1,010;-0,177;0,090;-0,023;-104,464;-185,221;308,111; 36
630,522278;-0,000;0,001;1,009;-0,177;0,029;-0,023;-115,714;-181,194;309,314; 37
630,523682;0,001;0,002;1,007;-0,055;0,151;0,038;-109,285;-148,982;304,500; 38
630,571045;-0,001;0,002;1,007;-0,116;-0,032;0,038;-101,250;-153,009;298,482; 39
630,571472;0,001;0,001;1,008;-0,177;0,090;-0,023;-107,678;-169,115;303,297; 40
630,573059;0,001;0,001;1,010;-0,116;0,090;0,099;-99,642;-189,248;294,872; 41
630,619812;-0,000;0,002;1,010;-0,177;0,029;0,099;-107,678;-169,115;298,482; 42
630,621033;-0,001;0,002;1,006;-0,116;0,029;0,038;-114,107;-193,274;305,704; 43
630,668579;-0,000;0,001;1,008;-0,116;0,029;-0,023;-99,642;-173,141;311,721; 44
630,669067;-0,000;0,001;1,006;-0,116;-0,032;-0,023;-96,428;-173,141;299,686; 45
630,670593;0,002;0,000;1,007;-0,177;0,029;0,038;-112,499;-165,088;304,500; 46
630,717224;-0,000;0,002;1,010;-0,238;0,029;0,038;-110,892;-169,115;291,261; 47
630,718872;-0,001;0,004;1,010;-0,299;-0,032;0,038;-102,857;-165,088;290,057; 48
630,766785;-0,000;0,002;1,007;-0,116;0,090;0,038;-104,464;-144,956;293,668; 49
630,768066;-0,001;0,001;1,008;-0,177;0,090;0,099;-114,107;-169,115;296,075; 50
#3. Test
accSen: 16384.0, accBias: [-124.0 / 933.0 / 357.0], gyrSen: 131.0, gyrBias: [127.0 / 100.0 / -1.0], magSen: [1.1914063 / 1.203125 / 1.15625], magBias: [-23.0 / 314.0 / -101.0], magScale: [0.8851675 / 1.48 / 0.8371041]
11,047606;-0,001;0,003;1,008;-0,055;-0,032;0,008;-150,218;21,359;323,631;  1
11,087330;-0,002;0,004;1,009;-0,116;-0,093;-0,053;-151,800;2,670;325,083;  2
11,088246;-0,001;0,003;1,009;-0,116;-0,032;0,008;-156,543;26,698;329,436;  3
11,137873;-0,000;0,001;1,007;-0,116;-0,032;0,069;-129,662;8,009;327,985;  4
11,138852;-0,001;0,002;1,007;-0,055;0,029;-0,053;-159,706;0,000;329,436;  5
11,185417;-0,000;0,004;1,006;-0,116;-0,032;0,008;-154,962;18,689;316,375;  6
11,186497;-0,000;0,003;1,010;-0,177;-0,093;0,008;-148,637;18,689;325,083;  7
11,187413;-0,001;0,004;1,010;-0,177;-0,032;0,008;-137,569;-26,699;317,826;  8
11,233596;0,001;0,001;1,008;-0,177;-0,032;-0,053;-137,569;10,679;335,241;  9
11,234628;-0,002;0,003;1,008;-0,116;0,029;0,008;-150,218;16,019;317,826; 10
11,282443;-0,002;0,004;1,013;-0,116;-0,032;0,069;-147,056;0,000;326,534; 11
11,283359;-0,002;0,002;1,008;-0,177;-0,032;0,008;-145,475;24,029;319,278; 12
11,286912;-0,001;0,003;1,011;-0,055;0,029;0,008;-148,637;8,009;322,180; 13
11,330429;-0,001;0,005;1,006;-0,177;-0,032;0,008;-159,706;21,359;335,241; 14
11,331408;-0,001;0,005;1,006;-0,116;-0,032;0,008;-137,569;21,359;320,729; 15
11,377213;-0,001;0,002;1,008;-0,116;-0,032;0,008;-137,569;10,679;326,534; 16
11,377756;-0,000;0,001;1,009;0,006;-0,032;0,008;-142,312;29,368;325,083; 17
11,379228;-0,001;0,003;1,010;-0,055;0,029;0,008;-151,800;8,009;325,083; 18
11,428506;-0,000;0,006;1,009;-0,055;0,029;0,069;-140,731;-5,340;332,339; 19
11,429411;-0,001;0,004;1,002;-0,116;-0,032;0,008;-158,125;8,009;313,472; 20
11,477525;-0,002;0,002;1,008;-0,116;-0,032;0,069;-150,218;5,340;332,339; 21
11,478414;0,000;0,004;1,009;-0,116;-0,032;0,008;-143,893;5,340;326,534; 22
11,527294;0,001;0,002;1,010;-0,177;-0,093;0,069;-150,218;5,340;338,144; 23
11,528267;0,000;0,002;1,008;0,006;0,029;0,008;-134,406;10,679;320,729; 24
11,529163;-0,000;0,005;1,009;-0,177;0,029;0,008;-142,312;8,009;310,570; 25
11,575970;-0,001;0,003;1,008;-0,116;-0,093;0,008;-143,893;-5,340;329,436; 26
11,576917;-0,002;0,002;1,008;-0,116;-0,032;0,130;-131,244;5,340;320,729; 27
11,622581;-0,002;0,003;1,009;-0,116;-0,032;-0,053;-140,731;16,019;323,631; 28
11,635692;-0,001;0,002;1,012;-0,116;0,029;0,069;-140,731;21,359;335,241; 29
11,637119;-0,000;0,003;1,011;-0,055;0,029;0,008;-147,056;5,340;312,021; 30
11,672071;-0,001;0,003;1,007;0,006;-0,032;0,008;-167,612;-13,349;333,790; 31
11,672745;-0,001;0,002;1,010;-0,116;-0,032;0,008;-143,893;5,340;317,826; 32
11,720592;-0,001;0,002;1,009;-0,116;-0,032;-0,053;-129,662;13,349;322,180; 33
11,722238;-0,001;0,003;1,008;-0,116;-0,093;0,069;-150,218;0,000;329,436; 34
11,724232;0,000;0,002;1,008;-0,116;-0,032;-0,114;-137,569;10,679;320,729; 35
11,767849;0,001;0,004;1,008;-0,177;-0,032;0,008;-147,056;21,359;326,534; 36
11,768839;-0,000;0,005;1,011;-0,116;0,029;0,008;-139,150;2,670;327,985; 37
11,817997;0,000;0,001;1,010;-0,116;-0,093;0,008;-137,569;0,000;323,631; 38
11,819359;-0,002;0,003;1,009;-0,238;-0,032;0,008;-140,731;10,679;317,826; 39
11,820218;-0,001;0,003;1,007;-0,116;-0,032;0,008;-143,893;0,000;326,534; 40
11,867067;-0,000;0,006;1,010;-0,055;0,029;-0,053;-148,637;13,349;310,570; 41
11,868036;0,001;0,005;1,006;-0,116;-0,093;-0,053;-151,800;-2,670;307,667; 42
11,914515;-0,000;0,002;1,013;-0,177;0,029;0,069;-145,475;-13,349;336,693; 43
11,916014;-0,000;0,003;1,010;-0,116;0,029;-0,053;-147,056;-10,679;335,241; 44
11,962207;0,000;0,003;1,007;-0,116;-0,093;0,069;-147,056;10,679;320,729; 45
11,962615;-0,003;0,003;1,010;-0,055;0,029;0,008;-142,312;18,689;322,180; 46
11,964246;-0,002;0,003;1,007;-0,055;0,029;0,008;-143,893;26,698;312,021; 47
12,011997;0,000;0,003;1,008;-0,177;-0,093;-0,053;-147,056;-21,359;323,631; 48
12,013413;-0,001;0,005;1,010;0,006;0,090;-0,053;-150,218;10,679;312,021; 49
12,062988;0,000;0,002;1,006;-0,116;-0,032;-0,053;-147,056;10,679;312,021; 50
...
170,066437;-0,002;0,005;1,010;-0,055;0,029;0,130;-128,081;5,340;312,021;  1
170,113373;-0,001;0,005;1,010;-0,116;-0,032;0,008;-148,637;-2,670;322,180;  2
170,115875;-0,003;0,003;1,011;-0,055;-0,032;0,008;-139,150;24,029;319,278;  3
170,116776;-0,002;0,004;1,011;-0,116;0,029;0,008;-147,056;10,679;332,339;  4
170,163391;-0,002;0,003;1,010;-0,055;-0,154;-0,053;-153,381;0,000;338,144;  5
170,164307;-0,004;0,005;1,009;-0,116;-0,032;-0,053;-150,218;16,019;317,826;  6
170,213348;-0,002;0,005;1,007;-0,177;-0,093;-0,053;-151,800;24,029;322,180;  7
170,214233;-0,001;0,004;1,009;-0,055;0,029;0,008;-147,056;5,340;323,631;  8
170,215256;-0,003;0,004;1,009;-0,116;-0,032;0,069;-150,218;10,679;329,436;  9
170,259277;-0,001;0,002;1,010;-0,055;-0,093;0,069;-150,218;5,340;314,924; 10
170,264969;-0,001;0,004;1,011;-0,055;-0,032;0,069;-139,150;18,689;313,472; 11
170,307098;-0,001;0,006;1,010;-0,055;-0,093;-0,053;-143,893;10,679;326,534; 12
170,308319;-0,002;0,004;1,010;-0,116;-0,093;0,008;-153,381;0,000;317,826; 13
170,357101;0,000;0,003;1,009;-0,116;-0,032;0,069;-143,893;-10,679;314,924; 14
170,358322;-0,004;0,005;1,008;-0,177;-0,032;0,008;-135,987;-2,670;322,180; 15
170,359192;-0,002;0,003;1,008;-0,177;-0,032;0,069;-143,893;21,359;332,339; 16
170,407654;-0,002;0,004;1,008;-0,116;-0,093;0,008;-154,962;-2,670;339,595; 17
170,408569;-0,003;0,004;1,009;-0,116;-0,093;0,008;-135,987;8,009;325,083; 18
170,456131;-0,002;0,006;1,006;-0,238;-0,093;0,008;-134,406;-5,340;314,924; 19
170,457733;-0,001;0,005;1,007;-0,055;-0,093;0,008;-139,150;18,689;333,790; 20
170,458649;-0,001;0,002;1,011;-0,055;-0,032;0,008;-140,731;5,340;335,241; 21
170,504120;-0,001;0,004;1,006;-0,055;0,029;0,008;-159,706;0,000;323,631; 22
170,505859;-0,002;0,003;1,011;-0,116;0,029;0,008;-131,244;10,679;326,534; 23
170,553177;-0,002;0,003;1,009;-0,116;-0,093;-0,053;-145,475;-2,670;319,278; 24
170,553864;-0,000;0,002;1,008;-0,116;-0,154;0,008;-148,637;18,689;310,570; 25
170,555771;-0,002;0,004;1,010;-0,055;-0,032;0,008;-147,056;5,340;323,631; 26
170,601425;-0,004;0,004;1,011;-0,116;-0,032;-0,053;-145,475;2,670;319,278; 27
170,602310;-0,000;0,004;1,009;-0,116;-0,093;-0,053;-148,637;18,689;327,985; 28
170,650604;-0,003;0,001;1,008;-0,116;-0,093;0,008;-137,569;16,019;317,826; 29
170,651489;-0,003;0,005;1,011;-0,177;-0,154;-0,053;-129,662;-8,010;322,180; 30
170,698364;-0,000;0,005;1,008;-0,116;-0,032;0,069;-131,244;0,000;320,729; 31
170,700394;-0,000;0,004;1,008;-0,116;-0,032;-0,114;-143,893;0,000;320,729; 32
170,701324;-0,002;0,004;1,009;-0,116;-0,093;0,008;-151,800;8,009;325,083; 33
170,747452;-0,002;0,004;1,012;0,006;-0,093;0,008;-131,244;-16,019;323,631; 34
170,748871;-0,003;0,004;1,008;-0,177;-0,093;0,008;-143,893;16,019;320,729; 35
170,796295;-0,002;0,002;1,008;-0,055;-0,093;0,008;-148,637;13,349;325,083; 36
170,799545;-0,004;0,004;1,008;-0,055;-0,093;0,069;-140,731;-10,679;314,924; 37
170,800461;-0,003;0,004;1,010;-0,177;-0,032;-0,053;-140,731;10,679;326,534; 38
170,844452;-0,003;0,003;1,009;-0,116;-0,093;0,008;-140,731;5,340;341,046; 39
170,846222;-0,003;0,004;1,006;-0,116;-0,093;0,069;-139,150;24,029;327,985; 40
170,892624;-0,001;0,003;1,008;-0,177;-0,093;0,008;-147,056;5,340;314,924; 41
170,892914;-0,002;0,004;1,009;-0,177;-0,032;0,008;-147,056;0,000;317,826; 42
170,894165;-0,002;0,003;1,010;-0,116;0,029;0,069;-143,893;26,698;320,729; 43
170,942917;-0,003;0,003;1,007;-0,116;-0,032;-0,053;-140,731;-5,340;326,534; 44
170,943649;-0,002;0,005;1,011;-0,116;0,029;0,008;-145,475;8,009;322,180; 45
170,991714;-0,003;0,001;1,009;-0,177;-0,032;0,008;-137,569;10,679;323,631; 46
170,993698;-0,002;0,004;1,012;-0,116;-0,093;0,008;-151,800;29,368;322,180; 47
170,994553;-0,001;0,004;1,010;-0,055;-0,032;0,008;-137,569;10,679;312,021; 48
171,040939;-0,001;0,004;1,010;0,067;0,029;0,008;-137,569;10,679;312,021; 49
171,041779;-0,001;0,004;1,011;-0,116;-0,032;0,008;-145,475;24,029;327,985; 50
#4. Test
accSen: 16384.0, accBias: [-125.0 / 967.0 / 406.0], gyrSen: 131.0, gyrBias: [115.0 / 104.0 / 13.0], magSen: [1.1914063 / 1.203125 / 1.15625], magBias: [-1.0 / 184.0 / -25.0], magScale: [0.8183521 / 2.0809524 / 0.7707231]
11,004905;-0,001;0,000;1,007;-0,085;-0,001;0,023;-90,637;-176,435;301,976;  1
11,005228;-0,000;0,003;1,006;-0,024;-0,123;-0,038;-83,328;-157,665;300,640;  2
11,048441;-0,002;0,001;1,006;-0,085;-0,123;0,023;-77,480;-142,650;297,968;  3
11,049107;-0,001;0,003;1,007;-0,146;-0,062;-0,099;-80,404;-157,665;295,296;  4
11,050397;-0,003;0,002;1,005;-0,146;-0,001;-0,038;-78,942;-198,959;307,321;  5
11,097945;-0,002;0,002;1,009;-0,146;0,060;-0,038;-90,637;-161,419;304,649;  6
11,099289;0,000;0,001;1,007;-0,146;-0,001;0,023;-80,404;-202,713;305,985;  7
11,146800;-0,000;0,003;1,008;-0,085;0,060;-0,038;-74,556;-150,158;300,640;  8
11,147799;-0,001;0,002;1,008;-0,085;-0,001;-0,038;-74,556;-180,189;295,296;  9
11,148504;-0,001;0,001;1,006;-0,085;-0,001;-0,099;-74,556;-165,173;303,313; 10
11,195945;-0,002;0,001;1,007;-0,207;-0,001;-0,099;-74,556;-172,681;300,640; 11
11,196758;-0,001;0,003;1,008;-0,146;-0,001;0,023;-71,633;-157,665;300,640; 12
11,245092;-0,001;0,002;1,008;-0,085;-0,001;-0,038;-70,171;-176,435;293,959; 13
11,246309;-0,002;0,002;1,005;-0,085;-0,001;0,023;-76,018;-161,419;293,959; 14
11,262282;-0,001;0,003;1,006;-0,024;-0,062;0,023;-86,251;-180,189;292,623; 15
11,291942;0,000;0,002;1,007;-0,207;-0,062;0,023;-78,942;-146,404;304,649; 16
11,297271;-0,002;0,002;1,004;-0,085;-0,062;-0,038;-77,480;-150,158;303,313; 17
11,341992;0,000;0,002;1,005;-0,207;0,060;0,023;-73,094;-176,435;301,976; 18
11,343790;-0,002;0,003;1,008;-0,085;0,060;-0,038;-78,942;-153,912;291,287; 19
11,393209;-0,002;0,000;1,007;-0,085;-0,062;0,023;-78,942;-138,896;296,632; 20
11,394184;-0,003;0,000;1,008;-0,085;-0,062;0,023;-84,790;-168,927;296,632; 21
11,396212;-0,002;0,001;1,007;-0,085;-0,001;-0,038;-73,094;-161,419;304,649; 22
11,439137;-0,002;0,002;1,005;-0,085;-0,001;0,084;-76,018;-146,404;304,649; 23
11,441843;-0,002;0,002;1,007;-0,146;-0,062;0,084;-76,018;-161,419;307,321; 24
11,487807;-0,002;0,000;1,005;-0,085;-0,001;-0,038;-77,480;-172,681;295,296; 25
11,489103;-0,001;0,003;1,007;-0,085;-0,062;-0,038;-87,713;-161,419;315,338; 26
11,489965;-0,001;-0,000;1,007;-0,146;-0,062;-0,038;-78,942;-153,912;301,976; 27
11,536952;-0,002;0,001;1,011;-0,146;-0,062;0,023;-71,633;-142,650;303,313; 28
11,537856;-0,002;0,002;1,005;-0,085;-0,062;0,023;-77,480;-172,681;303,313; 29
11,585896;-0,004;0,001;1,007;-0,085;-0,001;0,023;-81,866;-146,404;301,976; 30
11,586803;-0,001;0,000;1,006;-0,146;0,060;0,023;-81,866;-146,404;304,649; 31
11,587684;-0,001;0,002;1,005;-0,146;-0,001;-0,099;-76,018;-146,404;288,615; 32
11,635032;-0,002;0,002;1,007;-0,146;-0,001;-0,099;-81,866;-138,896;304,649; 33
11,635923;-0,000;0,002;1,008;-0,146;0,060;0,023;-81,866;-168,927;304,649; 34
11,685073;-0,004;-0,000;1,008;-0,146;0,060;0,023;-67,247;-176,435;304,649; 35
11,685820;-0,001;0,003;1,006;-0,085;0,060;-0,038;-78,942;-191,451;299,304; 36
11,687752;-0,001;-0,000;1,005;-0,146;-0,001;0,023;-70,171;-176,435;299,304; 37
11,731048;-0,002;0,002;1,006;-0,146;-0,001;0,084;-90,637;-153,912;301,976; 38
11,731927;-0,002;0,001;1,005;-0,146;-0,001;0,023;-80,404;-150,158;295,296; 39
11,783393;-0,002;0,001;1,009;-0,085;-0,062;-0,038;-74,556;-165,173;303,313; 40
11,784419;-0,001;0,002;1,008;-0,024;-0,001;0,023;-84,790;-161,419;304,649; 41
11,829244;-0,003;0,003;1,005;-0,207;-0,001;-0,038;-80,404;-150,158;297,968; 42
11,830605;-0,002;0,002;1,009;-0,146;0,060;-0,038;-78,942;-146,404;291,287; 43
11,831373;-0,000;0,000;1,008;-0,085;-0,062;0,023;-76,018;-153,912;291,287; 44
11,879005;0,000;0,002;1,006;-0,146;-0,062;-0,038;-80,404;-150,158;303,313; 45
11,879876;-0,000;0,001;1,009;-0,085;-0,062;-0,099;-77,480;-165,173;300,640; 46
11,926386;-0,000;0,003;1,004;-0,085;-0,001;-0,038;-71,633;-172,681;295,296; 47
11,928334;-0,002;0,002;1,006;-0,146;-0,123;-0,038;-92,099;-180,189;300,640; 48
11,929141;-0,003;0,003;1,006;-0,146;-0,062;-0,099;-81,866;-183,943;299,304; 49
11,976406;-0,002;0,002;1,004;-0,146;-0,001;0,084;-92,099;-172,681;295,296; 50
...
229,991745;-0,002;0,001;1,006;-0,085;-0,001;-0,038;-77,480;-135,142;305,985;  1
230,038467;-0,001;0,001;1,006;-0,085;-0,062;-0,099;-74,556;-135,142;305,985;  2
230,038940;-0,001;0,001;1,009;-0,085;-0,001;-0,038;-76,018;-168,927;293,959;  3
230,040833;-0,002;0,002;1,006;-0,146;-0,123;-0,038;-73,094;-131,388;296,632;  4
230,087204;-0,000;0,003;1,007;-0,146;-0,062;-0,038;-70,171;-146,404;288,615;  5
230,088638;-0,003;0,001;1,009;-0,207;-0,062;-0,099;-74,556;-135,142;305,985;  6
230,135880;-0,003;0,003;1,008;-0,085;-0,001;-0,038;-73,094;-138,896;301,976;  7
230,137329;-0,001;0,003;1,007;-0,207;-0,062;-0,099;-76,018;-176,435;293,959;  8
230,184906;-0,001;0,001;1,009;-0,146;-0,001;-0,038;-71,633;-142,650;305,985;  9
230,185242;-0,002;0,001;1,010;-0,085;-0,001;-0,038;-81,866;-176,435;293,959; 10
230,186783;-0,002;-0,001;1,009;-0,146;-0,062;-0,099;-78,942;-146,404;307,321; 11
230,233627;-0,002;0,002;1,008;-0,146;-0,062;-0,099;-67,247;-138,896;304,649; 12
230,234955;-0,003;0,002;1,008;-0,146;-0,123;-0,038;-76,018;-168,927;304,649; 13
230,282822;-0,003;0,000;1,009;-0,024;-0,123;0,023;-73,094;-183,943;304,649; 14
230,283432;-0,002;0,000;1,010;-0,146;-0,001;-0,099;-76,018;-168,927;293,959; 15
230,284424;-0,003;0,000;1,008;-0,085;-0,001;0,023;-78,942;-153,912;309,993; 16
230,331421;-0,002;0,002;1,007;-0,146;-0,062;-0,099;-77,480;-165,173;297,968; 17
230,332489;-0,002;0,002;1,007;-0,085;-0,001;-0,099;-78,942;-153,912;299,304; 18
230,379761;-0,004;0,003;1,005;-0,085;0,060;-0,099;-73,094;-153,912;288,615; 19
230,380234;-0,002;0,002;1,008;-0,207;-0,062;-0,099;-74,556;-135,142;308,657; 20
230,382370;-0,002;0,001;1,009;-0,085;0,060;-0,038;-64,323;-153,912;304,649; 21
230,429214;-0,004;-0,001;1,011;-0,146;0,060;-0,038;-74,556;-150,158;308,657; 22
230,433990;-0,000;0,003;1,002;-0,146;-0,062;-0,038;-76,018;-176,435;304,649; 23
230,477631;-0,000;0,002;1,007;-0,085;-0,062;-0,099;-70,171;-116,372;301,976; 24
230,479019;-0,000;0,002;1,005;-0,146;-0,001;-0,038;-76,018;-161,419;291,287; 25
230,574738;-0,001;0,001;1,011;-0,146;-0,001;-0,038;-76,018;-131,388;307,321; 26
230,575165;-0,003;0,000;1,006;-0,146;-0,123;-0,160;-65,785;-112,618;303,313; 27
230,575790;-0,004;0,001;1,007;-0,146;-0,001;-0,038;-67,247;-153,912;318,011; 28
230,577087;-0,003;0,002;1,006;-0,085;-0,001;-0,099;-73,094;-168,927;291,287; 29
230,623810;-0,004;0,000;1,010;-0,146;-0,062;0,023;-76,018;-153,912;304,649; 30
230,624817;-0,001;0,002;1,006;0,037;-0,001;0,023;-64,323;-153,912;307,321; 31
230,624985;-0,005;0,000;1,005;-0,146;-0,062;0,023;-68,709;-172,681;295,296; 32
230,626221;-0,002;0,001;1,013;-0,146;-0,062;-0,038;-74,556;-172,681;297,968; 33
230,672745;-0,005;-0,001;1,006;-0,085;-0,123;-0,038;-80,404;-150,158;303,313; 34
230,673981;-0,002;0,001;1,005;-0,085;-0,062;-0,160;-59,937;-150,158;305,985; 35
230,721832;-0,001;0,001;1,008;-0,085;-0,062;-0,038;-74,556;-157,665;289,951; 36
230,722382;-0,003;0,001;1,006;-0,146;-0,123;-0,038;-81,866;-168,927;299,304; 37
230,723389;-0,003;0,002;1,010;-0,146;-0,001;0,023;-81,866;-153,912;309,993; 38
230,770218;-0,004;0,000;1,005;-0,146;-0,001;-0,038;-73,094;-131,388;304,649; 39
230,771622;-0,004;0,001;1,005;-0,146;-0,123;-0,038;-77,480;-150,158;300,640; 40
230,818924;-0,003;0,002;1,009;-0,146;-0,062;-0,038;-83,328;-172,681;308,657; 41
230,819427;-0,005;0,001;1,010;-0,085;-0,062;-0,038;-62,861;-150,158;308,657; 42
230,821030;-0,004;0,001;1,011;-0,146;-0,001;-0,099;-67,247;-161,419;307,321; 43
230,867416;-0,002;0,001;1,008;-0,146;-0,062;-0,038;-67,247;-183,943;299,304; 44
230,868652;-0,005;0,000;1,007;-0,085;-0,062;0,023;-74,556;-157,665;303,313; 45
230,915970;-0,002;0,002;1,010;-0,207;-0,062;-0,038;-68,709;-187,697;305,985; 46
230,917389;-0,004;0,001;1,009;-0,085;-0,001;0,023;-80,404;-172,681;305,985; 47
230,964645;-0,002;0,001;1,009;-0,085;-0,062;-0,160;-73,094;-153,912;307,321; 48
230,965164;-0,004;0,001;1,007;-0,207;-0,001;-0,038;-67,247;-161,419;299,304; 49
230,966782;-0,003;0,002;1,008;-0,207;-0,001;-0,038;-71,633;-142,650;292,623; 50
--- Observations: - Accelerometer-data looks perfect (0,0,1)-stability for all axis (also after turning or waving the sensor) with an error of +-10 mg - Gyroscope-data looks ok with (0,0,0)-stability but not as perfect as it could be with +-0,2 dps - Magnetometer-data is a little jittering with deviations of +-50 mG - cant say how good it is though! From my perspective all the calibrated sensor data is quite stable and resets perfectly even after heavy motion and over longterm measurements. Still when doing the quat2euler-conversion I am seeing a highly unstable yaw-angle (realy the worst of all 3), a fairly stable roll-angle and a slow-responsive pitch-angle. Here are the links for 2 videos I made, that document my dilemma: MPU9250-Raw-Data-Plot: http://www.vidup.de/v/qlZQI/ MPU9250-Euler-Angle-Plot: http://www.vidup.de/v/jGZdA/ Cant wait to hear your statement to that! ;) Regards Ray
kriswiner commented 8 years ago

On the mag data you have printed out, is the ~300,000 z-axis number supposed in micro Gauss so it is ~300 mG? If so, then it's not too bad and about what I would expect. If you use the NED convention, you need to pass the Madgwick (or Mahony) filter the data that corresponds to the proper orientation. So if the + z-axis of the mag is pointing up (which is is IIRC), then you have to pass -Mz to the filter (since Down is - z). If you want the x-axis to define North or Up (which I usually do), the you have to pass the filter Mx on the first slot, and then either My or -My depending on which direction is East. In other words, you have to make sure the sensor axes align with your orientation convention, for all three sensors. So if the accel/gyro x-axis is defined as North and the mag x-axis points in the East direction, you have to pass the filter swapped Mx and My values to maintain consistency. This might be the cause of the inconsistencies in yaw behavior you are seeing. Although it is a bit hard for me to tell what is happening in the videos.

I hope this helps.

Kris

RayBreslin commented 8 years ago

Awwww... I totally forgot to add a description for the videos:

(1) MPU9250-Raw-Data-Plot:

(2) MPU9250-Angle-Data-Plot:

For orientation I use the one from the InvenSense-Datasheet for the MPU9250 (the same like you do):

gx = (double) scaledData[1][0] \* deg2radFactor;
gy = (double) scaledData[1][1] \* deg2radFactor;
gz = (double) scaledData[1][2] \* deg2radFactor;
ax = (double) scaledData[0][0];
ay = (double) scaledData[0][1];
az = (double) scaledData[0][2];
mx = (double) scaledData[2][1]; // Switch y --> x
my = (double) scaledData[2][0]; // Switch x --> y
mz = (double) scaledData[2][2];
filter_iteration = 0;
while(filter_iteration < 20)
{
   orientationFilter.updateAHRSmarg(gx, gy, gz, ax, ay, az, 0.0d, 0.0d, 0.0d);
   //orientationFilter.updateAHRSmarg(gx, gy, gz, ax, ay, az, mx, my, mz);
   filter_iteration++;
}
I will setup a testbench in Matlab now till the end of the week, to provide an easy-to-use-gui for the fast analysis of all the raw-sensor-data, quaternion-variables and euler-angles. In the meantime im testing your mahony-filter with the same data, doing a check on the correct data-format-input of the madgwick-algorithm (f.ex. passing uT instead of mG), adding a digital-low-pass-filter for the magnetometer-data and checking all the conversion-process-chain for both raw-data and calibration-data... Somewhere has to be the explanation, why I dont get such stable results like you described in your tests! Ray
kriswiner commented 8 years ago

Hi Ray,

I am assuming you changed the ordering of the accel and gyro data passed to your marg filter and are properly accounting for same. This could mess you up if you haven't!

Kris

-----Original Message----- From: RayBreslin [mailto:notifications@github.com] Sent: October 6, 2015 8:42 AM To: kriswiner/MPU-9250 Cc: Kris Winer Subject: Re: [MPU-9250] Madgwick-Filter-ODR / Filtered-Magnetometer-Data (#23)

Awwww... I totally forgot to add a description for the videos:

(1) MPU9250-Raw-Data-Plot:

(2) MPU9250-Angle-Data-Plot:

For orientation I use the one from the InvenSense-Datasheet for the MPU9250 (the same like you do):

gx = (double) scaledData[1][0] * deg2radFactor;

gy = (double) scaledData[1][1] * deg2radFactor;

gz = (double) scaledData[1][2] * deg2radFactor;

ax = (double) scaledData[0][0];

ay = (double) scaledData[0][1];

az = (double) scaledData[0][2];

mx = (double) scaledData[2][1]; // Switch y --> x

my = (double) scaledData[2][0]; // Switch x --> y

mz = (double) scaledData[2][2];

filter_iteration = 0;

while(filter_iteration < 20)

{

orientationFilter.updateAHRSmarg(gx, gy, gz, ax, ay, az, 0.0d, 0.0d,

0.0d);

//orientationFilter.updateAHRSmarg(gx, gy, gz, ax, ay, az, mx, my, mz);

}

I will setup a testbench in Matlab now till the end of the week, to provide an easy-to-use-gui for the fast analysis of all the raw-sensor-data, quaternion-variables and euler-angles.

In the meantime im testing your mahony-filter with the same data, doing a check on the correct data-format-input of the madgwick-algorithm (f.ex. passing uT instead of mG), adding a digital-low-pass-filter for the magnetometer-data and checking all the conversion-process-chain for both raw-data and calibration-data...

Somewhere has to be the explanation, why I dont get such stable results like you described in your tests!

� Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/23#issuecomment-145904938 . https://github.com/notifications/beacon/AGY1quyB5cCs4xaqGkFHkQQuzNp5RljHks5 o4-NXgaJpZM4GIc1_.gif

RayBreslin commented 8 years ago

Yes I did that - the one case where I followed madgwicks original coding! ;)

//orientationFilter.updateAHRSmarg(gx, gy, gz, ax, ay, az, 0.0d, 0.0d, 0.0d);
//orientationFilter.updateAHRSmarg(gx, gy, gz, ax, ay, az, mx, my, mz);
orientationFilter.MahonyQuaternionUpdate(gx, gy, gz, ax, ay, az, mx, my, mz);
public void updateAHRSmarg(double gx, double gy, double gz, double ax, double ay, double az, double mx, double my, double mz)
public void MahonyQuaternionUpdate(double gx, double gy, double gz, double ax, double ay, double az, double mx, double my, double mz)
Also took in your mahony-implementation, but that one - unchanged and getting same data like madgwick - shows absolutely unpredicted behaviour! But I dont want to open a new problem there, until I fixed the madgwick-issue entirely... Just thought hey since I am assuming you can easily exchange madgwick and mahony in your code vice-versa with approximately the same results, why dont I try that to at least exclude any false portation error... kinda didnt went as planned! But for now I am relying entirely on my matlab testbench and I wont do any side-analysis in the meantime. Totally appreciate your help so far, but I suppose I got to fix my coding mess here first and provide truely investigative data, that can actually help unriddling this mystery... Will get back to you in a few days to inform you on the progress! --- PS: Just 1 more question... you do multiply your calculated magBias with the magResolution and magSensitivity first before you subtract it from your rawMagData right?
kriswiner commented 8 years ago

Hi Ray,

Yes, it is a little hard for me to follow all the changes you have made so I can't quite tell where the problem, if any, might lay. I hope your further investigations provide a smoking gun to identify what the issue might be. The mag data you showed a few days ago looks somewhat strange to me and this might be where things are breaking down.

I make sure that whatever biases I subtract off of the magnetic field has all the same calibrations and scaling so I am subtracting properly scaled milligauss biases from properly scaled milligauss fields.

Kris

-----Original Message----- From: RayBreslin [mailto:notifications@github.com] Sent: October 6, 2015 11:39 PM To: kriswiner/MPU-9250 Cc: Kris Winer Subject: Re: [MPU-9250] Madgwick-Filter-ODR / Filtered-Magnetometer-Data (#23)

Yes I did that - the one case where I followed madgwicks original coding! ;)

//orientationFilter.updateAHRSmarg(ax, ay, az, gx, gy, gz, 0.0d, 0.0d, 0.0d);

//orientationFilter.updateAHRSmarg(gx, gy, gz, ax, ay, az, mx, my, mz);

orientationFilter.MahonyQuaternionUpdate(gx, gy, gz, ax, ay, az, mx, my, mz);

public void updateAHRSmarg(double gx, double gy, double gz, double ax, double ay, double az, double mx, double my, double mz)

public void MahonyQuaternionUpdate(double gx, double gy, double gz, double ax, double ay, double az, double mx, double my, double mz)

Also took in your mahony-implementation, but that one - unchanged and getting same data like madgwick - shows absolutely unpredicted behaviour! But I dont want to open a new problem there, until I fixed the madgwick-issue entirely...

Just thought hey since I am assuming you can easily exchange madgwick and mahony in your code vice-versa with approximately the same results, why dont I try that to at least exclude any false portation error... kinda didnt went as planned!

But for now I am relying entirely on my matlab testbench and I wont do any side-analysis in the meantime.

Totally appreciate your help so far, but I suppose I got to fix my coding mess here first and provide truely investigative data, that can actually help unriddling this mystery...

Will get back to you in a few days to inform you on the progress!

PS: Just 1 more question... you do multiply your calculated magBias with the magResolution and magSensitivity first before you subtract it from your rawMagData right?

Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/23#issuecomment-146091210 . https://github.com/notifications/beacon/AGY1qr2itEk32loONBcMLJI5CI20XGUMks5 o5LWGgaJpZM4GIc1_.gif

RayBreslin commented 8 years ago

Im sorry that I caused this much confusion...

Already thought about getting myself a teensy 3.2-board where I can attach one of my MPU9250 to, which then allows me to run your scetches MPU9250BasicAHRS.ino or MPU9250BasicAHRS_t3.ino entirely unchanged (hopefully). Just to get some kinda similar baseline or reference!

In general I felt that my approach wasnt too bad so far, since roll and pitch behaved pretty nicely just not the yaw...

Before I can draw any more conclusions or ask the right questions I got to improve my knowledge on basic sensor-functionality too, since right now I couldnt say in detail which sensor takes what part in actually getting to euler angles!

kriswiner commented 8 years ago

Don't be sorry... this is a complicated area and it takes a while to get your arms around it. I've been at it for almost two years and still don't know enough!

I'll take a look at that article this weekend. Kris

-----Original Message----- From: RayBreslin [mailto:notifications@github.com] Sent: October 7, 2015 12:05 AM To: kriswiner/MPU-9250 Cc: Kris Winer Subject: Re: [MPU-9250] Madgwick-Filter-ODR / Filtered-Magnetometer-Data (#23)

Im sorry that I caused this much confusion...

Already thought about getting myself a teensy 3.2-board where I can attach one of my MPU9250 to, which then allows me to run your scetches MPU9250BasicAHRS.ino or MPU9250BasicAHRS_t3.ino entirely unchanged (hopefully). Just to get some kinda similar baseline or reference!

In general I felt that my approach wasnt too bad so far, since roll and pitch behaved pretty nicely just now the yaw...

Before I can draw any more conclusions or ask the right questions I got to improve my knowledge on basic sensor-functionality too, since right now I couldnt say in detail which sensor takes what part in actually getting to euler angles!

Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/23#issuecomment-146097009 . https://github.com/notifications/beacon/AGY1ql0uwb2lphgVZ7YB7xqZP4NHBeb9ks5 o5LuFgaJpZM4GIc1_.gif