v1.17.0 #327

Merged
muellerr merged 131 commits from develop into main 2022-11-28 18:29:31 +01:00
26 changed files with 583 additions and 89 deletions
Showing only changes of commit 63f48c5f45 - Show all commits

View File

@ -10,8 +10,9 @@ list yields a list of all related PRs for each release.
# [unreleased]
- Add IRQ mode for PDEC handler
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/310
- ACS Subsystem. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/231
- Payload Subsystem. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/231
- Add IRQ mode for PDEC handler. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/310
- Extended TM funnels to allow multiple TM recipients.
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/312
- DHB: Transitions to normal mode now possible directly, which simplifies subsystem implementations

View File

@ -67,12 +67,6 @@ void initmission::initTasks() {
void (*missedDeadlineFunc)(void) = nullptr;
#endif
PeriodicTaskIF* sysCtrlTask = factory->createPeriodicTask(
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
result = sysCtrlTask->addComponent(objects::CORE_CONTROLLER);
if (result != returnvalue::OK) {
initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
}
#if OBSW_ADD_SA_DEPL == 1
// Could add this to the core controller but the core controller does so many thing that I would
// prefer to have the solar array deployment in a seprate task.
@ -84,6 +78,17 @@ void initmission::initTasks() {
}
#endif
PeriodicTaskIF* sysTask = factory->createPeriodicTask(
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
result = sysTask->addComponent(objects::CORE_CONTROLLER);
if (result != returnvalue::OK) {
initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
}
result = sysTask->addComponent(objects::PL_SUBSYSTEM);
if (result != returnvalue::OK) {
initmission::printAddObjectError("PL_SUBSYSTEM", objects::PL_SUBSYSTEM);
}
/* TMTC Distribution */
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
"DIST", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
@ -127,9 +132,7 @@ void initmission::initTasks() {
initmission::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER);
}
// Minimal distance between two received TCs amounts to 0.6 seconds
// If a command has not been read before the next one arrives, the old command will be
// overwritten by the PDEC.
// Runs in IRQ mode, frequency does not really matter
PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask(
"PDEC_HANDLER", 75, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER);
@ -275,14 +278,11 @@ void initmission::initTasks() {
}
#endif /* OBSW_ADD_PLOC_SUPERVISOR */
#if OBSW_TEST_CCSDS_BRIDGE == 1
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE);
if (result != returnvalue::OK) {
initmission::printAddObjectError("PTME_TEST", objects::CCSDS_IP_CORE_BRIDGE);
}
#endif
PeriodicTaskIF* plTask = factory->createPeriodicTask(
"PL_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
scheduling::addMpsocSupvHandlers(plTask);
plTask->addComponent(objects::CAM_SWITCHER);
#if OBSW_ADD_SCEX_DEVICE == 1
PeriodicTaskIF* scexDevHandler;
PeriodicTaskIF* scexReaderTask;
@ -295,6 +295,14 @@ void initmission::initTasks() {
createPstTasks(*factory, missedDeadlineFunc, pstTasks);
#if OBSW_ADD_TEST_CODE == 1
#if OBSW_TEST_CCSDS_BRIDGE == 1
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE);
if (result != returnvalue::OK) {
initmission::printAddObjectError("PTME_TEST", objects::CCSDS_IP_CORE_BRIDGE);
}
#endif
std::vector<PeriodicTaskIF*> testTasks;
createTestTasks(*factory, missedDeadlineFunc, testTasks);
#endif
@ -321,7 +329,7 @@ void initmission::initTasks() {
pdecHandlerTask->startTask();
#endif /* OBSW_ADD_CCSDS_IP_CORES == 1 */
sysCtrlTask->startTask();
sysTask->startTask();
#if OBSW_ADD_SA_DEPL == 1
solarArrayDeplTask->startTask();
#endif

View File

@ -1,5 +1,8 @@
#include "ObjectFactory.h"
#include <fsfw/subsystem/Subsystem.h>
#include <mission/system/objects/CamSwitcher.h>
#include "OBSWConfig.h"
#include "bsp_q7s/boardtest/Q7STestTask.h"
#include "bsp_q7s/callbacks/gnssCallback.h"
@ -45,6 +48,7 @@
#include "mission/system/objects/RwAssembly.h"
#include "mission/system/objects/TcsBoardAssembly.h"
#include "mission/system/tree/acsModeTree.h"
#include "mission/system/tree/payloadModeTree.h"
#include "tmtc/pusIds.h"
#if OBSW_TEST_LIBGPIOD == 1
#include "linux/boardtest/LibgpiodTest.h"
@ -464,6 +468,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
auto gpsCtrl =
new GPSHyperionLinuxController(objects::GPS_CONTROLLER, objects::NO_OBJECT, debugGps);
gpsCtrl->setResetPinTriggerFunction(gps::triggerGpioResetPin, &RESET_ARGS_GNSS);
AcsBoardHelper acsBoardHelper = AcsBoardHelper(
objects::MGM_0_LIS3_HANDLER, objects::MGM_1_RM3100_HANDLER, objects::MGM_2_LIS3_HANDLER,
objects::MGM_3_RM3100_HANDLER, objects::GYRO_0_ADIS_HANDLER, objects::GYRO_1_L3G_HANDLER,
@ -479,7 +484,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
}
}
gpsCtrl->connectModeTreeParent(*acsAss);
acsAss->connectModeTreeParent(satsystem::ACS_SUBSYSTEM);
acsAss->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
#endif /* OBSW_ADD_ACS_HANDLERS == 1 */
}
@ -582,9 +587,13 @@ void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) {
#endif
}
void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF& pwrSwitch) {
using namespace gpio;
std::stringstream consumer;
auto* camSwitcher =
new CamSwitcher(objects::CAM_SWITCHER, pwrSwitch, pcdu::PDU2_CH8_PAYLOAD_CAMERA);
camSwitcher->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
// camSwitcher->
#if OBSW_ADD_PLOC_MPSOC == 1
consumer << "0x" << std::hex << objects::PLOC_MPSOC_HANDLER;
auto gpioConfigMPSoC = new GpiodRegularByLineName(q7s::gpioNames::ENABLE_MPSOC_UART,
@ -597,9 +606,10 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
mpsoc::MAX_REPLY_SIZE, UartModes::NON_CANONICAL);
mpsocCookie->setNoFixedSizeReply();
auto plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocCookie,
plocMpsocHelper, Gpio(gpioIds::ENABLE_MPSOC_UART, gpioComIF),
objects::PLOC_SUPERVISOR_HANDLER);
auto* mpsocHandler = new PlocMPSoCHandler(
objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocCookie, plocMpsocHelper,
Gpio(gpioIds::ENABLE_MPSOC_UART, gpioComIF), objects::PLOC_SUPERVISOR_HANDLER);
mpsocHandler->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
#if OBSW_ADD_PLOC_SUPERVISOR == 1
consumer << "0x" << std::hex << objects::PLOC_SUPERVISOR_HANDLER;
@ -613,9 +623,10 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
uart::PLOC_SUPV_BAUD, supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL);
supervisorCookie->setNoFixedSizeReply();
auto supvHelper = new PlocSupvHelper(objects::PLOC_SUPERVISOR_HELPER);
new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF,
supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF),
pcdu::PDU1_CH6_PLOC_12V, supvHelper);
auto* supvHandler = new PlocSupervisorHandler(
objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, supervisorCookie,
Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF), pcdu::PDU1_CH6_PLOC_12V, supvHelper);
supvHandler->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
static_cast<void>(consumer);
}
@ -701,7 +712,7 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF,
<< std::endl;
}
}
rwAss->connectModeTreeParent(satsystem::ACS_SUBSYSTEM);
rwAss->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
#endif /* OBSW_ADD_RW == 1 */
}
@ -876,6 +887,7 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF*
plPcduHandler->setToGoToNormalModeImmediately(true);
plPcduHandler->enablePeriodicPrintout(true, 10);
#endif
plPcduHandler->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
}
void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
@ -902,7 +914,7 @@ void ObjectFactory::createStrComponents(PowerSwitchIF* pwrSwitcher) {
new StarTrackerHandler(objects::STAR_TRACKER, objects::UART_COM_IF, starTrackerCookie,
strHelper, pcdu::PDU1_CH2_STAR_TRACKER_5V);
starTracker->setPowerSwitcher(pwrSwitcher);
starTracker->connectModeTreeParent(satsystem::ACS_SUBSYSTEM);
starTracker->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
}
void ObjectFactory::createImtqComponents(PowerSwitchIF* pwrSwitcher) {
@ -911,7 +923,7 @@ void ObjectFactory::createImtqComponents(PowerSwitchIF* pwrSwitcher) {
auto imtqHandler = new ImtqHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie,
pcdu::Switches::PDU1_CH3_MGT_5V);
imtqHandler->setPowerSwitcher(pwrSwitcher);
imtqHandler->connectModeTreeParent(satsystem::ACS_SUBSYSTEM);
imtqHandler->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
static_cast<void>(imtqHandler);
#if OBSW_TEST_IMTQ == 1
imtqHandler->setStartUpImmediately();

View File

@ -38,7 +38,7 @@ void createBpxBatteryComponent();
void createStrComponents(PowerSwitchIF* pwrSwitcher);
void createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitcher, GpioIF& gpioIF);
void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher);
void createPayloadComponents(LinuxLibgpioIF* gpioComIF);
void createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF& pwrSwitcher);
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher);
ReturnValue_t createCcsdsComponents(LinuxLibgpioIF* gpioComIF, CcsdsIpCoreHandler** ipCoreHandler);
void createMiscComponents();

