Bugfix for GPS health devices #555

Merged
muellerr merged 5 commits from bugfix_gps_health_dev_connect_parent into develop 2023-04-03 19:57:51 +02:00
10 changed files with 56 additions and 17 deletions

View File

@ -25,6 +25,7 @@ will consitute of a breaking change warranting a new major release:
## Fixed ## Fixed
- PTME was not reset after configuration changes. - PTME was not reset after configuration changes.
- GPS health devices: ACS board assembly not reacts to health changes.
## Changed ## Changed

View File

@ -518,8 +518,6 @@ void ObjectFactory::createAcsBoardComponents(SpiComIF& spiComIF, LinuxLibgpioIF*
new GpsHyperionLinuxController(objects::GPS_CONTROLLER, objects::NO_OBJECT, debugGps); new GpsHyperionLinuxController(objects::GPS_CONTROLLER, objects::NO_OBJECT, debugGps);
gpsCtrl->setResetPinTriggerFunction(gps::triggerGpioResetPin, &RESET_ARGS_GNSS); 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); ObjectFactory::createAcsBoardAssy(pwrSwitcher, assemblyChildren, gpsCtrl, gpioComIF);
#endif /* OBSW_ADD_ACS_HANDLERS == 1 */ #endif /* OBSW_ADD_ACS_HANDLERS == 1 */
} }

View File

@ -99,8 +99,6 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio
new GyroAdisDummy(objects::GYRO_2_ADIS_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new GyroAdisDummy(objects::GYRO_2_ADIS_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
assemblyDhbs[7] = assemblyDhbs[7] =
new GyroL3GD20Dummy(objects::GYRO_3_L3G_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); 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* gpsCtrl = new GpsCtrlDummy(objects::GPS_CONTROLLER); auto* gpsCtrl = new GpsCtrlDummy(objects::GPS_CONTROLLER);
ObjectFactory::createAcsBoardAssy(pwrSwitcher, assemblyDhbs, gpsCtrl, gpioIF); ObjectFactory::createAcsBoardAssy(pwrSwitcher, assemblyDhbs, gpsCtrl, gpioIF);
} }

2
fsfw

@ -1 +1 @@
Subproject commit e2e87b149d91c51196c76d6b84243fce1c77a28a Subproject commit 7a392dc33a7e406986fa3684e114a41b0e91de9a

View File

@ -359,6 +359,10 @@ void ObjectFactory::createAcsBoardAssy(PowerSwitchIF& pwrSwitcher,
} }
} }
gpsCtrl->connectModeTreeParent(*acsAss); gpsCtrl->connectModeTreeParent(*acsAss);
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); acsAss->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
} }

View File

@ -2,6 +2,7 @@
#define MISSION_CORE_GENERICFACTORY_H_ #define MISSION_CORE_GENERICFACTORY_H_
#include <fsfw/devicehandlers/DeviceHandlerBase.h> #include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <fsfw/devicehandlers/HealthDevice.h>
#include <mission/memory/SdCardMountedIF.h> #include <mission/memory/SdCardMountedIF.h>
#include <mission/persistentTmStoreDefs.h> #include <mission/persistentTmStoreDefs.h>
#include <mission/tcs/Max31865Definitions.h> #include <mission/tcs/Max31865Definitions.h>

View File

