Aviation coordinates(NED) to OpenGL

Started by
-1 comments, last by HarinathReddy 12 years, 5 months ago
I'm working with an sensor board , similar to WII remote. It gives 3D rotation( attitude) with respect to NED ( North East Down ) which means body (aircraft) nose is +X , right wing is +Y , down to earth is +Z.
OpenGL uses Up Y coordinate system( Both can be seen in attached image).I get euler angles(roll, pitch, yaw) from sensor board. see here Sensor video & code .
If i set upvector (0,0-1) in glLookAt function, the coordinate system becomes Towords Viewr +X, Left +Y , Down +Z. Then i will construct Rotationmatrix (- Roll, -Pitch, Yaw) .
//---------------------------------------------------------------------------------------------------------------

void RotationMatrix (dMatrix3x3 &A, double r, double p, double y)
{
// Order (ZYX)
double sx = sin®, cx = cos®;
double sy = sin(p), cy = cos(p);
double sz = sin(y), cz = cos(y);
A[0][0] = cy*cz; A[0][1] = sy*sx*cz - sz*cx; A[0][2] = sy*cx*cz + sz*sx;
A[1][0] = cy*sz; A[1][1] = sy*sx*sz + cz*cx; A[1][2] = -cz*sx + sy*cx*sz ;
A[2][0] = -sy; A[2][1] = cy*sx; A[2][2] = cy*cx;
}
//--------------------------------------------------------------------------------------------------------------
if i apply this rotation matrix, it works perfect since i changed glLookAt & angles negated to suit Sensor board coordinate system.

Now, I don't want to change OpenGL upvector in glLookAt , i want to leave it as it is (0,1,0) and want to apply this rotation matrix to object. The object rotation is not intuitive since coordinate system doesn't match.
Please see the attached image.
How can i make the object rotation intuitive without changing glLookAt ?
I read a paper which talks about this issue, but could not understand. See the 4th section in attached paper .
Someone here tell me how ?
Thanks

This topic is closed to new replies.

Advertisement