View File

@ -11,7 +11,7 @@
#include "linux/ObjectFactory.h"
#include "linux/callbacks/gpioCallbacks.h"
#include "mission/core/GenericFactory.h"
#include "mission/system/tree/acsModeTree.h"
#include "mission/system/tree/system.h"
void ObjectFactory::produce(void* args) {
ObjectFactory::setStatics();
@ -49,7 +49,7 @@ void ObjectFactory::produce(void* args) {
createSyrlinksComponents(pwrSwitcher);
#endif /* OBSW_ADD_SYRLINKS == 1 */
createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher, spiMainComIF);
createPayloadComponents(gpioComIF);
createPayloadComponents(gpioComIF, *pwrSwitcher);
#if OBSW_ADD_MGT == 1
createImtqComponents(pwrSwitcher);
@ -67,7 +67,7 @@ void ObjectFactory::produce(void* args) {
CcsdsIpCoreHandler* ipCoreHandler = nullptr;
createCcsdsComponents(gpioComIF, &ipCoreHandler);
#if OBSW_TM_TO_PTME == 1
ObjectFactory::addTmtcIpCoresToFunnels(*ipCoreHandler, *pusFunnel, *cfdpFunnel);
addTmtcIpCoresToFunnels(*ipCoreHandler, *pusFunnel, *cfdpFunnel);
#endif
#endif /* OBSW_ADD_CCSDS_IP_CORES == 1 */
@ -83,5 +83,5 @@ void ObjectFactory::produce(void* args) {
createMiscComponents();
createThermalController();
createAcsController(true);
satsystem::initAcsSubsystem(objects::NO_OBJECT);
satsystem::init();
}

View File

@ -55,7 +55,7 @@ namespace uart {
static constexpr size_t HYPERION_GPS_REPLY_MAX_BUFFER = 1024;
static constexpr UartBaudRate SYRLINKS_BAUD = UartBaudRate::RATE_38400;
static constexpr UartBaudRate SCEX_BAUD = UartBaudRate::RATE_115200;
static constexpr UartBaudRate SCEX_BAUD = UartBaudRate::RATE_38400;
static constexpr UartBaudRate GNSS_BAUD = UartBaudRate::RATE_9600;
static constexpr UartBaudRate PLOC_MPSOC_BAUD = UartBaudRate::RATE_115200;
static constexpr UartBaudRate PLOC_SUPV_BAUD = UartBaudRate::RATE_115200;

View File

@ -127,13 +127,15 @@ enum commonObjects : uint32_t {
SUS_BOARD_ASS = 0x73000002,
TCS_BOARD_ASS = 0x73000003,
RW_ASS = 0x73000004,
CAM_SWITCHER = 0x73000006,
ACS_SUBSYSTEM = 0x73010001,
PL_SUBSYSTEM = 0x73010002,
EIVE_SYSTEM = 0x73010000,
CFDP_HANDLER = 0x73000005,
CFDP_DISTRIBUTOR = 0x73000006,
TM_FUNNEL = 0x73000100,
PUS_TM_FUNNEL = 0x73000101,
CFDP_TM_FUNNEL = 0x73000102,
CFDP_HANDLER = 0x73000205,
CFDP_DISTRIBUTOR = 0x73000206,
};
}

2
fsfw

@ -1 +1 @@
Subproject commit 0e8f5ddd26d586dd40e69f52aef1a63c0d5a9da6
Subproject commit 177c39dd53198a1b05e2f40fc3c5e88e7f7c2e0b

View File

@ -45,3 +45,21 @@ void scheduling::schedulingScex(TaskFactory& factory, PeriodicTaskIF*& scexDevHa
printAddObjectError("SCEX_UART_READER", objects::SCEX_UART_READER);
}
}
void scheduling::addMpsocSupvHandlers(PeriodicTaskIF* plTask) {
#if OBSW_ADD_PLOC_SUPERVISOR == 1
plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::PERFORM_OPERATION);
plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::SEND_READ);
plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::GET_READ);
plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::SEND_WRITE);
plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::GET_WRITE);
#endif
#if OBSW_ADD_PLOC_MPSOC == 1
plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::PERFORM_OPERATION);
plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::SEND_READ);
plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::GET_READ);
plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::SEND_WRITE);
plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::GET_WRITE);
#endif
}