@ -77,16 +77,14 @@ ReturnValue_t AcsBoardAssembly::checkChildrenStateOn(Mode_t wantedMode, Submode_
if (wantedSubmode == A_SIDE) { if (wantedSubmode == A_SIDE) {
if ((helper.gyro0SideAMode != wantedMode and helper.gyro1SideAMode != wantedMode) or if ((helper.gyro0SideAMode != wantedMode and helper.gyro1SideAMode != wantedMode) or
(helper.mgm0SideAMode != wantedMode and helper.mgm1SideAMode != wantedMode) or (helper.mgm0SideAMode != wantedMode and helper.mgm1SideAMode != wantedMode) or
(helper.gpsMode != MODE_ON) or (helper.gpsMode != MODE_ON) or gps0HealthDevFaulty()) {
(healthHelper.healthTable->getHealth(helper.healthDevGps0) == FAULTY)) {
return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE; return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE;
} }
return returnvalue::OK; return returnvalue::OK;
} else if (wantedSubmode == B_SIDE) { } else if (wantedSubmode == B_SIDE) {
if ((helper.gyro2SideBMode != wantedMode and helper.gyro3SideBMode != wantedMode) or if ((helper.gyro2SideBMode != wantedMode and helper.gyro3SideBMode != wantedMode) or
(helper.mgm2SideBMode != wantedMode and helper.mgm3SideBMode != wantedMode) or (helper.mgm2SideBMode != wantedMode and helper.mgm3SideBMode != wantedMode) or
(helper.gpsMode != MODE_ON) or (helper.gpsMode != MODE_ON) or gps1HealthDevFaulty()) {
(healthHelper.healthTable->getHealth(helper.healthDevGps1) == FAULTY)) {
return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE; return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE;
} }
return returnvalue::OK; return returnvalue::OK;
@ -121,7 +119,8 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s
modeTable[tableIdx].setSubmode(SUBMODE_NONE); 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) { auto gpsCmd = [&](bool gnss0NReset, bool gnss1NReset, uint8_t gnssSelect) {
if (gpsUsable) { if (gpsUsable) {
if (mode == MODE_ON or mode == DeviceHandlerIF::MODE_NORMAL) { if (mode == MODE_ON or mode == DeviceHandlerIF::MODE_NORMAL) {
@ -296,15 +295,13 @@ void AcsBoardAssembly::handleChildrenLostMode(ReturnValue_t result) {
// Special handling to account for GPS devices being faulty. If the GPS device on the other // 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. // side is marked faulty, directly to to dual side.
if (submode == Submodes::A_SIDE) { if (submode == Submodes::A_SIDE) {
if (healthHelper.healthTable->getHealth(helper.healthDevGps1) == FAULTY or if (gps0HealthDevFaulty()) {
healthHelper.healthTable->getHealth(helper.healthDevGps1) == PERMANENT_FAULTY) {
triggerEvent(DIRECT_TRANSITION_TO_DUAL_OTHER_GPS_FAULTY, submode, 0); triggerEvent(DIRECT_TRANSITION_TO_DUAL_OTHER_GPS_FAULTY, submode, 0);
startTransition(mode, Submodes::DUAL_MODE); startTransition(mode, Submodes::DUAL_MODE);
return; return;
} }
} else if (submode == Submodes::B_SIDE) { } else if (submode == Submodes::B_SIDE) {
if (healthHelper.healthTable->getHealth(helper.healthDevGps0) == FAULTY or if (gps1HealthDevFaulty()) {
healthHelper.healthTable->getHealth(helper.healthDevGps0) == PERMANENT_FAULTY) {
triggerEvent(DIRECT_TRANSITION_TO_DUAL_OTHER_GPS_FAULTY, submode, 0); triggerEvent(DIRECT_TRANSITION_TO_DUAL_OTHER_GPS_FAULTY, submode, 0);
startTransition(mode, Submodes::DUAL_MODE); startTransition(mode, Submodes::DUAL_MODE);
return; return;
@ -312,3 +309,38 @@ void AcsBoardAssembly::handleChildrenLostMode(ReturnValue_t result) {
} }
DualLaneAssemblyBase::handleChildrenLostMode(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;
}
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 true;
}

View File

@ -21,7 +21,9 @@ struct AcsBoardHelper {
gyro1L3gIdSideA(gyro1Id), gyro1L3gIdSideA(gyro1Id),
gyro2AdisIdSideB(gyro2Id), gyro2AdisIdSideB(gyro2Id),
gyro3L3gIdSideB(gyro3Id), gyro3L3gIdSideB(gyro3Id),
gpsId(gpsId) {} gpsId(gpsId),
healthDevGps0(gps0HealthDev),
healthDevGps1(gps1HealthDev) {}
object_id_t mgm0Lis3IdSideA = objects::NO_OBJECT; object_id_t mgm0Lis3IdSideA = objects::NO_OBJECT;
object_id_t mgm1Rm3100IdSideA = objects::NO_OBJECT; object_id_t mgm1Rm3100IdSideA = objects::NO_OBJECT;
@ -133,6 +135,9 @@ class AcsBoardAssembly : public DualLaneAssemblyBase {
ReturnValue_t handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode); ReturnValue_t handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode);
ReturnValue_t checkAndHandleHealthStates(Mode_t deviceMode, Submode_t deviceSubmode); ReturnValue_t checkAndHandleHealthStates(Mode_t deviceMode, Submode_t deviceSubmode);
void refreshHelperModes(); void refreshHelperModes();
bool gps0HealthDevFaulty() const;
bool gps1HealthDevFaulty() const;
bool isGpsUsable(uint8_t targetSubmode) const;
}; };
#endif /* MISSION_SYSTEM_ACSBOARDASSEMBLY_H_ */ #endif /* MISSION_SYSTEM_ACSBOARDASSEMBLY_H_ */

View File

@ -74,7 +74,7 @@ bool DualLaneAssemblyBase::isModeCommandable(object_id_t object, Mode_t mode) {
return true; return true;
} }
// Check for external control health state is done by base class. // Check for external control health state is done by base class.
return false; return true;
} }
ReturnValue_t DualLaneAssemblyBase::pwrStateMachineWrapper() { ReturnValue_t DualLaneAssemblyBase::pwrStateMachineWrapper() {

2
tmtc

@ -1 +1 @@
Subproject commit b72dad49a9c05a37c094a22d5fdaa15643b5ca7f Subproject commit 5f87092465b3d298b9f66410d333e8069e78df95