From 26f69d611e260e068c1c71c52028701e7cbf0938 Mon Sep 17 00:00:00 2001 From: meggert Date: Fri, 26 Jan 2024 15:45:24 +0100 Subject: [PATCH 1/9] never try sending invalid command --- mission/controller/acs/control/PtgCtrl.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mission/controller/acs/control/PtgCtrl.cpp b/mission/controller/acs/control/PtgCtrl.cpp index fd5b9f29..e1069aba 100644 --- a/mission/controller/acs/control/PtgCtrl.cpp +++ b/mission/controller/acs/control/PtgCtrl.cpp @@ -220,6 +220,8 @@ void PtgCtrl::rwAntistiction(ACS::SensorValues *sensorValues, int32_t *rwCmdSpee } } } + } else { + rwCmdSpeeds[i] = 0.0; } } } From 5f388d53a6b0742ae758d2841e36335196bb2ad3 Mon Sep 17 00:00:00 2001 From: meggert Date: Sat, 27 Jan 2024 10:33:49 +0100 Subject: [PATCH 2/9] reset RW cmds to 0 if they are not used anymore --- mission/controller/AcsController.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mission/controller/AcsController.cpp b/mission/controller/AcsController.cpp index 8e7ae8d4..43e2ccb6 100644 --- a/mission/controller/AcsController.cpp +++ b/mission/controller/AcsController.cpp @@ -885,6 +885,24 @@ ReturnValue_t AcsController::checkModeCommand(Mode_t mode, Submode_t submode, } void AcsController::modeChanged(Mode_t mode, Submode_t submode) { + if (mode == acs::AcsMode::SAFE) { + { + PoolReadGuard pg(&rw1SpeedSet); + rw1SpeedSet.setRwSpeed(0, 10); + } + { + PoolReadGuard pg(&rw2SpeedSet); + rw2SpeedSet.setRwSpeed(0, 10); + } + { + PoolReadGuard pg(&rw3SpeedSet); + rw3SpeedSet.setRwSpeed(0, 10); + } + { + PoolReadGuard pg(&rw4SpeedSet); + rw4SpeedSet.setRwSpeed(0, 10); + } + } return ExtendedControllerBase::modeChanged(mode, submode); } From 6cf746463b4f75c6be636af027b06fe82bb84cf2 Mon Sep 17 00:00:00 2001 From: meggert Date: Sat, 27 Jan 2024 10:35:33 +0100 Subject: [PATCH 3/9] is of type int --- mission/controller/acs/control/PtgCtrl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mission/controller/acs/control/PtgCtrl.cpp b/mission/controller/acs/control/PtgCtrl.cpp index e1069aba..a7ed422a 100644 --- a/mission/controller/acs/control/PtgCtrl.cpp +++ b/mission/controller/acs/control/PtgCtrl.cpp @@ -221,7 +221,7 @@ void PtgCtrl::rwAntistiction(ACS::SensorValues *sensorValues, int32_t *rwCmdSpee } } } else { - rwCmdSpeeds[i] = 0.0; + rwCmdSpeeds[i] = 0; } } } From 315365921ec2825ef82cd0aa1cf8406357257b2f Mon Sep 17 00:00:00 2001 From: meggert Date: Sat, 27 Jan 2024 10:37:39 +0100 Subject: [PATCH 4/9] changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8202cea7..8e866eb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,13 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +## Fixed + +- RW speed commands get reset to 0 RPM, if the `AcsController` is has changed its mode + to Safe +- Antistiction for RWs will set commanded speed to 0 RPM, if a wheel is detected as not + working + # [v7.5.5] 2024-01-22 ## Fixed From 772e8f11492dd837a8c8a4a5430179f1873b5840 Mon Sep 17 00:00:00 2001 From: meggert Date: Sat, 27 Jan 2024 10:45:00 +0100 Subject: [PATCH 5/9] enableAntistiction must not be optional as it prevents the ACS ctrl from sending invalid speed cmds --- mission/controller/AcsController.cpp | 10 +--- mission/controller/acs/AcsParameters.cpp | 61 +++++++++--------------- mission/controller/acs/AcsParameters.h | 1 - 3 files changed, 24 insertions(+), 48 deletions(-) diff --git a/mission/controller/AcsController.cpp b/mission/controller/AcsController.cpp index 43e2ccb6..410ee81d 100644 --- a/mission/controller/AcsController.cpp +++ b/mission/controller/AcsController.cpp @@ -445,7 +445,6 @@ void AcsController::performPointingCtrl() { break; } - uint8_t enableAntiStiction = true; double rwPseudoInv[4][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}; ReturnValue_t result = guidance.getDistributionMatrixRw(&sensorValues, *rwPseudoInv); if (result == returnvalue::FAILED) { @@ -486,7 +485,6 @@ void AcsController::performPointingCtrl() { mgmDataProcessed.mgmVecTot.isValid(), rotRateB, sensorValues.rw1Set.currSpeed.value, sensorValues.rw2Set.currSpeed.value, sensorValues.rw3Set.currSpeed.value, sensorValues.rw4Set.currSpeed.value, mgtDpDes); - enableAntiStiction = acsParameters.idleModeControllerParameters.enableAntiStiction; break; case acs::PTG_TARGET: @@ -510,7 +508,6 @@ void AcsController::performPointingCtrl() { mgmDataProcessed.mgmVecTot.isValid(), rotRateB, sensorValues.rw1Set.currSpeed.value, sensorValues.rw2Set.currSpeed.value, sensorValues.rw3Set.currSpeed.value, sensorValues.rw4Set.currSpeed.value, mgtDpDes); - enableAntiStiction = acsParameters.targetModeControllerParameters.enableAntiStiction; break; case acs::PTG_TARGET_GS: @@ -531,7 +528,6 @@ void AcsController::performPointingCtrl() { mgmDataProcessed.mgmVecTot.isValid(), rotRateB, sensorValues.rw1Set.currSpeed.value, sensorValues.rw2Set.currSpeed.value, sensorValues.rw3Set.currSpeed.value, sensorValues.rw4Set.currSpeed.value, mgtDpDes); - enableAntiStiction = acsParameters.gsTargetModeControllerParameters.enableAntiStiction; break; case acs::PTG_NADIR: @@ -555,7 +551,6 @@ void AcsController::performPointingCtrl() { mgmDataProcessed.mgmVecTot.isValid(), rotRateB, sensorValues.rw1Set.currSpeed.value, sensorValues.rw2Set.currSpeed.value, sensorValues.rw3Set.currSpeed.value, sensorValues.rw4Set.currSpeed.value, mgtDpDes); - enableAntiStiction = acsParameters.nadirModeControllerParameters.enableAntiStiction; break; case acs::PTG_INERTIAL: @@ -578,7 +573,6 @@ void AcsController::performPointingCtrl() { mgmDataProcessed.mgmVecTot.isValid(), rotRateB, sensorValues.rw1Set.currSpeed.value, sensorValues.rw2Set.currSpeed.value, sensorValues.rw3Set.currSpeed.value, sensorValues.rw4Set.currSpeed.value, mgtDpDes); - enableAntiStiction = acsParameters.inertialModeControllerParameters.enableAntiStiction; break; default: sif::error << "AcsController: Invalid mode for performPointingCtrl" << std::endl; @@ -590,9 +584,7 @@ void AcsController::performPointingCtrl() { sensorValues.rw3Set.currSpeed.value, sensorValues.rw4Set.currSpeed.value, acsParameters.onBoardParams.sampleTime, acsParameters.rwHandlingParameters.inertiaWheel, acsParameters.rwHandlingParameters.maxRwSpeed, torqueRws, cmdSpeedRws); - if (enableAntiStiction) { - ptgCtrl.rwAntistiction(&sensorValues, cmdSpeedRws); - } + ptgCtrl.rwAntistiction(&sensorValues, cmdSpeedRws); actuatorCmd.cmdDipoleMtq(*acsParameters.magnetorquerParameter.inverseAlignment, acsParameters.magnetorquerParameter.dipoleMax, mgtDpDes, cmdDipoleMtqs); diff --git a/mission/controller/acs/AcsParameters.cpp b/mission/controller/acs/AcsParameters.cpp index a6ce6c5d..4eb11246 100644 --- a/mission/controller/acs/AcsParameters.cpp +++ b/mission/controller/acs/AcsParameters.cpp @@ -432,9 +432,6 @@ ReturnValue_t AcsParameters::getParameter(uint8_t domainId, uint8_t parameterId, parameterWrapper->set(idleModeControllerParameters.desatOn); break; case 0x9: - parameterWrapper->set(idleModeControllerParameters.enableAntiStiction); - break; - case 0xA: parameterWrapper->set(idleModeControllerParameters.useMekf); break; default: @@ -471,42 +468,39 @@ ReturnValue_t AcsParameters::getParameter(uint8_t domainId, uint8_t parameterId, parameterWrapper->set(targetModeControllerParameters.desatOn); break; case 0x9: - parameterWrapper->set(targetModeControllerParameters.enableAntiStiction); - break; - case 0xA: parameterWrapper->set(targetModeControllerParameters.useMekf); break; - case 0xB: + case 0xA: parameterWrapper->setVector(targetModeControllerParameters.refDirection); break; - case 0xC: + case 0xB: parameterWrapper->setVector(targetModeControllerParameters.refRotRate); break; - case 0xD: + case 0xC: parameterWrapper->setVector(targetModeControllerParameters.quatRef); break; - case 0xE: + case 0xD: parameterWrapper->set(targetModeControllerParameters.timeElapsedMax); break; - case 0xF: + case 0xE: parameterWrapper->set(targetModeControllerParameters.latitudeTgt); break; - case 0x10: + case 0xF: parameterWrapper->set(targetModeControllerParameters.longitudeTgt); break; - case 0x11: + case 0x10: parameterWrapper->set(targetModeControllerParameters.altitudeTgt); break; - case 0x12: + case 0x11: parameterWrapper->set(targetModeControllerParameters.avoidBlindStr); break; - case 0x13: + case 0x12: parameterWrapper->set(targetModeControllerParameters.blindAvoidStart); break; - case 0x14: + case 0x13: parameterWrapper->set(targetModeControllerParameters.blindAvoidStop); break; - case 0x15: + case 0x14: parameterWrapper->set(targetModeControllerParameters.blindRotRate); break; default: @@ -543,24 +537,21 @@ ReturnValue_t AcsParameters::getParameter(uint8_t domainId, uint8_t parameterId, parameterWrapper->set(gsTargetModeControllerParameters.desatOn); break; case 0x9: - parameterWrapper->set(gsTargetModeControllerParameters.enableAntiStiction); - break; - case 0xA: parameterWrapper->set(gsTargetModeControllerParameters.useMekf); break; - case 0xB: + case 0xA: parameterWrapper->setVector(gsTargetModeControllerParameters.refDirection); break; - case 0xC: + case 0xB: parameterWrapper->set(gsTargetModeControllerParameters.timeElapsedMax); break; - case 0xD: + case 0xC: parameterWrapper->set(gsTargetModeControllerParameters.latitudeTgt); break; - case 0xE: + case 0xD: parameterWrapper->set(gsTargetModeControllerParameters.longitudeTgt); break; - case 0xF: + case 0xE: parameterWrapper->set(gsTargetModeControllerParameters.altitudeTgt); break; default: @@ -597,21 +588,18 @@ ReturnValue_t AcsParameters::getParameter(uint8_t domainId, uint8_t parameterId, parameterWrapper->set(nadirModeControllerParameters.desatOn); break; case 0x9: - parameterWrapper->set(nadirModeControllerParameters.enableAntiStiction); - break; - case 0xA: parameterWrapper->set(nadirModeControllerParameters.useMekf); break; - case 0xB: + case 0xA: parameterWrapper->setVector(nadirModeControllerParameters.refDirection); break; - case 0xC: + case 0xB: parameterWrapper->setVector(nadirModeControllerParameters.quatRef); break; - case 0xD: + case 0xC: parameterWrapper->setVector(nadirModeControllerParameters.refRotRate); break; - case 0xE: + case 0xD: parameterWrapper->set(nadirModeControllerParameters.timeElapsedMax); break; default: @@ -648,18 +636,15 @@ ReturnValue_t AcsParameters::getParameter(uint8_t domainId, uint8_t parameterId, parameterWrapper->set(inertialModeControllerParameters.desatOn); break; case 0x9: - parameterWrapper->set(inertialModeControllerParameters.enableAntiStiction); - break; - case 0xA: parameterWrapper->set(inertialModeControllerParameters.useMekf); break; - case 0xB: + case 0xA: parameterWrapper->setVector(inertialModeControllerParameters.tgtQuat); break; - case 0xC: + case 0xB: parameterWrapper->setVector(inertialModeControllerParameters.refRotRate); break; - case 0xD: + case 0xC: parameterWrapper->setVector(inertialModeControllerParameters.quatRef); break; default: diff --git a/mission/controller/acs/AcsParameters.h b/mission/controller/acs/AcsParameters.h index f11a673b..d58a2d44 100644 --- a/mission/controller/acs/AcsParameters.h +++ b/mission/controller/acs/AcsParameters.h @@ -863,7 +863,6 @@ class AcsParameters : public HasParametersIF { double desatMomentumRef[3] = {0, 0, 0}; double deSatGainFactor = 1000; uint8_t desatOn = true; - uint8_t enableAntiStiction = true; uint8_t useMekf = false; } pointingLawParameters; From c4297975ff77b87d0b5546fe7caf8fa7f54eda7c Mon Sep 17 00:00:00 2001 From: meggert Date: Sat, 27 Jan 2024 10:47:42 +0100 Subject: [PATCH 6/9] changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e866eb0..dbbcd40b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,9 @@ will consitute of a breaking change warranting a new major release: to Safe - Antistiction for RWs will set commanded speed to 0 RPM, if a wheel is detected as not working +- Removed parameter to disable antistiction, as deactivating it would result in the + `AcsController` being allowed sending invalid speed commands to the RW Handler, which + would then trigger FDIR and turning off the functioning device # [v7.5.5] 2024-01-22 From 398ddd1a3fca50998206aca89ac2e1cdaeaebe50 Mon Sep 17 00:00:00 2001 From: meggert Date: Sat, 27 Jan 2024 11:30:37 +0100 Subject: [PATCH 7/9] typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbbcd40b..57dc0902 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ will consitute of a breaking change warranting a new major release: ## Fixed -- RW speed commands get reset to 0 RPM, if the `AcsController` is has changed its mode +- RW speed commands get reset to 0 RPM, if the `AcsController` has changed its mode to Safe - Antistiction for RWs will set commanded speed to 0 RPM, if a wheel is detected as not working From 0d7f5d5dcafdddc0269f8de189513da6b4cee8f3 Mon Sep 17 00:00:00 2001 From: meggert Date: Sat, 27 Jan 2024 11:32:23 +0100 Subject: [PATCH 8/9] prevent use of if_id of DHB for rw rtvals --- mission/acs/RwHandler.h | 1 + 1 file changed, 1 insertion(+) diff --git a/mission/acs/RwHandler.h b/mission/acs/RwHandler.h index a8903b81..87689fe6 100644 --- a/mission/acs/RwHandler.h +++ b/mission/acs/RwHandler.h @@ -59,6 +59,7 @@ class RwHandler : public DeviceHandlerBase { LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; private: + static const uint8_t INTERFACE_ID = CLASS_ID::RW_HANDLER; //! [EXPORT] : [COMMENT] Action Message with invalid speed was received. Valid speeds must be in //! the range of [-65000; 1000] or [1000; 65000] static const ReturnValue_t INVALID_SPEED = MAKE_RETURN_CODE(0xA0); From 060217fbb4825cdf19a346ab131bbf89f35ff853 Mon Sep 17 00:00:00 2001 From: meggert Date: Sat, 27 Jan 2024 11:33:33 +0100 Subject: [PATCH 9/9] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57dc0902..33d9eeae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ will consitute of a breaking change warranting a new major release: - Removed parameter to disable antistiction, as deactivating it would result in the `AcsController` being allowed sending invalid speed commands to the RW Handler, which would then trigger FDIR and turning off the functioning device +- `RwHandler` returnvalues would use the `INTERFACE_ID` of the `DeviceHandlerBase` # [v7.5.5] 2024-01-22