Wrong euler angles displayed

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Wrong euler angles displayed

Postby misho » Thu Oct 07, 2010 3:20 pm

This is related to the "Very small torques..." issue which is currently in the bug list, and it will be very easy to test as well.

When I add small torques to rotate a body, I noticed that the values for Euler angles are wrong as displayed. The values are correct when the body rotates after the torque is applied, but WHILE the torque is applied, the Euler angle CHANGES drastically, only to revert to correct value when torque is no longer applied and the body is rotating freely under inertia. To reproduce:

Insert the following into body's SetTransformCallback:

Code: Select all
EulerXYZ = rotation.GetXYZ_EulerAngles();


where EulerXYZ is a global vector

and display it using

Code: Select all
   Print (dVector (1.0f, 1.0f, 1.0f, 1.0f), 10, 364, "Rotation: X = %5.8f", EulerXYZ[0]);
   Print (dVector (1.0f, 1.0f, 1.0f, 1.0f), 10, 384, "Rotation: Y = %5.8f", EulerXYZ[1]);
   Print (dVector (1.0f, 1.0f, 1.0f, 1.0f), 10, 404, "rotation: Z = %5.8f", EulerXYZ[2]);


With thihs setup, I have added torque to the body in X-axis and observed the correct Euler angle readout from zero to 3.14, then back from -3.14 to zero - which is the correct behavior. However, if I add more torque at around 90 degrees (1.57rad) while the body is already rotating under angular momentum, the readout of the Euler angle drops from 1.57rad to around 0.6rad. When I let go of the torque key, the readout jumps back to the correct current Euler angle. It is important to note that, while the readout of the value obtained using GetXYZ_EulerAngles() is incorrect, the body itself does NOT jump to the incorrect value - it continues to rotate properly and react to torque addition (aside from the issue with very small torques which are already in the bug list)

Cheers,
Misho
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Wrong euler angles displayed

Postby Julio Jerez » Thu Oct 07, 2010 3:35 pm

you can use the DQuaterion and dMatrix to ge the angle.

any function that decompose a matrix into euler angle will loose continuity at some point because eutle angel are no linear,

any funtion will adopt a convetion for example force the Yaw to be between -90 and 90, or any other convetion
I beleive GetXYZ_EulerAngles force Yaw to [-90 < yaw < 90]
so each time the yaw angle is close to +-90 the Pitch and Yaw because linearly dependend on each oher and a convention nee to be use.,
I beleibe newton convetion is to make Roll 0, and calculate Pitch
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Wrong euler angles displayed

Postby misho » Thu Oct 07, 2010 4:29 pm

Julio - sorry, I made a booboo in my code. I actually have 2 objects, and values of both were combined into a readout. I fixed that and the angle display is now correct. The manifestation of this was quite interesting, though :)

Thanks,
Misho
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 9 guests

cron