Rotation error during simultaneous axis turn

greenspun.com : LUSENET : quaternions : One Thread

Hello. I have a problem with the rotation of a body in the 3d area with quaternions.

My computation

Lambda = 1 - (q0^2 + q1^2 + q2^2 + q3^2)

q0t = -0.5 * ( q1*wx + q2*wy + q3*wz) + Lambda * q0; q1t = 0.5 * ( q0*wx + q2*wz - q3*wy) + Lambda * q1; q2t = 0.5 * ( q0*wy + q3*wx - q1*wz) + Lambda * q2; q3t = 0.5 * ( q0*wz - q1*wy - q2*wx) + Lambda * q3; qt = [q0t; q1t; q2t; q3t]

q0 = q0 + q0t; q1 = q1 + q1t; q2 = q2 + q2t; q3 = q3 + q3t; qC = [q0; q1; q2; q3]

probe = q0^2 + q1^2 + q2^2 + q3^2

% Roationsmatrix Quaternion C11 = q0^2 + q1^2 - q2^2 - q3^2; C12 = 2 * ( q1*q2 - q0*q3 ); C13 = 2 * ( q0*q2 + q1*q3 );

C21 = 2 * ( q1*q2 + q0*q3 ); C22 = q0^2 - q1^2 + q2^2 - q3^2; C23 = 2 * ( q2*q3 - q0*q1);

C31 = 2 * ( q1*q3 - q0*q2 ); C32 = 2 * ( q2*q3 + q0*q1 ); C33 = q0^2 - q1^2 - q2^2 + q3^2;

C = [C11 C12 C13; C21 C22 C23; C31 C32 C33];

XACHSE = C * xachse YACHSE = C * yachse ZACHSE = C * zachse

First I let the Obekt up to 90 degrees rotate over the x axis.Then up to 90 degrees over the z axis.Thus everything works correctly.

q0=0.49999; q1= 0.5; q2= -0.50001; q3= 0.5

XACHSE =

-0.0000 -0.0000 1.0000

YACHSE =

-1.0000 0.0000 -0.0000

ZACHSE =

0 -1.0000 -0.0000

If I rotate at the same time the x and z axis up to 90 degrees, it works wrongly.

q0=0.44399; q1= 0.63359; q2= 0; q3= 0.63359

XACHSE =

0.1971 0.5626 0.8029

YACHSE =

-0.5626 -0.6057 0.5626

ZACHSE =

0.8029 -0.5626 0.1971

Did I survey something in my computation?

Thank you for your assistance.

Yours sincerely

Manfred

-- Manfred Fischer (FManfred@gmx.net), July 29, 2003


Moderation questions? read the FAQ