|
|
|
@ -291,13 +291,13 @@ void AcsController::performPointingCtrl() {
|
|
|
|
|
} else {
|
|
|
|
|
multipleRwUnavailableCounter = 0;
|
|
|
|
|
}
|
|
|
|
|
double torquePtgRws[4] = {0, 0, 0, 0}, rwTrqNs[4] = {0, 0, 0, 0};
|
|
|
|
|
double torqueRws[4] = {0, 0, 0, 0}, torqueRwsScaled[4] = {0, 0, 0, 0};
|
|
|
|
|
double mgtDpDes[3] = {0, 0, 0};
|
|
|
|
|
|
|
|
|
|
// Variables required for guidance
|
|
|
|
|
double targetQuat[4] = {0, 0, 0, 1}, targetSatRotRate[3] = {0, 0, 0}, errorQuat[4] = {0, 0, 0, 1},
|
|
|
|
|
errorAngle = 0, errorSatRotRate[3] = {0, 0, 0};
|
|
|
|
|
// Variables required for setting actuators
|
|
|
|
|
double torquePtgRws[4] = {0, 0, 0, 0}, rwTrqNs[4] = {0, 0, 0, 0}, torqueRws[4] = {0, 0, 0, 0},
|
|
|
|
|
mgtDpDes[3] = {0, 0, 0};
|
|
|
|
|
switch (submode) {
|
|
|
|
|
case acs::PTG_IDLE:
|
|
|
|
|
guidance.targetQuatPtgSun(susDataProcessed.sunIjkModel.value, targetQuat, targetSatRotRate);
|
|
|
|
@ -310,8 +310,7 @@ void AcsController::performPointingCtrl() {
|
|
|
|
|
&(sensorValues.rw2Set.currSpeed.value), &(sensorValues.rw3Set.currSpeed.value),
|
|
|
|
|
&(sensorValues.rw4Set.currSpeed.value), rwTrqNs);
|
|
|
|
|
VectorOperations<double>::add(torquePtgRws, rwTrqNs, torqueRws, 4);
|
|
|
|
|
actuatorCmd.scalingTorqueRws(torqueRws, torqueRwsScaled,
|
|
|
|
|
acsParameters.rwHandlingParameters.maxTrq);
|
|
|
|
|
actuatorCmd.scalingTorqueRws(torqueRws, acsParameters.rwHandlingParameters.maxTrq);
|
|
|
|
|
ptgCtrl.ptgDesaturation(
|
|
|
|
|
&acsParameters.idleModeControllerParameters, mgmDataProcessed.mgmVecTot.value,
|
|
|
|
|
mgmDataProcessed.mgmVecTot.isValid(), mekfData.satRotRateMekf.value,
|
|
|
|
@ -335,8 +334,7 @@ void AcsController::performPointingCtrl() {
|
|
|
|
|
&(sensorValues.rw2Set.currSpeed.value), &(sensorValues.rw3Set.currSpeed.value),
|
|
|
|
|
&(sensorValues.rw4Set.currSpeed.value), rwTrqNs);
|
|
|
|
|
VectorOperations<double>::add(torquePtgRws, rwTrqNs, torqueRws, 4);
|
|
|
|
|
actuatorCmd.scalingTorqueRws(torqueRws, torqueRwsScaled,
|
|
|
|
|
acsParameters.rwHandlingParameters.maxTrq);
|
|
|
|
|
actuatorCmd.scalingTorqueRws(torqueRws, acsParameters.rwHandlingParameters.maxTrq);
|
|
|
|
|
ptgCtrl.ptgDesaturation(
|
|
|
|
|
&acsParameters.targetModeControllerParameters, mgmDataProcessed.mgmVecTot.value,
|
|
|
|
|
mgmDataProcessed.mgmVecTot.isValid(), mekfData.satRotRateMekf.value,
|
|
|
|
@ -357,8 +355,7 @@ void AcsController::performPointingCtrl() {
|
|
|
|
|
&(sensorValues.rw2Set.currSpeed.value), &(sensorValues.rw3Set.currSpeed.value),
|
|
|
|
|
&(sensorValues.rw4Set.currSpeed.value), rwTrqNs);
|
|
|
|
|
VectorOperations<double>::add(torquePtgRws, rwTrqNs, torqueRws, 4);
|
|
|
|
|
actuatorCmd.scalingTorqueRws(torqueRws, torqueRwsScaled,
|
|
|
|
|
acsParameters.rwHandlingParameters.maxTrq);
|
|
|
|
|
actuatorCmd.scalingTorqueRws(torqueRws, acsParameters.rwHandlingParameters.maxTrq);
|
|
|
|
|
ptgCtrl.ptgDesaturation(
|
|
|
|
|
&acsParameters.gsTargetModeControllerParameters, mgmDataProcessed.mgmVecTot.value,
|
|
|
|
|
mgmDataProcessed.mgmVecTot.isValid(), mekfData.satRotRateMekf.value,
|
|
|
|
@ -382,8 +379,7 @@ void AcsController::performPointingCtrl() {
|
|
|
|
|
&(sensorValues.rw2Set.currSpeed.value), &(sensorValues.rw3Set.currSpeed.value),
|
|
|
|
|
&(sensorValues.rw4Set.currSpeed.value), rwTrqNs);
|
|
|
|
|
VectorOperations<double>::add(torquePtgRws, rwTrqNs, torqueRws, 4);
|
|
|
|
|
actuatorCmd.scalingTorqueRws(torqueRws, torqueRwsScaled,
|
|
|
|
|
acsParameters.rwHandlingParameters.maxTrq);
|
|
|
|
|
actuatorCmd.scalingTorqueRws(torqueRws, acsParameters.rwHandlingParameters.maxTrq);
|
|
|
|
|
ptgCtrl.ptgDesaturation(
|
|
|
|
|
&acsParameters.nadirModeControllerParameters, mgmDataProcessed.mgmVecTot.value,
|
|
|
|
|
mgmDataProcessed.mgmVecTot.isValid(), mekfData.satRotRateMekf.value,
|
|
|
|
@ -406,8 +402,7 @@ void AcsController::performPointingCtrl() {
|
|
|
|
|
&(sensorValues.rw2Set.currSpeed.value), &(sensorValues.rw3Set.currSpeed.value),
|
|
|
|
|
&(sensorValues.rw4Set.currSpeed.value), rwTrqNs);
|
|
|
|
|
VectorOperations<double>::add(torquePtgRws, rwTrqNs, torqueRws, 4);
|
|
|
|
|
actuatorCmd.scalingTorqueRws(torqueRws, torqueRwsScaled,
|
|
|
|
|
acsParameters.rwHandlingParameters.maxTrq);
|
|
|
|
|
actuatorCmd.scalingTorqueRws(torqueRws, acsParameters.rwHandlingParameters.maxTrq);
|
|
|
|
|
ptgCtrl.ptgDesaturation(
|
|
|
|
|
&acsParameters.inertialModeControllerParameters, mgmDataProcessed.mgmVecTot.value,
|
|
|
|
|
mgmDataProcessed.mgmVecTot.isValid(), mekfData.satRotRateMekf.value,
|
|
|
|
@ -416,22 +411,22 @@ void AcsController::performPointingCtrl() {
|
|
|
|
|
enableAntiStiction = acsParameters.inertialModeControllerParameters.enableAntiStiction;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (enableAntiStiction) {
|
|
|
|
|
ptgCtrl.rwAntistiction(&sensorValues, torqueRwsScaled);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
actuatorCmd.cmdSpeedToRws(
|
|
|
|
|
sensorValues.rw1Set.currSpeed.value, sensorValues.rw2Set.currSpeed.value,
|
|
|
|
|
sensorValues.rw3Set.currSpeed.value, sensorValues.rw4Set.currSpeed.value, torqueRwsScaled,
|
|
|
|
|
sensorValues.rw3Set.currSpeed.value, sensorValues.rw4Set.currSpeed.value, torqueRws,
|
|
|
|
|
cmdSpeedRws, acsParameters.onBoardParams.sampleTime,
|
|
|
|
|
acsParameters.rwHandlingParameters.maxRwSpeed,
|
|
|
|
|
acsParameters.rwHandlingParameters.inertiaWheel);
|
|
|
|
|
if (enableAntiStiction) {
|
|
|
|
|
ptgCtrl.rwAntistiction(&sensorValues, cmdSpeedRws);
|
|
|
|
|
}
|
|
|
|
|
actuatorCmd.cmdDipolMtq(mgtDpDes, cmdDipolMtqs,
|
|
|
|
|
*acsParameters.magnetorquerParameter.inverseAlignment,
|
|
|
|
|
acsParameters.magnetorquerParameter.dipolMax);
|
|
|
|
|
|
|
|
|
|
updateCtrlValData(targetQuat, errorQuat, errorAngle, targetSatRotRate);
|
|
|
|
|
updateActuatorCmdData(torqueRwsScaled, cmdSpeedRws, cmdDipolMtqs);
|
|
|
|
|
updateActuatorCmdData(torqueRws, cmdSpeedRws, cmdDipolMtqs);
|
|
|
|
|
// commandActuators(cmdDipolMtqs[0], cmdDipolMtqs[1], cmdDipolMtqs[2],
|
|
|
|
|
// acsParameters.magnetorquesParameter.torqueDuration, cmdSpeedRws[0],
|
|
|
|
|
// cmdSpeedRws[1], cmdSpeedRws[2], cmdSpeedRws[3],
|
|
|
|
|