From 1610bdecf9e40b3114d140092aeeda3f9ff6c9dc Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 3 Apr 2023 18:02:45 +0200 Subject: [PATCH 1/5] connect parent --- bsp_q7s/core/ObjectFactory.cpp | 7 ++++--- dummies/helperFactory.cpp | 7 ++++--- fsfw | 2 +- mission/genericFactory.cpp | 3 +++ mission/genericFactory.h | 2 ++ mission/system/acs/AcsBoardAssembly.cpp | 26 +++++++++++++++++++------ mission/system/acs/AcsBoardAssembly.h | 2 ++ tmtc | 2 +- 8 files changed, 37 insertions(+), 14 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index dea4a675..8113539d 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -518,9 +518,10 @@ void ObjectFactory::createAcsBoardComponents(SpiComIF& spiComIF, LinuxLibgpioIF* new GpsHyperionLinuxController(objects::GPS_CONTROLLER, objects::NO_OBJECT, debugGps); gpsCtrl->setResetPinTriggerFunction(gps::triggerGpioResetPin, &RESET_ARGS_GNSS); - new HealthDevice(objects::GPS_0_HEALTH_DEV, objects::ACS_BOARD_ASS); - new HealthDevice(objects::GPS_1_HEALTH_DEV, objects::ACS_BOARD_ASS); - ObjectFactory::createAcsBoardAssy(pwrSwitcher, assemblyChildren, gpsCtrl, gpioComIF); + auto* healthDevGps0 = new HealthDevice(objects::GPS_0_HEALTH_DEV, objects::ACS_BOARD_ASS); + auto* healthDevGps1 = new HealthDevice(objects::GPS_1_HEALTH_DEV, objects::ACS_BOARD_ASS); + ObjectFactory::createAcsBoardAssy(pwrSwitcher, assemblyChildren, *healthDevGps0, *healthDevGps1, + gpsCtrl, gpioComIF); #endif /* OBSW_ADD_ACS_HANDLERS == 1 */ } diff --git a/dummies/helperFactory.cpp b/dummies/helperFactory.cpp index 703683f4..70e80e87 100644 --- a/dummies/helperFactory.cpp +++ b/dummies/helperFactory.cpp @@ -99,10 +99,11 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio new GyroAdisDummy(objects::GYRO_2_ADIS_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); assemblyDhbs[7] = new GyroL3GD20Dummy(objects::GYRO_3_L3G_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); - new HealthDevice(objects::GPS_0_HEALTH_DEV, objects::ACS_BOARD_ASS); - new HealthDevice(objects::GPS_1_HEALTH_DEV, objects::ACS_BOARD_ASS); + auto* gps0HealthDev = new HealthDevice(objects::GPS_0_HEALTH_DEV, objects::ACS_BOARD_ASS); + auto* gps1HealthDev = new HealthDevice(objects::GPS_1_HEALTH_DEV, objects::ACS_BOARD_ASS); auto* gpsCtrl = new GpsCtrlDummy(objects::GPS_CONTROLLER); - ObjectFactory::createAcsBoardAssy(pwrSwitcher, assemblyDhbs, gpsCtrl, gpioIF); + ObjectFactory::createAcsBoardAssy(pwrSwitcher, assemblyDhbs, *gps0HealthDev, *gps1HealthDev, + gpsCtrl, gpioIF); } if (cfg.addSusDummies) { diff --git a/fsfw b/fsfw index e2e87b14..1e3c89b6 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit e2e87b149d91c51196c76d6b84243fce1c77a28a +Subproject commit 1e3c89b672e17700a9b50a312d9df29c54977685 diff --git a/mission/genericFactory.cpp b/mission/genericFactory.cpp index ca05a309..2bef9a41 100644 --- a/mission/genericFactory.cpp +++ b/mission/genericFactory.cpp @@ -343,6 +343,7 @@ void ObjectFactory::createSusAssy(PowerSwitchIF& pwrSwitcher, void ObjectFactory::createAcsBoardAssy(PowerSwitchIF& pwrSwitcher, std::array assemblyDhbs, + HealthDevice& gps0HealthDev, HealthDevice& gps1HealthDev, ExtendedControllerBase* gpsCtrl, GpioIF* gpioComIF) { AcsBoardHelper acsBoardHelper = AcsBoardHelper( objects::MGM_0_LIS3_HANDLER, objects::MGM_1_RM3100_HANDLER, objects::MGM_2_LIS3_HANDLER, @@ -359,6 +360,8 @@ void ObjectFactory::createAcsBoardAssy(PowerSwitchIF& pwrSwitcher, } } gpsCtrl->connectModeTreeParent(*acsAss); + gps0HealthDev.setParentQueue(acsAss->getCommandQueue()); + gps1HealthDev.setParentQueue(acsAss->getCommandQueue()); acsAss->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM); } diff --git a/mission/genericFactory.h b/mission/genericFactory.h index 58edfc02..5b602d36 100644 --- a/mission/genericFactory.h +++ b/mission/genericFactory.h @@ -2,6 +2,7 @@ #define MISSION_CORE_GENERICFACTORY_H_ #include +#include #include #include #include @@ -53,6 +54,7 @@ void createRwAssy(PowerSwitchIF& pwrSwitcher, power::Switch_t theSwitch, std::array rws, std::array rwIds); void createSusAssy(PowerSwitchIF& pwrSwitcher, std::array suses); void createAcsBoardAssy(PowerSwitchIF& pwrSwitcher, std::array assemblyDhbs, + HealthDevice& gps0HealthDev, HealthDevice& gps1HealthDev, ExtendedControllerBase* gpsCtrl, GpioIF* gpioComIF); TcsBoardAssembly* createTcsBoardAssy(PowerSwitchIF& pwrSwitcher); diff --git a/mission/system/acs/AcsBoardAssembly.cpp b/mission/system/acs/AcsBoardAssembly.cpp index 1868185e..48621336 100644 --- a/mission/system/acs/AcsBoardAssembly.cpp +++ b/mission/system/acs/AcsBoardAssembly.cpp @@ -78,7 +78,7 @@ ReturnValue_t AcsBoardAssembly::checkChildrenStateOn(Mode_t wantedMode, Submode_ if ((helper.gyro0SideAMode != wantedMode and helper.gyro1SideAMode != wantedMode) or (helper.mgm0SideAMode != wantedMode and helper.mgm1SideAMode != wantedMode) or (helper.gpsMode != MODE_ON) or - (healthHelper.healthTable->getHealth(helper.healthDevGps0) == FAULTY)) { + gps0HealthDevFaulty()) { return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE; } return returnvalue::OK; @@ -86,7 +86,7 @@ ReturnValue_t AcsBoardAssembly::checkChildrenStateOn(Mode_t wantedMode, Submode_ if ((helper.gyro2SideBMode != wantedMode and helper.gyro3SideBMode != wantedMode) or (helper.mgm2SideBMode != wantedMode and helper.mgm3SideBMode != wantedMode) or (helper.gpsMode != MODE_ON) or - (healthHelper.healthTable->getHealth(helper.healthDevGps1) == FAULTY)) { + gps1HealthDevFaulty()) { return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE; } return returnvalue::OK; @@ -296,15 +296,13 @@ void AcsBoardAssembly::handleChildrenLostMode(ReturnValue_t result) { // Special handling to account for GPS devices being faulty. If the GPS device on the other // side is marked faulty, directly to to dual side. if (submode == Submodes::A_SIDE) { - if (healthHelper.healthTable->getHealth(helper.healthDevGps1) == FAULTY or - healthHelper.healthTable->getHealth(helper.healthDevGps1) == PERMANENT_FAULTY) { + if (gps0HealthDevFaulty()) { triggerEvent(DIRECT_TRANSITION_TO_DUAL_OTHER_GPS_FAULTY, submode, 0); startTransition(mode, Submodes::DUAL_MODE); return; } } else if (submode == Submodes::B_SIDE) { - if (healthHelper.healthTable->getHealth(helper.healthDevGps0) == FAULTY or - healthHelper.healthTable->getHealth(helper.healthDevGps0) == PERMANENT_FAULTY) { + if (gps1HealthDevFaulty()) { triggerEvent(DIRECT_TRANSITION_TO_DUAL_OTHER_GPS_FAULTY, submode, 0); startTransition(mode, Submodes::DUAL_MODE); return; @@ -312,3 +310,19 @@ void AcsBoardAssembly::handleChildrenLostMode(ReturnValue_t result) { } DualLaneAssemblyBase::handleChildrenLostMode(result); } + +bool AcsBoardAssembly::gps0HealthDevFaulty() const { + auto health = healthHelper.healthTable->getHealth(helper.healthDevGps0); + if (health == FAULTY or health == PERMANENT_FAULTY) { + return true; + } + return false; +} + +bool AcsBoardAssembly::gps1HealthDevFaulty() const { + auto health = healthHelper.healthTable->getHealth(helper.healthDevGps1); + if (health == FAULTY or health == PERMANENT_FAULTY) { + return true; + } + return false; +} diff --git a/mission/system/acs/AcsBoardAssembly.h b/mission/system/acs/AcsBoardAssembly.h index 6619dadb..0afe9052 100644 --- a/mission/system/acs/AcsBoardAssembly.h +++ b/mission/system/acs/AcsBoardAssembly.h @@ -133,6 +133,8 @@ class AcsBoardAssembly : public DualLaneAssemblyBase { ReturnValue_t handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode); ReturnValue_t checkAndHandleHealthStates(Mode_t deviceMode, Submode_t deviceSubmode); void refreshHelperModes(); + bool gps0HealthDevFaulty() const; + bool gps1HealthDevFaulty() const; }; #endif /* MISSION_SYSTEM_ACSBOARDASSEMBLY_H_ */ diff --git a/tmtc b/tmtc index b72dad49..f899d169 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit b72dad49a9c05a37c094a22d5fdaa15643b5ca7f +Subproject commit f899d169b2a6f7454b2f425dfa2713acf029e016 -- 2.43.0 From 8404ce237b0981e7e64c6c40ac5e4e433debc079 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 3 Apr 2023 18:54:47 +0200 Subject: [PATCH 2/5] something is wrong now --- bsp_q7s/core/ObjectFactory.cpp | 5 +---- dummies/helperFactory.cpp | 5 +---- fsfw | 2 +- mission/genericFactory.cpp | 7 ++++--- mission/genericFactory.h | 1 - mission/system/acs/AcsBoardAssembly.cpp | 28 ++++++++++++++++++++----- mission/system/acs/AcsBoardAssembly.h | 1 + tmtc | 2 +- 8 files changed, 32 insertions(+), 19 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 8113539d..8da0e6ec 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -518,10 +518,7 @@ void ObjectFactory::createAcsBoardComponents(SpiComIF& spiComIF, LinuxLibgpioIF* new GpsHyperionLinuxController(objects::GPS_CONTROLLER, objects::NO_OBJECT, debugGps); gpsCtrl->setResetPinTriggerFunction(gps::triggerGpioResetPin, &RESET_ARGS_GNSS); - auto* healthDevGps0 = new HealthDevice(objects::GPS_0_HEALTH_DEV, objects::ACS_BOARD_ASS); - auto* healthDevGps1 = new HealthDevice(objects::GPS_1_HEALTH_DEV, objects::ACS_BOARD_ASS); - ObjectFactory::createAcsBoardAssy(pwrSwitcher, assemblyChildren, *healthDevGps0, *healthDevGps1, - gpsCtrl, gpioComIF); + ObjectFactory::createAcsBoardAssy(pwrSwitcher, assemblyChildren, gpsCtrl, gpioComIF); #endif /* OBSW_ADD_ACS_HANDLERS == 1 */ } diff --git a/dummies/helperFactory.cpp b/dummies/helperFactory.cpp index 70e80e87..404b640c 100644 --- a/dummies/helperFactory.cpp +++ b/dummies/helperFactory.cpp @@ -99,11 +99,8 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio new GyroAdisDummy(objects::GYRO_2_ADIS_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); assemblyDhbs[7] = new GyroL3GD20Dummy(objects::GYRO_3_L3G_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); - auto* gps0HealthDev = new HealthDevice(objects::GPS_0_HEALTH_DEV, objects::ACS_BOARD_ASS); - auto* gps1HealthDev = new HealthDevice(objects::GPS_1_HEALTH_DEV, objects::ACS_BOARD_ASS); auto* gpsCtrl = new GpsCtrlDummy(objects::GPS_CONTROLLER); - ObjectFactory::createAcsBoardAssy(pwrSwitcher, assemblyDhbs, *gps0HealthDev, *gps1HealthDev, - gpsCtrl, gpioIF); + ObjectFactory::createAcsBoardAssy(pwrSwitcher, assemblyDhbs, gpsCtrl, gpioIF); } if (cfg.addSusDummies) { diff --git a/fsfw b/fsfw index 1e3c89b6..7a392dc3 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 1e3c89b672e17700a9b50a312d9df29c54977685 +Subproject commit 7a392dc33a7e406986fa3684e114a41b0e91de9a diff --git a/mission/genericFactory.cpp b/mission/genericFactory.cpp index 2bef9a41..ce338097 100644 --- a/mission/genericFactory.cpp +++ b/mission/genericFactory.cpp @@ -343,7 +343,6 @@ void ObjectFactory::createSusAssy(PowerSwitchIF& pwrSwitcher, void ObjectFactory::createAcsBoardAssy(PowerSwitchIF& pwrSwitcher, std::array assemblyDhbs, - HealthDevice& gps0HealthDev, HealthDevice& gps1HealthDev, ExtendedControllerBase* gpsCtrl, GpioIF* gpioComIF) { AcsBoardHelper acsBoardHelper = AcsBoardHelper( objects::MGM_0_LIS3_HANDLER, objects::MGM_1_RM3100_HANDLER, objects::MGM_2_LIS3_HANDLER, @@ -360,8 +359,10 @@ void ObjectFactory::createAcsBoardAssy(PowerSwitchIF& pwrSwitcher, } } gpsCtrl->connectModeTreeParent(*acsAss); - gps0HealthDev.setParentQueue(acsAss->getCommandQueue()); - gps1HealthDev.setParentQueue(acsAss->getCommandQueue()); + auto* gps0HealthDev = new HealthDevice(objects::GPS_0_HEALTH_DEV, acsAss->getCommandQueue()); + auto* gps1HealthDev = new HealthDevice(objects::GPS_1_HEALTH_DEV, acsAss->getCommandQueue()); + acsAss->registerChild(objects::GPS_0_HEALTH_DEV, gps0HealthDev->getCommandQueue()); + acsAss->registerChild(objects::GPS_1_HEALTH_DEV, gps1HealthDev->getCommandQueue()); acsAss->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM); } diff --git a/mission/genericFactory.h b/mission/genericFactory.h index 5b602d36..496c516b 100644 --- a/mission/genericFactory.h +++ b/mission/genericFactory.h @@ -54,7 +54,6 @@ void createRwAssy(PowerSwitchIF& pwrSwitcher, power::Switch_t theSwitch, std::array rws, std::array rwIds); void createSusAssy(PowerSwitchIF& pwrSwitcher, std::array suses); void createAcsBoardAssy(PowerSwitchIF& pwrSwitcher, std::array assemblyDhbs, - HealthDevice& gps0HealthDev, HealthDevice& gps1HealthDev, ExtendedControllerBase* gpsCtrl, GpioIF* gpioComIF); TcsBoardAssembly* createTcsBoardAssy(PowerSwitchIF& pwrSwitcher); diff --git a/mission/system/acs/AcsBoardAssembly.cpp b/mission/system/acs/AcsBoardAssembly.cpp index 48621336..9d4238ef 100644 --- a/mission/system/acs/AcsBoardAssembly.cpp +++ b/mission/system/acs/AcsBoardAssembly.cpp @@ -77,16 +77,14 @@ ReturnValue_t AcsBoardAssembly::checkChildrenStateOn(Mode_t wantedMode, Submode_ if (wantedSubmode == A_SIDE) { if ((helper.gyro0SideAMode != wantedMode and helper.gyro1SideAMode != wantedMode) or (helper.mgm0SideAMode != wantedMode and helper.mgm1SideAMode != wantedMode) or - (helper.gpsMode != MODE_ON) or - gps0HealthDevFaulty()) { + (helper.gpsMode != MODE_ON) or gps0HealthDevFaulty()) { return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE; } return returnvalue::OK; } else if (wantedSubmode == B_SIDE) { if ((helper.gyro2SideBMode != wantedMode and helper.gyro3SideBMode != wantedMode) or (helper.mgm2SideBMode != wantedMode and helper.mgm3SideBMode != wantedMode) or - (helper.gpsMode != MODE_ON) or - gps1HealthDevFaulty()) { + (helper.gpsMode != MODE_ON) or gps1HealthDevFaulty()) { return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE; } return returnvalue::OK; @@ -121,7 +119,8 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s modeTable[tableIdx].setSubmode(SUBMODE_NONE); } }; - bool gpsUsable = isModeCommandable(helper.gpsId, helper.gpsMode); + + bool gpsUsable = isGpsUsable(submode); auto gpsCmd = [&](bool gnss0NReset, bool gnss1NReset, uint8_t gnssSelect) { if (gpsUsable) { if (mode == MODE_ON or mode == DeviceHandlerIF::MODE_NORMAL) { @@ -326,3 +325,22 @@ bool AcsBoardAssembly::gps1HealthDevFaulty() const { } return false; } + +bool AcsBoardAssembly::isGpsUsable(uint8_t targetSubmode) const { + if (targetSubmode == duallane::A_SIDE and + healthHelper.healthTable->isFaulty(helper.healthDevGps0)) { + // Causes a OFF command to be sent, which triggers a side switch or a switch to dual side. + return false; + } + if (targetSubmode == duallane::B_SIDE and + healthHelper.healthTable->isFaulty(helper.healthDevGps1)) { + // Causes a OFF command to be sent, which triggers a side switch or a switch to dual side. + return false; + } + auto gpsIter = childrenMap.find(helper.gpsId); + // Check if device is already in target mode + if (gpsIter != childrenMap.end() and gpsIter->second.mode == mode) { + return true; + } + return false; +} diff --git a/mission/system/acs/AcsBoardAssembly.h b/mission/system/acs/AcsBoardAssembly.h index 0afe9052..7e2a46d7 100644 --- a/mission/system/acs/AcsBoardAssembly.h +++ b/mission/system/acs/AcsBoardAssembly.h @@ -135,6 +135,7 @@ class AcsBoardAssembly : public DualLaneAssemblyBase { void refreshHelperModes(); bool gps0HealthDevFaulty() const; bool gps1HealthDevFaulty() const; + bool isGpsUsable(uint8_t targetSubmode) const; }; #endif /* MISSION_SYSTEM_ACSBOARDASSEMBLY_H_ */ diff --git a/tmtc b/tmtc index f899d169..5f870924 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit f899d169b2a6f7454b2f425dfa2713acf029e016 +Subproject commit 5f87092465b3d298b9f66410d333e8069e78df95 -- 2.43.0 From a26d71f745a1a196cde03e690b6fb3bb31697df6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 3 Apr 2023 19:04:21 +0200 Subject: [PATCH 3/5] i hate this crap --- mission/system/acs/AcsBoardAssembly.cpp | 2 +- mission/system/acs/DualLaneAssemblyBase.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mission/system/acs/AcsBoardAssembly.cpp b/mission/system/acs/AcsBoardAssembly.cpp index 9d4238ef..de820535 100644 --- a/mission/system/acs/AcsBoardAssembly.cpp +++ b/mission/system/acs/AcsBoardAssembly.cpp @@ -342,5 +342,5 @@ bool AcsBoardAssembly::isGpsUsable(uint8_t targetSubmode) const { if (gpsIter != childrenMap.end() and gpsIter->second.mode == mode) { return true; } - return false; + return true; } diff --git a/mission/system/acs/DualLaneAssemblyBase.cpp b/mission/system/acs/DualLaneAssemblyBase.cpp index 858e6892..ecb91689 100644 --- a/mission/system/acs/DualLaneAssemblyBase.cpp +++ b/mission/system/acs/DualLaneAssemblyBase.cpp @@ -74,7 +74,7 @@ bool DualLaneAssemblyBase::isModeCommandable(object_id_t object, Mode_t mode) { return true; } // Check for external control health state is done by base class. - return false; + return true; } ReturnValue_t DualLaneAssemblyBase::pwrStateMachineWrapper() { -- 2.43.0 From 23af9685d602d46c21187962752e477ad043a056 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 3 Apr 2023 19:15:14 +0200 Subject: [PATCH 4/5] bugfix --- mission/system/acs/AcsBoardAssembly.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mission/system/acs/AcsBoardAssembly.h b/mission/system/acs/AcsBoardAssembly.h index 7e2a46d7..01e74862 100644 --- a/mission/system/acs/AcsBoardAssembly.h +++ b/mission/system/acs/AcsBoardAssembly.h @@ -21,7 +21,9 @@ struct AcsBoardHelper { gyro1L3gIdSideA(gyro1Id), gyro2AdisIdSideB(gyro2Id), gyro3L3gIdSideB(gyro3Id), - gpsId(gpsId) {} + gpsId(gpsId), + healthDevGps0(gps0HealthDev), + healthDevGps1(gps1HealthDev) {} object_id_t mgm0Lis3IdSideA = objects::NO_OBJECT; object_id_t mgm1Rm3100IdSideA = objects::NO_OBJECT; -- 2.43.0 From 6d0bd88cd96357f7a3edf91828ff3e413f760175 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 3 Apr 2023 19:57:16 +0200 Subject: [PATCH 5/5] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9830c767..7e21a18d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ will consitute of a breaking change warranting a new major release: ## Fixed - PTME was not reset after configuration changes. +- GPS health devices: ACS board assembly not reacts to health changes. ## Changed -- 2.43.0