Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register


converting count units from sensors


Total Posts: 9

Joined 2018-02-28


Using the FITtoCSV.bat file in the SDK I obtained the csv from the fit file.
In the csv the accelerometer, gyro and magnetometer data are given in counts and need to be converted in a (physically) meaningfull unit before one can use them.

At page 43, section 6.3 of the document Flexible and Interoperable Data Transfer Protocol Rev 2.3 provided in the SDK package, there is an equation that should be used to convert count to an understandable unit of measure.
However I don't understand what should I do with the matrix... like, should I calculate the determinat of the matrix at samo point? what do I need to divide by the calibration_factor exactely?

I'm no mathematician and I don't know java (so any answer like "use the java plugin" is useless to me).

Any suggestion is welcome!


Total Posts: 67

Joined 0


The first thing to do is calculate the input vector by performing the subtraction operations and multiplying each element by the CalFactor. After calculating the input vector, calculate the rotated vector using the process described here: https://www.varsitytutors.com/hotmath/hotmath_help/topics/multiplying-vector-by-a-matrix. The output of the calculation should be a 3 element adjusted vector.

You can take a look at the plugins to see how the SDK performs the adjustment.
Here is the C# SDKs Implementation of the adjustment:
private float[] AdjustSensorData(int[] rawDataCalibrationParameters calParams)
    float[] calibratedValues 
= new float[rawData.Length];
float[] rotatedValues = new float[rawData.Length];

//Apply the calibration parameters
for (int i 0rawData.Lengthi++)
= (float)rawData[i];
calibratedValues[i] -= calParams.LevelShift;
calibratedValues[i] -= calParams.ChannelOffset[i];
calibratedValues[i] *= calParams.CalFactor;
calibratedValues[i] /= calParams.CalDivisor;

// Apply the rotation matrix
    // [Rotation] * [XYZ]
rotatedValues[0] = (calParams.RotationMatrix[00] calibratedValues[0])
        + (
calParams.RotationMatrix[01] calibratedValues[1])
        + (
calParams.RotationMatrix[02] calibratedValues[2]);

rotatedValues[1] = (calParams.RotationMatrix[10] calibratedValues[0])
        + (
calParams.RotationMatrix[11] calibratedValues[1])
        + (
calParams.RotationMatrix[12] calibratedValues[2]);

rotatedValues[2] = (calParams.RotationMatrix[20] calibratedValues[0])
        + (
calParams.RotationMatrix[21] calibratedValues[1])
        + (
calParams.RotationMatrix[22] calibratedValues[2]);


Total Posts: 9

Joined 2018-02-28


Great Thanks!

you made my day!