View File

@ -4,4 +4,6 @@
namespace scheduling {
void schedulingScex(TaskFactory& factory, PeriodicTaskIF*& scexDevHandler,
PeriodicTaskIF*& scexReaderTask);
}
void addMpsocSupvHandlers(PeriodicTaskIF* task);
} // namespace scheduling

View File

@ -27,6 +27,7 @@
#include "mission/system/objects/SusAssembly.h"
#include "mission/system/objects/TcsBoardAssembly.h"
#include "mission/system/tree/acsModeTree.h"
#include "mission/system/tree/payloadModeTree.h"
void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiComIF,
PowerSwitchIF* pwrSwitcher, std::string spiDev) {
@ -185,7 +186,7 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
#endif
}
}
susAss->connectModeTreeParent(satsystem::ACS_SUBSYSTEM);
susAss->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
#endif /* OBSW_ADD_SUN_SENSORS == 1 */
}
@ -336,6 +337,7 @@ void ObjectFactory::createScexComponents(std::string uartDev, PowerSwitchIF* pwr
if (switchId) {
scexHandler->setPowerSwitcher(*pwrSwitcher, switchId.value());
}
scexHandler->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
}
void ObjectFactory::createThermalController() {
@ -345,7 +347,7 @@ void ObjectFactory::createThermalController() {
AcsController* ObjectFactory::createAcsController(bool connectSubsystem) {
auto acsCtrl = new AcsController(objects::ACS_CONTROLLER);
if (connectSubsystem) {
acsCtrl->connectModeTreeParent(satsystem::ACS_SUBSYSTEM);
acsCtrl->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
}
return acsCtrl;
}

View File

@ -461,26 +461,6 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) {
// Length of a communication cycle
uint32_t length = thisSequence->getPeriodMs();
static_cast<void>(length);
#if OBSW_ADD_PLOC_MPSOC == 1
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::PLOC_MEMORY_DUMPER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
#endif
#if OBSW_ADD_PLOC_SUPERVISOR == 1
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
#endif
#if OBSW_ADD_SYRLINKS == 1
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0,

View File

@ -101,6 +101,9 @@ enum NormalSubmodeBits {
};
static constexpr Submode_t ALL_OFF_SUBMODE = 0;
static constexpr Submode_t ALL_ON_SUBMODE = (1 << HPA_ON) | (1 << MPA_ON) | (1 << TX_ON) |
(1 << X8_ON) | (1 << DRO_ON) |
(1 << SOLID_STATE_RELAYS_ADC_ON);
// 12 ADC values * 2 + trailing zero
static constexpr size_t ADC_REPLY_SIZE = 25;

View File

@ -1,6 +1,7 @@
target_sources(
${LIB_EIVE_MISSION}
PRIVATE EiveSystem.cpp
CamSwitcher.cpp
AcsSubsystem.cpp
ComSubsystem.cpp
PayloadSubsystem.cpp

View File

@ -0,0 +1,5 @@
#include "CamSwitcher.h"
CamSwitcher::CamSwitcher(object_id_t objectId, PowerSwitchIF &pwrSwitcher,
power::Switch_t pwrSwitch)
: PowerSwitcherComponent(objectId, &pwrSwitcher, pwrSwitch) {}

View File

@ -0,0 +1,13 @@
#ifndef MISSION_SYSTEM_OBJECTS_CAMSWITCHER_H_
#define MISSION_SYSTEM_OBJECTS_CAMSWITCHER_H_
#include <fsfw/power/PowerSwitcherComponent.h>
class CamSwitcher : public PowerSwitcherComponent {
public:
CamSwitcher(object_id_t objectId, PowerSwitchIF &pwrSwitcher, power::Switch_t pwrSwitch);
private:
};
#endif /* MISSION_SYSTEM_OBJECTS_CAMSWITCHER_H_ */

View File

@ -16,4 +16,16 @@ enum Submodes : Submode_t { A_SIDE = 0, B_SIDE = 1, DUAL_MODE = 2 };
} // namespace duallane
namespace payload {
enum Modes { NONE = 0, SUPV_ONLY = 1, MPSOC_STREAM = 2, CAM_STREAM = 3, EARTH_OBSV = 4, SCEX = 5 };
namespace ploc {
enum Modes { OFF = 0, SUPV_ONLY = 1, MPSOC_ON = 2 };
}
} // namespace payload
#endif /* MISSION_SYSTEM_DEFINITIONS_H_ */

View File

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

View File

@ -8,19 +8,22 @@
#include "eive/objects.h"
#include "mission/controller/controllerdefinitions/AcsControllerDefinitions.h"
#include "util.h"
Subsystem satsystem::ACS_SUBSYSTEM(objects::ACS_SUBSYSTEM, 12, 24);
Subsystem satsystem::acs::ACS_SUBSYSTEM(objects::ACS_SUBSYSTEM, 12, 24);
namespace {
// Alias for checker function
const auto check = subsystem::checkInsert;
void checkInsert(ReturnValue_t result, const char* ctx);
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);
} // namespace
// Alias for checker function
const auto check = checkInsert;
static const auto OFF = HasModesIF::MODE_OFF;
static const auto NML = DeviceHandlerIF::MODE_NORMAL;
@ -76,7 +79,7 @@ auto ACS_TABLE_TARGET_PT_TRANS_0 =
auto ACS_TABLE_TARGET_PT_TRANS_1 =
std::make_pair((acs::CtrlModes::TARGET_PT << 24) | 3, FixedArrayList<ModeListEntry, 1>());
void satsystem::initAcsSubsystem(object_id_t satSystemObjId) {
void satsystem::acs::init() {
ModeListEntry entry;
buildOffSequence(&ACS_SUBSYSTEM, entry);
buildSafeSequence(&ACS_SUBSYSTEM, entry);
@ -87,8 +90,10 @@ void satsystem::initAcsSubsystem(object_id_t satSystemObjId) {
ACS_SUBSYSTEM.setInitialMode(HasModesIF::MODE_OFF);
}
namespace {
void buildOffSequence(Subsystem* ss, ModeListEntry& eh) {
std::string context = "satsystem::buildOffSequence";
std::string context = "satsystem::acs::buildOffSequence";
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
@ -127,7 +132,7 @@ void buildOffSequence(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();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
@ -176,7 +181,7 @@ void buildSafeSequence(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();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
@ -228,7 +233,7 @@ void buildDetumbleSequence(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();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
@ -275,7 +280,7 @@ void buildIdleSequence(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();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
@ -329,7 +334,7 @@ void buildIdleChargeSequence(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();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
@ -383,15 +388,4 @@ void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) {
ctxc);
}
void checkInsert(ReturnValue_t result, const char* ctx) {
if (result != returnvalue::OK) {
sif::warning << "satsystem::checkInsert: Insertion failed at " << ctx;
if (result == mapdefs::KEY_ALREADY_EXISTS) {
sif::warning << ": Key already exists" << std::endl;
} else if (result == mapdefs::MAP_FULL) {
sif::warning << ": Map full" << std::endl;
} else {
sif::warning << std::endl;
}
}
}
} // namespace

View File

@ -3,9 +3,10 @@
class Subsystem;
namespace satsystem {
namespace acs {
extern Subsystem ACS_SUBSYSTEM;
void init();
void initAcsSubsystem(object_id_t satSystemObjId);
} // namespace acs
} // namespace satsystem

View File

@ -0,0 +1,372 @@
#include "payloadModeTree.h"
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/modes/HasModesIF.h>
#include <fsfw/retval.h>
#include <fsfw/subsystem/Subsystem.h>
#include "eive/objects.h"
#include "mission/devices/devicedefinitions/payloadPcduDefinitions.h"
#include "mission/system/objects/PayloadSubsystem.h"
#include "mission/system/objects/definitions.h"
#include "util.h"
namespace {
void initOffSequence(Subsystem& ss, ModeListEntry& eh);
void initPlMpsocStreamSequence(Subsystem& ss, ModeListEntry& eh);
void initPlCamStreamSequence(Subsystem& ss, ModeListEntry& eh);
void initPlSpvSequence(Subsystem& ss, ModeListEntry& eh);
void initEarthObsvSequence(Subsystem& ss, ModeListEntry& eh);
void initScexSequence(Subsystem& ss, ModeListEntry& eh);
} // namespace
Subsystem satsystem::pl::SUBSYSTEM = Subsystem(objects::PL_SUBSYSTEM, 12, 24);
const auto check = subsystem::checkInsert;
static const auto OFF = HasModesIF::MODE_OFF;
static const auto ON = HasModesIF::MODE_ON;
static const auto NML = DeviceHandlerIF::MODE_NORMAL;
auto PL_SEQUENCE_OFF = std::make_pair(OFF << 24, FixedArrayList<ModeListEntry, 3>());
auto PL_TABLE_OFF_TGT = std::make_pair((OFF << 24) | 1, FixedArrayList<ModeListEntry, 0>());
auto PL_TABLE_OFF_TRANS_0 = std::make_pair((OFF << 24) | 2, FixedArrayList<ModeListEntry, 5>());
auto PL_TABLE_OFF_TRANS_1 = std::make_pair((OFF << 24) | 3, FixedArrayList<ModeListEntry, 1>());
auto PL_SEQUENCE_MPSOC_STREAM =
std::make_pair(payload::Modes::MPSOC_STREAM << 24, FixedArrayList<ModeListEntry, 3>());
auto PL_TABLE_MPSOC_STREAM_TGT =
std::make_pair((payload::Modes::MPSOC_STREAM << 24) | 1, FixedArrayList<ModeListEntry, 5>());
auto PL_TABLE_MPSOC_STREAM_TRANS_0 =
std::make_pair((payload::Modes::MPSOC_STREAM << 24) | 2, FixedArrayList<ModeListEntry, 4>());
auto PL_TABLE_MPSOC_STREAM_TRANS_1 =
std::make_pair((payload::Modes::MPSOC_STREAM << 24) | 3, FixedArrayList<ModeListEntry, 2>());
auto PL_SEQUENCE_CAM_STREAM =
std::make_pair(payload::Modes::CAM_STREAM << 24, FixedArrayList<ModeListEntry, 3>());
auto PL_TABLE_CAM_STREAM_TGT =
std::make_pair((payload::Modes::CAM_STREAM << 24) | 1, FixedArrayList<ModeListEntry, 2>());
auto PL_TABLE_CAM_STREAM_TRANS_0 =
std::make_pair((payload::Modes::CAM_STREAM << 24) | 2, FixedArrayList<ModeListEntry, 4>());
auto PL_TABLE_CAM_STREAM_TRANS_1 =
std::make_pair((payload::Modes::CAM_STREAM << 24) | 3, FixedArrayList<ModeListEntry, 2>());
auto PL_SEQUENCE_SUPV_ONLY =
std::make_pair(payload::Modes::SUPV_ONLY << 24, FixedArrayList<ModeListEntry, 3>());
auto PL_TABLE_SUPV_ONLY_TGT =
std::make_pair((payload::Modes::SUPV_ONLY << 24) | 1, FixedArrayList<ModeListEntry, 5>());
auto PL_TABLE_SUPV_ONLY_TRANS_0 =
std::make_pair((payload::Modes::SUPV_ONLY << 24) | 2, FixedArrayList<ModeListEntry, 5>());
auto PL_TABLE_SUPV_ONLY_TRANS_1 =
std::make_pair((payload::Modes::SUPV_ONLY << 24) | 3, FixedArrayList<ModeListEntry, 5>());
auto PL_SEQUENCE_EARTH_OBSV =
std::make_pair(payload::Modes::EARTH_OBSV << 24, FixedArrayList<ModeListEntry, 3>());
auto PL_TABLE_EARTH_OBSV_TGT =
std::make_pair((payload::Modes::EARTH_OBSV << 24) | 1, FixedArrayList<ModeListEntry, 5>());
auto PL_TABLE_EARTH_OBSV_TRANS_0 =
std::make_pair((payload::Modes::EARTH_OBSV << 24) | 2, FixedArrayList<ModeListEntry, 3>());
auto PL_TABLE_EARTH_OBSV_TRANS_1 =
std::make_pair((payload::Modes::EARTH_OBSV << 24) | 3, FixedArrayList<ModeListEntry, 2>());
auto PL_SEQUENCE_SCEX =
std::make_pair(payload::Modes::SCEX << 24, FixedArrayList<ModeListEntry, 2>());
auto PL_TABLE_SCEX_TGT =
std::make_pair((payload::Modes::SCEX << 24) | 1, FixedArrayList<ModeListEntry, 1>());
auto PL_TABLE_SCEX_TRANS_0 =
std::make_pair((payload::Modes::SCEX << 24) | 2, FixedArrayList<ModeListEntry, 1>());
void satsystem::pl::init() {
ModeListEntry entry;
initOffSequence(SUBSYSTEM, entry);
initPlMpsocStreamSequence(SUBSYSTEM, entry);
initPlCamStreamSequence(SUBSYSTEM, entry);
initPlSpvSequence(SUBSYSTEM, entry);
initEarthObsvSequence(SUBSYSTEM, entry);
initScexSequence(SUBSYSTEM, entry);
SUBSYSTEM.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);
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 OFF target. Is empty
check(ss.addTable(TableEntry(PL_TABLE_OFF_TGT.first, &PL_TABLE_OFF_TGT.second)), ctxc);
// Build OFF transition 0
iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_OFF_TRANS_0.second);
iht(objects::SCEX, OFF, 0, PL_TABLE_OFF_TRANS_0.second);
iht(objects::PLPCDU_HANDLER, OFF, 0, PL_TABLE_OFF_TRANS_0.second);
iht(objects::PLOC_MPSOC_HANDLER, OFF, 0, PL_TABLE_OFF_TRANS_0.second);
check(ss.addTable(TableEntry(PL_TABLE_OFF_TRANS_0.first, &PL_TABLE_OFF_TRANS_0.second)), ctxc);
// Build OFF transition 1
iht(objects::PLOC_SUPERVISOR_HANDLER, OFF, 0, PL_TABLE_OFF_TRANS_1.second);
check(ss.addTable(TableEntry(PL_TABLE_OFF_TRANS_1.first, &PL_TABLE_OFF_TRANS_1.second)), ctxc);
// Build OFF sequence
ihs(PL_SEQUENCE_OFF.second, PL_TABLE_OFF_TGT.first, 0, false);
ihs(PL_SEQUENCE_OFF.second, PL_TABLE_OFF_TRANS_0.first, 0, false);
ihs(PL_SEQUENCE_OFF.second, PL_TABLE_OFF_TRANS_1.first, 0, false);
check(ss.addSequence(
SequenceEntry(PL_SEQUENCE_OFF.first, &PL_SEQUENCE_OFF.second, PL_SEQUENCE_OFF.first)),
ctxc);
}
void initPlMpsocStreamSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::payload::initPlMpsocStreamSequence";
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 MPSoC stream target
// Camera should always be off to prevent a conflict with the MPSoC streaming
// PL PCDU must be on and in normal mode, but this is commanded separately because of the
// number of commands invovled
iht(objects::PLPCDU_HANDLER, NML, plpcdu::ALL_ON_SUBMODE, PL_TABLE_MPSOC_STREAM_TGT.second);
iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_MPSOC_STREAM_TGT.second);
iht(objects::PLOC_MPSOC_HANDLER, NML, 0, PL_TABLE_MPSOC_STREAM_TGT.second);
iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_MPSOC_STREAM_TGT.second);
check(ss.addTable(TableEntry(PL_TABLE_MPSOC_STREAM_TGT.first, &PL_TABLE_MPSOC_STREAM_TGT.second)),
ctxc);
// Build MPSoC stream transition 0
iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second);
iht(objects::SCEX, OFF, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second);
iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_MPSOC_STREAM_TRANS_0.second);
check(ss.addTable(
TableEntry(PL_TABLE_MPSOC_STREAM_TRANS_0.first, &PL_TABLE_MPSOC_STREAM_TRANS_0.second)),
ctxc);
// Build MPSoC stream transition 1
iht(objects::PLOC_MPSOC_HANDLER, NML, 0, PL_TABLE_MPSOC_STREAM_TRANS_1.second);
check(ss.addTable(
TableEntry(PL_TABLE_MPSOC_STREAM_TRANS_1.first, &PL_TABLE_MPSOC_STREAM_TRANS_1.second)),
ctxc);
// Build MPSoC stream sequence
ihs(PL_SEQUENCE_MPSOC_STREAM.second, PL_TABLE_MPSOC_STREAM_TGT.first, 0, true);
ihs(PL_SEQUENCE_MPSOC_STREAM.second, PL_TABLE_MPSOC_STREAM_TRANS_0.first, 0, true);
ihs(PL_SEQUENCE_MPSOC_STREAM.second, PL_TABLE_MPSOC_STREAM_TRANS_1.first, 0, false);
check(ss.addSequence(SequenceEntry(PL_SEQUENCE_MPSOC_STREAM.first,
&PL_SEQUENCE_MPSOC_STREAM.second, PL_SEQUENCE_OFF.first)),
ctxc);
}
void initPlCamStreamSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::payload::initPlCamStreamSequence";
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 CAM target
// Only check that the PL PCDU is on for now. It might later become necessary to switch on
// the PLOC, so we ignore its state.
iht(objects::PLPCDU_HANDLER, NML, plpcdu::ALL_ON_SUBMODE, PL_TABLE_CAM_STREAM_TGT.second);
check(ss.addTable(TableEntry(PL_TABLE_CAM_STREAM_TGT.first, &PL_TABLE_CAM_STREAM_TGT.second)),
ctxc);
// Build CAM transition 0
// PLOC is actively commanded off here
iht(objects::PLOC_MPSOC_HANDLER, OFF, 0, PL_TABLE_CAM_STREAM_TRANS_0.second);
iht(objects::CAM_SWITCHER, ON, 0, PL_TABLE_CAM_STREAM_TRANS_0.second);
iht(objects::SCEX, OFF, 0, PL_TABLE_CAM_STREAM_TRANS_0.second);
check(ss.addTable(
TableEntry(PL_TABLE_CAM_STREAM_TRANS_0.first, &PL_TABLE_CAM_STREAM_TRANS_0.second)),
ctxc);
// Build CAM transition 1
iht(objects::PLOC_SUPERVISOR_HANDLER, OFF, 0, PL_TABLE_CAM_STREAM_TRANS_1.second);
check(ss.addTable(
TableEntry(PL_TABLE_CAM_STREAM_TRANS_1.first, &PL_TABLE_CAM_STREAM_TRANS_1.second)),
ctxc);
// Build CAM stream sequence
ihs(PL_SEQUENCE_CAM_STREAM.second, PL_TABLE_CAM_STREAM_TGT.first, 0, true);
ihs(PL_SEQUENCE_CAM_STREAM.second, PL_TABLE_CAM_STREAM_TRANS_0.first, 0, true);
ihs(PL_SEQUENCE_CAM_STREAM.second, PL_TABLE_CAM_STREAM_TRANS_1.first, 0, false);
check(ss.addSequence(SequenceEntry(PL_SEQUENCE_CAM_STREAM.first, &PL_SEQUENCE_CAM_STREAM.second,
PL_SEQUENCE_OFF.first)),
ctxc);
}
void initPlSpvSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::payload::initPlSupvSequence";
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 Payload Supervisor Only target
iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_SUPV_ONLY_TGT.second);
check(ss.addTable(TableEntry(PL_TABLE_SUPV_ONLY_TGT.first, &PL_TABLE_SUPV_ONLY_TGT.second)),
ctxc);
// Build Payload Supervisor Only transition 0
iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_SUPV_ONLY_TRANS_0.second);
iht(objects::CAM_SWITCHER, OFF, 0, PL_TABLE_SUPV_ONLY_TRANS_0.second);
check(
ss.addTable(TableEntry(PL_TABLE_SUPV_ONLY_TRANS_0.first, &PL_TABLE_SUPV_ONLY_TRANS_0.second)),
ctxc);
// Build Payload Supervisor Only transition 1
iht(objects::PLOC_MPSOC_HANDLER, OFF, 0, PL_TABLE_SUPV_ONLY_TRANS_1.second);
check(
ss.addTable(TableEntry(PL_TABLE_SUPV_ONLY_TRANS_1.first, &PL_TABLE_SUPV_ONLY_TRANS_1.second)),
ctxc);
// Build Payload Supervisor Only Sequence
ihs(PL_SEQUENCE_SUPV_ONLY.second, PL_TABLE_SUPV_ONLY_TGT.first, 0, true);
ihs(PL_SEQUENCE_SUPV_ONLY.second, PL_TABLE_SUPV_ONLY_TRANS_0.first, 0, true);
ihs(PL_SEQUENCE_SUPV_ONLY.second, PL_TABLE_SUPV_ONLY_TRANS_1.first, 0, false);
check(ss.addSequence(SequenceEntry(PL_SEQUENCE_SUPV_ONLY.first, &PL_SEQUENCE_SUPV_ONLY.second,
PL_SEQUENCE_OFF.first)),
ctxc);
}
void initEarthObsvSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::payload::initEarthObsvSequence";
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 Earth Observation target
iht(objects::PLOC_MPSOC_HANDLER, NML, 0, PL_TABLE_EARTH_OBSV_TGT.second);
iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_EARTH_OBSV_TGT.second);
iht(objects::CAM_SWITCHER, ON, 0, PL_TABLE_EARTH_OBSV_TGT.second);
iht(objects::PLPCDU_HANDLER, OFF, 0, PL_TABLE_EARTH_OBSV_TGT.second);
check(ss.addTable(TableEntry(PL_TABLE_EARTH_OBSV_TGT.first, &PL_TABLE_EARTH_OBSV_TGT.second)),
ctxc);
// Build Earth Observation transition 0
iht(objects::PLOC_SUPERVISOR_HANDLER, NML, 0, PL_TABLE_EARTH_OBSV_TRANS_0.second);
iht(objects::CAM_SWITCHER, ON, 0, PL_TABLE_EARTH_OBSV_TRANS_0.second);
iht(objects::PLPCDU_HANDLER, OFF, 0, PL_TABLE_EARTH_OBSV_TRANS_0.second);
check(ss.addTable(
TableEntry(PL_TABLE_EARTH_OBSV_TRANS_0.first, &PL_TABLE_EARTH_OBSV_TRANS_0.second)),
ctxc);
// Build Earth Observation transition 1
iht(objects::PLOC_MPSOC_HANDLER, NML, 0, PL_TABLE_CAM_STREAM_TRANS_1.second);
check(ss.addTable(
TableEntry(PL_TABLE_EARTH_OBSV_TRANS_1.first, &PL_TABLE_EARTH_OBSV_TRANS_1.second)),
ctxc);
ihs(PL_SEQUENCE_EARTH_OBSV.second, PL_TABLE_EARTH_OBSV_TGT.first, 0, true);
ihs(PL_SEQUENCE_EARTH_OBSV.second, PL_TABLE_EARTH_OBSV_TRANS_0.first, 0, true);
ihs(PL_SEQUENCE_EARTH_OBSV.second, PL_TABLE_EARTH_OBSV_TRANS_1.first, 0, false);
check(ss.addSequence(SequenceEntry(PL_SEQUENCE_EARTH_OBSV.first, &PL_SEQUENCE_EARTH_OBSV.second,
PL_SEQUENCE_OFF.first)),
ctxc);
}
void initScexSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::payload::initScexSequence";
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 SCEX target
iht(objects::SCEX, NML, 0, PL_TABLE_SCEX_TGT.second);
check(ss.addTable(TableEntry(PL_TABLE_SCEX_TGT.first, &PL_TABLE_SCEX_TGT.second)), ctxc);
// Build SCEX transition 0
iht(objects::SCEX, NML, 0, PL_TABLE_SCEX_TRANS_0.second);
check(ss.addTable(TableEntry(PL_TABLE_SCEX_TRANS_0.first, &PL_TABLE_SCEX_TRANS_0.second)), ctxc);
// Build SCEX sequence
ihs(PL_SEQUENCE_SCEX.second, PL_TABLE_SCEX_TGT.first, 0, true);
ihs(PL_SEQUENCE_SCEX.second, PL_TABLE_SCEX_TRANS_0.first, 0, false);
check(ss.addSequence(
SequenceEntry(PL_SEQUENCE_SCEX.first, &PL_SEQUENCE_SCEX.second, PL_SEQUENCE_OFF.first)),
ctxc);
}
} // namespace

