Weixin Shen

10-27-1999, 02:50 AM

Dear all,

Recently I posted a message regarding the calculation of euler

angles in "Dynamics of Human Gait". Thanks Dr. Vaughan for the

discusses on it. Also thank many Biomch-Lers for information and

suggestions. As requested by a number of people for a summary

of the discussion, I am attaching the E-mails of Dr. Vaughan

and mine at the end of the mail.

I also noticed quite a few mails regarding 3D rotation calculation

on Biomech-L. Cynically, although rotational kinematics is a simple

problem and was well studied many years ago, it is not an easy job

to find the concise and programmable formulations -- at least that

was what I felt when I started working in this area a few months ago.

Therefore, I am thinking putting toghther the formulations I collected

and derived and post it on Biomech-L, hopefully, as early as next

week.

Regards,

==

Weixin Shen, Ph.D., Senior Scientist

Science and Engineering Technology Division

JAYCOR, Inc

9775 Towne Center Drive

San Diego, Ca 92121

Tel: (858) 552-3508

Fax: (858) 552-9172

E-mail: wshen@jaycor.com

ATTACHED MESSAGES,

-----Original Message-----

From: Weixin Shen

To: BIOMCH-L@NIC.SURFNET.NL

Date: Monday, October 25, 1999 6:41 PM

Subject: Euler angle calculation in Vaughan's book

>Dear All,

>

>I have a question regarding the formulations to calculate euler

