trigger transition into detumble no matter which mode we are in
This commit is contained in:
parent
21fc431bc6
commit
d8ae45b352
@ -178,6 +178,24 @@ void AcsController::performAttitudeControl() {
|
|||||||
result = navigation.useMekf(&sensorValues, &gyrDataProcessed, &mgmDataProcessed,
|
result = navigation.useMekf(&sensorValues, &gyrDataProcessed, &mgmDataProcessed,
|
||||||
&susDataProcessed, &attitudeEstimationData, &acsParameters);
|
&susDataProcessed, &attitudeEstimationData, &acsParameters);
|
||||||
|
|
||||||
|
if (not submode == acs::SafeSubmode::DETUMBLE) {
|
||||||
|
if (acsParameters.safeModeControllerParameters.useMekf) {
|
||||||
|
if (mgmDataProcessed.mgmVecTotDerivative.isValid() and
|
||||||
|
VectorOperations<double>::norm(mgmDataProcessed.mgmVecTotDerivative.value, 3) >
|
||||||
|
acsParameters.detumbleParameter.omegaDetumbleStart) {
|
||||||
|
detumbleCounter++;
|
||||||
|
}
|
||||||
|
} else if (detumbleCounter > 0) {
|
||||||
|
detumbleCounter -= 1;
|
||||||
|
}
|
||||||
|
if (detumbleCounter > acsParameters.detumbleParameter.detumblecounter) {
|
||||||
|
detumbleCounter = 0;
|
||||||
|
// Triggers detumble mode transition in subsystem
|
||||||
|
triggerEvent(acs::SAFE_RATE_VIOLATION);
|
||||||
|
startTransition(mode, acs::SafeSubmode::DETUMBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (result != MultiplicativeKalmanFilter::MEKF_RUNNING and
|
if (result != MultiplicativeKalmanFilter::MEKF_RUNNING and
|
||||||
result != MultiplicativeKalmanFilter::MEKF_INITIALIZED) {
|
result != MultiplicativeKalmanFilter::MEKF_INITIALIZED) {
|
||||||
if (not mekfInvalidFlag) {
|
if (not mekfInvalidFlag) {
|
||||||
@ -284,33 +302,6 @@ void AcsController::performSafe() {
|
|||||||
actuatorCmd.cmdDipoleMtq(*acsParameters.magnetorquerParameter.inverseAlignment,
|
actuatorCmd.cmdDipoleMtq(*acsParameters.magnetorquerParameter.inverseAlignment,
|
||||||
acsParameters.magnetorquerParameter.dipoleMax, magMomMtq, cmdDipoleMtqs);
|
acsParameters.magnetorquerParameter.dipoleMax, magMomMtq, cmdDipoleMtqs);
|
||||||
|
|
||||||
// detumble check and switch
|
|
||||||
if (acsParameters.safeModeControllerParameters.useMekf) {
|
|
||||||
if (attitudeEstimationData.satRotRateMekf.isValid() and
|
|
||||||
VectorOperations<double>::norm(attitudeEstimationData.satRotRateMekf.value, 3) >
|
|
||||||
acsParameters.detumbleParameter.omegaDetumbleStart) {
|
|
||||||
detumbleCounter++;
|
|
||||||
}
|
|
||||||
} else if (acsParameters.safeModeControllerParameters.useGyr) {
|
|
||||||
if (gyrDataProcessed.gyrVecTot.isValid() and
|
|
||||||
VectorOperations<double>::norm(gyrDataProcessed.gyrVecTot.value, 3) >
|
|
||||||
acsParameters.detumbleParameter.omegaDetumbleStart) {
|
|
||||||
detumbleCounter++;
|
|
||||||
}
|
|
||||||
} else if (fusedRotRateData.rotRateTotal.isValid() and
|
|
||||||
VectorOperations<double>::norm(fusedRotRateData.rotRateTotal.value, 3) >
|
|
||||||
acsParameters.detumbleParameter.omegaDetumbleStart) {
|
|
||||||
detumbleCounter++;
|
|
||||||
} else if (detumbleCounter > 0) {
|
|
||||||
detumbleCounter -= 1;
|
|
||||||
}
|
|
||||||
if (detumbleCounter > acsParameters.detumbleParameter.detumblecounter) {
|
|
||||||
detumbleCounter = 0;
|
|
||||||
// Triggers detumble mode transition in subsystem
|
|
||||||
triggerEvent(acs::SAFE_RATE_VIOLATION);
|
|
||||||
startTransition(mode, acs::SafeSubmode::DETUMBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateCtrlValData(errAng, safeCtrlStrat);
|
updateCtrlValData(errAng, safeCtrlStrat);
|
||||||
updateActuatorCmdData(cmdDipoleMtqs);
|
updateActuatorCmdData(cmdDipoleMtqs);
|
||||||
commandActuators(cmdDipoleMtqs[0], cmdDipoleMtqs[1], cmdDipoleMtqs[2],
|
commandActuators(cmdDipoleMtqs[0], cmdDipoleMtqs[1], cmdDipoleMtqs[2],
|
||||||
|
Loading…
Reference in New Issue
Block a user