View File

@ -0,0 +1,17 @@
#ifndef MISSION_SYSTEM_TREE_PAYLOADMODETREE_H_
#define MISSION_SYSTEM_TREE_PAYLOADMODETREE_H_
#include <fsfw/subsystem/Subsystem.h>
namespace satsystem {
namespace pl {
extern Subsystem SUBSYSTEM;
void init();
} // namespace pl
} // 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_ */

View File

@ -0,0 +1,19 @@
#include "util.h"
#include "fsfw/container/FixedMap.h"
#include "fsfw/serviceinterface.h"
void subsystem::checkInsert(ReturnValue_t result, const char* ctx) {
if (result != returnvalue::OK) {
sif::warning << "satsystem::checkInsert: Insertion failed at " << ctx;
if (result == containers::KEY_ALREADY_EXISTS) {
sif::warning << ": Key already exists" << std::endl;
} else if (result == containers::MAP_FULL) {
sif::warning << ": Map full" << std::endl;
} else if (result == containers::LIST_FULL) {
sif::warning << ": List full" << std::endl;
} else {
sif::warning << std::endl;
}
}
}

View File

@ -0,0 +1,12 @@
#ifndef MISSION_SYSTEM_TREE_UTIL_H_
#define MISSION_SYSTEM_TREE_UTIL_H_
#include <fsfw/retval.h>
namespace subsystem {
void checkInsert(ReturnValue_t result, const char* ctx);
}
#endif /* MISSION_SYSTEM_TREE_UTIL_H_ */