In the following screenshot Rho, Theta, and Phi represent the calculated deflection angles (in degrees) for the ADI ball along each axis and X, Y and Z proc are the animation states. My vessel's current attitude matches my reference attitude and as such all 3 angles are less than a degree and the Proc values are either 0.5 or damn close.
The ball is centered. (as it should be)
No this screenshot is from the same simulation session and was taken not 3 minutes later after performing a few random rotations and then returning to my reference attitude. Once again all 3 angles are within a degree and the Proc values are close to 0.5. But as you can see...
...the Ball is not centered.
WTF?!
Why would "SetAnimation( anim_ADI_Xrot, 0.5);" not set the animation to 0.5 each time?
If 0.5 does not equal 0.5 what does it equal?
How do I make it equal 0.5 again?
ETA: here is the code...
from "DefineAnimations()"
...and the ADI function itself (called every post step)
The ball is centered. (as it should be)
No this screenshot is from the same simulation session and was taken not 3 minutes later after performing a few random rotations and then returning to my reference attitude. Once again all 3 angles are within a degree and the Proc values are close to 0.5. But as you can see...
...the Ball is not centered.
WTF?!
Why would "SetAnimation( anim_ADI_Xrot, 0.5);" not set the animation to 0.5 each time?
If 0.5 does not equal 0.5 what does it equal?
How do I make it equal 0.5 again?
ETA: here is the code...
from "DefineAnimations()"
Code:
// ADI Ball
static UINT ADIGroups = VC_GRP_ADI_Ball;
static MGROUP_ROTATE ADI_X ( 4, &ADIGroups, 1, ADI_BALL_POS, ADI_X_AXIS, (float) 2*PI); // X axis (Pitch)
anim_ADI_Xrot = CreateAnimation(0.50);
ah_ADIpitch = AddAnimationComponent ( anim_ADI_Xrot, 0, 1, &ADI_X);
static MGROUP_ROTATE ADI_Y ( 4, &ADIGroups, 1, ADI_BALL_POS, ADI_Y_AXIS, (float) 2*PI); // y axis (Yaw)
anim_ADI_Yrot = CreateAnimation(0.50);
ah_ADIyaw = AddAnimationComponent ( anim_ADI_Yrot, 0, 1, &ADI_Y);
static MGROUP_ROTATE ADI_Z ( 4, &ADIGroups, 1, ADI_BALL_POS, ADI_Z_AXIS, (float) 2*PI); // z axis (Roll)
anim_ADI_Zrot = CreateAnimation(0.50);
ah_ADIroll = AddAnimationComponent ( anim_ADI_Zrot, 0, 1, &ADI_Z, ah_ADIpitch);
...and the ADI function itself (called every post step)
Code:
// Animate VC ADI ball
void SpiderLEM::AnimateADI(VECTOR3 euler)
{
double rho = euler.x; // pitch angle
double theta = euler.y; // yaw angle
double phi = euler.z; // roll angle
double x_proc = 0.5 + (rho / 360);
double y_proc = 0.5 + (theta / 360);
double z_proc = 0.5 + (phi / 360);
// Ensure that process values are between 0 and 1. The function that clculates the Euler angles is restricted to +/-180 so technically we shouldn't have to do this but just to be safe...
if (x_proc > 1) x_proc -= 1;
else if (x_proc < 0) x_proc += 1;
if (y_proc > 1) y_proc -= 1;
else if (y_proc < 0) y_proc += 1;
if (z_proc > 1) z_proc -= 1;
else if (z_proc < 0) z_proc += 1;
// Perform Animations
SetAnimation( anim_ADI_Xrot, x_proc);
SetAnimation( anim_ADI_Yrot, y_proc);
SetAnimation( anim_ADI_Zrot, z_proc);
// Debuggery
sprintf(oapiDebugString(),"Rho %0.2f Theta %0.2f Phi %0.2f X proc %0.3f Y proc %0.3f Z proc %0.3f", rho, theta, phi, x_proc, y_proc, z_proc);
}
Last edited: