fausto
FOI SuperMod
Hi all!
My goal is to fire RCS thrusters in order to rotate the vessel and keep it towards Earth. I want to do it exactly as Attitude MFD does, and i gave a look to the avaiable source code. After days of battle, I isolated a function which I think is the center of what i want to do. It's the following one:
etonoff is the condition of earth tracking activation, and I call it in clbkPreStep. I can compile it and it's a good result. The problem is, when I activate it, RCS thrusters start a pitch firing and they don't stop at all!! The vessel rotates over and over again!!
This function is void inline AttitudeMFD::Control() inside attitude MFD source code..
My goal is to fire RCS thrusters in order to rotate the vessel and keep it towards Earth. I want to do it exactly as Attitude MFD does, and i gave a look to the avaiable source code. After days of battle, I isolated a function which I think is the center of what i want to do. It's the following one:
Code:
if (etonoff==ENGAGED)
{
// Use different function calls to SetAttitude for the rotating reference vector cases than the static reference vector cases
if ( (fabs(PitchYawRoll.data[YAW]) + fabs(PitchYawRoll.data[PITCH])) > DEADBAND_MAX ) {
SetAttitude(0, PitchYawRoll.data[PITCH], PITCH, DB_COARSE, RATE_NULL_HIGH, LastTimeElapsed);
SetAttitude(0, PitchYawRoll.data[YAW], YAW, DB_COARSE, RATE_NULL_HIGH, LastTimeElapsed);
SetAttitude(0, 0, ROLL, DB_COARSE, RATE_NULL_HIGH, TimeElapsed);
}
else {
if ((RefMode == VELOCITY)||(RefMode == TARGET_RELATIVE)) {
SetAttitude(0, PitchYawRoll.data[PITCH], PitchYawRollRate.data[PITCH], PITCH, DB_FINE, RATE_NULL_HIGH, LastTimeElapsed);
SetAttitude(0, PitchYawRoll.data[YAW], PitchYawRollRate.data[YAW], YAW, DB_FINE, RATE_NULL_HIGH, LastTimeElapsed);
SetAttitude(0, PitchYawRoll.data[ROLL], PitchYawRollRate.data[ROLL], ROLL, DB_FINE, RATE_NULL_HIGH, LastTimeElapsed);
}
else {
SetAttitude(0, PitchYawRoll.data[PITCH], PITCH, DB_MIN, RATE_NULL_LOW, LastTimeElapsed);
SetAttitude(0, PitchYawRoll.data[YAW], YAW, DB_MIN, RATE_NULL_LOW, LastTimeElapsed);
SetAttitude(0, PitchYawRoll.data[ROLL], ROLL, DB_MIN, RATE_NULL_LOW, LastTimeElapsed);
}
}
}
etonoff is the condition of earth tracking activation, and I call it in clbkPreStep. I can compile it and it's a good result. The problem is, when I activate it, RCS thrusters start a pitch firing and they don't stop at all!! The vessel rotates over and over again!!
This function is void inline AttitudeMFD::Control() inside attitude MFD source code..