started acs subsystem
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2022-04-25 13:36:11 +02:00
parent f9dd77b8ec
commit 0697cca88a
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
11 changed files with 183 additions and 16 deletions

View File

@ -42,7 +42,7 @@
#include "mission/system/objects/SusAssembly.h" #include "mission/system/objects/SusAssembly.h"
#include "mission/system/objects/SusFdir.h" #include "mission/system/objects/SusFdir.h"
#include "mission/system/objects/TcsBoardAssembly.h" #include "mission/system/objects/TcsBoardAssembly.h"
#include "mission/system/tree/acsModeTree.h" #include "mission/system/tree/system.h"
#include "tmtc/apid.h" #include "tmtc/apid.h"
#include "tmtc/pusIds.h" #include "tmtc/pusIds.h"
@ -208,7 +208,7 @@ void ObjectFactory::produce(void* args) {
new PlocUpdater(objects::PLOC_UPDATER); new PlocUpdater(objects::PLOC_UPDATER);
new PlocMemoryDumper(objects::PLOC_MEMORY_DUMPER); new PlocMemoryDumper(objects::PLOC_MEMORY_DUMPER);
satsystem::initAcsSubsystem(); satsystem::init();
} }
void ObjectFactory::createTmpComponents() { void ObjectFactory::createTmpComponents() {

View File

@ -38,7 +38,7 @@ enum commonObjects: uint32_t {
GYRO_2_ADIS_HANDLER = 0x44120212, GYRO_2_ADIS_HANDLER = 0x44120212,
GYRO_3_L3G_HANDLER = 0x44120313, GYRO_3_L3G_HANDLER = 0x44120313,
PLPCDU_HANDLER = 0x44300000, PLPCDU_HANDLER = 0x44300000,
SCEX_HANDLER = 0x44400000,
IMTQ_HANDLER = 0x44140014, IMTQ_HANDLER = 0x44140014,
PLOC_MPSOC_HANDLER = 0x44330015, PLOC_MPSOC_HANDLER = 0x44330015,
PLOC_SUPERVISOR_HANDLER = 0x44330016, PLOC_SUPERVISOR_HANDLER = 0x44330016,
@ -99,8 +99,12 @@ enum commonObjects: uint32_t {
SUS_BOARD_ASS = 0x73000002, SUS_BOARD_ASS = 0x73000002,
TCS_BOARD_ASS = 0x73000003, TCS_BOARD_ASS = 0x73000003,
RW_ASS = 0x73000004, RW_ASS = 0x73000004,
ACS_SUBSYSTEM = 0x73010001, PLOC_SWITCHER = 0x73000005,
CAM_SWITCHER = 0x73000006,
EIVE_SYSTEM = 0x73010000, EIVE_SYSTEM = 0x73010000,
ACS_SUBSYSTEM = 0x73010001,
PL_SUBSYSTEM = 0x73010002,
PLOC_SUBSYSTEM = 0x73010003,
}; };
} }

@ -1 +1 @@
Subproject commit d2bdabbf0f213747efc18cb45fcf2a2294b14bc8 Subproject commit 2a408e8c7dd2ebe974b9699fb5aee0889aa86392

View File

@ -16,4 +16,10 @@ enum Submodes : Submode_t { A_SIDE = 0, B_SIDE = 1, DUAL_MODE = 2 };
} // namespace duallane } // namespace duallane
namespace payload {
enum Modes { NONE = 0, DAC = 1, CAM = 2, PL_DATA = 3, EARTH_OBSV = 4, SCEX = 5 };
}
#endif /* MISSION_SYSTEM_DEFINITIONS_H_ */ #endif /* MISSION_SYSTEM_DEFINITIONS_H_ */

View File

@ -1,3 +1,5 @@
target_sources(${LIB_EIVE_MISSION} PRIVATE target_sources(${LIB_EIVE_MISSION} PRIVATE
acsModeTree.cpp acsModeTree.cpp
payloadModeTree.cpp
system.cpp
) )

View File

