Forums > Jitter

### IMU Sensor quaternion output to local sensor axis angle

Jan 19 2017 | 7:26 am

Hi,
i use an wireless IMU Sensor (from Yost Labs) to track movements in space.
I am a little bit confused how to calculate from the quaternion output of the sensor the actual angle of the sensor’s axes relative to the calibrated orientation.
i want to work with just the roll, pitch and yaw angles from the sensors point of view, just as if a pilot sits on the sensor and navigates through space…
do i have to deal with the gimbal lock problem in this case?

too many years between now and my 3d-Matrix math lessons…

i am sure there are 3d experts here who deal with these 3d math formulas all day…

many thanks,
joa

Jan 20 2017 | 4:50 pm

Hey, would be interested in this, too!

Feb 17 2017 | 5:20 pm

have a look at this

/*j

euler[0] = atan2( 2.0 * (quaternion[0]*quaternion[1] + quaternion[2]*quaternion[3]), 1.0f – 2.0 * ( quaternion[1]*quaternion[1] + quaternion[2]*quaternion[2] ) );
euler[1] = asin( 2.0 * (quaternion[0]*quaternion[2] – quaternion[3]*quaternion[1]) );
euler[2] = atan2( 2.0 * (quaternion[0]*quaternion[3] + quaternion[1]*quaternion[2]), 1.0f – 2.0 * ( quaternion[2]*quaternion[2] + quaternion[3]*quaternion[3] ) );
euler[2] *= -1.0f;

— Pasted Max Patch, click to expand. —
Viewing 3 posts - 1 through 3 (of 3 total)

Forums > Jitter