Given three angular velocities vx
, vy
, vz
about the x
, y
and z
axes, measured in radians per second, as derived from an IMU's rate gyro, how do I produce an equivalent quaternion for the entire rotation between one sample and the next, i.e. the integral of rotation over time dt
between the current sample and the previous sample?
The primary issue is that these three angular velocities are measured independently of each other, and yet rotations are not commutative. This means the order in which the angular velocities are applied during the integration would affect the computed quaternion, just as converting Euler angles to a quaternion produces a different quaternion depending on the order in which the Euler rotations are applied (e.g. x
, then y
, then z
, vs. some other order).
I think the right thing to do is to split the timestep dt
into a number of shorter time period samples, e.g. say N=10
, then divide each velocity by that number, giving vx' = vx/N
, vy' = vy/N
, vz' = vz/N
, and then applying the rotations N
times in round robin fashion, in largest to smallest order, calculating the actual rotation over the interval dt/N
in each case, and accumulating this into the final rotation quaternion.
I see a lot of references to quaternion derivatives when related questions are asked though, and I wonder if it might be possible to convert the angular velocities (which are derivatives of Euler angles) directly to a quaternion derivative (again though probably suffering from axis ordering sensitivity), then somehow integrate the quaternion derivative to convert back to a quaternion spanning time dt
.
Seems like there should be a "right" way to do this, since every IMU that uses a rate gyro has to solve this problem. Any insights into this would be greatly appreciated!