neat
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2022-04-25 08:48:22 +02:00
parent e3783d0941
commit baa6f05f8e
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
3 changed files with 70 additions and 127 deletions

View File

@ -1,38 +1,36 @@
#include "acsModeTree.h"
#include <commonObjects.h> #include <commonObjects.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h> #include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include "acsModeTree.h"
#include "mission/controller/controllerdefinitions/AcsControllerDefinitions.h"
#include <fsfw/subsystem/modes/ModeDefinitions.h>
#include <fsfw/subsystem/Subsystem.h>
#include <fsfw/modes/HasModesIF.h> #include <fsfw/modes/HasModesIF.h>
#include <fsfw/subsystem/Subsystem.h>
#include <fsfw/subsystem/modes/ModeDefinitions.h>
FixedArrayList<ModeListEntry, 2> ACS_SEQUENCE_OFF = FixedArrayList<ModeListEntry, 2>(); #include "mission/controller/controllerdefinitions/AcsControllerDefinitions.h"
FixedArrayList<ModeListEntry, 0> ACS_TABLE_OFF_TGT = FixedArrayList<ModeListEntry, 0>();
FixedArrayList<ModeListEntry, 6> ACS_TABLE_OFF_TRANS = FixedArrayList<ModeListEntry, 6>();
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<ModeListEntry, 2> ACS_SEQUENCE_DETUMBLE = FixedArrayList<ModeListEntry, 2>();
FixedArrayList<ModeListEntry, 3> ACS_TABLE_DETUMBLE_TGT = FixedArrayList<ModeListEntry, 3>();
FixedArrayList<ModeListEntry, 5> ACS_TABLE_DETUMBLE_TRANS_0 = FixedArrayList<ModeListEntry, 5>();
FixedArrayList<ModeListEntry, 1> ACS_TABLE_DETUMBLE_TRANS_1 = FixedArrayList<ModeListEntry, 1>();
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 // Alias for checker function
const auto CHK = satsystem::checkInsert; const auto CHK = satsystem::checkInsert;
static const auto OFF = HasModesIF::MODE_OFF; static const auto OFF = HasModesIF::MODE_OFF;
static const auto NML = DeviceHandlerIF::MODE_NORMAL; static const auto NML = DeviceHandlerIF::MODE_NORMAL;
auto ACS_SEQUENCE_OFF = std::make_pair(acs::CtrlModes::OFF, FixedArrayList<ModeListEntry, 2>());
auto ACS_TABLE_OFF_TGT =
std::make_pair((acs::CtrlModes::OFF << 8) | 1, FixedArrayList<ModeListEntry, 0>());
auto ACS_TABLE_OFF_TRANS =
std::make_pair((acs::CtrlModes::OFF << 8) | 2, FixedArrayList<ModeListEntry, 6>());
auto ACS_SEQUENCE_DETUMBLE =
std::make_pair(acs::CtrlModes::DETUMBLE, FixedArrayList<ModeListEntry, 2>());
auto ACS_TABLE_DETUMBLE_TGT =
std::make_pair((acs::CtrlModes::DETUMBLE << 8) | 1, FixedArrayList<ModeListEntry, 3>());
auto ACS_TABLE_DETUMBLE_TRANS_0 =
std::make_pair((acs::CtrlModes::DETUMBLE << 8) | 2, FixedArrayList<ModeListEntry, 5>());
auto ACS_TABLE_DETUMBLE_TRANS_1 =
std::make_pair((acs::CtrlModes::DETUMBLE << 8) | 3, FixedArrayList<ModeListEntry, 1>());
void satsystem::acsSubsystemInit() { void satsystem::acsSubsystemInit() {
ModeListEntry entry; ModeListEntry entry;
Subsystem *acsSubsystem = new Subsystem(objects::ACS_SUBSYSTEM, objects::EIVE_SYSTEM, 20, 20); Subsystem* acsSubsystem = new Subsystem(objects::ACS_SUBSYSTEM, objects::EIVE_SYSTEM, 20, 20);
buildOffSequence(acsSubsystem, entry); buildOffSequence(acsSubsystem, entry);
buildDetumbleSequence(acsSubsystem, entry); buildDetumbleSequence(acsSubsystem, entry);
acsSubsystem->setInitialMode(HasModesIF::MODE_OFF); acsSubsystem->setInitialMode(HasModesIF::MODE_OFF);
@ -41,121 +39,74 @@ void satsystem::acsSubsystemInit() {
void satsystem::buildOffSequence(Subsystem* ss, ModeListEntry& eh) { void satsystem::buildOffSequence(Subsystem* ss, ModeListEntry& eh) {
std::string context = "satsystem::buildOffSequence"; std::string context = "satsystem::buildOffSequence";
auto ctxc = context.c_str(); auto ctxc = context.c_str();
// Build OFF target
ss->addTable(&ACS_TABLE_OFF_TGT, ACS_TABLE_OFF_TGT_ID, false, true); auto ih = [&](object_id_t obj, Mode_t mode, Submode_t submode,
ArrayList<ModeListEntry>& sequence) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
CHK(sequence.insert(eh), ctxc);
};
// Build OFF transition // Build OFF transition
eh.setObject(objects::ACS_CONTROLLER); ih(objects::ACS_CONTROLLER, OFF, 0, ACS_TABLE_OFF_TRANS.second);
eh.setMode(OFF); ih(objects::IMTQ_HANDLER, OFF, 0, ACS_TABLE_OFF_TRANS.second);
eh.setSubmode(0); ih(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_OFF_TRANS.second);
CHK(ACS_TABLE_OFF_TRANS.insert(eh), ctxc); ih(objects::ACS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second);
ih(objects::SUS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second);
eh.setObject(objects::IMTQ_HANDLER); ih(objects::RW_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second);
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 // Build OFF sequence
eh.setTableId(ACS_TABLE_OFF_TGT_ID); eh.setTableId(ACS_TABLE_OFF_TGT.first);
eh.setWaitSeconds(0); eh.setWaitSeconds(0);
eh.setCheckSuccess(false); eh.setCheckSuccess(false);
CHK(ACS_SEQUENCE_OFF.insert(eh), ctxc); CHK(ACS_SEQUENCE_OFF.second.insert(eh), ctxc);
eh.setTableId(ACS_TABLE_OFF_TRANS_ID); eh.setTableId(ACS_TABLE_OFF_TRANS.first);
eh.setWaitSeconds(0); eh.setWaitSeconds(0);
eh.setCheckSuccess(false); eh.setCheckSuccess(false);
CHK(ACS_SEQUENCE_OFF.insert(eh), ctxc); CHK(ACS_SEQUENCE_OFF.second.insert(eh), ctxc);
ss->addSequence(&ACS_SEQUENCE_OFF, ACS_SEQUENCE_OFF_ID, ACS_SEQUENCE_OFF_ID, false, true); // Build OFF target
ss->addTable(&ACS_TABLE_OFF_TGT.second, ACS_TABLE_OFF_TGT.first, false, true);
ss->addTable(&ACS_TABLE_OFF_TRANS.second, ACS_TABLE_OFF_TRANS.first, false, true);
ss->addSequence(&ACS_SEQUENCE_OFF.second, ACS_SEQUENCE_OFF.first, ACS_SEQUENCE_OFF.first, false,
true);
} }
void satsystem::buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { void satsystem::buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) {
std::string context = "satsystem::buildDetumbleSequence"; std::string context = "satsystem::buildDetumbleSequence";
auto ctxc = context.c_str(); auto ctxc = context.c_str();
auto ih = [&](object_id_t obj, Mode_t mode, Submode_t submode,
ArrayList<ModeListEntry>& sequence) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
CHK(sequence.insert(eh), ctxc);
};
// Build DETUMBLE target // Build DETUMBLE target
eh.setObject(objects::ACS_CONTROLLER); ih(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TGT.second);
eh.setMode(acs::CtrlModes::DETUMBLE); ih(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TGT.second);
eh.setSubmode(0); ih(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second);
CHK(ACS_TABLE_DETUMBLE_TGT.insert(eh), ctxc); ih(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second);
eh.setObject(objects::IMTQ_HANDLER); ss->addTable(&ACS_TABLE_DETUMBLE_TGT.second, ACS_TABLE_DETUMBLE_TGT.first, false, true);
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 // Build DETUMBLE transition 0
ih(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
eh.setObject(objects::IMTQ_HANDLER); ih(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
eh.setMode(NML); ih(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
eh.setSubmode(0); ih(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
CHK(ACS_TABLE_DETUMBLE_TRANS_0.insert(eh), ctxc); ih(objects::RW_ASS, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
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 // Build DETUMBLE transition 1
ih(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TRANS_1.second);
eh.setObject(objects::ACS_CONTROLLER); // Build full sequence
eh.setMode(acs::CtrlModes::DETUMBLE); ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_0.second, ACS_TABLE_DETUMBLE_TRANS_0.first, false, true);
eh.setSubmode(0); ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_1.second, ACS_TABLE_DETUMBLE_TRANS_1.first, false, true);
CHK(ACS_TABLE_DETUMBLE_TRANS_1.insert(eh), ctxc); ss->addSequence(&ACS_SEQUENCE_DETUMBLE.second, ACS_SEQUENCE_DETUMBLE.first,
ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_1, ACS_TABLE_DETUMBLE_TRANS_1_ID, false, true); ACS_SEQUENCE_DETUMBLE.first, false, true);
ss->addSequence(&ACS_SEQUENCE_DETUMBLE, ACS_SEQUENCE_DETUMBLE_ID, 0 /*Ü TODO*/, false, true);
} }
void satsystem::buildSafeSequence(Subsystem* ss, ModeListEntry& eh) {} void satsystem::buildSafeSequence(Subsystem* ss, ModeListEntry& eh) {}
@ -165,7 +116,7 @@ void satsystem::buildIdleSequence(Subsystem* ss, ModeListEntry& eh) {}
void satsystem::buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) {} void satsystem::buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) {}
void satsystem::checkInsert(ReturnValue_t result, const char* ctx) { void satsystem::checkInsert(ReturnValue_t result, const char* ctx) {
if(result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Insertion failed at " << ctx << std::endl; sif::error << "Insertion failed at " << ctx << std::endl;
} }
} }

View File

@ -12,4 +12,4 @@ void buildIdleSequence(Subsystem* ss, ModeListEntry& entryHelper);
void buildTargetPtSequence(Subsystem* ss, ModeListEntry& entryHelper); void buildTargetPtSequence(Subsystem* ss, ModeListEntry& entryHelper);
void checkInsert(ReturnValue_t result, const char* ctx); void checkInsert(ReturnValue_t result, const char* ctx);
} } // namespace satsystem

View File

@ -5,16 +5,8 @@
namespace acs { namespace acs {
enum CtrlModes { enum CtrlModes { OFF = HasModesIF::MODE_OFF, DETUMBLE = 2, SAFE = 3, IDLE = 4, TARGET_PT = 5 };
OFF = HasModesIF::MODE_OFF,
DETUMBLE = 2,
SAFE = 3,
IDLE = 4,
TARGET_PT = 5
};
} }
#endif /* MISSION_CONTROLLER_CONTROLLERDEFINITIONS_ACSCONTROLLERDEFINITIONS_H_ */ #endif /* MISSION_CONTROLLER_CONTROLLERDEFINITIONS_ACSCONTROLLERDEFINITIONS_H_ */