Hello,
I see in the Optitrack Rigid Body application real-time tracking data for heading, bank, and attitude. However, I do not see data fields for these values in the sRigidBodyData struct that is received by the sample listener. Are these values not streamed?
Thanks,
Brandon
attitude, banking, roll
Re: attitude, banking, roll
Here's a function that can do the conversion for you. Does this help?
Code: Select all
void GetEulers(float qx, float qy, float qz, float qw, float *angle1,float *angle2, float *angle3)
{
float &heading = *angle1;
float &attitude = *angle2;
float &bank = *angle3;
double test = qx*qy + qz*qw;
if (test > 0.499) { // singularity at north pole
heading = (float) 2.0f * atan2(qx,qw);
attitude = 3.14159265f/2.0f;
bank = 0;
RadiansToDegrees(&heading);
RadiansToDegrees(&attitude);
RadiansToDegrees(&bank);
return;
}
if (test < -0.499) { // singularity at south pole
heading = (float) -2.0f * atan2(qx,qw);
attitude = - 3.14159265f/2.0f;
bank = 0;
RadiansToDegrees(&heading);
RadiansToDegrees(&attitude);
RadiansToDegrees(&bank);
return;
}
double sqx = qx*qx;
double sqy = qy*qy;
double sqz = qz*qz;
heading = (float) atan2((double)2.0*qy*qw-2.0*qx*qz , (double)1 - 2.0*sqy - 2.0*sqz);
attitude = (float)asin(2.0*test);
bank = (float) atan2((double)2.0*qx*qw-2.0*qy*qz , (double)1.0 - 2.0*sqx - 2.0*sqz);
RadiansToDegrees(&heading);
RadiansToDegrees(&attitude);
RadiansToDegrees(&bank);
}
void RadiansToDegrees(float *value)
{
*value = (*value)*(180.0f/3.14159265f);
}
Re: attitude, banking, roll
Thanks! That function gave me the rotation data I needed.
Re: attitude, banking, roll
I am trying to get pitch roll and yaw values?
Is heading=pitch, attitude=roll and bank=yaw?
Is heading=pitch, attitude=roll and bank=yaw?
Re: attitude, banking, roll
I believe it is -----
Yaw - Heading
Pitch - Attitude
Roll - Bank
Yaw - Heading
Pitch - Attitude
Roll - Bank
Re: attitude, banking, roll
I just want to make sure: are you talking about the parameters of the RB_GetRigidBodyLocation (...) call in the RB API?