0

I came to a situation on getting Tibia angles from an IMU. The sensor is giving me quaternions and also Euler Angles (order XYZ). I need to know based on a reference plane, the Z angle on plane XZ (Directing z up)

My protocol is to get the person standing and get a calibrated quaternion from that position and then when the person walks I still need to know that angle based like if the sensor was still positioning that plane.

I came into an interesting paper that explains exactly my problem and application on equation 6.

For my understanding, I need to get a DCM matrix out of each measurement quaternion and then apply the directional unit vector from euler angles during calibration and apply to that matrix, then apply atan of division of component X and Z of the result of that multiplication.

Based on that my steps are:

1 - Get calibrated quaternion Q1 and calculate directional vector of my Euler angles. 2 - As the sensor measures, I take the Directional Cosine Matrix of Q1 apply to the calibrated direction vector my coordinate transformation 3 - calculate the Atan of components X and Z of that directional vector on sensor coordinate system.

However, I am getting different results and I am not understanding what is that equation really doing.

ds16
  • 3
  • 1
  • 3
  • Look here https://stackoverflow.com/questions/3684269/component-of-a-quaternion-rotation-around-an-axis/22401169#22401169 – minorlogic Jan 14 '19 at 08:48
  • Thanks for the help, @minorlogic I notive I am not looking for twist angle but the angle of my vector on plane XZ. That solution helped me a bit. – ds16 Jan 14 '19 at 13:59

1 Answers1

1

You are not looking for the twist angle but unit vectors on the quaternion coordinate system.

  1. Take your calibrated roll, pitch and Yaw and save it as a unit vector (be aware that there are 12 ways to do this conversion and you might look at this link). If you say that its XYZ order then get this:

    • Mx[0,0] = Cosy * Cosz;
    • Mx[0,1] = -Cosy * Sinz;
    • Mx[0,2] = Siny;
    • Mx[1,0] = Cosz * Sinx * Siny + Cosx * Sinz;
    • Mx[1,1] = Cosx * Cosz - Sinx * Siny * Sinz;
    • Mx[1,2] = -Cosy * Sinx;
    • Mx[2,0] = -Cosx * Cosz * Siny + Sinx * Sinz;
    • Mx[2,1] = Cosz * Sinx + Cosx * Siny * Sinz;
    • Mx[2,2] = Cosx * Cosy;
  2. Convert each quaternion of that same sensor into a DCM matrix

  3. Multiply the direction vector into each DCM matrix
  4. Now you have unit vector in all directions. In order to get angles you can get the Acos of the dot product of those vectors or calculate Atan(Dcmx/Dcmx) like the paper you shared