[ODE] Determining relative orientation and angular velocity

SJS ode at pulsecode.net
Sun Jun 26 14:16:31 MST 2005

If you already know how to convert quat->euler, then all you have to do is
transform your quaternion to the frame of the reference orientation and then
do your quat->euler procedure on the resulting quaternion.

For an angular velocity vector, just perform the transform on the vector
(just a rotation).

e.g. if you have a quaternion q0 and velocity vector v0 in the world frame
and you want to know their values relative to some ODE object, get the
quaternion of the ODE object (I'll call it qR), and then

q1 = q0*(qR^-1)

and to transform v0 you can use a quat. transform (v1 = vector part of
qR*quat<v0, 0.0>*~qR) or just convert qR to matrix form (mR) and do

v1 = v0*(mR^-1) [or (mR^-1)*v0 if you're using column-vector notation]

(qR represents a transform for taking things in the local frame of the
object and converting them to the world frame, so its inverse transforms
things from world frame to the object's local frame)

If you're more comfortable with matrices, you can just convert the
quaternions to matrices and all of the same operations still apply.
[Note, however, that quaternion multiplication is typically notated and
implemented to be consistent with matrices that multiply with column
vectors, which is the opposite order as D3D-style matrix operations (which
use row vectors).  So if you're using row vectors with D3D-style matrices,
use m1 = (mR^-1)*m0 for the case above.]


Stephen Schlueter
sschluet at alum.mit.edu

-----Original Message-----
From: ode-bounces at q12.org [mailto:ode-bounces at q12.org]On Behalf Of
Marcus Brubaker
Sent: Sunday, June 26, 2005 11:43 AM
To: ode at q12.org
Subject: [ODE] Determining relative orientation and angular velocity


I'm trying to determine the orientation and angular velocity of an
object relative to a reference orientation.  Specifically, I'm need to
calculate the Euler angles (and their time derivatives) but instead of
relative to the canonical orientation, relative to some specificied base
orientation.  I know how to compute the regular Euler angles from a
quaternion so I guess it's just a matter of getting the right quaternion
and its time derivative.  Anyone have any suggestions?  Thanks.

ODE mailing list
ODE at q12.org

More information about the ODE mailing list