I'm trying to obtain the relative rotation between two IMU's. In order to verify the quality of the orientation delivered by the IMU (quaternions), I attached both IMUs to a rigid body (bar) but placed in a different orientation. I recording of 1 min data for rotation of the system (2 IMUs attached to the bar) in slow motion. Both IMUs should give the same orientations after aligning their frames or in other words the relative rotation between both should be constant. So, to align the frames, I first take q_start of both (imu1 and 2) in the first 5s when the system was at rest on the table:
q_start1 = mean(Q1(t0->5s));
q_start2 = mean(Q2(t0->5s));
Now in order to express their frames in world frame:
Q1_w = Q1 * Inverse(q_start1);
Q2_w = Q2 * Inverse(q_start2);
And to obtain the relative rotation between them:
Q_relative_w= Inverse(Q1_w) * Q2_w;
But Q_relative was not constant but if I switch the 3rd and – 2nd component of Q2_w that’s mean:
Q2_w = [w,x,y,z] -> Q2_w_new = [w,-y,x,z]
Then I apply:
Q_ relative_w_new = Inverse(Q1_w) * Q2_w_new;
I obtain a relative constant Q_ relative_w_new.
My question: Where is my error in the calculation or if this calibration makes sense at all? If not how can I otherwise align the frames?