IMU Sensor quaternion output to local sensor axis angle


    Jan 19 2017 | 3:26 pm
    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 21 2017 | 12:50 am
      Hey, would be interested in this, too!
    • Feb 18 2017 | 1:16 am
      have a look at this
      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;
      cheers
      /*j
    • Feb 18 2017 | 1:20 am
      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;