# How to Standardize Orientation Representation Across Sensors in IMU Networks

I'm working with a system of IMUs where each IMU outputs an orientation quaternion which is then converted into Euler angles. I want to be able to standardize the meaning of the Euler angles across all of the sensors. However, the way the sensors are set up, the $x$-axis (heading) of the sensors are pointing in different directions. So the EulerX (and EulerY) angles from each sensor represent different kinds of movement (one represents what could be considered roll of the body and another pitch of the body). I want to be able to make it so that the EulerX output represents roll of the body on every sensor.

Now this seems doable by just switching the EulerX and EulerY components on the output (i.e. $[1.5, .3, .5]$ -> $[.3, 1.5, .5]$ where [roll, pitch, yaw]) however this seems inelegant and feels like it's missing a true understanding of how quaternions work. So I'm wondering if there's a method for determining the transformation quaternion that I can multiply each sensor by that will satisfy the swapping of the Euler angles laid out above when the quaternion is converted to Euler Angles.

If it helps the sensors are set up so that one sensor is pointing forward on the rigid body (the direction I want) another is set at a $90°$ angle and another is set at a $180°$ angle (with relatively similar pitch and roll values)

Previous Work

I had some success finding a representation of the sensor turned $180°$ by right multiplying the orientation quaternion (q1) by a $180°$ yaw rotation quaternion. This returned the following Euler results: $q1 = [eX, eY, eZ]$ -> $[-eX, -eY, eZ-180°]$

However when I try to do the same for the sensor that is $90°$ off by right multiplying by a quaternion representing a $90°$ rotation. That doesn't work. Clearly there's a lack of understanding I have about what these right hand multiplications represent.

Code

In : quat = np.matrix([0.6094978‌​, -0.757683, 0.05746635, -0.2261116]) print(Calc_Euler(qua‌​t)) Out : [-1.7323621052571858‌​, -0.27608459761902809‌​, -0.38654233181239173‌​]

So these are the Euler Angles I get for the quaternion off the sensor. Now if I apply a right hand 90 degree rotation here's what I get.

In : quat = np.matrix([0.6094978‌​, -0.757683, 0.05746635, -0.2261116]) sensfr = np.matrix([1,0,0,1])‌​/np.linalg.norm([1,0,‌​0,1]) new_q = QuatProd(quat, sensfr) print(Calc_Euler(new‌​_q)) Out : [-2.087188748187, 1.251957112363, -0.9254284237615]

Let IMU $i$ have a quaternion $b_i$ that represents its orientation relative to the body, and let $m_i$ be the orientation that the IMU measures (you haven't said what orientation this is).
Then $m_i b_i$ takes the measured orientation and puts it back in the body frame. You could then compute Euler angles from this, and these angles will correspond to rotations about the body axes.
• So $m_i$ is the sensors orientation relative to a global frame defined by gravity and magnetic north. If i were to apply a rotation like you suggested wouldn't that give me completely different roll and pitch values? When in reality I basically want the roll and pitch values to be swapped and then the yaw value to be degree heading away from magnetic north. I'm basically trying to change the heading of the frame so that the y-axis is now the x-axis and the y-axis is 180 degree from the original x-axis. – thumbtack_5 Aug 15 '16 at 15:29