#include #include #include "acsModeTree.h" #include "mission/controller/controllerdefinitions/AcsControllerDefinitions.h" #include #include #include FixedArrayList ACS_SEQUENCE_OFF = FixedArrayList(); FixedArrayList ACS_TABLE_OFF_TGT = FixedArrayList(); FixedArrayList ACS_TABLE_OFF_TRANS = FixedArrayList(); static constexpr Mode_t ACS_SEQUENCE_OFF_ID = acs::CtrlModes::OFF; static constexpr Mode_t ACS_TABLE_OFF_TGT_ID = (acs::CtrlModes::OFF << 8) | 1; static constexpr Mode_t ACS_TABLE_OFF_TRANS_ID = (acs::CtrlModes::OFF << 8) | 2; FixedArrayList ACS_SEQUENCE_DETUMBLE = FixedArrayList(); FixedArrayList ACS_TABLE_DETUMBLE_TGT = FixedArrayList(); FixedArrayList ACS_TABLE_DETUMBLE_TRANS_0 = FixedArrayList(); FixedArrayList ACS_TABLE_DETUMBLE_TRANS_1 = FixedArrayList(); static constexpr Mode_t ACS_SEQUENCE_DETUMBLE_ID = acs::CtrlModes::DETUMBLE; static constexpr Mode_t ACS_TABLE_DETUMBLE_TGT_ID = (acs::CtrlModes::DETUMBLE << 8) | 1; static constexpr Mode_t ACS_TABLE_DETUMBLE_TRANS_0_ID = (acs::CtrlModes::DETUMBLE << 8) | 2; static constexpr Mode_t ACS_TABLE_DETUMBLE_TRANS_1_ID = (acs::CtrlModes::DETUMBLE << 8) | 3; // Alias for checker function const auto CHK = satsystem::checkInsert; static const auto OFF = HasModesIF::MODE_OFF; static const auto NML = DeviceHandlerIF::MODE_NORMAL; void satsystem::acsSubsystemInit() { ModeListEntry entry; Subsystem *acsSubsystem = new Subsystem(objects::ACS_SUBSYSTEM, objects::EIVE_SYSTEM, 20, 20); buildOffSequence(acsSubsystem, entry); buildDetumbleSequence(acsSubsystem, entry); acsSubsystem->setInitialMode(HasModesIF::MODE_OFF); } void satsystem::buildOffSequence(Subsystem* ss, ModeListEntry& eh) { std::string context = "satsystem::buildOffSequence"; auto ctxc = context.c_str(); // Build OFF target ss->addTable(&ACS_TABLE_OFF_TGT, ACS_TABLE_OFF_TGT_ID, false, true); // Build OFF transition eh.setObject(objects::ACS_CONTROLLER); eh.setMode(OFF); eh.setSubmode(0); CHK(ACS_TABLE_OFF_TRANS.insert(eh), ctxc); eh.setObject(objects::IMTQ_HANDLER); eh.setMode(OFF); eh.setSubmode(0); CHK(ACS_TABLE_OFF_TRANS.insert(eh), ctxc); eh.setObject(objects::STAR_TRACKER); eh.setMode(OFF); eh.setSubmode(0); CHK(ACS_TABLE_OFF_TRANS.insert(eh), ctxc); eh.setObject(objects::ACS_BOARD_ASS); eh.setMode(OFF); eh.setSubmode(0); CHK(ACS_TABLE_OFF_TRANS.insert(eh), ctxc); eh.setObject(objects::SUS_BOARD_ASS); eh.setMode(OFF); eh.setSubmode(0); CHK(ACS_TABLE_OFF_TRANS.insert(eh), ctxc); eh.setObject(objects::RW_ASS); eh.setMode(OFF); eh.setSubmode(0); CHK(ACS_TABLE_OFF_TRANS.insert(eh), ctxc); ss->addTable(&ACS_TABLE_OFF_TRANS, ACS_TABLE_OFF_TRANS_ID, false, true); // Build OFF sequence eh.setTableId(ACS_TABLE_OFF_TGT_ID); eh.setWaitSeconds(0); eh.setCheckSuccess(false); CHK(ACS_SEQUENCE_OFF.insert(eh), ctxc); eh.setTableId(ACS_TABLE_OFF_TRANS_ID); eh.setWaitSeconds(0); eh.setCheckSuccess(false); CHK(ACS_SEQUENCE_OFF.insert(eh), ctxc); ss->addSequence(&ACS_SEQUENCE_OFF, ACS_SEQUENCE_OFF_ID, ACS_SEQUENCE_OFF_ID, false, true); } void satsystem::buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { std::string context = "satsystem::buildDetumbleSequence"; auto ctxc = context.c_str(); // Build DETUMBLE target eh.setObject(objects::ACS_CONTROLLER); eh.setMode(acs::CtrlModes::DETUMBLE); eh.setSubmode(0); CHK(ACS_TABLE_DETUMBLE_TGT.insert(eh), ctxc); eh.setObject(objects::IMTQ_HANDLER); eh.setMode(NML); eh.setSubmode(0); CHK(ACS_TABLE_DETUMBLE_TGT.insert(eh), ctxc); eh.setObject(objects::SUS_BOARD_ASS); eh.setMode(NML); eh.setSubmode(0); CHK(ACS_TABLE_DETUMBLE_TGT.insert(eh), ctxc); eh.setObject(objects::ACS_BOARD_ASS); eh.setMode(NML); eh.setSubmode(0); CHK(ACS_TABLE_DETUMBLE_TGT.insert(eh), ctxc); ss->addTable(&ACS_TABLE_DETUMBLE_TGT, ACS_TABLE_DETUMBLE_TGT_ID, false, true); // Build DETUMBLE transition 0 eh.setObject(objects::IMTQ_HANDLER); eh.setMode(NML); eh.setSubmode(0); CHK(ACS_TABLE_DETUMBLE_TRANS_0.insert(eh), ctxc); eh.setObject(objects::STAR_TRACKER); eh.setMode(OFF); eh.setSubmode(0); CHK(ACS_TABLE_DETUMBLE_TRANS_0.insert(eh), ctxc); eh.setObject(objects::ACS_BOARD_ASS); eh.setMode(NML); eh.setSubmode(0); CHK(ACS_TABLE_DETUMBLE_TRANS_0.insert(eh), ctxc); eh.setObject(objects::SUS_BOARD_ASS); eh.setMode(NML); eh.setSubmode(0); CHK(ACS_TABLE_DETUMBLE_TRANS_0.insert(eh), ctxc); eh.setObject(objects::RW_ASS); eh.setMode(OFF); eh.setSubmode(0); CHK(ACS_TABLE_DETUMBLE_TRANS_0.insert(eh), ctxc); ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_0, ACS_TABLE_DETUMBLE_TRANS_0_ID, false, true); // Build DETUMBLE transition 1 eh.setObject(objects::ACS_CONTROLLER); eh.setMode(acs::CtrlModes::DETUMBLE); eh.setSubmode(0); CHK(ACS_TABLE_DETUMBLE_TRANS_1.insert(eh), ctxc); ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_1, ACS_TABLE_DETUMBLE_TRANS_1_ID, false, true); ss->addSequence(&ACS_SEQUENCE_DETUMBLE, ACS_SEQUENCE_DETUMBLE_ID, 0 /*Ü TODO*/, false, true); } void satsystem::buildSafeSequence(Subsystem* ss, ModeListEntry& eh) {} void satsystem::buildIdleSequence(Subsystem* ss, ModeListEntry& eh) {} void satsystem::buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) {} void satsystem::checkInsert(ReturnValue_t result, const char* ctx) { if(result != HasReturnvaluesIF::RETURN_OK) { sif::error << "Insertion failed at " << ctx << std::endl; } }