About drivers values scale

I have a questions about output values for drivers MPU9250 and LSM9DS1.
Accelerometers values in both sensors is multipliers of g.
Gyroscopes values in both sensors is dps. But in drivers values conver to rps (why?).
But magnetometers is differ in these sensors. For MPU9250 values is µT and for LSM9DS1 is gauss.
In driver MPU9250:
_mx = bit_data[0] * magnetometer_ASA[0];
where magnetometer_ASA
magnetometer_ASA[i] = ((data - 128) / 256 + 1) * Magnetometer_Sensitivity_Scale_Factor;
Ok. We have a value.
But in driver LSM9DS1:
_mx = 100.0 * ((float)bit_data[0] * mag_scale);
What is the meaning of the multiplier 100.0? By ((float)bit_data[0] * mag_scale) we have a right value or no? This sensor have a gauss unit.
µT = 1e-6 T = 1e-2 Gs, if LSM9DS1 sensor had a unit of measurement for the µT, then it would be obvious. But this sensor have a gauss unit… Is this issue in driver?

Thank you in advance for your help.



Thank you for reporting the slight inconsistency. We’ll see what we can do.

As far as I remember we just made the drivers output the same units in order to make other examples (namely, AHRS) to work without being modified. At the time the code was written the ArduPilot project that is a definitive reference in this kind of work only started standardizing the units (prior to that it had just used the raw units of the HMC5883L as a reference units). So there can be some inconsistency. They were just made to output the same units. It’s actually almost irrelevant what to use (as long as they are the same) because most of the calculations are made on vectors/quaternions.

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.