I am unable to find any information on how to interpret the values from the IMU, can you please offer a detailed explanation and perhaps information (data sheet) on the specific hardware unit in the mini lx?
G, degs/sec, etc.
As we know from the docs we have:
pFrameData->accelerometerPresent - Flag for check if a MPU sensor is available.
pFrameData->accelData[0,1,2] - Array containing the accelerometer data (x,y,z)
pFrameData->gyroData[0,1,2] - Array containing the gyroscope data (x,y,z)
pFrameData->tempData - Float with the temperature data (0.0C)
First its good to allow for up to 100 frames to pass before using the IMU data as it takes time to initialize.
Accessing the data is rather straight forward and can be put into a standard Vector3D structure.
Vector3D(pFrameData->accelData, pFrameData->accelData, pFrameData->accelData
Vector3D(pFrameData->gyroData - gyroOffsetX, pFrameData->gyroData - gyroOffsetY, pFrameData->gyroData - gyroOffsetZ)
Next set up some vars to keep track of the timeDelta:
static float prevTime = 0;
float timeNow = pFrameData->timeStamp / 10000.0f;
float deltaTime = timeNow - prevTime;
prevTime = timeNow;
With these two things in place you can determine angle by fusing the accel and gryoscope data and knowing the time difference. I’ll follow up with a bit more details.