add eive system first impl
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2023-02-10 17:52:46 +01:00
parent b3202623f4
commit 62eb39923f
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
11 changed files with 111 additions and 17 deletions

View File

@ -94,7 +94,7 @@ auto ACS_TABLE_PTG_TARGET_INERTIAL_TGT =
auto ACS_TABLE_PTG_TARGET_INERTIAL_TRANS_1 =
std::make_pair((acs::AcsMode::PTG_INERTIAL << 24) | 3, FixedArrayList<ModeListEntry, 1>());
void satsystem::acs::init() {
Subsystem& satsystem::acs::init() {
ModeListEntry entry;
const char* ctxc = "satsystem::acs::init: generic target";
// Insert Helper Table
@ -123,6 +123,7 @@ void satsystem::acs::init() {
buildTargetPtNadirSequence(ACS_SUBSYSTEM, entry);
buildTargetPtInertialSequence(ACS_SUBSYSTEM, entry);
ACS_SUBSYSTEM.setInitialMode(::acs::AcsMode::SAFE);
return ACS_SUBSYSTEM;
}
namespace {

View File

@ -4,7 +4,7 @@ namespace satsystem {
namespace acs {
extern AcsSubsystem ACS_SUBSYSTEM;
void init();
Subsystem& init();
} // namespace acs
} // namespace satsystem

View File

@ -62,13 +62,14 @@ void buildTxAndRxDefaultRateSequence(Subsystem& ss, ModeListEntry& eh);
} // namespace
void satsystem::com::init() {
Subsystem& satsystem::com::init() {
ModeListEntry entry;
buildRxOnlySequence(SUBSYSTEM, entry);
buildTxAndRxLowRateSequence(SUBSYSTEM, entry);
buildTxAndRxHighRateSequence(SUBSYSTEM, entry);
buildTxAndRxDefaultRateSequence(SUBSYSTEM, entry);
SUBSYSTEM.setInitialMode(NML, ::com::Submode::RX_ONLY);
return SUBSYSTEM;
}
namespace {

View File

@ -8,7 +8,7 @@ namespace satsystem {
namespace com {
extern ComSubsystem SUBSYSTEM;
void init();
Subsystem& init();
} // namespace com
} // namespace satsystem

View File

@ -20,7 +20,7 @@ void initEarthObsvSequence(Subsystem& ss, ModeListEntry& eh);
void initScexSequence(Subsystem& ss, ModeListEntry& eh);
} // namespace
Subsystem satsystem::pl::SUBSYSTEM = Subsystem(objects::PL_SUBSYSTEM, 12, 24);
PayloadSubsystem satsystem::pl::SUBSYSTEM = PayloadSubsystem(objects::PL_SUBSYSTEM, 12, 24);
const auto check = subsystem::checkInsert;
static const auto OFF = HasModesIF::MODE_OFF;
@ -77,7 +77,7 @@ auto PL_TABLE_SCEX_TGT =
auto PL_TABLE_SCEX_TRANS_0 =
std::make_pair((payload::Mode::SCEX << 24) | 2, FixedArrayList<ModeListEntry, 1>());
void satsystem::pl::init() {
Subsystem& satsystem::pl::init() {
ModeListEntry entry;
initOffSequence(SUBSYSTEM, entry);
initPlMpsocStreamSequence(SUBSYSTEM, entry);
@ -86,6 +86,7 @@ void satsystem::pl::init() {
initEarthObsvSequence(SUBSYSTEM, entry);
initScexSequence(SUBSYSTEM, entry);
SUBSYSTEM.setInitialMode(OFF);
return SUBSYSTEM;
}
namespace {

View File

@ -1,15 +1,15 @@
#ifndef MISSION_SYSTEM_TREE_PAYLOADMODETREE_H_
#define MISSION_SYSTEM_TREE_PAYLOADMODETREE_H_
#include <fsfw/subsystem/Subsystem.h>
#include <mission/system/objects/PayloadSubsystem.h>
namespace satsystem {
namespace pl {
extern Subsystem SUBSYSTEM;
extern PayloadSubsystem SUBSYSTEM;
void init();
Subsystem& init();
} // namespace pl
} // namespace satsystem

View File

@ -1,13 +1,99 @@
#include "system.h"
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/subsystem/Subsystem.h>
#include <mission/acsDefs.h>
#include "acsModeTree.h"
#include "comModeTree.h"
#include "eive/objects.h"
#include "payloadModeTree.h"
#include "tcsModeTree.h"
#include "util.h"
namespace {
// Alias for checker function
const auto check = subsystem::checkInsert;
void buildSafeSequence(Subsystem& ss, ModeListEntry& eh);
} // namespace
static const auto OFF = HasModesIF::MODE_OFF;
static const auto NML = DeviceHandlerIF::MODE_NORMAL;
void satsystem::init() {
acs::init();
pl::init();
tcs::init();
com::init();
auto& acsSubsystem = acs::init();
acsSubsystem.connectModeTreeParent(EIVE_SYSTEM);
auto& payloadSubsystem = pl::init();
payloadSubsystem.connectModeTreeParent(EIVE_SYSTEM);
auto& tcsSubsystem = tcs::init();
tcsSubsystem.connectModeTreeParent(EIVE_SYSTEM);
auto& comSubsystem = com::init();
comSubsystem.connectModeTreeParent(EIVE_SYSTEM);
ModeListEntry entry;
buildSafeSequence(EIVE_SYSTEM, entry);
}
EiveSystem satsystem::EIVE_SYSTEM = EiveSystem(objects::EIVE_SYSTEM, 12, 24);
auto EIVE_SEQUENCE_SAFE = std::make_pair(acs::AcsMode::SAFE, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_SAFE_TGT =
std::make_pair((acs::AcsMode::SAFE << 24) | 1, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_SAFE_TRANS_0 =
std::make_pair((acs::AcsMode::SAFE << 24) | 2, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_SAFE_TRANS_1 =
std::make_pair((acs::AcsMode::SAFE << 24) | 3, FixedArrayList<ModeListEntry, 5>());
auto EIVE_SEQUENCE_IDLE =
std::make_pair(acs::AcsMode::PTG_IDLE, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_IDLE_TGT =
std::make_pair((acs::AcsMode::PTG_IDLE << 24) | 1, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_IDLE_TRANS_0 =
std::make_pair((acs::AcsMode::PTG_IDLE << 24) | 2, FixedArrayList<ModeListEntry, 5>());
namespace {
void buildSafeSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::buildSafeSequence";
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
check(table.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);
};
// Only tracks that payload is off
iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_SAFE_TGT.second);
check(ss.addTable(TableEntry(EIVE_TABLE_IDLE_TGT.first, &EIVE_TABLE_IDLE_TGT.second)), ctxc);
// Build SAFE transition 0
iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_SAFE_TRANS_0.second);
check(ss.addTable(TableEntry(EIVE_TABLE_SAFE_TRANS_0.first, &EIVE_TABLE_SAFE_TRANS_0.second)),
ctxc);
// Build SAFE transition 1
iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_SAFE_TRANS_1.second);
iht(objects::ACS_SUBSYSTEM, acs::AcsMode::SAFE, 0, EIVE_TABLE_SAFE_TRANS_1.second);
check(ss.addTable(TableEntry(EIVE_TABLE_SAFE_TRANS_1.first, &EIVE_TABLE_SAFE_TRANS_1.second)),
ctxc);
// Build Safe sequence
ihs(EIVE_SEQUENCE_SAFE.second, EIVE_TABLE_SAFE_TGT.first, 0, false);
ihs(EIVE_SEQUENCE_SAFE.second, EIVE_TABLE_SAFE_TRANS_0.first, 0, false);
ihs(EIVE_SEQUENCE_SAFE.second, EIVE_TABLE_SAFE_TRANS_1.first, 2, false);
check(ss.addSequence(SequenceEntry(EIVE_SEQUENCE_SAFE.first, &EIVE_SEQUENCE_SAFE.second,
EIVE_SEQUENCE_SAFE.first)),
ctxc);
}
} // namespace

View File

@ -1,10 +1,14 @@
#ifndef MISSION_SYSTEM_TREE_SYSTEM_H_
#define MISSION_SYSTEM_TREE_SYSTEM_H_
#include <mission/system/objects/EiveSystem.h>
namespace satsystem {
void init();
}
extern EiveSystem EIVE_SYSTEM;
} // namespace satsystem
#endif /* MISSION_SYSTEM_TREE_SYSTEM_H_ */

View File

@ -27,11 +27,12 @@ auto TCS_TABLE_NORMAL_TGT = std::make_pair((NML << 24) | 1, FixedArrayList<ModeL
auto TCS_TABLE_NORMAL_TRANS_0 = std::make_pair((NML << 24) | 2, FixedArrayList<ModeListEntry, 7>());
auto TCS_TABLE_NORMAL_TRANS_1 = std::make_pair((NML << 24) | 3, FixedArrayList<ModeListEntry, 2>());
void satsystem::tcs::init() {
Subsystem& satsystem::tcs::init() {
ModeListEntry entry;
buildOffSequence(SUBSYSTEM, entry);
buildNormalSequence(SUBSYSTEM, entry);
SUBSYSTEM.setInitialMode(OFF);
return SUBSYSTEM;
}
namespace {

View File

@ -6,7 +6,7 @@ namespace satsystem {
namespace tcs {
extern Subsystem SUBSYSTEM;
void init();
Subsystem& init();
} // namespace tcs
} // namespace satsystem

2
tmtc

@ -1 +1 @@
Subproject commit 8d23f29f947e2a4f79e1fc0910cd9ad59a4fc346
Subproject commit 6db34aacaabedf69f05b330d71e25cc7cedb5632