v1.16.0 #323

Merged
muellerr merged 223 commits from develop into main 2022-11-18 14:23:24 +01:00
3 changed files with 70 additions and 127 deletions
Showing only changes of commit baa6f05f8e - Show all commits

View File

@ -1,38 +1,36 @@
#include "acsModeTree.h"
#include <commonObjects.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/subsystem/Subsystem.h>
#include <fsfw/subsystem/modes/ModeDefinitions.h>
FixedArrayList<ModeListEntry, 2> ACS_SEQUENCE_OFF = FixedArrayList<ModeListEntry, 2>();
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;
#include "mission/controller/controllerdefinitions/AcsControllerDefinitions.h"
// Alias for checker function
const auto CHK = satsystem::checkInsert;
static const auto OFF = HasModesIF::MODE_OFF;
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() {
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);
buildDetumbleSequence(acsSubsystem, entry);
acsSubsystem->setInitialMode(HasModesIF::MODE_OFF);
@ -41,121 +39,74 @@ void satsystem::acsSubsystemInit() {
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);
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
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);
ih(objects::ACS_CONTROLLER, OFF, 0, ACS_TABLE_OFF_TRANS.second);
ih(objects::IMTQ_HANDLER, OFF, 0, ACS_TABLE_OFF_TRANS.second);
ih(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_OFF_TRANS.second);
ih(objects::ACS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second);
ih(objects::SUS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second);
ih(objects::RW_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second);
// Build OFF sequence
eh.setTableId(ACS_TABLE_OFF_TGT_ID);
eh.setTableId(ACS_TABLE_OFF_TGT.first);
eh.setWaitSeconds(0);
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.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) {
std::string context = "satsystem::buildDetumbleSequence";
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
eh.setObject(objects::ACS_CONTROLLER);
eh.setMode(acs::CtrlModes::DETUMBLE);
eh.setSubmode(0);
CHK(ACS_TABLE_DETUMBLE_TGT.insert(eh), ctxc);
ih(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TGT.second);
ih(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TGT.second);
ih(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second);
ih(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second);
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);
ss->addTable(&ACS_TABLE_DETUMBLE_TGT.second, ACS_TABLE_DETUMBLE_TGT.first, 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);
ih(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
ih(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
ih(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
ih(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
ih(objects::RW_ASS, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
// Build DETUMBLE transition 1
ih(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TRANS_1.second);
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);
// Build full sequence
ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_0.second, ACS_TABLE_DETUMBLE_TRANS_0.first, false, true);
ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_1.second, ACS_TABLE_DETUMBLE_TRANS_1.first, false, true);
ss->addSequence(&ACS_SEQUENCE_DETUMBLE.second, ACS_SEQUENCE_DETUMBLE.first,
ACS_SEQUENCE_DETUMBLE.first, false, true);
}
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::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;
}
}

View File

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

View File

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