@ -8,6 +8,8 @@
#include "mission/controller/controllerdefinitions/AcsControllerDefinitions.h" #include "mission/controller/controllerdefinitions/AcsControllerDefinitions.h"
// Alias for checker function
namespace {
void checkInsert(ReturnValue_t result, const char* ctx); void checkInsert(ReturnValue_t result, const char* ctx);
void buildOffSequence(Subsystem* ss, ModeListEntry& eh); void buildOffSequence(Subsystem* ss, ModeListEntry& eh);
void buildDetumbleSequence(Subsystem* ss, ModeListEntry& entryHelper); void buildDetumbleSequence(Subsystem* ss, ModeListEntry& entryHelper);
@ -15,8 +17,8 @@ void buildSafeSequence(Subsystem* ss, ModeListEntry& entryHelper);
void buildIdleSequence(Subsystem* ss, ModeListEntry& entryHelper); void buildIdleSequence(Subsystem* ss, ModeListEntry& entryHelper);
void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& entryHelper); void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& entryHelper);
void buildTargetPtSequence(Subsystem* ss, ModeListEntry& entryHelper); void buildTargetPtSequence(Subsystem* ss, ModeListEntry& entryHelper);
} // namespace
// Alias for checker function
const auto CHK = checkInsert; const auto CHK = checkInsert;
static const auto OFF = HasModesIF::MODE_OFF; static const auto OFF = HasModesIF::MODE_OFF;
static const auto NML = DeviceHandlerIF::MODE_NORMAL; static const auto NML = DeviceHandlerIF::MODE_NORMAL;
@ -73,7 +75,7 @@ auto ACS_TABLE_TARGET_PT_TRANS_0 =
auto ACS_TABLE_TARGET_PT_TRANS_1 = auto ACS_TABLE_TARGET_PT_TRANS_1 =
std::make_pair((acs::CtrlModes::TARGET_PT << 24) | 3, FixedArrayList<ModeListEntry, 1>()); std::make_pair((acs::CtrlModes::TARGET_PT << 24) | 3, FixedArrayList<ModeListEntry, 1>());
void satsystem::initAcsSubsystem() { void satsystem::acs::init() {
ModeListEntry entry; ModeListEntry entry;
Subsystem* acsSubsystem = new Subsystem(objects::ACS_SUBSYSTEM, objects::EIVE_SYSTEM, 12, 24); Subsystem* acsSubsystem = new Subsystem(objects::ACS_SUBSYSTEM, objects::EIVE_SYSTEM, 12, 24);
buildOffSequence(acsSubsystem, entry); buildOffSequence(acsSubsystem, entry);
@ -82,11 +84,13 @@ void satsystem::initAcsSubsystem() {
buildIdleSequence(acsSubsystem, entry); buildIdleSequence(acsSubsystem, entry);
buildIdleChargeSequence(acsSubsystem, entry); buildIdleChargeSequence(acsSubsystem, entry);
buildTargetPtSequence(acsSubsystem, entry); buildTargetPtSequence(acsSubsystem, entry);
acsSubsystem->setInitialMode(HasModesIF::MODE_OFF); acsSubsystem->setInitialMode(OFF);
} }
namespace {
void buildOffSequence(Subsystem* ss, ModeListEntry& eh) { void buildOffSequence(Subsystem* ss, ModeListEntry& eh) {
std::string context = "satsystem::buildOffSequence"; std::string context = "satsystem::acs::buildOffSequence";
auto ctxc = context.c_str(); auto ctxc = context.c_str();
// Insert Helper Table // Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) { auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
@ -125,7 +129,7 @@ void buildOffSequence(Subsystem* ss, ModeListEntry& eh) {
} }
void buildSafeSequence(Subsystem* ss, ModeListEntry& eh) { void buildSafeSequence(Subsystem* ss, ModeListEntry& eh) {
std::string context = "satsystem::buildSafeSequence"; std::string context = "satsystem::acs::buildSafeSequence";
auto ctxc = context.c_str(); auto ctxc = context.c_str();
// Insert Helper Table // Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
@ -174,7 +178,7 @@ void buildSafeSequence(Subsystem* ss, ModeListEntry& eh) {
} }
void buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { void buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) {
std::string context = "satsystem::buildDetumbleSequence"; std::string context = "satsystem::acs::buildDetumbleSequence";
auto ctxc = context.c_str(); auto ctxc = context.c_str();
// Insert Helper Table // Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
@ -226,7 +230,7 @@ void buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) {
} }
void buildIdleSequence(Subsystem* ss, ModeListEntry& eh) { void buildIdleSequence(Subsystem* ss, ModeListEntry& eh) {
std::string context = "satsystem::buildIdleSequence"; std::string context = "satsystem::acs::buildIdleSequence";
auto ctxc = context.c_str(); auto ctxc = context.c_str();
// Insert Helper Table // Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
@ -273,7 +277,7 @@ void buildIdleSequence(Subsystem* ss, ModeListEntry& eh) {
} }
void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) { void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) {
std::string context = "satsystem::buildIdleChargeSequence"; std::string context = "satsystem::acs::buildIdleChargeSequence";
auto ctxc = context.c_str(); auto ctxc = context.c_str();
// Insert Helper Table // Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
@ -327,7 +331,7 @@ void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) {
} }
void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) {
std::string context = "satsystem::buildTargetPtSequence"; std::string context = "satsystem::acs::buildTargetPtSequence";
auto ctxc = context.c_str(); auto ctxc = context.c_str();
// Insert Helper Table // Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
@ -383,6 +387,8 @@ void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) {
void checkInsert(ReturnValue_t result, const char* ctx) { void checkInsert(ReturnValue_t result, const char* ctx) {
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "satsystem::checkInsert: Insertion failed at " << ctx << std::endl; sif::warning << "Insertion failed at " << ctx << std::endl;
} }
} }
} // namespace

View File

