2022-04-25 08:48:22 +02:00
|
|
|
#include "acsModeTree.h"
|
|
|
|
|
2022-10-10 17:40:30 +02:00
|
|
|
#include <fsfw/container/FixedMap.h>
|
2022-04-22 17:49:28 +02:00
|
|
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
2022-04-22 17:00:23 +02:00
|
|
|
#include <fsfw/modes/HasModesIF.h>
|
2022-04-25 08:48:22 +02:00
|
|
|
#include <fsfw/subsystem/Subsystem.h>
|
|
|
|
#include <fsfw/subsystem/modes/ModeDefinitions.h>
|
2022-04-22 17:00:23 +02:00
|
|
|
|
2022-09-29 19:40:00 +02:00
|
|
|
#include "eive/objects.h"
|
2022-04-25 08:48:22 +02:00
|
|
|
#include "mission/controller/controllerdefinitions/AcsControllerDefinitions.h"
|
2022-04-28 16:20:41 +02:00
|
|
|
#include "util.h"
|
2022-04-22 17:49:28 +02:00
|
|
|
|
2022-10-17 10:52:05 +02:00
|
|
|
Subsystem satsystem::acs::ACS_SUBSYSTEM(objects::ACS_SUBSYSTEM, 12, 24);
|
|
|
|
|
2022-04-25 13:36:11 +02:00
|
|
|
namespace {
|
2022-10-17 10:52:05 +02:00
|
|
|
// Alias for checker function
|
|
|
|
const auto check = subsystem::checkInsert;
|
2022-09-29 19:40:00 +02:00
|
|
|
|
2022-04-25 10:50:59 +02:00
|
|
|
void buildOffSequence(Subsystem* ss, ModeListEntry& eh);
|
|
|
|
void buildDetumbleSequence(Subsystem* ss, ModeListEntry& entryHelper);
|
|
|
|
void buildSafeSequence(Subsystem* ss, ModeListEntry& entryHelper);
|
|
|
|
void buildIdleSequence(Subsystem* ss, ModeListEntry& entryHelper);
|
|
|
|
void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& entryHelper);
|
|
|
|
void buildTargetPtSequence(Subsystem* ss, ModeListEntry& entryHelper);
|
2022-04-25 13:36:11 +02:00
|
|
|
} // namespace
|
2022-04-25 10:50:59 +02:00
|
|
|
|
2022-04-22 17:49:28 +02:00
|
|
|
static const auto OFF = HasModesIF::MODE_OFF;
|
|
|
|
static const auto NML = DeviceHandlerIF::MODE_NORMAL;
|
2022-04-22 17:00:23 +02:00
|
|
|
|
2022-04-25 10:30:47 +02:00
|
|
|
auto ACS_SEQUENCE_OFF =
|
|
|
|
std::make_pair(acs::CtrlModes::OFF << 24, FixedArrayList<ModeListEntry, 2>());
|
2022-04-25 08:48:22 +02:00
|
|
|
auto ACS_TABLE_OFF_TGT =
|
2022-11-29 23:24:45 +01:00
|
|
|
std::make_pair((acs::CtrlModes::OFF << 24) | 1, FixedArrayList<ModeListEntry, 1>());
|
2022-04-25 08:48:22 +02:00
|
|
|
auto ACS_TABLE_OFF_TRANS =
|
2022-04-25 10:30:47 +02:00
|
|
|
std::make_pair((acs::CtrlModes::OFF << 24) | 2, FixedArrayList<ModeListEntry, 6>());
|
2022-04-25 08:48:22 +02:00
|
|
|
|
|
|
|
auto ACS_SEQUENCE_DETUMBLE =
|
2022-04-25 10:30:47 +02:00
|
|
|
std::make_pair(acs::CtrlModes::DETUMBLE << 24, FixedArrayList<ModeListEntry, 3>());
|
2022-04-25 08:48:22 +02:00
|
|
|
auto ACS_TABLE_DETUMBLE_TGT =
|
2022-04-25 10:30:47 +02:00
|
|
|
std::make_pair((acs::CtrlModes::DETUMBLE << 24) | 1, FixedArrayList<ModeListEntry, 4>());
|
2022-04-25 08:48:22 +02:00
|
|
|
auto ACS_TABLE_DETUMBLE_TRANS_0 =
|
2022-04-25 10:30:47 +02:00
|
|
|
std::make_pair((acs::CtrlModes::DETUMBLE << 24) | 2, FixedArrayList<ModeListEntry, 5>());
|
2022-04-25 08:48:22 +02:00
|
|
|
auto ACS_TABLE_DETUMBLE_TRANS_1 =
|
2022-04-25 10:30:47 +02:00
|
|
|
std::make_pair((acs::CtrlModes::DETUMBLE << 24) | 3, FixedArrayList<ModeListEntry, 1>());
|
2022-04-25 08:48:22 +02:00
|
|
|
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ACS_SEQUENCE_SAFE =
|
2022-04-25 10:30:47 +02:00
|
|
|
std::make_pair(acs::CtrlModes::SAFE << 24, FixedArrayList<ModeListEntry, 3>());
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ACS_TABLE_SAFE_TGT =
|
2022-04-25 10:30:47 +02:00
|
|
|
std::make_pair((acs::CtrlModes::SAFE << 24) | 1, FixedArrayList<ModeListEntry, 4>());
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ACS_TABLE_SAFE_TRANS_0 =
|
2022-04-25 10:30:47 +02:00
|
|
|
std::make_pair((acs::CtrlModes::SAFE << 24) | 2, FixedArrayList<ModeListEntry, 5>());
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ACS_TABLE_SAFE_TRANS_1 =
|
2022-04-25 10:30:47 +02:00
|
|
|
std::make_pair((acs::CtrlModes::SAFE << 24) | 3, FixedArrayList<ModeListEntry, 1>());
|
2022-04-25 10:08:29 +02:00
|
|
|
|
|
|
|
auto ACS_SEQUENCE_IDLE =
|
2022-04-25 10:30:47 +02:00
|
|
|
std::make_pair(acs::CtrlModes::IDLE << 24, FixedArrayList<ModeListEntry, 3>());
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ACS_TABLE_IDLE_TGT =
|
2022-04-25 10:30:47 +02:00
|
|
|
std::make_pair((acs::CtrlModes::IDLE << 24) | 1, FixedArrayList<ModeListEntry, 5>());
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ACS_TABLE_IDLE_TRANS_0 =
|
2022-04-25 10:30:47 +02:00
|
|
|
std::make_pair((acs::CtrlModes::IDLE << 24) | 2, FixedArrayList<ModeListEntry, 5>());
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ACS_TABLE_IDLE_TRANS_1 =
|
2022-04-25 10:30:47 +02:00
|
|
|
std::make_pair((acs::CtrlModes::IDLE << 24) | 3, FixedArrayList<ModeListEntry, 1>());
|
|
|
|
|
|
|
|
auto ACS_SEQUENCE_IDLE_CHRG = std::make_pair(acs::CtrlModes::IDLE << 24 | (acs::IDLE_CHARGE << 8),
|
|
|
|
FixedArrayList<ModeListEntry, 3>());
|
|
|
|
auto ACS_TABLE_IDLE_CHRG_TGT = std::make_pair(
|
|
|
|
(acs::CtrlModes::IDLE << 24) | (acs::IDLE_CHARGE << 8) | 1, FixedArrayList<ModeListEntry, 4>());
|
|
|
|
auto ACS_TABLE_IDLE_CHRG_TRANS_0 = std::make_pair(
|
|
|
|
(acs::CtrlModes::IDLE << 24) | (acs::IDLE_CHARGE << 8) | 2, FixedArrayList<ModeListEntry, 5>());
|
|
|
|
auto ACS_TABLE_IDLE_CHRG_TRANS_1 = std::make_pair(
|
|
|
|
(acs::CtrlModes::IDLE << 24) | (acs::IDLE_CHARGE << 8) | 3, FixedArrayList<ModeListEntry, 1>());
|
2022-04-25 10:08:29 +02:00
|
|
|
|
|
|
|
auto ACS_SEQUENCE_TARGET_PT =
|
|
|
|
std::make_pair(acs::CtrlModes::TARGET_PT, FixedArrayList<ModeListEntry, 3>());
|
|
|
|
auto ACS_TABLE_TARGET_PT_TGT =
|
2022-09-30 15:05:48 +02:00
|
|
|
std::make_pair((acs::CtrlModes::TARGET_PT << 24) | 1, FixedArrayList<ModeListEntry, 6>());
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ACS_TABLE_TARGET_PT_TRANS_0 =
|
2022-04-25 10:30:47 +02:00
|
|
|
std::make_pair((acs::CtrlModes::TARGET_PT << 24) | 2, FixedArrayList<ModeListEntry, 5>());
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ACS_TABLE_TARGET_PT_TRANS_1 =
|
2022-04-25 10:30:47 +02:00
|
|
|
std::make_pair((acs::CtrlModes::TARGET_PT << 24) | 3, FixedArrayList<ModeListEntry, 1>());
|
2022-04-25 10:08:29 +02:00
|
|
|
|
2022-04-25 13:36:11 +02:00
|
|
|
void satsystem::acs::init() {
|
2022-04-22 17:00:23 +02:00
|
|
|
ModeListEntry entry;
|
2022-09-29 19:40:00 +02:00
|
|
|
buildOffSequence(&ACS_SUBSYSTEM, entry);
|
|
|
|
buildSafeSequence(&ACS_SUBSYSTEM, entry);
|
|
|
|
buildDetumbleSequence(&ACS_SUBSYSTEM, entry);
|
|
|
|
buildIdleSequence(&ACS_SUBSYSTEM, entry);
|
|
|
|
buildIdleChargeSequence(&ACS_SUBSYSTEM, entry);
|
|
|
|
buildTargetPtSequence(&ACS_SUBSYSTEM, entry);
|
|
|
|
ACS_SUBSYSTEM.setInitialMode(HasModesIF::MODE_OFF);
|
2022-04-22 17:00:23 +02:00
|
|
|
}
|
|
|
|
|
2022-04-25 13:36:11 +02:00
|
|
|
namespace {
|
|
|
|
|
2022-04-25 10:50:59 +02:00
|
|
|
void buildOffSequence(Subsystem* ss, ModeListEntry& eh) {
|
2022-04-25 13:36:11 +02:00
|
|
|
std::string context = "satsystem::acs::buildOffSequence";
|
2022-04-22 17:49:28 +02:00
|
|
|
auto ctxc = context.c_str();
|
2022-04-25 10:08:29 +02:00
|
|
|
// Insert Helper Table
|
2022-04-25 10:30:47 +02:00
|
|
|
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
|
2022-04-25 08:48:22 +02:00
|
|
|
eh.setObject(obj);
|
|
|
|
eh.setMode(mode);
|
|
|
|
eh.setSubmode(submode);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(table.insert(eh), ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
};
|
|
|
|
// Insert Helper Sequence
|
2022-04-25 10:30:47 +02:00
|
|
|
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
|
|
|
|
bool checkSuccess) {
|
2022-04-25 10:08:29 +02:00
|
|
|
eh.setTableId(tableId);
|
|
|
|
eh.setWaitSeconds(waitSeconds);
|
|
|
|
eh.setCheckSuccess(checkSuccess);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(sequence.insert(eh), ctxc);
|
2022-04-25 08:48:22 +02:00
|
|
|
};
|
2022-04-22 17:00:23 +02:00
|
|
|
|
2022-04-25 10:08:29 +02:00
|
|
|
// OFF Target table is empty
|
2022-04-28 16:20:41 +02:00
|
|
|
check(ss->addTable(&ACS_TABLE_OFF_TGT.second, ACS_TABLE_OFF_TGT.first, false, true), ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
|
2022-04-22 17:00:23 +02:00
|
|
|
// Build OFF transition
|
2022-04-25 10:08:29 +02:00
|
|
|
iht(objects::ACS_CONTROLLER, OFF, 0, ACS_TABLE_OFF_TRANS.second);
|
|
|
|
iht(objects::IMTQ_HANDLER, OFF, 0, ACS_TABLE_OFF_TRANS.second);
|
|
|
|
iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_OFF_TRANS.second);
|
|
|
|
iht(objects::ACS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second);
|
|
|
|
iht(objects::SUS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second);
|
|
|
|
iht(objects::RW_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(ss->addTable(&ACS_TABLE_OFF_TRANS.second, ACS_TABLE_OFF_TRANS.first, false, true), ctxc);
|
2022-04-22 17:00:23 +02:00
|
|
|
|
|
|
|
// Build OFF sequence
|
2022-04-25 10:08:29 +02:00
|
|
|
ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TGT.first, 0, false);
|
|
|
|
ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TRANS.first, 0, false);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(ss->addSequence(&ACS_SEQUENCE_OFF.second, ACS_SEQUENCE_OFF.first, ACS_SEQUENCE_OFF.first,
|
|
|
|
false, true),
|
|
|
|
ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
}
|
2022-04-22 17:00:23 +02:00
|
|
|
|
2022-04-25 10:50:59 +02:00
|
|
|
void buildSafeSequence(Subsystem* ss, ModeListEntry& eh) {
|
2022-04-25 13:36:11 +02:00
|
|
|
std::string context = "satsystem::acs::buildSafeSequence";
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ctxc = context.c_str();
|
|
|
|
// Insert Helper Table
|
|
|
|
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
|
2022-04-25 10:30:47 +02:00
|
|
|
ArrayList<ModeListEntry>& sequence) {
|
2022-04-25 10:08:29 +02:00
|
|
|
eh.setObject(obj);
|
|
|
|
eh.setMode(mode);
|
|
|
|
eh.setSubmode(submode);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(sequence.insert(eh), ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
};
|
|
|
|
// Insert Helper Sequence
|
2022-04-25 10:30:47 +02:00
|
|
|
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
|
|
|
|
bool checkSuccess) {
|
2022-04-25 10:08:29 +02:00
|
|
|
eh.setTableId(tableId);
|
|
|
|
eh.setWaitSeconds(waitSeconds);
|
|
|
|
eh.setCheckSuccess(checkSuccess);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(sequence.insert(eh), ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
};
|
|
|
|
// Build SAFE target
|
|
|
|
iht(objects::ACS_CONTROLLER, acs::CtrlModes::SAFE, 0, ACS_TABLE_SAFE_TGT.second);
|
|
|
|
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_SAFE_TGT.second);
|
|
|
|
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TGT.second);
|
|
|
|
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TGT.second);
|
2022-09-30 15:05:48 +02:00
|
|
|
check(ss->addTable(&ACS_TABLE_SAFE_TGT.second, ACS_TABLE_SAFE_TGT.first, false, true), ctxc);
|
2022-04-22 17:00:23 +02:00
|
|
|
|
2022-04-25 10:08:29 +02:00
|
|
|
// Build SAFE transition 0
|
|
|
|
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_SAFE_TRANS_0.second);
|
|
|
|
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TRANS_0.second);
|
|
|
|
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TRANS_0.second);
|
|
|
|
iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_SAFE_TRANS_0.second);
|
|
|
|
iht(objects::RW_ASS, OFF, 0, ACS_TABLE_SAFE_TRANS_0.second);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(ss->addTable(&ACS_TABLE_SAFE_TRANS_0.second, ACS_TABLE_SAFE_TRANS_0.first, false, true),
|
|
|
|
ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
|
|
|
|
// Build SAFE transition 1
|
|
|
|
iht(objects::ACS_CONTROLLER, acs::CtrlModes::SAFE, 0, ACS_TABLE_SAFE_TRANS_1.second);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(ss->addTable(&ACS_TABLE_SAFE_TRANS_1.second, ACS_TABLE_SAFE_TRANS_1.first, false, true),
|
|
|
|
ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
|
|
|
|
// Build SAFE sequence
|
2022-04-25 10:30:47 +02:00
|
|
|
ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TGT.first, 0, true);
|
2022-04-25 10:08:29 +02:00
|
|
|
ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TRANS_0.first, 0, false);
|
|
|
|
ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TRANS_1.first, 0, false);
|
2022-10-11 15:19:03 +02:00
|
|
|
check(ss->addSequence(&ACS_SEQUENCE_SAFE.second, ACS_SEQUENCE_SAFE.first, ACS_SEQUENCE_SAFE.first,
|
2022-04-28 16:20:41 +02:00
|
|
|
false, true),
|
|
|
|
ctxc);
|
2022-04-22 17:49:28 +02:00
|
|
|
}
|
|
|
|
|
2022-04-25 10:50:59 +02:00
|
|
|
void buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) {
|
2022-04-25 13:36:11 +02:00
|
|
|
std::string context = "satsystem::acs::buildDetumbleSequence";
|
2022-04-22 17:49:28 +02:00
|
|
|
auto ctxc = context.c_str();
|
2022-04-25 10:08:29 +02:00
|
|
|
// Insert Helper Table
|
|
|
|
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
|
2022-04-25 10:30:47 +02:00
|
|
|
ArrayList<ModeListEntry>& sequence) {
|
2022-04-25 08:48:22 +02:00
|
|
|
eh.setObject(obj);
|
|
|
|
eh.setMode(mode);
|
|
|
|
eh.setSubmode(submode);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(sequence.insert(eh), ctxc);
|
2022-04-25 08:48:22 +02:00
|
|
|
};
|
2022-04-25 10:08:29 +02:00
|
|
|
// Insert Helper Sequence
|
2022-04-25 10:30:47 +02:00
|
|
|
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
|
|
|
|
bool checkSuccess) {
|
2022-04-25 10:08:29 +02:00
|
|
|
eh.setTableId(tableId);
|
|
|
|
eh.setWaitSeconds(waitSeconds);
|
|
|
|
eh.setCheckSuccess(checkSuccess);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(sequence.insert(eh), ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
};
|
2022-04-22 17:49:28 +02:00
|
|
|
// Build DETUMBLE target
|
2022-04-25 10:08:29 +02:00
|
|
|
iht(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TGT.second);
|
|
|
|
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TGT.second);
|
|
|
|
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second);
|
|
|
|
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(ss->addTable(&ACS_TABLE_DETUMBLE_TGT.second, ACS_TABLE_DETUMBLE_TGT.first, false, true),
|
|
|
|
ctxc);
|
2022-04-22 17:49:28 +02:00
|
|
|
|
|
|
|
// Build DETUMBLE transition 0
|
2022-04-25 10:08:29 +02:00
|
|
|
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
|
|
|
|
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
|
|
|
|
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
|
|
|
|
iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
|
|
|
|
iht(objects::RW_ASS, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_0.second, ACS_TABLE_DETUMBLE_TRANS_0.first, false,
|
|
|
|
true),
|
|
|
|
ctxc);
|
2022-04-22 17:49:28 +02:00
|
|
|
|
|
|
|
// Build DETUMBLE transition 1
|
2022-04-25 10:08:29 +02:00
|
|
|
iht(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TRANS_1.second);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_1.second, ACS_TABLE_DETUMBLE_TRANS_1.first, false,
|
|
|
|
true),
|
|
|
|
ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
|
|
|
|
// Build DETUMBLE sequence
|
2022-04-25 10:30:47 +02:00
|
|
|
ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TGT.first, 0, true);
|
2022-04-25 10:08:29 +02:00
|
|
|
ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TRANS_0.first, 0, false);
|
|
|
|
ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TRANS_1.first, 0, false);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(ss->addSequence(&ACS_SEQUENCE_DETUMBLE.second, ACS_SEQUENCE_DETUMBLE.first,
|
|
|
|
ACS_SEQUENCE_SAFE.first, false, true),
|
|
|
|
ctxc);
|
2022-04-22 17:49:28 +02:00
|
|
|
}
|
|
|
|
|
2022-04-25 10:50:59 +02:00
|
|
|
void buildIdleSequence(Subsystem* ss, ModeListEntry& eh) {
|
2022-04-25 13:36:11 +02:00
|
|
|
std::string context = "satsystem::acs::buildIdleSequence";
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ctxc = context.c_str();
|
|
|
|
// Insert Helper Table
|
|
|
|
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
|
2022-04-25 10:30:47 +02:00
|
|
|
ArrayList<ModeListEntry>& sequence) {
|
2022-04-25 10:08:29 +02:00
|
|
|
eh.setObject(obj);
|
|
|
|
eh.setMode(mode);
|
|
|
|
eh.setSubmode(submode);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(sequence.insert(eh), ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
};
|
|
|
|
// Insert Helper Sequence
|
2022-04-25 10:30:47 +02:00
|
|
|
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
|
|
|
|
bool checkSuccess) {
|
2022-04-25 10:08:29 +02:00
|
|
|
eh.setTableId(tableId);
|
|
|
|
eh.setWaitSeconds(waitSeconds);
|
|
|
|
eh.setCheckSuccess(checkSuccess);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(sequence.insert(eh), ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
};
|
|
|
|
// Build IDLE target
|
|
|
|
iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, 0, ACS_TABLE_IDLE_TGT.second);
|
|
|
|
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_IDLE_TGT.second);
|
|
|
|
iht(objects::RW_ASS, NML, 0, ACS_TABLE_IDLE_TGT.second);
|
|
|
|
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_TGT.second);
|
|
|
|
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_TGT.second);
|
|
|
|
ss->addTable(&ACS_TABLE_IDLE_TGT.second, ACS_TABLE_IDLE_TGT.first, false, true);
|
|
|
|
|
|
|
|
// Build IDLE transition 0
|
2022-04-25 10:30:47 +02:00
|
|
|
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_IDLE_TRANS_0.second);
|
|
|
|
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_TRANS_0.second);
|
|
|
|
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_TRANS_0.second);
|
|
|
|
iht(objects::RW_ASS, NML, 0, ACS_TABLE_IDLE_TRANS_0.second);
|
|
|
|
iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_IDLE_TRANS_0.second);
|
2022-04-25 10:08:29 +02:00
|
|
|
ss->addTable(&ACS_TABLE_IDLE_TRANS_0.second, ACS_TABLE_IDLE_TRANS_0.first, false, true);
|
|
|
|
|
|
|
|
// Build IDLE transition 1
|
2022-04-25 10:30:47 +02:00
|
|
|
iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, 0, ACS_TABLE_IDLE_TRANS_1.second);
|
2022-04-25 10:08:29 +02:00
|
|
|
ss->addTable(&ACS_TABLE_IDLE_TRANS_1.second, ACS_TABLE_IDLE_TRANS_1.first, false, true);
|
|
|
|
|
|
|
|
// Build IDLE sequence
|
2022-04-25 10:30:47 +02:00
|
|
|
ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TGT.first, 0, true);
|
|
|
|
ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TRANS_0.first, 0, true);
|
2022-04-25 10:08:29 +02:00
|
|
|
ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TRANS_1.first, 0, false);
|
2022-04-25 10:30:47 +02:00
|
|
|
ss->addSequence(&ACS_SEQUENCE_IDLE.second, ACS_SEQUENCE_IDLE.first, ACS_SEQUENCE_SAFE.first,
|
|
|
|
false, true);
|
|
|
|
}
|
|
|
|
|
2022-04-25 10:50:59 +02:00
|
|
|
void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) {
|
2022-04-25 13:36:11 +02:00
|
|
|
std::string context = "satsystem::acs::buildIdleChargeSequence";
|
2022-04-25 10:30:47 +02:00
|
|
|
auto ctxc = context.c_str();
|
|
|
|
// Insert Helper Table
|
|
|
|
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
|
|
|
|
ArrayList<ModeListEntry>& sequence) {
|
|
|
|
eh.setObject(obj);
|
|
|
|
eh.setMode(mode);
|
|
|
|
eh.setSubmode(submode);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(sequence.insert(eh), ctxc);
|
2022-04-25 10:30:47 +02:00
|
|
|
};
|
|
|
|
// Insert Helper Sequence
|
|
|
|
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
|
|
|
|
bool checkSuccess) {
|
|
|
|
eh.setTableId(tableId);
|
|
|
|
eh.setWaitSeconds(waitSeconds);
|
|
|
|
eh.setCheckSuccess(checkSuccess);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(sequence.insert(eh), ctxc);
|
2022-04-25 10:30:47 +02:00
|
|
|
};
|
|
|
|
// Build IDLE target
|
|
|
|
iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, acs::IDLE_CHARGE,
|
|
|
|
ACS_TABLE_IDLE_CHRG_TGT.second);
|
|
|
|
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_IDLE_CHRG_TGT.second);
|
|
|
|
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_CHRG_TGT.second);
|
|
|
|
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_CHRG_TGT.second);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(ss->addTable(&ACS_TABLE_IDLE_CHRG_TGT.second, ACS_TABLE_IDLE_CHRG_TGT.first, false, true),
|
|
|
|
ctxc);
|
2022-04-25 10:30:47 +02:00
|
|
|
|
|
|
|
// Build IDLE transition 0
|
|
|
|
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second);
|
|
|
|
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second);
|
|
|
|
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second);
|
|
|
|
iht(objects::RW_ASS, OFF, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second);
|
|
|
|
iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(ss->addTable(&ACS_TABLE_IDLE_CHRG_TRANS_0.second, ACS_TABLE_IDLE_CHRG_TRANS_0.first, false,
|
|
|
|
true),
|
|
|
|
ctxc);
|
2022-04-25 10:30:47 +02:00
|
|
|
|
|
|
|
// Build IDLE transition 1
|
|
|
|
iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, acs::IDLE_CHARGE,
|
|
|
|
ACS_TABLE_IDLE_CHRG_TRANS_1.second);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(ss->addTable(&ACS_TABLE_IDLE_CHRG_TRANS_1.second, ACS_TABLE_IDLE_CHRG_TRANS_1.first, false,
|
|
|
|
true),
|
|
|
|
ctxc);
|
2022-04-25 10:30:47 +02:00
|
|
|
|
|
|
|
// Build IDLE sequence
|
|
|
|
ihs(ACS_SEQUENCE_IDLE_CHRG.second, ACS_TABLE_IDLE_CHRG_TGT.first, 0, true);
|
|
|
|
ihs(ACS_SEQUENCE_IDLE_CHRG.second, ACS_TABLE_IDLE_CHRG_TRANS_0.first, 0, true);
|
|
|
|
ihs(ACS_SEQUENCE_IDLE_CHRG.second, ACS_TABLE_IDLE_CHRG_TRANS_1.first, 0, false);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(ss->addSequence(&ACS_SEQUENCE_IDLE_CHRG.second, ACS_SEQUENCE_IDLE_CHRG.first,
|
|
|
|
ACS_SEQUENCE_SAFE.first, false, true),
|
|
|
|
ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
}
|
|
|
|
|
2022-04-25 10:50:59 +02:00
|
|
|
void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) {
|
2022-04-25 13:36:11 +02:00
|
|
|
std::string context = "satsystem::acs::buildTargetPtSequence";
|
2022-04-25 10:08:29 +02:00
|
|
|
auto ctxc = context.c_str();
|
|
|
|
// Insert Helper Table
|
|
|
|
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
|
2022-04-25 10:30:47 +02:00
|
|
|
ArrayList<ModeListEntry>& sequence) {
|
2022-04-25 10:08:29 +02:00
|
|
|
eh.setObject(obj);
|
|
|
|
eh.setMode(mode);
|
|
|
|
eh.setSubmode(submode);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(sequence.insert(eh), ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
};
|
|
|
|
// Insert Helper Sequence
|
2022-04-25 10:30:47 +02:00
|
|
|
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
|
|
|
|
bool checkSuccess) {
|
2022-04-25 10:08:29 +02:00
|
|
|
eh.setTableId(tableId);
|
|
|
|
eh.setWaitSeconds(waitSeconds);
|
|
|
|
eh.setCheckSuccess(checkSuccess);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(sequence.insert(eh), ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// Build TARGET PT table
|
|
|
|
iht(objects::ACS_CONTROLLER, acs::CtrlModes::TARGET_PT, 0, ACS_TABLE_TARGET_PT_TGT.second);
|
|
|
|
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_TARGET_PT_TGT.second);
|
|
|
|
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TGT.second);
|
|
|
|
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TGT.second);
|
|
|
|
iht(objects::RW_ASS, NML, 0, ACS_TABLE_TARGET_PT_TGT.second);
|
|
|
|
iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_TARGET_PT_TGT.second);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(ss->addTable(&ACS_TABLE_TARGET_PT_TGT.second, ACS_TABLE_TARGET_PT_TGT.first, false, true),
|
|
|
|
ctxc);
|
2022-04-22 17:49:28 +02:00
|
|
|
|
2022-04-25 10:08:29 +02:00
|
|
|
// Build TARGET PT transition 0
|
|
|
|
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second);
|
|
|
|
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second);
|
|
|
|
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second);
|
|
|
|
iht(objects::RW_ASS, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second);
|
|
|
|
iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(ss->addTable(&ACS_TABLE_TARGET_PT_TRANS_0.second, ACS_TABLE_TARGET_PT_TRANS_0.first, false,
|
|
|
|
true),
|
|
|
|
ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
|
|
|
|
// Build TARGET PT transition 1
|
|
|
|
iht(objects::ACS_CONTROLLER, acs::CtrlModes::TARGET_PT, 0, ACS_TABLE_TARGET_PT_TRANS_1.second);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(ss->addTable(&ACS_TABLE_TARGET_PT_TRANS_1.second, ACS_TABLE_TARGET_PT_TRANS_1.first, false,
|
|
|
|
true),
|
|
|
|
ctxc);
|
2022-04-25 10:08:29 +02:00
|
|
|
|
|
|
|
// Build IDLE sequence
|
2022-04-25 10:30:47 +02:00
|
|
|
ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TGT.first, 0, true);
|
|
|
|
ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TRANS_0.first, 0, true);
|
2022-04-25 10:08:29 +02:00
|
|
|
ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TRANS_1.first, 0, false);
|
2022-04-28 16:20:41 +02:00
|
|
|
check(ss->addSequence(&ACS_SEQUENCE_TARGET_PT.second, ACS_SEQUENCE_TARGET_PT.first,
|
|
|
|
ACS_SEQUENCE_IDLE.first, false, true),
|
|
|
|
ctxc);
|
2022-04-22 17:00:23 +02:00
|
|
|
}
|
2022-04-25 13:36:11 +02:00
|
|
|
|
|
|
|
} // namespace
|