[ODE] quat to eulerXYZ

SJS ode at pulsecode.net
Sat Jun 25 13:30:07 MST 2005


Euler angles aren't really used for angular velocity-- interpolating
linearly using euler angles won't necessarily (or usually, basically almost
never) give you the desired (shortest) path of rotation, and the numbers
become a bit arbitrary around the poles.  You instead just use an angular
velocity vector (rotation is around that vector, and the magnitude of the
vector represents the speed of rotation).

What you probably want is:
eulers at time A and B -> quats at time A and B -> "delta quat" (qB * ~qA)
-> axis-angle of delta quat (angle is scalar angular velocity around axis)

the vector form of the instantaneous velocity is (axis*angle) of that
axis-angle extracted from the delta quaternion.

If you need to convert the vector-form angular velocity from one coordinate
system to another, just rotate it using the matrix that rotates the axes of
the coordinate system 0 to coordinate system 1... a matrix of all
ones, -ones, and zeroes (if you're just swapping axes and signs of axis).

SJS

-------------------------
Stephen Schlueter
sschluet at alum.mit.edu
-------------------------

-----Original Message-----
From: ode-bounces at q12.org [mailto:ode-bounces at q12.org]On Behalf Of
Patrick Enoch
Sent: Saturday, June 25, 2005 12:35 PM
To: ode at q12.org
Subject: Re: [ODE] quat to eulerXYZ


So its impossible to convert the angular vel from one euler to the
other?
or maybe someone has a patch so i can give the ang. vel. in quats?

Patrick


On 25. Jun 2005, at 18:11 Uhr, Bill Sellers wrote:


> Dear Patrick,
>
> You've just hit on the reason why most people don't use Euler
> coordinates any more - they are discontinous so a 3D angle that is
> very close to another 3D angle can have a very different Euler
> coordinate. It all happens when one of the angles is close to 90
> degrees. This (as you can imagine) leads to horrible instability
> (and there's a mechanical analogue called gimbal lock if you are at
> all interested). Matrix representations are similarly (but not as
> catastrophically) unhelpful but Quaternions are nicely well behaved
> (except for the bit where the negative of a quaternion equals the
> positive).
>
> The joys of 3D rotations.
>
> Cheers
> Bill
>
> On Saturday, June 25, 2005, at 04:04  pm, Patrick Enoch wrote:
>
>
>
>> Hello all,
>>
>>
>> I am having problems with angular velocities. currently i am
>> interfacing ODE to another program which uses eulerZXY.
>> so if i have a body with eulerZXY angular velocity, I need to
>> convert it to ODEs eulerXYZ.
>> i am using quaternions as the interface, which looks like this:
>>
>> prog eulerZXY at time A and B -> quats at time A and B -> ODE
>> eulerXYZ at time A and B
>> (angular velocity is difference between eulers divided by (B-A))
>>
>> BUT:
>> when converting quats -> eulerZXY there are jumps in the
>> conversion. for example:
>>
>> euler ZXY (0,89,0) -> eulerXYZ (89,0,0)  (works fine)
>> euler ZXY (0,91,0) -> eulerXYZ (180,-91,180) (pretty far away from
>> the above)
>> (values as far as i remember. but i think the prob is clear. the
>> difference should be small, but the resulting
>> angular velocity is very big. conversion depends on into which
>> quadrant the rotation points, its an
>> unsteady function. )
>>
>> anyone knows a quat -> euler converter, which i can tell to give
>> me values "near" to another triple?
>>
>>
>> Patrick
>>
>> _______________________________________________
>> ODE mailing list
>> ODE at q12.org
>> http://q12.org/mailman/listinfo/ode
>>
>>
>>
> --
> Dr. Bill Sellers, Editor Primate Eye   Email: W.I.Sellers at lboro.ac.uk
> Department of Human Sciences           Tel:   UK (0) 1509 228228
> Loughborough University                Fax:   UK (0) 1509 223941
> Loughborough LE11 3TU UK               http://mac-huwis.lboro.ac.uk/
> ASL/
>
> Primate Society of Great Britain WWW site http://www.psgb.org/
>
>
>


_______________________________________________
ODE mailing list
ODE at q12.org
http://q12.org/mailman/listinfo/ode



More information about the ODE mailing list