Finding angles from an IMU (Quaternions to Eulers) Greetings and apologies if this has already been answered, but I haven't been able to get a clear answer from looking on Stack Exchange so-far.
I have Quaternions coming from two different IMU's located on the trunk and the back of the head, in order to describe relative rotations between both.
Of course if I would make use of the Euler transform for each of the IMU´s (and subtract to find the relative angles), gimbal locks manifest. But we SHOULDN'T have that problem if we were to represent the relative angles (which is the case, because the aim of this is to show an angular representation that a physiotherapist can understand), because relatives are quite small angles, and probably won't go near +-90.
So what I have in mind is taking the quaternion Q1 that represents the trunk IMU and the quaternion Q2 that represents the head, find the quaternion that rotates Q1 into Q2 (let´s call it Qr) and transform THAT ONE into Eulers.
And it... works. But for some reason I have a "crosstalk" between the pitch and the roll, meaning that they are NOT independent between them.
Is this procedure flawed? What would be a better approach to this?
 A: Actually, I'm having kind of the same problem at the moment (and am still trying to figure out a definitive solution), but I'll try to help out with what I know nevertheless:
From my understanding of quaternion math (which admittedly isn't flawless), your approach is generally a good idea. There may be a few issues with your technical set-up, though:


*

*Your IMUs may use different device-relative coordinate systems if they are from different manufacturers (or potentially even different models from the same manufacturer). Check the respective data sheets for info on this and potentially correct your coordinate systems accordingly - be especially wary of handedness changes.

*Similarly, both IMUs may use different reference orientations (e.g. to the magnetic north or south), which may also need correction.

*Depending on where your IMUs are mounted, surrounding magnetic fields may influence the measurements of the reference direction, i.e. even though both IMUs may reference the magnetic north, due to electromagnetic fields nearby one of them may think north is in some other direction than where the other IMU thinks it is. Therefore, try not to place your IMUs too closely to microchips or magnets.


In general, however, those are technical issues, not necessarily fundamentally mathematical ones, which is why I think that your question may be a bit misplaced on the math StackExchange, and should rather go under Robotics, Signal Processing, or good ol' general StackOverflow (I would have preferred to write this as a comment, but alas, my score around here is still too low)
