[ODE] Naive Pitch/Roll/Yaw rotation questions
charlie.garrett at gmail.com
Tue Mar 15 15:45:36 MST 2005
If you have a body-relative vector (your roll axis) and want to
into world coordinates, you want to do a matrix-vector multiply of the
body's orientation matrix and the vector.
z' = R * z
If you want to do this in a low level way, extract the body's rotation
and call dMULTIPLY0_331. But ODE provides the function
which will do this for you.
dBodyVectorToWorld(turtle.body, 0, 0, 1, zPrime);
If you really want to start with your rotation matrix represented as a
you can convert it to a rotation matrix with dQtoR. But for any body,
both the quaternion and rotation matrix representations internally, so
dBodyVectorToWorld will work immediately after you call
On Mar 15, 2005, at 11:08 AM, john rieffel wrote:
> Gabriel's advice was particularly useful. The difficulty with
> "letting the physics take care of it" is that my object is disabled,
> and doesn't interact with the environment other than moving around
> (it's not really an airplane, it's more like a print-head, or LOGO
> turtle, if you must know). I need it to move through discrete
> portions of the space, and to send it roll/pitch/yaw commands.
> Here's what I've got for Yaw:
> // make the local rotation
> dQuaternion localQ;
> //get the global rotation
> const dReal *globalQ = dBodyGetQuaternion(turtle.body);
> dQuaternion newQ;
> //multiply them and set the result as the new body quaternion
> And for pitch, the only change is to the localQ:
> and for roll:
> This seems to work great! Again, thanks gabriel!
> Now - howabout the inverse problem, of sorts: given an object's
> quaternion, how do I find which global axis is currently the object's
> "local" roll axis?
> On Tue, 15 Mar 2005 18:48:48 +0100, Anders Olofsson
> <anders.olofsson at biologigrand.ac> wrote:
>> Let the physics take care of rotation, dont call dBodySetRotation
>> more than to
>> initialize your bodies. Roughly speaking, if you for example want to
>> roll your
>> aircraft add an "up" force on one wing and a "down" force on the other
>> wing. Thats
>> what I do anyway.
>> --Anders Olofsson
>> At 17:25 2005-03-15, john rieffel wrote:
>>> I'm comfortable using dBodySetRotation and dRFromAxisAndAngle in
>>> to rotate bodies in the global reference frame, but I'm stumped about
>>> how to rotate objects relative to their own frame of reference. I'm
>>> sure that it's a simple matter of quaternion arithmetic, but it
>>> me.(kicking myself for never having taken any aero/astro classes, or
>>> graphics classes for that matter).
>>> Imagine, for instance that my body is an airplane - I'd like it be
>>> able to get it to pitch/yaw/roll. To make things even easier, I only
>>> ever want it to pitch/roll/yaw over a 90 degree angle. For
>>> if the object's current roll axis is the "z" axis, and its yaw axis
>>> the "y" axis, then I want a +90 degree yaw to place its roll axis on
>>> the x axis.
>>> ODE mailing list
>>> ODE at q12.org
> ODE mailing list
> ODE at q12.org
More information about the ODE