View Full Version : Re: Euler Angle Calculation

Ton Van Den Bogert
08-19-1998, 04:46 AM
Dear all,

I post this to Biomch-L since there may be some information
of general interest in this reply.

Dong CHEN wrote:
> In my experiment, the global coordinations of four markers sticking on the
> back of the human body were sampled and stored in a computer while the
> object was walking on a treadmill. My task is to calculate the change of
> the Euler Angles in this procedure according to the global coordinations of
> the four markers.
> It is a over-determined problem. Because the error of the rigid body
> assumption on the human body and error in the data collection, this
> over-determined problem has no solutions !

The overdetermined data will allow you to find a least-squares
solution. On the ISB web site, you can find several algorithms
to do this either in Matlab or Fortran. Look under
"Movement Analysis" in http://www.lri.ccf.org/isb/software/
Least squares solutions are better because they are less sensitive
to errors in a single marker. And the more markers the better.

Input is marker coordinates in a segment-fixed coordinate system
and coordinates of the same markers in a laboratory coordinate
system. Output is a rotation matrix and translation vector
relating the two coordinate systems. Then you can extract Euler
angles from the rotation matrix. First you must define the
sequence of rotations and symbolically derive the equations for
all matrix elements in terms of the Euler angles you have chosen.
This is tedious, and below I have appended a Mathematica script
to automate this for the XYZ sequence, but the script is easily
modified for other sequences. After doing this,
you can derive simple expressions to compute Euler angles from
the matrix elements. Matlab routines for this can be found in
http://www.lri.ccf.org/isb/software/kinemat/ but before using those
take some time to make sure that you understand which Euler system
you are using.

Let R be defined as the rotation matrix relating the segment
coordinates to the laboratory coordinates of markers on a rigid

poslab = R*posseg + translation

Then an Euler decomposition

R = Rx*Ry*Rz

means that the rotation is decomposed into rotations about the
Z-axis of the segment reference frame, the X-axis of the laboratory
reference frame, and a third ("Y") rotation about the mutual perpendicular axis.
This interpretation may help you choose a suitable Euler sequence.
To extract Euler angles from matrix elements, use the ATAN2 function
(Matlab or Fortran) as much as possible, because this gives you
a range of -180 to +180 degrees, as opposed to -90 to +90 for
ASIN or ACOS. This was not done in the Kinemat package, so this
is something you can improve upon.

For whole body orientation relative to the laboratory reference
frame, there is an ISB standardization proposal by M.R. Yeadon:


This defines the Euler angles "somersault", "tilt", and "twist",
which is consistent with existing terminology used in sport.
I suggest that you use this Euler system for describing upper
body rotations.


Ton van den Bogert
Dept. of Biomedical Engineering
Cleveland Clinic Foundation

Appendix: Mathematica script for generating symbolic rotation matrices
from Euler angles.

================================================== ===========================

SetOptions[$Output, PageWidth -> Infinity]
(* Print[ Options[$Output] ] *)

Rx = { { 1, 0, 0},
{ 0, Cos[a], -Sin[a]},
{ 0, Sin[a], Cos[a]}

Ry = { { Cos[b], 0, Sin[b] },
{ 0, 1, 0},
{ -Sin[b], 0, Cos[b]}

Rz = { { Cos[c], -Sin[c], 0},
{ Sin[c], Cos[c], 0},
{ 0, 0, 1}

Rxyz = Rx . Ry . Rz
Print[ MatrixForm[Rxyz] ]
Print[ TeXForm[Rxyz] ]

To unsubscribe send UNSUBSCRIBE BIOMCH-L to LISTSERV@nic.surfnet.nl
For information and archives: http://www.bme.ccf.org/isb/biomch-l