[ODE] dRFromEulerAngles interpretation

Yefei He yhe at nads-sc.uiowa.edu
Tue Oct 10 15:02:25 MST 2006


Ciao, Mauro, 

    What I ended up doing was changing the code inside 
dRFromEulerAngles(), changing every line of 
    _R(i, j) = *** 
to 
    _R(j, i) = ***

    I did it on my local copy of ode 0.5. I haven't checked 
out the latest version of ode so I don't know if anything 
has been changed since then. I made the change over a year 
ago and I can't remember clearly my motive of doing this 
instead of negating the angles. I think it's because I felt 
this was a bug in the function. Negating the angles and 
reinterpreting the meaning of phi, theta and psi was a hack, 
while change the order of the matrix was the correct way to 
fix the bug. in 0.5 this fuction is not called anywhere else 
inside ode, so it's a safe change.  

    Yefei 

> -----Original Message-----
> From: ode-bounces at q12.org [mailto:ode-bounces at q12.org] On
> Behalf Of Jon Watte (ODE)
> Sent: Tuesday, October 10, 2006 12:41 PM
> To: Mauro G. Todeschini
> Cc: ode at q12.org
> Subject: Re: [ODE] dRFromEulerAngles interpretation
> 
> 
> Maybe the error of the order is attempting to cancel out the error of
> the rotation direction?
> 
> I've never used the function, and I'm not sure whether ODE does
> internally. If ODE uses it internally, then I would be very careful 
> about trying to change it. If it's just a convenience, then 
> there's some 
> chance that not many people use it, and it's just slipped through the 
> cracks.
> 
> Cheers,
> 
>           / h+
> 
> Mauro G. Todeschini wrote:
> > Hi,
> > 	I looked at the ODE's code just to understand something
> of the way It
> > works but I encoutered the same problem Yefei He pointed out over a
> > year ago. In my emails of last week I thought I wasn't 
> understanding
> > row-major, column-major issues... but after reading more code and
> > experimenting I think the problem is in the function 
> > dRFromEulerAngles. To my understanding dRFromEulerAngles applies a 
> > rotation about Z axis followed by a rotation about Y axis 
> followed by
> > a rotation about X axis. The order of the rotations to be onest is
> > uncommon (or at least It is not a standard) and I think It 
> would be a
> > good idea to point It out in the documentation. But I don't
> understand
> > why the rotations are clockwise (I'm considering a right-hand
> > reference system, row-major matrixes and column vector on 
> the right).
> > In this case rotation are usually conterclockwise in
> letterature and
> > even inside ODE dRFromAxisAndAngle seems to follow counterclockwise
> > rotations. Anyone knows the reason of clockwise rotations in 
> > dRFromEulerAngles? Is It a bug or a feature? :D
> >
> > Bye
> >
> > Yefei He wrote:
> >   
> >> Hi,
> >>
> >>     I think Left handed rule explains my problem. So this means a
> >> positive
> >> angle rotates the object clockwise since rotation is in a 
> left-handed
> >> coordinate system. My problem is then, how are the angles
> in the function
> >> dRFromEulerAngles( R, phi, theta, psi ) interpreted? I use
> it to set the
> >> rotation angles. I did a comparison of this to
> dRFromAxisAngle( R, ax, ay,
> >> az, angle ). And I noticed the differences in the rotation
> matrix that
> >> they generate:
> >>
> >>     dRFromEulerAngles( R, a, 0, 0 ) 
> >>     1       0       0
> >>     0    cos(a)  sin(a)
> >>     0   -sin(a)  cos(a)
> >>
> >>     dRFromEulerAngles( R, 0, a, 0 )
> >>  cos(a)     0   -sin(a)
> >>     0       1       0
> >>  sin(a)     0    cos(a)
> >>
> >>     dRFromEulerAngles( R, 0, 0, a )
> >>  cos(a)  sin(a)     0
> >> -sin(a)  cos(a)     0
> >>     0       0       1
> >>
> >> and
> >>     dRFromAxisAngle( R, 1, 0, 0, a )
> >>     1       0       0
> >>     0    cos(a) -sin(a)
> >>     0    sin(a)  cos(a)
> >>
> >>     dRFromAxisAngle( R, 0, 1, 0, a )
> >>  cos(a)     0    sin(a)
> >>     0       1       0
> >> -sin(a)     0    cos(a)
> >>
> >>     dRFromAxisAngle( R, 0, 0, 1, a )
> >>  cos(a) -sin(a)     0
> >>  sin(a)  cos(a)     0
> >>     0       0       1
> >>
> >>     That means Euler angles need to be negated to match
> the results
> >> of
> >> rotation around x, y, or z axis. The discrepancy between
> Euler angles
> >> and angular velocity is the same. My next question is
> then, is there a
> >> reason why Euler angles are interpreted this way in ODE? I thought
> >> in the left-handed system, A positive Euler angle would 
> also mean a
> >> clockwise rotation around axis?
> >>
> >>     Yefei
> >>     
> > _______________________________________________
> > ODE mailing list
> > ODE at q12.org
> > http://q12.org/mailman/listinfo/ode
> >
> >
> >   
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
> 



More information about the ODE mailing list