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

518 lines
23 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
2023-02-03 14:21:36 +01:00
AcsSubsystem 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
2023-02-08 13:18:45 +01:00
auto ACS_SEQUENCE_OFF = std::make_pair(acs::AcsMode::OFF, FixedArrayList<ModeListEntry, 3>());
2022-04-25 08:48:22 +02:00
auto ACS_TABLE_OFF_TGT =
2023-02-08 13:18:45 +01:00
std::make_pair((acs::AcsMode::OFF << 24) | 1, FixedArrayList<ModeListEntry, 1>());
2023-02-03 11:25:03 +01:00
auto ACS_TABLE_OFF_TRANS_0 =
2023-02-08 13:18:45 +01:00
std::make_pair((acs::AcsMode::OFF << 24) | 2, FixedArrayList<ModeListEntry, 1>());
2023-02-03 11:25:03 +01:00
auto ACS_TABLE_OFF_TRANS_1 =
2023-02-08 13:18:45 +01:00
std::make_pair((acs::AcsMode::OFF << 24) | 3, FixedArrayList<ModeListEntry, 6>());
2022-04-25 08:48:22 +02:00
auto ACS_SEQUENCE_DETUMBLE =
2023-02-08 13:18:45 +01:00
std::make_pair(acs::AcsMode::DETUMBLE, FixedArrayList<ModeListEntry, 3>());
2022-04-25 08:48:22 +02:00
auto ACS_TABLE_DETUMBLE_TGT =
2023-02-08 13:18:45 +01:00
std::make_pair((acs::AcsMode::DETUMBLE << 24) | 1, FixedArrayList<ModeListEntry, 4>());
2022-04-25 08:48:22 +02:00
auto ACS_TABLE_DETUMBLE_TRANS_0 =
2023-02-08 13:18:45 +01:00
std::make_pair((acs::AcsMode::DETUMBLE << 24) | 2, FixedArrayList<ModeListEntry, 5>());
2022-04-25 08:48:22 +02:00
auto ACS_TABLE_DETUMBLE_TRANS_1 =
2023-02-08 13:18:45 +01:00
std::make_pair((acs::AcsMode::DETUMBLE << 24) | 3, FixedArrayList<ModeListEntry, 1>());
2022-04-25 08:48:22 +02:00
2023-02-08 13:18:45 +01:00
auto ACS_SEQUENCE_SAFE = std::make_pair(acs::AcsMode::SAFE, FixedArrayList<ModeListEntry, 3>());
2022-04-25 10:08:29 +02:00
auto ACS_TABLE_SAFE_TGT =
2023-02-08 13:18:45 +01:00
std::make_pair((acs::AcsMode::SAFE << 24) | 1, FixedArrayList<ModeListEntry, 4>());
2022-04-25 10:08:29 +02:00
auto ACS_TABLE_SAFE_TRANS_0 =
2023-02-08 13:18:45 +01:00
std::make_pair((acs::AcsMode::SAFE << 24) | 2, FixedArrayList<ModeListEntry, 5>());
2022-04-25 10:08:29 +02:00
auto ACS_TABLE_SAFE_TRANS_1 =
2023-02-08 13:18:45 +01:00
std::make_pair((acs::AcsMode::SAFE << 24) | 3, FixedArrayList<ModeListEntry, 1>());
2022-04-25 10:08:29 +02:00
2023-02-08 13:40:03 +01:00
auto ACS_SEQUENCE_IDLE = std::make_pair(acs::AcsMode::PTG_IDLE, FixedArrayList<ModeListEntry, 3>());
2022-04-25 10:08:29 +02:00
auto ACS_TABLE_IDLE_TGT =
2023-02-08 13:40:03 +01:00
std::make_pair((acs::AcsMode::PTG_IDLE << 24) | 1, FixedArrayList<ModeListEntry, 6>());
2022-04-25 10:08:29 +02:00
auto ACS_TABLE_IDLE_TRANS_0 =
2023-02-08 13:40:03 +01:00
std::make_pair((acs::AcsMode::PTG_IDLE << 24) | 2, FixedArrayList<ModeListEntry, 6>());
2022-04-25 10:08:29 +02:00
auto ACS_TABLE_IDLE_TRANS_1 =
2023-02-08 13:40:03 +01:00
std::make_pair((acs::AcsMode::PTG_IDLE << 24) | 3, FixedArrayList<ModeListEntry, 2>());
2023-02-03 11:25:03 +01:00
auto ACS_TABLE_PTG_TRANS_0 =
2023-02-08 13:18:45 +01:00
std::make_pair((acs::AcsMode::PTG_TARGET << 24) | 2, FixedArrayList<ModeListEntry, 5>());
2023-02-03 11:25:03 +01:00
auto ACS_SEQUENCE_PTG_TARGET =
2023-02-08 13:18:45 +01:00
std::make_pair(acs::AcsMode::PTG_TARGET, FixedArrayList<ModeListEntry, 3>());
auto ACS_TABLE_PTG_TARGET_TGT =
2023-02-08 13:18:45 +01:00
std::make_pair((acs::AcsMode::PTG_TARGET << 24) | 1, FixedArrayList<ModeListEntry, 6>());
auto ACS_TABLE_PTG_TARGET_TRANS_1 =
2023-02-08 13:18:45 +01:00
std::make_pair((acs::AcsMode::PTG_TARGET << 24) | 3, FixedArrayList<ModeListEntry, 1>());
2023-02-03 11:25:03 +01:00
auto ACS_SEQUENCE_PTG_TARGET_GS =
2023-02-08 13:18:45 +01:00
std::make_pair(acs::AcsMode::PTG_TARGET_GS, FixedArrayList<ModeListEntry, 3>());
2023-02-03 11:25:03 +01:00
auto ACS_TABLE_PTG_TARGET_GS_TGT =
2023-02-08 13:18:45 +01:00
std::make_pair((acs::AcsMode::PTG_TARGET_GS << 24) | 1, FixedArrayList<ModeListEntry, 6>());
2023-02-03 11:25:03 +01:00
auto ACS_TABLE_PTG_TARGET_GS_TRANS_1 =
2023-02-08 13:18:45 +01:00
std::make_pair((acs::AcsMode::PTG_TARGET_GS << 24) | 3, FixedArrayList<ModeListEntry, 1>());
2023-02-03 11:25:03 +01:00
auto ACS_SEQUENCE_PTG_TARGET_NADIR =
std::make_pair(acs::AcsMode::PTG_NADIR, FixedArrayList<ModeListEntry, 3>());
2023-02-08 13:40:03 +01:00
auto ACS_TABLE_PTG_TARGET_NADIR_TGT =
std::make_pair((acs::AcsMode::PTG_NADIR << 24) | 1, FixedArrayList<ModeListEntry, 6>());
auto ACS_TABLE_PTG_TARGET_NADIR_TRANS_1 =
std::make_pair((acs::AcsMode::PTG_NADIR << 24) | 3, FixedArrayList<ModeListEntry, 1>());
2023-02-03 11:25:03 +01:00
auto ACS_SEQUENCE_PTG_TARGET_INERTIAL =
std::make_pair(acs::AcsMode::PTG_INERTIAL, FixedArrayList<ModeListEntry, 3>());
2023-02-08 13:40:03 +01:00
auto ACS_TABLE_PTG_TARGET_INERTIAL_TGT =
std::make_pair((acs::AcsMode::PTG_INERTIAL << 24) | 1, FixedArrayList<ModeListEntry, 6>());
auto ACS_TABLE_PTG_TARGET_INERTIAL_TRANS_1 =
std::make_pair((acs::AcsMode::PTG_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 14:21:36 +01:00
const char* ctxc = "satsystem::acs::init: generic target";
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);
2023-02-03 14:21:36 +01:00
check(ACS_SUBSYSTEM.addTable(
TableEntry(ACS_TABLE_PTG_TRANS_0.first, &ACS_TABLE_PTG_TRANS_0.second)),
ctxc);
2023-02-03 11:25:03 +01:00
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);
2023-02-03 11:33:18 +01:00
buildTargetPtGsSequence(ACS_SUBSYSTEM, entry);
buildTargetPtNadirSequence(ACS_SUBSYSTEM, entry);
buildTargetPtInertialSequence(ACS_SUBSYSTEM, entry);
2023-02-08 13:18:45 +01:00
ACS_SUBSYSTEM.setInitialMode(::acs::AcsMode::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-08 13:18:45 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::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-08 13:18:45 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::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-08 13:18:45 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::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-08 13:18:45 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::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-08 13:40:03 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::PTG_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-08 13:40:03 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::PTG_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);
2023-02-03 11:33:18 +01:00
ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TRANS_1.first, 0, true);
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-08 13:18:45 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::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 14:21:36 +01:00
// Transition 0 already built
2022-04-25 10:08:29 +02:00
// Build TARGET PT transition 1
2023-02-08 13:40:03 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::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);
2023-02-03 11:33:18 +01:00
ihs(ACS_SEQUENCE_PTG_TARGET.second, ACS_TABLE_PTG_TARGET_TRANS_1.first, 0, true);
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
2023-02-08 13:18:45 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::PTG_TARGET,
2023-02-03 11:25:03 +01:00
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);
2023-02-03 14:21:36 +01:00
// Transition 0 already built
2023-02-03 11:25:03 +01:00
// Build TARGET PT transition 1
2023-02-08 13:40:03 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::PTG_NADIR,
2023-02-03 11:25:03 +01:00
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);
2023-02-03 14:21:36 +01:00
ihs(ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_TABLE_PTG_TRANS_0.first, 0, true);
2023-02-03 11:33:18 +01:00
ihs(ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_TABLE_PTG_TARGET_NADIR_TRANS_1.first, 0, true);
2023-02-03 11:25:03 +01:00
check(
ss.addSequence(SequenceEntry(ACS_SEQUENCE_PTG_TARGET_NADIR.first,
&ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_SEQUENCE_IDLE.first)),
ctxc);
}
2023-02-03 11:33:18 +01:00
void buildTargetPtGsSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::acs::buildTargetPtGsSequence";
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
2023-02-08 13:18:45 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::PTG_TARGET_GS,
2023-02-03 14:21:36 +01:00
ACS_TABLE_PTG_TARGET_GS_TGT.second);
2023-02-03 11:33:18 +01:00
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_PTG_TARGET_GS_TGT.second);
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_GS_TGT.second);
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_GS_TGT.second);
iht(objects::RW_ASS, NML, 0, ACS_TABLE_PTG_TARGET_GS_TGT.second);
iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_PTG_TARGET_GS_TGT.second);
check(ss.addTable(
TableEntry(ACS_TABLE_PTG_TARGET_GS_TGT.first, &ACS_TABLE_PTG_TARGET_GS_TGT.second)),
ctxc);
2023-02-03 14:21:36 +01:00
// Transition 0 already built
2023-02-03 11:33:18 +01:00
// Build TARGET PT transition 1
2023-02-08 13:18:45 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::PTG_TARGET_GS,
2023-02-03 11:33:18 +01:00
ACS_TABLE_PTG_TARGET_GS_TRANS_1.second);
check(ss.addTable(TableEntry(ACS_TABLE_PTG_TARGET_GS_TRANS_1.first,
&ACS_TABLE_PTG_TARGET_GS_TRANS_1.second)),
ctxc);
// Build IDLE sequence
ihs(ACS_SEQUENCE_PTG_TARGET_GS.second, ACS_TABLE_PTG_TARGET_GS_TGT.first, 0, true);
2023-02-03 14:21:36 +01:00
ihs(ACS_SEQUENCE_PTG_TARGET_GS.second, ACS_TABLE_PTG_TRANS_0.first, 0, true);
2023-02-03 11:33:18 +01:00
ihs(ACS_SEQUENCE_PTG_TARGET_GS.second, ACS_TABLE_PTG_TARGET_GS_TRANS_1.first, 0, true);
check(ss.addSequence(SequenceEntry(ACS_SEQUENCE_PTG_TARGET_GS.first,
&ACS_SEQUENCE_PTG_TARGET_GS.second, ACS_SEQUENCE_IDLE.first)),
ctxc);
}
2023-02-03 11:25:03 +01:00
2023-02-03 14:21:36 +01:00
void buildTargetPtInertialSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::acs::buildTargetPtInertialSequence";
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
2023-02-08 13:40:03 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::PTG_INERTIAL,
2023-02-03 14:21:36 +01:00
ACS_TABLE_PTG_TARGET_INERTIAL_TGT.second);
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_PTG_TARGET_INERTIAL_TGT.second);
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_INERTIAL_TGT.second);
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_INERTIAL_TGT.second);
iht(objects::RW_ASS, NML, 0, ACS_TABLE_PTG_TARGET_INERTIAL_TGT.second);
iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_PTG_TARGET_INERTIAL_TGT.second);
check(ss.addTable(TableEntry(ACS_TABLE_PTG_TARGET_INERTIAL_TGT.first,
&ACS_TABLE_PTG_TARGET_INERTIAL_TGT.second)),
ctxc);
// Transition 0 already built
// Build TARGET PT transition 1
2023-02-08 13:40:03 +01:00
iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::PTG_INERTIAL,
2023-02-03 14:21:36 +01:00
ACS_TABLE_PTG_TARGET_INERTIAL_TRANS_1.second);
check(ss.addTable(TableEntry(ACS_TABLE_PTG_TARGET_INERTIAL_TRANS_1.first,
&ACS_TABLE_PTG_TARGET_INERTIAL_TRANS_1.second)),
ctxc);
// Build IDLE sequence
ihs(ACS_SEQUENCE_PTG_TARGET_INERTIAL.second, ACS_TABLE_PTG_TARGET_INERTIAL_TGT.first, 0, true);
ihs(ACS_SEQUENCE_PTG_TARGET_INERTIAL.second, ACS_TABLE_PTG_TRANS_0.first, 0, true);
ihs(ACS_SEQUENCE_PTG_TARGET_INERTIAL.second, ACS_TABLE_PTG_TARGET_INERTIAL_TRANS_1.first, 0,
true);
check(ss.addSequence(SequenceEntry(ACS_SEQUENCE_PTG_TARGET_INERTIAL.first,
&ACS_SEQUENCE_PTG_TARGET_INERTIAL.second,
ACS_SEQUENCE_IDLE.first)),
ctxc);
}
2023-02-03 11:25:03 +01:00
2022-04-25 13:36:11 +02:00
} // namespace