>angles in the book "Dynamics of Human Gait" (by C.L. Vaughan,

>B.L. Davis and J.C O'Connor).

>

>Recently, I wrote some matlab programs as a solver for inverse

>and forword dynamics problems. I used the model decribed in

>the above book as a test problem. The software GaitLab was

>downloaded from the ISB web site. The kinematic reconstruction and

>data filtering were exactly the same. However, the results are

>different for segment angular velocity, and thus angular acceleration,

>and joint forces and torques.

>

>I tried various conventions to represent segment rotation, including

>rotational matrix, ZXZ euler angles, ZYX euler angles and euler

>parameters. They all lead to the same angular velocity, which is

>a function of euler angles (or euler parameters) and their

>time derivatives.

>

>The formulations in the book (B.72, B.73, B.74) calculate euler

>angles using 'arcsin' function. This is where I am not sure if

>they are correct. By default (say in ZXZ convention), the range of

>three euler angles should be [0 2*pi], [0, pi] and [0 2*pi]

>respectively (without considering tumbling motion). The angle

>calculated from arcsin is limited between [-pi/2 pi/2] or

>[0 pi] depending on the convention. Therefore, I think the

>euler angles calculated from GaitLab are not correct.

>

>Since I am new to the biomechanical area, I would appreciate if

>someone can provide me the corresponding address of the authors

>of the book. I will also appreciate any thoughts and suggestions

>on the matter. Thanks!

-----Original Message-----

From: Kit Vaughan

To: wshen@jaycor.com

Cc: KVAUGHAN@anat.uct.ac.za ; davis@bme.ri.ccf.org

Date: Tuesday, October 26, 1999 12:35 AM

Subject: Re: Euler angle calculation in Vaughan's book

Dear Weixin

Further to your posting, you are correct in saying that the segnmental

angular velocities, derived from the Euler angles, are incorrect in the

GaitLab that's on the ISB web-site. The problem is indeed related to

the general form which we used:

Euler angle = arcsin[(a x b) dot c]

However, we have solved the problem in the next version of GaitLab by

using an algorithm that looks something like this (quasi C code):

/* compute angle based on standard formula */

sin_ang = (a x b) dot c;

if (sin_ang < -1) sin_ang = -1;

if (sin_ang > 1) sin_ang = 1;

ang = asin(sin_ang);

/* compensate for symmetry of (a x b) about +/- pi radians */

cos_ab = a dot b;

if (cos_ab , 0) ang = pi - ang;

The next version of GaitLab is now available from Kiboho Publishers at:

http://www.kiboho.co.za/GaitCD

I trust the above is helpful.

Kit Vaughan

University of Cape Town

-----Original Message-----

From: Weixin Shen

To: Kit Vaughan

Date: Tuesday, October 26, 1999 10:05 AM

Subject: Re: Euler angle calculation in Vaughan's book

>Dear Professor Vaughan,

>

>Thanks for your response. I will get the new CD and look into the

>results.

>

>Is the program you provide exactly what you implemented in

>the new CD? If it is, I still argue it is not correct.

>

>Fristly, it cannot handle the case when only rotation around

>one axis is involved. For example, let the global frame be

>I = [1 0 0]'; J = [0 1 0]'; K = [0 0 1]'; and rotate the frame

>around the K axis for pi/4. The rotated frame expressed in IJK

>should be i = [0.7071 0.7071 0]; j = [-0.7071 0.7071 0]; and

>k = [0 0 1]. Using the formulations, L = unit(cross(K,k)) = [ 0 0 0]'.

>The line of action is not defined! And therefore the calculated

>euler angles are all zeros -- obviously wrong.

>

>Another point worth mention is how the the tumbling motion

>is considered in the formulations. For phi and psi, I guess

>a 2pi range of motion might be enough -- we don't expect

>any segment to move more than one cycle. However, is [-pi/2 pi/2]

>good enough for theta? (I don't have much background in

>locomotion area, so I just pose the question. Hope it is not

>a silly question). But if theta can go beyond the range. The program

>will not be able to handle the situation. Because exterpolation

>theta beyond the range can not be simply treated by adding

>or substracting pi. It will also affect the value of

>phi and psi.

>

>I wrote my program based on the formulations in the book

>"Robot Manipulators, mathematics, programming and control"

>by R.P. Paul. If you prefer, I can also send my formulations to you.

>

>Thanks for your attention! I look forward to your response,

>

-----Original Message-----

From: Kit Vaughan

To: Weixin Shen

Cc: KVAUGHAN@anat.uct.ac.za ; davis@bme.ri.ccf.org

Date: Tuesday, October 26, 1999 11:48 PM

Subject: Re: Euler angle calculation in Vaughan's book

Dear Weixin

Thanks for your reply. In answer to your questions:

> Is the program you provide exactly what you implemented in

> the new CD? If it is, I still argue it is not correct.

Yes, it is the same, with the modification in my previous note. I must

argue that it is correct! In response to your concern:

> Fristly, it cannot handle the case when only rotation around

> one axis is involved. For example, let the global frame be

> I = [1 0 0]'; J = [0 1 0]'; K = [0 0 1]'; and rotate the frame

> around the K axis for pi/4. The rotated frame expressed in IJK

> should be i = [0.7071 0.7071 0]; j = [-0.7071 0.7071 0]; and

> k = [0 0 1]. Using the formulations, L = unit(cross(K,k)) = [ 0 0 0]'.

> The line of action is not defined! And therefore the calculated

> euler angles are all zeros -- obviously wrong.

Theoretically, you are correct. However, realising this problem, we

have chosen the segmental k vector so that it can never be parallel to

the global K vector. I refer you here to Figure 3.10 in our book. As

long as k and K are not parallel, then the line of nodes can be defined

by their cross product.

> Another point worth mention is how the the tumbling motion

> is considered in the formulations. For phi and psi, I guess

> a 2pi range of motion might be enough -- we don't expect

> any segment to move more than one cycle. However, is [-pi/2 pi/2]

> good enough for theta? (I don't have much background in

> locomotion area, so I just pose the question. Hope it is not

> a silly question). But if theta can go beyond the range. The program

> will not be able to handle the situation. Because exterpolation

> theta beyond the range can not be simply treated by adding

> or substracting pi. It will also affect the value of

> phi and psi.

I did not provide the quasi-code in my previous note, but it is

certainly feasible to monitor the Euler angle over time to ensure that

no discontinuities occur. This is not a problem for walking but is

clearly relevant for somersaulting motion.

> I wrote my program based on the formulations in the book

> "Robot Manipulators, mathematics, programming and control"

> by R.P. Paul. If you prefer, I can also send my formulations to you.

Thanks for the offer but at this stage I am snowed under with other

projects!

Regards

Kit

---------------------------------------------------------------

To unsubscribe send SIGNOFF BIOMCH-L to LISTSERV@nic.surfnet.nl

For information and archives: http://isb.ri.ccf.org/biomch-l

---------------------------------------------------------------

Recently I posted a message regarding the calculation of euler

angles in "Dynamics of Human Gait". Thanks Dr. Vaughan for the

discusses on it. Also thank many Biomch-Lers for information and

suggestions. As requested by a number of people for a summary

of the discussion, I am attaching the E-mails of Dr. Vaughan

and mine at the end of the mail.

I also noticed quite a few mails regarding 3D rotation calculation

on Biomech-L. Cynically, although rotational kinematics is a simple

problem and was well studied many years ago, it is not an easy job

to find the concise and programmable formulations -- at least that

was what I felt when I started working in this area a few months ago.

Therefore, I am thinking putting toghther the formulations I collected

and derived and post it on Biomech-L, hopefully, as early as next

week.

Regards,

==

Weixin Shen, Ph.D., Senior Scientist

Science and Engineering Technology Division

JAYCOR, Inc

9775 Towne Center Drive

San Diego, Ca 92121

Tel: (858) 552-3508

Fax: (858) 552-9172

E-mail: wshen@jaycor.com

ATTACHED MESSAGES,

-----Original Message-----

From: Weixin Shen

To: BIOMCH-L@NIC.SURFNET.NL

Date: Monday, October 25, 1999 6:41 PM

Subject: Euler angle calculation in Vaughan's book

>Dear All,

>

>I have a question regarding the formulations to calculate euler

>angles in the book "Dynamics of Human Gait" (by C.L. Vaughan,

>B.L. Davis and J.C O'Connor).

>

>Recently, I wrote some matlab programs as a solver for inverse

>and forword dynamics problems. I used the model decribed in

>the above book as a test problem. The software GaitLab was

>downloaded from the ISB web site. The kinematic reconstruction and

>data filtering were exactly the same. However, the results are

>different for segment angular velocity, and thus angular acceleration,

>and joint forces and torques.

>

>I tried various conventions to represent segment rotation, including

>rotational matrix, ZXZ euler angles, ZYX euler angles and euler

>parameters. They all lead to the same angular velocity, which is

>a function of euler angles (or euler parameters) and their

>time derivatives.

>

>The formulations in the book (B.72, B.73, B.74) calculate euler

>angles using 'arcsin' function. This is where I am not sure if

>they are correct. By default (say in ZXZ convention), the range of

>three euler angles should be [0 2*pi], [0, pi] and [0 2*pi]

>respectively (without considering tumbling motion). The angle

>calculated from arcsin is limited between [-pi/2 pi/2] or

>[0 pi] depending on the convention. Therefore, I think the

>euler angles calculated from GaitLab are not correct.

>

>Since I am new to the biomechanical area, I would appreciate if

>someone can provide me the corresponding address of the authors

>of the book. I will also appreciate any thoughts and suggestions

>on the matter. Thanks!

-----Original Message-----

From: Kit Vaughan

To: wshen@jaycor.com

Cc: KVAUGHAN@anat.uct.ac.za ; davis@bme.ri.ccf.org

Date: Tuesday, October 26, 1999 12:35 AM

Subject: Re: Euler angle calculation in Vaughan's book

Dear Weixin

Further to your posting, you are correct in saying that the segnmental

angular velocities, derived from the Euler angles, are incorrect in the

GaitLab that's on the ISB web-site. The problem is indeed related to

the general form which we used:

Euler angle = arcsin[(a x b) dot c]

However, we have solved the problem in the next version of GaitLab by

using an algorithm that looks something like this (quasi C code):

/* compute angle based on standard formula */

sin_ang = (a x b) dot c;

if (sin_ang < -1) sin_ang = -1;

if (sin_ang > 1) sin_ang = 1;

ang = asin(sin_ang);

/* compensate for symmetry of (a x b) about +/- pi radians */

cos_ab = a dot b;

if (cos_ab , 0) ang = pi - ang;

The next version of GaitLab is now available from Kiboho Publishers at:

http://www.kiboho.co.za/GaitCD

I trust the above is helpful.

Kit Vaughan

University of Cape Town

-----Original Message-----

From: Weixin Shen

To: Kit Vaughan

Date: Tuesday, October 26, 1999 10:05 AM

Subject: Re: Euler angle calculation in Vaughan's book

>Dear Professor Vaughan,

>

>Thanks for your response. I will get the new CD and look into the

>results.

>

>Is the program you provide exactly what you implemented in

>the new CD? If it is, I still argue it is not correct.

>

>Fristly, it cannot handle the case when only rotation around

>one axis is involved. For example, let the global frame be

>I = [1 0 0]'; J = [0 1 0]'; K = [0 0 1]'; and rotate the frame

>around the K axis for pi/4. The rotated frame expressed in IJK

>should be i = [0.7071 0.7071 0]; j = [-0.7071 0.7071 0]; and

>k = [0 0 1]. Using the formulations, L = unit(cross(K,k)) = [ 0 0 0]'.

>The line of action is not defined! And therefore the calculated

>euler angles are all zeros -- obviously wrong.

>

>Another point worth mention is how the the tumbling motion

>is considered in the formulations. For phi and psi, I guess

>a 2pi range of motion might be enough -- we don't expect

>any segment to move more than one cycle. However, is [-pi/2 pi/2]

>good enough for theta? (I don't have much background in

>locomotion area, so I just pose the question. Hope it is not

>a silly question). But if theta can go beyond the range. The program

>will not be able to handle the situation. Because exterpolation

>theta beyond the range can not be simply treated by adding

>or substracting pi. It will also affect the value of

>phi and psi.

>

>I wrote my program based on the formulations in the book

>"Robot Manipulators, mathematics, programming and control"

>by R.P. Paul. If you prefer, I can also send my formulations to you.

>

>Thanks for your attention! I look forward to your response,

>

-----Original Message-----

From: Kit Vaughan

To: Weixin Shen

Cc: KVAUGHAN@anat.uct.ac.za ; davis@bme.ri.ccf.org

Date: Tuesday, October 26, 1999 11:48 PM

Subject: Re: Euler angle calculation in Vaughan's book

Dear Weixin

Thanks for your reply. In answer to your questions:

> Is the program you provide exactly what you implemented in

> the new CD? If it is, I still argue it is not correct.

Yes, it is the same, with the modification in my previous note. I must

argue that it is correct! In response to your concern:

> Fristly, it cannot handle the case when only rotation around

> one axis is involved. For example, let the global frame be

> I = [1 0 0]'; J = [0 1 0]'; K = [0 0 1]'; and rotate the frame

> around the K axis for pi/4. The rotated frame expressed in IJK

> should be i = [0.7071 0.7071 0]; j = [-0.7071 0.7071 0]; and

> k = [0 0 1]. Using the formulations, L = unit(cross(K,k)) = [ 0 0 0]'.

> The line of action is not defined! And therefore the calculated

> euler angles are all zeros -- obviously wrong.

Theoretically, you are correct. However, realising this problem, we

have chosen the segmental k vector so that it can never be parallel to

the global K vector. I refer you here to Figure 3.10 in our book. As

long as k and K are not parallel, then the line of nodes can be defined

by their cross product.

> Another point worth mention is how the the tumbling motion

> is considered in the formulations. For phi and psi, I guess

> a 2pi range of motion might be enough -- we don't expect

> any segment to move more than one cycle. However, is [-pi/2 pi/2]

> good enough for theta? (I don't have much background in

> locomotion area, so I just pose the question. Hope it is not

> a silly question). But if theta can go beyond the range. The program

> will not be able to handle the situation. Because exterpolation

> theta beyond the range can not be simply treated by adding

> or substracting pi. It will also affect the value of

> phi and psi.

I did not provide the quasi-code in my previous note, but it is

certainly feasible to monitor the Euler angle over time to ensure that

no discontinuities occur. This is not a problem for walking but is

clearly relevant for somersaulting motion.

> I wrote my program based on the formulations in the book

> "Robot Manipulators, mathematics, programming and control"

> by R.P. Paul. If you prefer, I can also send my formulations to you.

Thanks for the offer but at this stage I am snowed under with other

projects!

Regards

Kit

---------------------------------------------------------------

To unsubscribe send SIGNOFF BIOMCH-L to LISTSERV@nic.surfnet.nl

For information and archives: http://isb.ri.ccf.org/biomch-l

---------------------------------------------------------------