@ -3,7 +3,9 @@
class Subsystem; class Subsystem;
namespace satsystem { namespace satsystem {
namespace acs {
void initAcsSubsystem(); void init();
}
} // namespace satsystem } // namespace satsystem

View File

@ -0,0 +1,116 @@
#include "payloadModeTree.h"
#include <commonObjects.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/modes/HasModesIF.h>
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/subsystem/Subsystem.h>
#include "mission/system/objects/PayloadSubsystem.h"
namespace {
void checkInsert(ReturnValue_t result, const char* ctx);
void initOffSequence(Subsystem* ss, ModeListEntry& eh);
void initPlDacSequence(Subsystem* ss, ModeListEntry& eh);
void initPlCamSequence(Subsystem* ss, ModeListEntry& eh);
void initPlDataSequence(Subsystem* ss, ModeListEntry& eh);
void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh);
void initScexSequence(Subsystem* ss, ModeListEntry& eh);
} // namespace
const auto CHK = checkInsert;
static const auto OFF = HasModesIF::MODE_OFF;
// static const auto NML = DeviceHandlerIF::MODE_NORMAL;
auto PL_SEQUENCE_OFF = std::make_pair(OFF << 24, FixedArrayList<ModeListEntry, 2>());
auto PL_TABLE_OFF_TGT = std::make_pair((OFF << 24) | 1, FixedArrayList<ModeListEntry, 0>());
auto PL_TABLE_OFF_TRANS = std::make_pair((OFF << 24) | 2, FixedArrayList<ModeListEntry, 5>());
void satsystem::pl::init() {
ModeListEntry entry;
Subsystem* plSubsystem = new Subsystem(objects::PL_SUBSYSTEM, objects::EIVE_SYSTEM, 12, 24);
initOffSequence(plSubsystem, entry);
initPlDacSequence(plSubsystem, entry);
initPlCamSequence(plSubsystem, entry);
initPlDataSequence(plSubsystem, entry);
initEarthObsvSequence(plSubsystem, entry);
initScexSequence(plSubsystem, entry);
plSubsystem->setInitialMode(OFF);
}
namespace {
void initOffSequence(Subsystem* ss, ModeListEntry& eh) {
std::string context = "satsystem::payload::buildOffSequence";
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);
CHK(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);
CHK(sequence.insert(eh), ctxc);
};
// Build OFF target. Is empty
ss->addTable(&PL_TABLE_OFF_TGT.second, PL_TABLE_OFF_TGT.first, false, true);
// Build OFF transition 0
iht(objects::PLOC_SWITCHER, OFF, 0, PL_TABLE_OFF_TRANS.second);
iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_OFF_TRANS.second);
iht(objects::SCEX_HANDLER, OFF, 0, PL_TABLE_OFF_TRANS.second);
iht(objects::PLPCDU_HANDLER, OFF, 0, PL_TABLE_OFF_TRANS.second);
iht(objects::PLOC_SUBSYSTEM, OFF, 0, PL_TABLE_OFF_TRANS.second);
ss->addTable(&PL_TABLE_OFF_TRANS.second, PL_TABLE_OFF_TRANS.first, false, true);
// Build OFF sequence
ihs(PL_SEQUENCE_OFF.second, PL_TABLE_OFF_TGT.first, 0, false);
ihs(PL_SEQUENCE_OFF.second, PL_TABLE_OFF_TRANS.first, 0, false);
ss->addSequence(&PL_SEQUENCE_OFF.second, PL_SEQUENCE_OFF.first, PL_SEQUENCE_OFF.first, false,
true);
}
void initPlDacSequence(Subsystem* ss, ModeListEntry& eh) {
std::string context = "satsystem::payload::initPlDacSequence";
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);
CHK(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);
CHK(sequence.insert(eh), ctxc);
};
}
void initPlCamSequence(Subsystem* ss, ModeListEntry& eh) {}
void initPlDataSequence(Subsystem* ss, ModeListEntry& eh) {}
void initEarthObsvSequence(Subsystem* ss, ModeListEntry& eh) {}
void initScexSequence(Subsystem* ss, ModeListEntry& eh) {}
void checkInsert(ReturnValue_t result, const char* ctx) {
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "satsystem::checkInsert: PL | Insertion failed at " << ctx << std::endl;
}
}
} // namespace

View File

@ -0,0 +1,12 @@
#ifndef MISSION_SYSTEM_TREE_PAYLOADMODETREE_H_
#define MISSION_SYSTEM_TREE_PAYLOADMODETREE_H_
namespace satsystem {
namespace pl {
void init();
}
} // namespace satsystem
#endif /* MISSION_SYSTEM_TREE_PAYLOADMODETREE_H_ */

View File

@ -0,0 +1,9 @@
#include "system.h"
#include "acsModeTree.h"
#include "payloadModeTree.h"
void satsystem::init() {
acs::init();
pl::init();
}

View File

@ -0,0 +1,10 @@
#ifndef MISSION_SYSTEM_TREE_SYSTEM_H_
#define MISSION_SYSTEM_TREE_SYSTEM_H_
namespace satsystem {
void init();
}
#endif /* MISSION_SYSTEM_TREE_SYSTEM_H_ */