Hi all,
My project is using the ICM-20648 chip and I set it up for DMP output (32-bit 6-axis quaternion).
The data are then converted to Euler angles to calculate yaw, pitch and roll:
yaw = atan2(2.0*(q.y*q.z + q.w*q.x), q.w*q.w - q.x*q.x - q.y*q.y + q.z*q.z);
pitch = asin(-2.0*(q.x*q.z - q.w*q.y));
roll = atan2(2.0*(q.x*q.y + q.w*q.z), q.w*q.w + q.x*q.x - q.y*q.y - q.z*q.z);
"q.w" is calculated from q.w*q.w + q.x*q.x + q.y*q.y + q.z*q.z = 1
The chip is installed on the device that is parallel to a flat surface. When it is in that position, the pitch angle reads 0 degrees which is correct. The angle changes correctly as I tilt the device to the left and right.
The problem arises when I tilt the device to more than 90 degrees in the current axis or to any angle in the other two axes. The pitch angle then are permanently shifted by up to 30 degrees.
Has anyone experienced this issue?