4
$\begingroup$

I have a sensor (3 axis gyroscope) which can rotate and measure angular velocity in 3 dimensions (aligned with the sensor). I know what its current orientation is with respect to the world frame. Call this quaternion qs. I take a reading from my gyroscope and integrate it to give me a rotation in the sensor frame. Call this quaternion qr.

I now want to apply the rotation qr to the current orientation qs to obtain the new orientation, qs'. But I cannot use qr directly as it describes a rotation in the sensor body frame.

I need to transform my rotation quaternion into the world frame, and then I could just apply it to the orientation i.e. qs' = qs * qr_world. But I am really struggling to understand how I can perform this transformation qr -> qr_world.

Does this even make sense? I wonder if I have fundamentally misunderstood some concepts here. If it does make sense, then I am specifically interested in understanding how to do this using quaternion operations (if that is possible) rather than rotation matrices or euler angles.

$\endgroup$
4
  • $\begingroup$ What are you confused about? The order of the multiplication? $\endgroup$
    – fibonatic
    Feb 27, 2018 at 5:29
  • $\begingroup$ The transformation of a rotation described in the sensor body frame to a rotation described in the world frame. I have edited my question to try and make this clearer. $\endgroup$ Feb 27, 2018 at 9:32
  • $\begingroup$ This is actually simpler than you may think. Remember, qs and qr are fundamentally different, where the former represents orientation (in reference to the outside world) and the latter represents a mere rotation (without any external reference at all). You can think of qr as the delta to get to qs'. Therefore, there is no need for somehow further translating anything. $\endgroup$
    – Biscuits
    Mar 17, 2018 at 19:08
  • $\begingroup$ After additional reading, I believe that my question was redundant because, as per the comment from @Biscuits, I don't need to do any additional transformations. I.e. my new orientation qs' will be given by qs' = qs * qr The way I am thinking of it now (and I hope that this is correct) is that the orientation quaternion qs already describes the rotation required to move from the world frame to the sensor frame, so the further rotation qr can just be applied directly to that. @Biscuits if you put this in an answer I will accept it. $\endgroup$ Mar 30, 2018 at 15:21

1 Answer 1

3
$\begingroup$

As pointed out in my earlier comment, this is actually simpler than you may think. Remember, $qs$ and $qr$ are fundamentally different, where the former represents orientation (in reference to the outside world) and the latter represents rotation (irrespective of any reference coordinate system).

You're right in saying that you don't need to do any additional transformations and that your new orientation $qs'$ will be given by:

$qs' = qs \times qr$

where;

Example

Let's presume a simple analogy with straight line displacement;

$\delta s = v \times \delta t$

Given an initial position $s$, it can be said that moving at a velocity $v$ for a period of time $t$ sees us ending up at a final position $s'$:

$s' = s + \delta s$

Similarly, presume angular displacement (rotation in one axis);

$\delta \theta = \omega \times \delta t$

Given an initial angular position $\theta$, it can be said that moving at an angular velocity $\omega$ for a period of time $t$ sees us ending up at a final angular position $\theta'$:

$\theta' = \theta + \delta \theta$

Now, presume angular displacement in three-dimensional space (rotation in three axes) that, according to Euler's rotation theorem, is equivalent to a single rotation by a given angle $\theta$ about a fixed axis $\hat \omega$;

$qr_w = \cos \dfrac{\theta}{2}$

$qr_x = \omega_x \times \sin \dfrac{\theta}{2}$

$qr_y = \omega_y \times \sin \dfrac{\theta}{2}$

$qr_z = \omega_z \times \sin \dfrac{\theta}{2}$

Given initial three-dimensional angular positions (orientation) $qs$, it can be said that moving at angular velocities $\omega_x$, $\omega_y$ and $\omega_z$ for a period of time $t$ sees us ending up at final three-dimensional angular positions (orientation) $qs'$:

$qs' = qs \times qr$

Therefore, as straight line displacement $\delta s$ can be accumulated to track the position along a straight line $s$, so can angular displacements about three axes (or, rather, their single equivalent angular displacement about the Euler axis $qr$) be accumulated to track angular position in three-dimensional space (orientation) $qs$.

$\endgroup$
2
  • $\begingroup$ For reference, you can look at this C# implementation for an AHRS. Specifically pay attention to how GroundOrientation is continually calculated by applying Rotation. $\endgroup$
    – Biscuits
    Mar 30, 2018 at 16:18
  • $\begingroup$ In your example, you are using the relative angular velocities (wx, wy, wz) in the 3 axes to scale the vector part of the quaternion - is that correct? But if you are considering three separate rotations (and rotation axes) then what rotation does theta relate to? I am slightly confused about this additional information but this may just require more study on my part. $\endgroup$ Apr 5, 2018 at 21:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.