eive-obsw/mission/system/tree/acsModeTree.cpp

424 lines
19 KiB
C++
Raw Normal View History

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"
#include "mission/acsDefs.h"
#include "util.h"
2022-04-22 17:49:28 +02:00
Subsystem satsystem::acs::ACS_SUBSYSTEM(objects::ACS_SUBSYSTEM, 12, 24);
2022-04-25 13:36:11 +02:00
namespace {
// Alias for checker function
const auto check = subsystem::checkInsert;
2022-09-29 19:40:00 +02:00
2022-11-14 13:46:26 +01:00
void buildOffSequence(Subsystem& ss, ModeListEntry& eh);
2022-11-14 13:36:51 +01:00
void buildDetumbleSequence(Subsystem& ss, ModeListEntry& entryHelper);
void buildSafeSequence(Subsystem& ss, ModeListEntry& entryHelper);
void buildIdleSequence(Subsystem& ss, ModeListEntry& entryHelper);
2023-02-03 11:25:03 +01:00
void buildTargetPtNadirSequence(Subsystem& ss, ModeListEntry& eh);
2022-11-14 13:36:51 +01:00
void buildTargetPtSequence(Subsystem& ss, ModeListEntry& entryHelper);
2023-02-03 11:25:03 +01:00
void buildTargetPtGsSequence(Subsystem& ss, ModeListEntry& entryHelper);
void buildTargetPtInertialSequence(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
auto ACS_SEQUENCE_OFF = std::make_pair(acs::CtrlSubmode::OFF, FixedArrayList<ModeListEntry, 2>());
2022-04-25 08:48:22 +02:00
auto ACS_TABLE_OFF_TGT =
std::make_pair((acs::CtrlSubmode::OFF << 24) | 1, FixedArrayList<ModeListEntry, 1>());
2023-02-03 11:25:03 +01:00
auto ACS_TABLE_OFF_TRANS_0 =
std::make_pair((acs::CtrlSubmode::OFF << 24) | 2, FixedArrayList<ModeListEntry, 1>());
auto ACS_TABLE_OFF_TRANS_1 =
std::make_pair((acs::CtrlSubmode::OFF << 24) | 3, FixedArrayList<ModeListEntry, 6>());
2022-04-25 08:48:22 +02:00
auto ACS_SEQUENCE_DETUMBLE =
std::make_pair(acs::CtrlSubmode::DETUMBLE, FixedArrayList<ModeListEntry, 3>());
2022-04-25 08:48:22 +02:00
auto ACS_TABLE_DETUMBLE_TGT =
std::make_pair((acs::CtrlSubmode::DETUMBLE << 24) | 1, FixedArrayList<ModeListEntry, 4>());
2022-04-25 08:48:22 +02:00
auto ACS_TABLE_DETUMBLE_TRANS_0 =
std::make_pair((acs::CtrlSubmode::DETUMBLE << 24) | 2, FixedArrayList<ModeListEntry, 5>());
2022-04-25 08:48:22 +02:00
auto ACS_TABLE_DETUMBLE_TRANS_1 =
std::make_pair((acs::CtrlSubmode::DETUMBLE << 24) | 3, FixedArrayList<ModeListEntry, 1>());
2022-04-25 08:48:22 +02:00
auto ACS_SEQUENCE_SAFE = std::make_pair(acs::CtrlSubmode::SAFE, FixedArrayList<ModeListEntry, 3>());
2022-04-25 10:08:29 +02:00
auto ACS_TABLE_SAFE_TGT =
std::make_pair((acs::CtrlSubmode::SAFE << 24) | 1, FixedArrayList<ModeListEntry, 4>());
2022-04-25 10:08:29 +02:00
auto ACS_TABLE_SAFE_TRANS_0 =
std::make_pair((acs::CtrlSubmode::SAFE << 24) | 2, FixedArrayList<ModeListEntry, 5>());
2022-04-25 10:08:29 +02:00
auto ACS_TABLE_SAFE_TRANS_1 =
std::make_pair((acs::CtrlSubmode::SAFE << 24) | 3, FixedArrayList<ModeListEntry, 1>());
2022-04-25 10:08:29 +02:00
auto ACS_SEQUENCE_IDLE = std::make_pair(acs::CtrlSubmode::IDLE, FixedArrayList<ModeListEntry, 3>());
2022-04-25 10:08:29 +02:00
auto ACS_TABLE_IDLE_TGT =
std::make_pair((acs::CtrlSubmode::IDLE << 24) | 1, FixedArrayList<ModeListEntry, 6>());
2022-04-25 10:08:29 +02:00
auto ACS_TABLE_IDLE_TRANS_0 =
std::make_pair((acs::CtrlSubmode::IDLE << 24) | 2, FixedArrayList<ModeListEntry, 6>());
2022-04-25 10:08:29 +02:00
auto ACS_TABLE_IDLE_TRANS_1 =
std::make_pair((acs::CtrlSubmode::IDLE << 24) | 3, FixedArrayList<ModeListEntry, 2>());
2023-02-03 11:25:03 +01:00
auto ACS_TABLE_PTG_TRANS_0 =
std::make_pair((acs::CtrlSubmode::PTG_TARGET << 24) | 2, FixedArrayList<ModeListEntry, 5>());
auto ACS_SEQUENCE_PTG_TARGET =
std::make_pair(acs::CtrlSubmode::PTG_TARGET, FixedArrayList<ModeListEntry, 3>());
auto ACS_TABLE_PTG_TARGET_TGT =
std::make_pair((acs::CtrlSubmode::PTG_TARGET << 24) | 1, FixedArrayList<ModeListEntry, 6>());
auto ACS_TABLE_PTG_TARGET_TRANS_1 =
std::make_pair((acs::CtrlSubmode::PTG_TARGET << 24) | 3, FixedArrayList<ModeListEntry, 1>());
2023-02-03 11:25:03 +01:00
auto ACS_SEQUENCE_PTG_TARGET_GS =
std::make_pair(acs::CtrlSubmode::PTG_TARGET_GS, FixedArrayList<ModeListEntry, 3>());
auto ACS_TABLE_PTG_TARGET_GS_TGT =
std::make_pair((acs::CtrlSubmode::PTG_TARGET_GS << 24) | 1, FixedArrayList<ModeListEntry, 6>());
auto ACS_TABLE_PTG_TARGET_GS_TRANS_0 =
std::make_pair((acs::CtrlSubmode::PTG_TARGET_GS << 24) | 2, FixedArrayList<ModeListEntry, 5>());
auto ACS_TABLE_PTG_TARGET_GS_TRANS_1 =
std::make_pair((acs::CtrlSubmode::PTG_TARGET_GS << 24) | 3, FixedArrayList<ModeListEntry, 1>());
auto ACS_SEQUENCE_PTG_TARGET_NADIR =
std::make_pair(acs::CtrlSubmode::PTG_TARGET_NADIR, FixedArrayList<ModeListEntry, 3>());
auto ACS_TABLE_PTG_TARGET_NADIR_TGT = std::make_pair((acs::CtrlSubmode::PTG_TARGET_NADIR << 24) | 1,
FixedArrayList<ModeListEntry, 6>());
auto ACS_TABLE_PTG_TARGET_NADIR_TRANS_0 = std::make_pair(
(acs::CtrlSubmode::PTG_TARGET_NADIR << 24) | 2, FixedArrayList<ModeListEntry, 5>());
auto ACS_TABLE_PTG_TARGET_NADIR_TRANS_1 = std::make_pair(
(acs::CtrlSubmode::PTG_TARGET_NADIR << 24) | 3, FixedArrayList<ModeListEntry, 1>());
auto ACS_SEQUENCE_PTG_TARGET_INERTIAL =
std::make_pair(acs::CtrlSubmode::PTG_TARGET_INERTIAL, FixedArrayList<ModeListEntry, 3>());
auto ACS_TABLE_PTG_TARGET_INERTIAL_TGT = std::make_pair(
(acs::CtrlSubmode::PTG_TARGET_INERTIAL << 24) | 1, FixedArrayList<ModeListEntry, 6>());
auto ACS_TABLE_PTG_TARGET_INERTIAL_TRANS_0 = std::make_pair(
(acs::CtrlSubmode::PTG_TARGET_INERTIAL << 24) | 2, FixedArrayList<ModeListEntry, 5>());
auto ACS_TABLE_PTG_TARGET_INERTIAL_TRANS_1 = std::make_pair(
(acs::CtrlSubmode::PTG_TARGET_INERTIAL << 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;
2023-02-03 11:25:03 +01:00
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
entry.setObject(obj);
entry.setMode(mode);
entry.setSubmode(submode);
check(table.insert(entry), "satsystem::acs::init: generic target");
};
// Build TARGET PT transition 0
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_PTG_TRANS_0.second);
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TRANS_0.second);
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TRANS_0.second);
iht(objects::RW_ASS, NML, 0, ACS_TABLE_PTG_TRANS_0.second);
iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_PTG_TRANS_0.second);
2022-11-14 13:36:51 +01:00
buildOffSequence(ACS_SUBSYSTEM, entry);
buildSafeSequence(ACS_SUBSYSTEM, entry);
buildDetumbleSequence(ACS_SUBSYSTEM, entry);
buildIdleSequence(ACS_SUBSYSTEM, entry);
buildTargetPtSequence(ACS_SUBSYSTEM, entry);
ACS_SUBSYSTEM.setInitialMode(::acs::CtrlSubmode::SAFE);
2022-04-22 17:00:23 +02:00
}
2022-04-25 13:36:11 +02:00
namespace {
2022-11-14 13:36:51 +01: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);
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);
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
2023-02-03 11:25:03 +01:00
check(ss.addTable(TableEntry(ACS_TABLE_OFF_TGT.first, &ACS_TABLE_OFF_TGT.second)), ctxc);
// Build OFF transition 0
iht(objects::ACS_CONTROLLER, OFF, 0, ACS_TABLE_OFF_TRANS_0.second);
check(ss.addTable(TableEntry(ACS_TABLE_OFF_TRANS_0.first, &ACS_TABLE_OFF_TRANS_0.second)), ctxc);
2022-04-25 10:08:29 +02:00
2023-02-03 11:25:03 +01:00
// Build OFF transition 1
iht(objects::IMTQ_HANDLER, OFF, 0, ACS_TABLE_OFF_TRANS_1.second);
iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_OFF_TRANS_1.second);
iht(objects::ACS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS_1.second);
iht(objects::SUS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS_1.second);
iht(objects::RW_ASS, OFF, 0, ACS_TABLE_OFF_TRANS_1.second);
check(ss.addTable(TableEntry(ACS_TABLE_OFF_TRANS_1.first, &ACS_TABLE_OFF_TRANS_1.second)), 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);
2023-02-03 11:25:03 +01:00
ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TRANS_0.first, 0, false);
ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TRANS_1.first, 0, false);
2022-11-14 13:36:51 +01:00
check(ss.addSequence(&ACS_SEQUENCE_OFF.second, ACS_SEQUENCE_OFF.first, ACS_SEQUENCE_OFF.first,
2022-11-14 13:46:26 +01:00
false, true),
ctxc);
2022-04-25 10:08:29 +02:00
}
2022-04-22 17:00:23 +02:00
2022-11-14 13:36:51 +01: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);
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);
check(sequence.insert(eh), ctxc);
2022-04-25 10:08:29 +02:00
};
// Build SAFE target
2023-02-03 11:25:03 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::SAFE, ACS_TABLE_SAFE_TGT.second);
2022-04-25 10:08:29 +02:00
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-11-14 13:36:51 +01: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-11-14 13:36:51 +01: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
2023-02-03 11:25:03 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::SAFE, ACS_TABLE_SAFE_TRANS_1.second);
2022-11-14 13:36:51 +01: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-11-14 13:36:51 +01:00
check(ss.addSequence(&ACS_SEQUENCE_SAFE.second, ACS_SEQUENCE_SAFE.first, ACS_SEQUENCE_SAFE.first,
2022-11-14 13:46:26 +01:00
false, true),
ctxc);
2022-04-22 17:49:28 +02:00
}
2022-11-14 13:36:51 +01: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);
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);
check(sequence.insert(eh), ctxc);
2022-04-25 10:08:29 +02:00
};
2022-04-22 17:49:28 +02:00
// Build DETUMBLE target
2023-02-03 11:25:03 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::DETUMBLE, ACS_TABLE_DETUMBLE_TGT.second);
2022-04-25 10:08:29 +02:00
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-11-14 13:36:51 +01: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-11-14 13:36:51 +01:00
check(ss.addTable(&ACS_TABLE_DETUMBLE_TRANS_0.second, ACS_TABLE_DETUMBLE_TRANS_0.first, false,
2022-11-14 13:46:26 +01:00
true),
ctxc);
2022-04-22 17:49:28 +02:00
// Build DETUMBLE transition 1
2023-02-03 11:25:03 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::DETUMBLE, ACS_TABLE_DETUMBLE_TRANS_1.second);
2022-11-14 13:36:51 +01:00
check(ss.addTable(&ACS_TABLE_DETUMBLE_TRANS_1.second, ACS_TABLE_DETUMBLE_TRANS_1.first, false,
2022-11-14 13:46:26 +01:00
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-11-14 13:36:51 +01:00
check(ss.addSequence(&ACS_SEQUENCE_DETUMBLE.second, ACS_SEQUENCE_DETUMBLE.first,
2022-11-14 13:46:26 +01:00
ACS_SEQUENCE_SAFE.first, false, true),
ctxc);
2022-04-22 17:49:28 +02:00
}
2022-11-14 13:36:51 +01: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);
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);
check(sequence.insert(eh), ctxc);
2022-04-25 10:08:29 +02:00
};
// Build IDLE target
2023-02-03 11:25:03 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::IDLE, ACS_TABLE_IDLE_TGT.second);
2022-04-25 10:08:29 +02:00
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);
2022-11-14 13:36:51 +01:00
ss.addTable(&ACS_TABLE_IDLE_TGT.second, ACS_TABLE_IDLE_TGT.first, false, true);
2022-04-25 10:08:29 +02:00
// 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, NML, 0, ACS_TABLE_IDLE_TRANS_0.second);
2022-11-14 13:36:51 +01:00
ss.addTable(&ACS_TABLE_IDLE_TRANS_0.second, ACS_TABLE_IDLE_TRANS_0.first, false, true);
2022-04-25 10:08:29 +02:00
// Build IDLE transition 1
2023-02-03 11:25:03 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::IDLE, ACS_TABLE_IDLE_TRANS_1.second);
2022-11-14 13:36:51 +01:00
ss.addTable(&ACS_TABLE_IDLE_TRANS_1.second, ACS_TABLE_IDLE_TRANS_1.first, false, true);
2022-04-25 10:08:29 +02:00
// 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-11-14 13:46:26 +01:00
ss.addSequence(&ACS_SEQUENCE_IDLE.second, ACS_SEQUENCE_IDLE.first, ACS_SEQUENCE_SAFE.first, false,
true);
2022-04-25 10:30:47 +02:00
}
2022-11-14 13:36:51 +01: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);
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);
check(sequence.insert(eh), ctxc);
2022-04-25 10:08:29 +02:00
};
// Build TARGET PT table
2023-02-03 11:25:03 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::PTG_TARGET, ACS_TABLE_PTG_TARGET_TGT.second);
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second);
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second);
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second);
iht(objects::RW_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second);
iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second);
check(ss.addTable(&ACS_TABLE_PTG_TARGET_TGT.second, ACS_TABLE_PTG_TARGET_TGT.first, false, true),
ctxc);
2022-04-22 17:49:28 +02:00
2023-02-03 11:25:03 +01:00
check(ss.addTable(&ACS_TABLE_PTG_TRANS_0.second, ACS_TABLE_PTG_TRANS_0.first, false, true), ctxc);
2022-04-25 10:08:29 +02:00
// Build TARGET PT transition 1
2023-02-03 11:25:03 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::PTG_TARGET,
ACS_TABLE_PTG_TARGET_TRANS_1.second);
check(ss.addTable(&ACS_TABLE_PTG_TARGET_TRANS_1.second, ACS_TABLE_PTG_TARGET_TRANS_1.first, false,
2022-11-14 13:46:26 +01:00
true),
ctxc);
2022-04-25 10:08:29 +02:00
// Build IDLE sequence
ihs(ACS_SEQUENCE_PTG_TARGET.second, ACS_TABLE_PTG_TARGET_TGT.first, 0, true);
2023-02-03 11:25:03 +01:00
ihs(ACS_SEQUENCE_PTG_TARGET.second, ACS_TABLE_PTG_TRANS_0.first, 0, true);
ihs(ACS_SEQUENCE_PTG_TARGET.second, ACS_TABLE_PTG_TARGET_TRANS_1.first, 0, false);
check(ss.addSequence(&ACS_SEQUENCE_PTG_TARGET.second, ACS_SEQUENCE_PTG_TARGET.first,
2022-11-14 13:46:26 +01:00
ACS_SEQUENCE_IDLE.first, false, true),
ctxc);
2022-04-22 17:00:23 +02:00
}
2022-04-25 13:36:11 +02:00
2023-02-03 11:25:03 +01:00
void buildTargetPtNadirSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::acs::buildTargetPtNadirSequence";
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);
check(sequence.insert(eh), ctxc);
};
// 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);
check(sequence.insert(eh), ctxc);
};
// Build TARGET PT table
iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::PTG_TARGET,
ACS_TABLE_PTG_TARGET_NADIR_TGT.second);
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_PTG_TARGET_NADIR_TGT.second);
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_NADIR_TGT.second);
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_NADIR_TGT.second);
iht(objects::RW_ASS, NML, 0, ACS_TABLE_PTG_TARGET_NADIR_TGT.second);
iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_PTG_TARGET_NADIR_TGT.second);
check(ss.addTable(TableEntry(ACS_TABLE_PTG_TARGET_NADIR_TGT.first,
&ACS_TABLE_PTG_TARGET_NADIR_TGT.second)),
ctxc);
check(ss.addTable(TableEntry(ACS_TABLE_PTG_TRANS_0.first, &ACS_TABLE_PTG_TRANS_0.second)), ctxc);
// Build TARGET PT transition 1
iht(objects::ACS_CONTROLLER, NML, acs::CtrlSubmode::PTG_TARGET_NADIR,
ACS_TABLE_PTG_TARGET_NADIR_TRANS_1.second);
check(ss.addTable(TableEntry(ACS_TABLE_PTG_TARGET_NADIR_TRANS_1.first,
&ACS_TABLE_PTG_TARGET_NADIR_TRANS_1.second)),
ctxc);
// Build IDLE sequence
ihs(ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_TABLE_PTG_TARGET_NADIR_TGT.first, 0, true);
ihs(ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_TABLE_PTG_TARGET_NADIR_TRANS_0.first, 0, true);
ihs(ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_TABLE_PTG_TARGET_NADIR_TRANS_1.first, 0, false);
check(
ss.addSequence(SequenceEntry(ACS_SEQUENCE_PTG_TARGET_NADIR.first,
&ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_SEQUENCE_IDLE.first)),
ctxc);
}
void buildTargetPtGsSequence(Subsystem& ss, ModeListEntry& entryHelper) {}
void buildTargetPtInertialSequence(Subsystem& ss, ModeListEntry& entryHelper) {}
2022-04-25 13:36:11 +02:00
} // namespace