Merge pull request 'Make satsystem work on EM' (#377) from make_satsyste_work_on_em into develop
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

Reviewed-on: #377
Reviewed-by: Marius Eggert <eggertm@irs.uni-stuttgart.de>
This commit is contained in:
Marius Eggert 2023-02-13 18:04:01 +01:00
commit d9acbe3207
22 changed files with 564 additions and 185 deletions

View File

@ -239,10 +239,9 @@ ReturnValue_t ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF,
}
void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, SerialComIF* uartComIF,
PowerSwitchIF* pwrSwitcher) {
PowerSwitchIF& pwrSwitcher) {
using namespace gpio;
GpioCookie* gpioCookieAcsBoard = new GpioCookie();
std::vector<std::reference_wrapper<DeviceHandlerBase>> assemblyChildren;
std::stringstream consumer;
GpiodRegularByLineName* gpio = nullptr;
@ -344,6 +343,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, SerialCo
#if OBSW_ADD_ACS_BOARD == 1
std::string spiDev = q7s::SPI_DEFAULT_DEV;
std::array<DeviceHandlerBase*, 8> assemblyChildren;
SpiCookie* spiCookie =
new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, MGMLIS3MDL::MAX_BUFFER_SIZE,
spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
@ -352,7 +352,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, SerialCo
objects::MGM_0_LIS3_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie, spi::LIS3_TRANSITION_DELAY);
fdir = new AcsBoardFdir(objects::MGM_0_LIS3_HANDLER);
mgmLis3Handler0->setCustomFdir(fdir);
assemblyChildren.push_back(*mgmLis3Handler0);
assemblyChildren[0] = mgmLis3Handler0;
#if OBSW_TEST_ACS == 1
mgmLis3Handler->setStartUpImmediately();
mgmLis3Handler->setToGoToNormalMode(true);
@ -369,7 +369,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, SerialCo
spi::RM3100_TRANSITION_DELAY);
fdir = new AcsBoardFdir(objects::MGM_1_RM3100_HANDLER);
mgmRm3100Handler1->setCustomFdir(fdir);
assemblyChildren.push_back(*mgmRm3100Handler1);
assemblyChildren[1] = mgmRm3100Handler1;
#if OBSW_TEST_ACS == 1
mgmRm3100Handler->setStartUpImmediately();
mgmRm3100Handler->setToGoToNormalMode(true);
@ -385,7 +385,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, SerialCo
objects::MGM_2_LIS3_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie, spi::LIS3_TRANSITION_DELAY);
fdir = new AcsBoardFdir(objects::MGM_2_LIS3_HANDLER);
mgmLis3Handler2->setCustomFdir(fdir);
assemblyChildren.push_back(*mgmLis3Handler2);
assemblyChildren[2] = mgmLis3Handler2;
#if OBSW_TEST_ACS == 1
mgmLis3Handler->setStartUpImmediately();
mgmLis3Handler->setToGoToNormalMode(true);
@ -402,7 +402,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, SerialCo
spi::RM3100_TRANSITION_DELAY);
fdir = new AcsBoardFdir(objects::MGM_3_RM3100_HANDLER);
mgmRm3100Handler3->setCustomFdir(fdir);
assemblyChildren.push_back(*mgmRm3100Handler3);
assemblyChildren[3] = mgmRm3100Handler3;
#if OBSW_TEST_ACS == 1
mgmRm3100Handler->setStartUpImmediately();
mgmRm3100Handler->setToGoToNormalMode(true);
@ -421,7 +421,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, SerialCo
ADIS1650X::Type::ADIS16505);
fdir = new AcsBoardFdir(objects::GYRO_0_ADIS_HANDLER);
adisHandler->setCustomFdir(fdir);
assemblyChildren.push_back(*adisHandler);
assemblyChildren[4] = adisHandler;
#if OBSW_TEST_ACS == 1
adisHandler->setStartUpImmediately();
adisHandler->setToGoToNormalModeImmediately();
@ -437,7 +437,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, SerialCo
objects::GYRO_1_L3G_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie, spi::L3G_TRANSITION_DELAY);
fdir = new AcsBoardFdir(objects::GYRO_1_L3G_HANDLER);
gyroL3gHandler1->setCustomFdir(fdir);
assemblyChildren.push_back(*gyroL3gHandler1);
assemblyChildren[5] = gyroL3gHandler1;
#if OBSW_TEST_ACS == 1
gyroL3gHandler->setStartUpImmediately();
gyroL3gHandler->setToGoToNormalMode(true);
@ -454,7 +454,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, SerialCo
spiCookie, ADIS1650X::Type::ADIS16505);
fdir = new AcsBoardFdir(objects::GYRO_2_ADIS_HANDLER);
adisHandler->setCustomFdir(fdir);
assemblyChildren.push_back(*adisHandler);
assemblyChildren[6] = adisHandler;
#if OBSW_TEST_ACS == 1
adisHandler->setStartUpImmediately();
adisHandler->setToGoToNormalModeImmediately();
@ -467,7 +467,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, SerialCo
objects::GYRO_3_L3G_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie, spi::L3G_TRANSITION_DELAY);
fdir = new AcsBoardFdir(objects::GYRO_3_L3G_HANDLER);
gyroL3gHandler3->setCustomFdir(fdir);
assemblyChildren.push_back(*gyroL3gHandler3);
assemblyChildren[7] = gyroL3gHandler3;
#if OBSW_TEST_ACS == 1
gyroL3gHandler->setStartUpImmediately();
gyroL3gHandler->setToGoToNormalMode(true);
@ -485,22 +485,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, SerialCo
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,
objects::GYRO_2_ADIS_HANDLER, objects::GYRO_3_L3G_HANDLER, objects::GPS_CONTROLLER);
auto acsAss =
new AcsBoardAssembly(objects::ACS_BOARD_ASS, pwrSwitcher, acsBoardHelper, gpioComIF);
static_cast<void>(acsAss);
for (auto& assChild : assemblyChildren) {
ReturnValue_t result = assChild.get().connectModeTreeParent(*acsAss);
if (result != returnvalue::OK) {
sif::error << "Connecting assembly for ACS board component " << assChild.get().getObjectId()
<< " failed" << std::endl;
}
}
gpsCtrl->connectModeTreeParent(*acsAss);
acsAss->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
ObjectFactory::createAcsBoardAssy(pwrSwitcher, assemblyChildren, gpsCtrl, gpioComIF);
#endif /* OBSW_ADD_ACS_HANDLERS == 1 */
}
@ -692,33 +677,24 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF,
std::array<object_id_t, 4> rwIds = {objects::RW1, objects::RW2, objects::RW3, objects::RW4};
std::array<gpioId_t, 4> rwGpioIds = {gpioIds::EN_RW1, gpioIds::EN_RW2, gpioIds::EN_RW3,
gpioIds::EN_RW4};
std::array<RwHandler*, 4> rws = {};
std::array<DeviceHandlerBase*, 4> rws = {};
for (uint8_t idx = 0; idx < rwCookies.size(); idx++) {
rwCookies[idx] = new SpiCookie(rwCookieParams[idx].first, rwCookieParams[idx].second,
RwDefinitions::MAX_REPLY_SIZE, spi::RW_MODE, spi::RW_SPEED,
&rwSpiCallback::spiCallback, nullptr);
rws[idx] = new RwHandler(rwIds[idx], objects::SPI_RW_COM_IF, rwCookies[idx], gpioComIF,
auto* rwHandler = new RwHandler(rwIds[idx], objects::SPI_RW_COM_IF, rwCookies[idx], gpioComIF,
rwGpioIds[idx]);
rwCookies[idx]->setCallbackArgs(rws[idx]);
#if OBSW_TEST_RW == 1
rws[idx]->setStartUpImmediately();
#endif
#if OBSW_DEBUG_RW == 1
rws[idx]->setDebugMode(true);
rwHandler->setDebugMode(true);
#endif
rws[idx] = rwHandler;
}
RwHelper rwHelper(rwIds);
auto* rwAss =
new RwAssembly(objects::RW_ASS, pwrSwitcher, pcdu::Switches::PDU2_CH2_RW_5V, rwHelper);
for (uint8_t idx = 0; idx < rws.size(); idx++) {
ReturnValue_t result = rws[idx]->connectModeTreeParent(*rwAss);
if (result != returnvalue::OK) {
sif::error << "Connecting RW " << static_cast<int>(idx) << " to RW assembly failed"
<< std::endl;
}
}
rwAss->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
createRwAssy(*pwrSwitcher, pcdu::Switches::PDU2_CH2_RW_5V, rws, rwIds);
#endif /* OBSW_ADD_RW == 1 */
}

View File

@ -33,7 +33,7 @@ void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
void createTmpComponents();
ReturnValue_t createRadSensorComponent(LinuxLibgpioIF* gpioComIF, Stack5VHandler& handler);
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, SerialComIF* uartComIF,
PowerSwitchIF* pwrSwitcher);
PowerSwitchIF& pwrSwitcher);
void createHeaterComponents(GpioIF* gpioIF, PowerSwitchIF* pwrSwitcher, HealthTableIF* healthTable,
HeaterHandler*& heaterHandler);
void createImtqComponents(PowerSwitchIF* pwrSwitcher);

View File

@ -221,12 +221,10 @@ void scheduling::initTasks() {
if (result != returnvalue::OK) {
scheduling::printAddObjectError("TCS_SUBSYSTEM", objects::TCS_SUBSYSTEM);
}
#if OBSW_ADD_RTD_DEVICES == 1
result = tcsSystemTask->addComponent(objects::TCS_BOARD_ASS);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("TCS_BOARD_ASS", objects::TCS_BOARD_ASS);
}
#endif /* OBSW_ADD_RTD_DEVICES */
#if OBSW_ADD_TCS_CTRL == 1
result = tcsSystemTask->addComponent(objects::THERMAL_CONTROLLER);
if (result != returnvalue::OK) {

View File

@ -2,6 +2,7 @@
#include <fsfw/health/HealthTableIF.h>
#include <fsfw/power/DummyPowerSwitcher.h>
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
#include <mission/system/tree/system.h>
#include "OBSWConfig.h"
#include "bsp_q7s/core/CoreController.h"
@ -54,7 +55,7 @@ void ObjectFactory::produce(void* args) {
createPcduComponents(gpioComIF, &pwrSwitcher);
#endif
dummy::createDummies(dummyCfg, *pwrSwitcher);
dummy::createDummies(dummyCfg, *pwrSwitcher, gpioComIF);
new CoreController(objects::CORE_CONTROLLER);
@ -74,7 +75,7 @@ void ObjectFactory::produce(void* args) {
// createRadSensorComponent(gpioComIF);
#if OBSW_ADD_ACS_BOARD == 1
createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher);
createAcsBoardComponents(gpioComIF, uartComIF, *pwrSwitcher);
#endif
#if OBSW_ADD_MGT == 1
@ -115,5 +116,5 @@ void ObjectFactory::produce(void* args) {
HeaterHandler* heaterHandler = nullptr;
ObjectFactory::createGenericHeaterComponents(*gpioComIF, *pwrSwitcher, heaterHandler);
createThermalController(*heaterHandler);
satsystem::com::init();
satsystem::init();
}

View File

@ -39,11 +39,11 @@ void ObjectFactory::produce(void* args) {
createRadSensorComponent(gpioComIF, *stackHandler);
#endif
#if OBSW_ADD_SUN_SENSORS == 1
createSunSensorComponents(gpioComIF, spiMainComIF, pwrSwitcher, q7s::SPI_DEFAULT_DEV, true);
createSunSensorComponents(gpioComIF, spiMainComIF, *pwrSwitcher, q7s::SPI_DEFAULT_DEV, true);
#endif
#if OBSW_ADD_ACS_BOARD == 1
createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher);
createAcsBoardComponents(gpioComIF, uartComIF, *pwrSwitcher);
#endif
HeaterHandler* heaterHandler;
createHeaterComponents(gpioComIF, pwrSwitcher, healthTable, heaterHandler);

View File

@ -14,12 +14,16 @@ target_sources(
PduDummy.cpp
P60DockDummy.cpp
SaDeploymentDummy.cpp
GpsDummy.cpp
GpsDhbDummy.cpp
GpsCtrlDummy.cpp
GyroAdisDummy.cpp
GyroL3GD20Dummy.cpp
MgmLIS3MDLDummy.cpp
PlPcduDummy.cpp
ScexDummy.cpp
CoreControllerDummy.cpp
PlocMpsocDummy.cpp
PlocSupervisorDummy.cpp
helpers.cpp
MgmRm3100Dummy.cpp
Tmp1075Dummy.cpp)

21
dummies/GpsCtrlDummy.cpp Normal file
View File

@ -0,0 +1,21 @@
#include "GpsCtrlDummy.h"
GpsCtrlDummy::GpsCtrlDummy(object_id_t objectId) : ExtendedControllerBase(objectId, 20) {}
ReturnValue_t GpsCtrlDummy::handleCommandMessage(CommandMessage* message) {
return returnvalue::OK;
}
void GpsCtrlDummy::performControlOperation() {}
ReturnValue_t GpsCtrlDummy::checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t* msToReachTheMode) {
return returnvalue::OK;
}
ReturnValue_t GpsCtrlDummy::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) {
return returnvalue::OK;
}
LocalPoolDataSetBase* GpsCtrlDummy::getDataSetHandle(sid_t sid) { return nullptr; }

20
dummies/GpsCtrlDummy.h Normal file
View File

@ -0,0 +1,20 @@
#ifndef DUMMIES_GPSCTRLDUMMY_H_
#define DUMMIES_GPSCTRLDUMMY_H_
#include <fsfw/controller/ExtendedControllerBase.h>
class GpsCtrlDummy : public ExtendedControllerBase {
public:
GpsCtrlDummy(object_id_t objectId);
private:
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
void performControlOperation() override;
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t* msToReachTheMode) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
};
#endif /* DUMMIES_GPSCTRLDUMMY_H_ */

View File

@ -1,41 +1,43 @@
#include "GpsDummy.h"
#include <dummies/GpsDhbDummy.h>
#include <mission/devices/devicedefinitions/GPSDefinitions.h>
GpsDummy::GpsDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
GpsDhbDummy::GpsDhbDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
: DeviceHandlerBase(objectId, comif, comCookie) {}
GpsDummy::~GpsDummy() {}
GpsDhbDummy::~GpsDhbDummy() {}
void GpsDummy::doStartUp() {}
void GpsDhbDummy::doStartUp() {}
void GpsDummy::doShutDown() {}
void GpsDhbDummy::doShutDown() {}
ReturnValue_t GpsDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; }
ReturnValue_t GpsDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
ReturnValue_t GpsDhbDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) {
return NOTHING_TO_SEND;
}
ReturnValue_t GpsDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData, size_t commandDataLen) {
ReturnValue_t GpsDhbDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
return NOTHING_TO_SEND;
}
ReturnValue_t GpsDhbDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData,
size_t commandDataLen) {
return returnvalue::OK;
}
ReturnValue_t GpsDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
size_t *foundLen) {
ReturnValue_t GpsDhbDummy::scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) {
return returnvalue::OK;
}
ReturnValue_t GpsDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
ReturnValue_t GpsDhbDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
return returnvalue::OK;
}
void GpsDummy::fillCommandAndReplyMap() {}
void GpsDhbDummy::fillCommandAndReplyMap() {}
uint32_t GpsDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
uint32_t GpsDhbDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
ReturnValue_t GpsDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
ReturnValue_t GpsDhbDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(GpsHyperion::LATITUDE, new PoolEntry<double>({0.0}, 1));
localDataPoolMap.emplace(GpsHyperion::LONGITUDE, new PoolEntry<double>({0.0}, 1));

33
dummies/GpsDhbDummy.h Normal file
View File

@ -0,0 +1,33 @@
#ifndef DUMMIES_GPSDHBDUMMY_H_
#define DUMMIES_GPSDHBDUMMY_H_
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
class GpsDhbDummy : public DeviceHandlerBase {
public:
static const DeviceCommandId_t SIMPLE_COMMAND = 1;
static const DeviceCommandId_t PERIODIC_REPLY = 2;
static const uint8_t SIMPLE_COMMAND_DATA = 1;
static const uint8_t PERIODIC_REPLY_DATA = 2;
GpsDhbDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie);
virtual ~GpsDhbDummy();
protected:
void doStartUp() override;
void doShutDown() override;
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override;
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData,
size_t commandDataLen) override;
ReturnValue_t scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
size_t *foundLen) override;
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;
void fillCommandAndReplyMap() override;
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) override;
};
#endif /* DUMMIES_GPSDHBDUMMY_H_ */

View File

@ -0,0 +1,42 @@
#include "PlocMpsocDummy.h"
PlocMpsocDummy::PlocMpsocDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
: DeviceHandlerBase(objectId, comif, comCookie) {}
PlocMpsocDummy::~PlocMpsocDummy() {}
void PlocMpsocDummy::doStartUp() {}
void PlocMpsocDummy::doShutDown() {}
ReturnValue_t PlocMpsocDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) {
return NOTHING_TO_SEND;
}
ReturnValue_t PlocMpsocDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
return NOTHING_TO_SEND;
}
ReturnValue_t PlocMpsocDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData,
size_t commandDataLen) {
return returnvalue::OK;
}
ReturnValue_t PlocMpsocDummy::scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) {
return returnvalue::OK;
}
ReturnValue_t PlocMpsocDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
return returnvalue::OK;
}
void PlocMpsocDummy::fillCommandAndReplyMap() {}
uint32_t PlocMpsocDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
ReturnValue_t PlocMpsocDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
return returnvalue::OK;
}

View File

@ -1,9 +1,8 @@
#ifndef DUMMIES_GPSDUMMY_H_
#define DUMMIES_GPSDUMMY_H_
#pragma once
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
class GpsDummy : public DeviceHandlerBase {
class PlocMpsocDummy : public DeviceHandlerBase {
public:
static const DeviceCommandId_t SIMPLE_COMMAND = 1;
static const DeviceCommandId_t PERIODIC_REPLY = 2;
@ -11,8 +10,8 @@ class GpsDummy : public DeviceHandlerBase {
static const uint8_t SIMPLE_COMMAND_DATA = 1;
static const uint8_t PERIODIC_REPLY_DATA = 2;
GpsDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie);
virtual ~GpsDummy();
PlocMpsocDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie);
virtual ~PlocMpsocDummy();
protected:
void doStartUp() override;
@ -29,5 +28,3 @@ class GpsDummy : public DeviceHandlerBase {
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) override;
};
#endif /* DUMMIES_GPSDUMMY_H_ */

View File

@ -0,0 +1,44 @@
#include "PlocSupervisorDummy.h"
PlocSupervisorDummy::PlocSupervisorDummy(object_id_t objectId, object_id_t comif,
CookieIF *comCookie)
: DeviceHandlerBase(objectId, comif, comCookie) {}
PlocSupervisorDummy::~PlocSupervisorDummy() {}
void PlocSupervisorDummy::doStartUp() {}
void PlocSupervisorDummy::doShutDown() {}
ReturnValue_t PlocSupervisorDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) {
return NOTHING_TO_SEND;
}
ReturnValue_t PlocSupervisorDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
return NOTHING_TO_SEND;
}
ReturnValue_t PlocSupervisorDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData,
size_t commandDataLen) {
return returnvalue::OK;
}
ReturnValue_t PlocSupervisorDummy::scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) {
return returnvalue::OK;
}
ReturnValue_t PlocSupervisorDummy::interpretDeviceReply(DeviceCommandId_t id,
const uint8_t *packet) {
return returnvalue::OK;
}
void PlocSupervisorDummy::fillCommandAndReplyMap() {}
uint32_t PlocSupervisorDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
ReturnValue_t PlocSupervisorDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
return returnvalue::OK;
}

View File

@ -0,0 +1,30 @@
#pragma once
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
class PlocSupervisorDummy : public DeviceHandlerBase {
public:
static const DeviceCommandId_t SIMPLE_COMMAND = 1;
static const DeviceCommandId_t PERIODIC_REPLY = 2;
static const uint8_t SIMPLE_COMMAND_DATA = 1;
static const uint8_t PERIODIC_REPLY_DATA = 2;
PlocSupervisorDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie);
virtual ~PlocSupervisorDummy();
protected:
void doStartUp() override;
void doShutDown() override;
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override;
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData,
size_t commandDataLen) override;
ReturnValue_t scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
size_t *foundLen) override;
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;
void fillCommandAndReplyMap() override;
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) override;
};

40
dummies/ScexDummy.cpp Normal file
View File

@ -0,0 +1,40 @@
#include "ScexDummy.h"
ScexDummy::ScexDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
: DeviceHandlerBase(objectId, comif, comCookie) {}
ScexDummy::~ScexDummy() {}
void ScexDummy::doStartUp() {}
void ScexDummy::doShutDown() {}
ReturnValue_t ScexDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; }
ReturnValue_t ScexDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
return NOTHING_TO_SEND;
}
ReturnValue_t ScexDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData,
size_t commandDataLen) {
return returnvalue::OK;
}
ReturnValue_t ScexDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
size_t *foundLen) {
return returnvalue::OK;
}
ReturnValue_t ScexDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
return returnvalue::OK;
}
void ScexDummy::fillCommandAndReplyMap() {}
uint32_t ScexDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
ReturnValue_t ScexDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
return returnvalue::OK;
}

30
dummies/ScexDummy.h Normal file
View File

@ -0,0 +1,30 @@
#pragma once
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
class ScexDummy : public DeviceHandlerBase {
public:
static const DeviceCommandId_t SIMPLE_COMMAND = 1;
static const DeviceCommandId_t PERIODIC_REPLY = 2;
static const uint8_t SIMPLE_COMMAND_DATA = 1;
static const uint8_t PERIODIC_REPLY_DATA = 2;
ScexDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie);
virtual ~ScexDummy();
protected:
void doStartUp() override;
void doShutDown() override;
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override;
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData,
size_t commandDataLen) override;
ReturnValue_t scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
size_t *foundLen) override;
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;
void fillCommandAndReplyMap() override;
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) override;
};

View File

@ -5,7 +5,8 @@
#include <dummies/ComCookieDummy.h>
#include <dummies/ComIFDummy.h>
#include <dummies/CoreControllerDummy.h>
#include <dummies/GpsDummy.h>
#include <dummies/GpsCtrlDummy.h>
#include <dummies/GpsDhbDummy.h>
#include <dummies/GyroAdisDummy.h>
#include <dummies/GyroL3GD20Dummy.h>
#include <dummies/ImtqDummy.h>
@ -14,20 +15,29 @@
#include <dummies/P60DockDummy.h>
#include <dummies/PduDummy.h>
#include <dummies/PlPcduDummy.h>
#include <dummies/PlocMpsocDummy.h>
#include <dummies/PlocSupervisorDummy.h>
#include <dummies/RwDummy.h>
#include <dummies/SaDeploymentDummy.h>
#include <dummies/ScexDummy.h>
#include <dummies/StarTrackerDummy.h>
#include <dummies/SusDummy.h>
#include <dummies/SyrlinksDummy.h>
#include <fsfw_hal/common/gpio/GpioIF.h>
#include <mission/system/objects/CamSwitcher.h>
#include <mission/system/objects/TcsBoardAssembly.h>
#include "TemperatureSensorInserter.h"
#include "dummies/Max31865Dummy.h"
#include "dummies/Tmp1075Dummy.h"
#include "mission/core/GenericFactory.h"
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
#include "mission/system/tree/acsModeTree.h"
#include "mission/system/tree/comModeTree.h"
#include "mission/system/tree/payloadModeTree.h"
#include "mission/system/tree/tcsModeTree.h"
using namespace dummy;
void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitch) {
void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpioIF) {
new ComIFDummy(objects::DUMMY_COM_IF);
auto* comCookieDummy = new ComCookieDummy();
new BpxDummy(objects::BPX_BATT_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
@ -37,17 +47,25 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitch) {
if (cfg.addRtdComIFDummy) {
new ComIFDummy(objects::SPI_RTD_COM_IF);
}
new RwDummy(objects::RW1, objects::DUMMY_COM_IF, comCookieDummy);
new RwDummy(objects::RW2, objects::DUMMY_COM_IF, comCookieDummy);
new RwDummy(objects::RW3, objects::DUMMY_COM_IF, comCookieDummy);
new RwDummy(objects::RW4, objects::DUMMY_COM_IF, comCookieDummy);
std::array<object_id_t, 4> rwIds = {objects::RW1, objects::RW2, objects::RW3, objects::RW4};
std::array<DeviceHandlerBase*, 4> rws;
rws[0] = new RwDummy(objects::RW1, objects::DUMMY_COM_IF, comCookieDummy);
rws[1] = new RwDummy(objects::RW2, objects::DUMMY_COM_IF, comCookieDummy);
rws[2] = new RwDummy(objects::RW3, objects::DUMMY_COM_IF, comCookieDummy);
rws[3] = new RwDummy(objects::RW4, objects::DUMMY_COM_IF, comCookieDummy);
ObjectFactory::createRwAssy(pwrSwitcher, pcdu::Switches::PDU2_CH2_RW_5V, rws, rwIds);
new SaDeplDummy(objects::SOLAR_ARRAY_DEPL_HANDLER);
auto* strDummy =
new StarTrackerDummy(objects::STAR_TRACKER, objects::DUMMY_COM_IF, comCookieDummy);
strDummy->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
if (cfg.addSyrlinksDummies) {
auto* syrlinksDummy =
new SyrlinksDummy(objects::SYRLINKS_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
syrlinksDummy->connectModeTreeParent(satsystem::com::SUBSYSTEM);
}
auto* imtqDummy = new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
imtqDummy->enableThermalModule(ThermalStateCfg());
imtqDummy->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
if (cfg.addPowerDummies) {
new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new PduDummy(objects::PDU1_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
@ -56,103 +74,147 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitch) {
}
if (cfg.addAcsBoardDummies) {
new GyroAdisDummy(objects::GYRO_0_ADIS_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new GyroL3GD20Dummy(objects::GYRO_1_L3G_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new GyroAdisDummy(objects::GYRO_2_ADIS_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new GyroL3GD20Dummy(objects::GYRO_3_L3G_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
std::array<DeviceHandlerBase*, 8> assemblyDhbs;
assemblyDhbs[0] =
new MgmLIS3MDLDummy(objects::MGM_0_LIS3_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
assemblyDhbs[1] =
new MgmLIS3MDLDummy(objects::MGM_2_LIS3_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
assemblyDhbs[2] =
new MgmRm3100Dummy(objects::MGM_1_RM3100_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
assemblyDhbs[3] =
new MgmRm3100Dummy(objects::MGM_3_RM3100_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new GpsDummy(objects::GPS_CONTROLLER, objects::DUMMY_COM_IF, comCookieDummy);
assemblyDhbs[4] =
new GyroAdisDummy(objects::GYRO_0_ADIS_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
assemblyDhbs[5] =
new GyroL3GD20Dummy(objects::GYRO_1_L3G_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
assemblyDhbs[6] =
new GyroAdisDummy(objects::GYRO_2_ADIS_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
assemblyDhbs[7] =
new GyroL3GD20Dummy(objects::GYRO_3_L3G_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
auto* gpsCtrl = new GpsCtrlDummy(objects::GPS_CONTROLLER);
ObjectFactory::createAcsBoardAssy(pwrSwitcher, assemblyDhbs, gpsCtrl, gpioIF);
}
if (cfg.addSusDummies) {
std::array<DeviceHandlerBase*, 12> suses;
suses[0] =
new SusDummy(objects::SUS_0_N_LOC_XFYFZM_PT_XF, objects::DUMMY_COM_IF, comCookieDummy);
suses[1] =
new SusDummy(objects::SUS_1_N_LOC_XBYFZM_PT_XB, objects::DUMMY_COM_IF, comCookieDummy);
suses[2] =
new SusDummy(objects::SUS_2_N_LOC_XFYBZB_PT_YB, objects::DUMMY_COM_IF, comCookieDummy);
suses[3] =
new SusDummy(objects::SUS_3_N_LOC_XFYBZF_PT_YF, objects::DUMMY_COM_IF, comCookieDummy);
suses[4] =
new SusDummy(objects::SUS_4_N_LOC_XMYFZF_PT_ZF, objects::DUMMY_COM_IF, comCookieDummy);
suses[5] =
new SusDummy(objects::SUS_5_N_LOC_XFYMZB_PT_ZB, objects::DUMMY_COM_IF, comCookieDummy);
suses[6] =
new SusDummy(objects::SUS_6_R_LOC_XFYBZM_PT_XF, objects::DUMMY_COM_IF, comCookieDummy);
suses[7] =
new SusDummy(objects::SUS_7_R_LOC_XBYBZM_PT_XB, objects::DUMMY_COM_IF, comCookieDummy);
suses[8] =
new SusDummy(objects::SUS_8_R_LOC_XBYBZB_PT_YB, objects::DUMMY_COM_IF, comCookieDummy);
suses[9] =
new SusDummy(objects::SUS_9_R_LOC_XBYBZB_PT_YF, objects::DUMMY_COM_IF, comCookieDummy);
suses[10] =
new SusDummy(objects::SUS_10_N_LOC_XMYBZF_PT_ZF, objects::DUMMY_COM_IF, comCookieDummy);
suses[11] =
new SusDummy(objects::SUS_11_R_LOC_XBYMZB_PT_ZB, objects::DUMMY_COM_IF, comCookieDummy);
ObjectFactory::createSusAssy(pwrSwitcher, suses);
}
if (cfg.addTempSensorDummies) {
std::map<object_id_t, Max31865Dummy*> tempSensorDummies;
tempSensorDummies.emplace(objects::RTD_0_IC3_PLOC_HEATSPREADER,
std::map<object_id_t, Max31865Dummy*> rtdSensorDummies;
rtdSensorDummies.emplace(objects::RTD_0_IC3_PLOC_HEATSPREADER,
new Max31865Dummy(objects::RTD_0_IC3_PLOC_HEATSPREADER,
objects::DUMMY_COM_IF, comCookieDummy));
tempSensorDummies.emplace(objects::RTD_1_IC4_PLOC_MISSIONBOARD,
rtdSensorDummies.emplace(objects::RTD_1_IC4_PLOC_MISSIONBOARD,
new Max31865Dummy(objects::RTD_1_IC4_PLOC_MISSIONBOARD,
objects::DUMMY_COM_IF, comCookieDummy));
tempSensorDummies.emplace(
rtdSensorDummies.emplace(
objects::RTD_2_IC5_4K_CAMERA,
new Max31865Dummy(objects::RTD_2_IC5_4K_CAMERA, objects::DUMMY_COM_IF, comCookieDummy));
tempSensorDummies.emplace(objects::RTD_3_IC6_DAC_HEATSPREADER,
rtdSensorDummies.emplace(objects::RTD_3_IC6_DAC_HEATSPREADER,
new Max31865Dummy(objects::RTD_3_IC6_DAC_HEATSPREADER,
objects::DUMMY_COM_IF, comCookieDummy));
tempSensorDummies.emplace(
rtdSensorDummies.emplace(
objects::RTD_4_IC7_STARTRACKER,
new Max31865Dummy(objects::RTD_4_IC7_STARTRACKER, objects::DUMMY_COM_IF, comCookieDummy));
tempSensorDummies.emplace(
rtdSensorDummies.emplace(
objects::RTD_5_IC8_RW1_MX_MY,
new Max31865Dummy(objects::RTD_5_IC8_RW1_MX_MY, objects::DUMMY_COM_IF, comCookieDummy));
tempSensorDummies.emplace(
rtdSensorDummies.emplace(
objects::RTD_6_IC9_DRO,
new Max31865Dummy(objects::RTD_6_IC9_DRO, objects::DUMMY_COM_IF, comCookieDummy));
tempSensorDummies.emplace(
rtdSensorDummies.emplace(
objects::RTD_7_IC10_SCEX,
new Max31865Dummy(objects::RTD_7_IC10_SCEX, objects::DUMMY_COM_IF, comCookieDummy));
tempSensorDummies.emplace(
rtdSensorDummies.emplace(
objects::RTD_8_IC11_X8,
new Max31865Dummy(objects::RTD_8_IC11_X8, objects::DUMMY_COM_IF, comCookieDummy));
tempSensorDummies.emplace(
rtdSensorDummies.emplace(
objects::RTD_9_IC12_HPA,
new Max31865Dummy(objects::RTD_9_IC12_HPA, objects::DUMMY_COM_IF, comCookieDummy));
tempSensorDummies.emplace(
rtdSensorDummies.emplace(
objects::RTD_10_IC13_PL_TX,
new Max31865Dummy(objects::RTD_10_IC13_PL_TX, objects::DUMMY_COM_IF, comCookieDummy));
tempSensorDummies.emplace(
rtdSensorDummies.emplace(
objects::RTD_11_IC14_MPA,
new Max31865Dummy(objects::RTD_11_IC14_MPA, objects::DUMMY_COM_IF, comCookieDummy));
tempSensorDummies.emplace(
rtdSensorDummies.emplace(
objects::RTD_12_IC15_ACU,
new Max31865Dummy(objects::RTD_12_IC15_ACU, objects::DUMMY_COM_IF, comCookieDummy));
tempSensorDummies.emplace(objects::RTD_13_IC16_PLPCDU_HEATSPREADER,
rtdSensorDummies.emplace(objects::RTD_13_IC16_PLPCDU_HEATSPREADER,
new Max31865Dummy(objects::RTD_13_IC16_PLPCDU_HEATSPREADER,
objects::DUMMY_COM_IF, comCookieDummy));
tempSensorDummies.emplace(
rtdSensorDummies.emplace(
objects::RTD_14_IC17_TCS_BOARD,
new Max31865Dummy(objects::RTD_14_IC17_TCS_BOARD, objects::DUMMY_COM_IF, comCookieDummy));
tempSensorDummies.emplace(
rtdSensorDummies.emplace(
objects::RTD_15_IC18_IMTQ,
new Max31865Dummy(objects::RTD_15_IC18_IMTQ, objects::DUMMY_COM_IF, comCookieDummy));
std::map<object_id_t, Tmp1075Dummy*> tempTmpSensorDummies;
tempTmpSensorDummies.emplace(
std::map<object_id_t, Tmp1075Dummy*> tmpSensorDummies;
tmpSensorDummies.emplace(
objects::TMP1075_HANDLER_TCS_0,
new Tmp1075Dummy(objects::TMP1075_HANDLER_TCS_0, objects::DUMMY_COM_IF, comCookieDummy));
tempTmpSensorDummies.emplace(
tmpSensorDummies.emplace(
objects::TMP1075_HANDLER_TCS_1,
new Tmp1075Dummy(objects::TMP1075_HANDLER_TCS_1, objects::DUMMY_COM_IF, comCookieDummy));
tempTmpSensorDummies.emplace(
tmpSensorDummies.emplace(
objects::TMP1075_HANDLER_PLPCDU_0,
new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_0, objects::DUMMY_COM_IF, comCookieDummy));
tempTmpSensorDummies.emplace(
tmpSensorDummies.emplace(
objects::TMP1075_HANDLER_PLPCDU_1,
new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_1, objects::DUMMY_COM_IF, comCookieDummy));
tempTmpSensorDummies.emplace(
tmpSensorDummies.emplace(
objects::TMP1075_HANDLER_IF_BOARD,
new Tmp1075Dummy(objects::TMP1075_HANDLER_IF_BOARD, objects::DUMMY_COM_IF, comCookieDummy));
new TemperatureSensorInserter(objects::THERMAL_TEMP_INSERTER, tempSensorDummies,
tempTmpSensorDummies);
new TemperatureSensorInserter(objects::THERMAL_TEMP_INSERTER, rtdSensorDummies,
tmpSensorDummies);
TcsBoardAssembly* tcsBoardAssy = ObjectFactory::createTcsBoardAssy(pwrSwitcher);
for (auto& rtd : rtdSensorDummies) {
rtd.second->connectModeTreeParent(*tcsBoardAssy);
}
new CamSwitcher(objects::CAM_SWITCHER, pwrSwitch, power::NO_SWITCH);
for (auto& tmp : tmpSensorDummies) {
tmp.second->connectModeTreeParent(satsystem::tcs::SUBSYSTEM);
}
}
auto* camSwitcher = new CamSwitcher(objects::CAM_SWITCHER, pwrSwitcher, power::NO_SWITCH);
camSwitcher->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
auto* scexDummy = new ScexDummy(objects::SCEX, objects::DUMMY_COM_IF, comCookieDummy);
scexDummy->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
auto* plPcduDummy =
new PlPcduDummy(objects::PLPCDU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
plPcduDummy->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
if (cfg.addPlocDummies) {
auto* plocMpsocDummy =
new PlocMpsocDummy(objects::PLOC_MPSOC_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
plocMpsocDummy->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
auto* plocSupervisorDummy = new PlocSupervisorDummy(objects::PLOC_SUPERVISOR_HANDLER,
objects::DUMMY_COM_IF, comCookieDummy);
plocSupervisorDummy->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
}
}

View File

@ -2,6 +2,8 @@
#include <fsfw/power/PowerSwitchIF.h>
class GpioIF;
namespace dummy {
struct DummyCfg {
@ -12,8 +14,9 @@ struct DummyCfg {
bool addSusDummies = true;
bool addTempSensorDummies = true;
bool addRtdComIFDummy = true;
bool addPlocDummies = true;
};
void createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitch);
void createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitch, GpioIF* gpioIF);
} // namespace dummy

View File

@ -11,6 +11,7 @@
#include <linux/callbacks/gpioCallbacks.h>
#include <linux/devices/Max31865RtdLowlevelHandler.h>
#include <mission/controller/AcsController.h>
#include <mission/core/GenericFactory.h>
#include <mission/devices/Max31865EiveHandler.h>
#include <mission/devices/ScexDeviceHandler.h>
#include <mission/devices/SusHandler.h>
@ -29,7 +30,7 @@
#include "mission/system/tree/tcsModeTree.h"
void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiComIF,
PowerSwitchIF* pwrSwitcher, std::string spiDev,
PowerSwitchIF& pwrSwitcher, std::string spiDev,
bool swap0And6) {
using namespace gpio;
GpioCookie* gpioCookieSus = new GpioCookie();
@ -173,22 +174,8 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
fdir = new SusFdir(objects::SUS_11_R_LOC_XBYMZB_PT_ZB);
susHandlers[11]->setCustomFdir(fdir);
std::array<object_id_t, 12> susIds = {
objects::SUS_0_N_LOC_XFYFZM_PT_XF, objects::SUS_1_N_LOC_XBYFZM_PT_XB,
objects::SUS_2_N_LOC_XFYBZB_PT_YB, objects::SUS_3_N_LOC_XFYBZF_PT_YF,
objects::SUS_4_N_LOC_XMYFZF_PT_ZF, objects::SUS_5_N_LOC_XFYMZB_PT_ZB,
objects::SUS_6_R_LOC_XFYBZM_PT_XF, objects::SUS_7_R_LOC_XBYBZM_PT_XB,
objects::SUS_8_R_LOC_XBYBZB_PT_YB, objects::SUS_9_R_LOC_XBYBZB_PT_YF,
objects::SUS_10_N_LOC_XMYBZF_PT_ZF, objects::SUS_11_R_LOC_XBYMZB_PT_ZB};
SusAssHelper susAssHelper = SusAssHelper(susIds);
auto susAss = new SusAssembly(objects::SUS_BOARD_ASS, pwrSwitcher, susAssHelper);
for (auto& sus : susHandlers) {
if (sus != nullptr) {
ReturnValue_t result = sus->connectModeTreeParent(*susAss);
if (result != returnvalue::OK) {
sif::error << "Connecting SUS " << sus->getObjectId() << " to SUS assembly failed"
<< std::endl;
}
#if OBSW_TEST_SUS == 1
sus->setStartUpImmediately();
sus->setToGoToNormalMode(true);
@ -198,7 +185,11 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
#endif
}
}
susAss->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
std::array<DeviceHandlerBase*, 12> susDhbs;
for (unsigned i = 0; i < susDhbs.size(); i++) {
susDhbs[i] = susHandlers[i];
}
createSusAssy(pwrSwitcher, susDhbs);
#endif /* OBSW_ADD_SUN_SENSORS == 1 */
}
@ -279,32 +270,13 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
{addresses::RTD_IC_18, gpioIds::RTD_IC_18},
}};
// HSPD: Heatspreader
std::array<std::pair<object_id_t, std::string>, NUM_RTDS> rtdInfos = {{
{objects::RTD_0_IC3_PLOC_HEATSPREADER, "RTD_0_PLOC_HSPD"},
{objects::RTD_1_IC4_PLOC_MISSIONBOARD, "RTD_1_PLOC_MISSIONBRD"},
{objects::RTD_2_IC5_4K_CAMERA, "RTD_2_4K_CAMERA"},
{objects::RTD_3_IC6_DAC_HEATSPREADER, "RTD_3_DAC_HSPD"},
{objects::RTD_4_IC7_STARTRACKER, "RTD_4_STARTRACKER"},
{objects::RTD_5_IC8_RW1_MX_MY, "RTD_5_RW1_MX_MY"},
{objects::RTD_6_IC9_DRO, "RTD_6_DRO"},
{objects::RTD_7_IC10_SCEX, "RTD_7_SCEX"},
{objects::RTD_8_IC11_X8, "RTD_8_X8"},
{objects::RTD_9_IC12_HPA, "RTD_9_HPA"},
{objects::RTD_10_IC13_PL_TX, "RTD_10_PL_TX,"},
{objects::RTD_11_IC14_MPA, "RTD_11_MPA"},
{objects::RTD_12_IC15_ACU, "RTD_12_ACU"},
{objects::RTD_13_IC16_PLPCDU_HEATSPREADER, "RTD_13_PLPCDU_HSPD"},
{objects::RTD_14_IC17_TCS_BOARD, "RTD_14_TCS_BOARD"},
{objects::RTD_15_IC18_IMTQ, "RTD_15_IMTQ"},
}};
std::array<SpiCookie*, NUM_RTDS> rtdCookies = {};
std::array<Max31865EiveHandler*, NUM_RTDS> rtds = {};
RtdFdir* rtdFdir = nullptr;
TcsBoardHelper helper(rtdInfos);
TcsBoardAssembly* tcsBoardAss = new TcsBoardAssembly(
objects::TCS_BOARD_ASS, pwrSwitcher, pcdu::Switches::PDU1_CH0_TCS_BOARD_3V3, helper);
tcsBoardAss->connectModeTreeParent(satsystem::tcs::SUBSYSTEM);
TcsBoardAssembly* tcsBoardAss = ObjectFactory::createTcsBoardAssy(*pwrSwitcher);
// Create special low level reader communication interface
new Max31865RtdReader(objects::SPI_RTD_COM_IF, comIF, gpioComIF);
for (uint8_t idx = 0; idx < NUM_RTDS; idx++) {
@ -312,16 +284,16 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
MAX31865::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
rtdCookies[idx]->setMutexParams(MutexIF::TimeoutType::WAITING, spi::RTD_CS_TIMEOUT);
Max31865ReaderCookie* rtdLowLevelCookie =
new Max31865ReaderCookie(rtdInfos[idx].first, idx, rtdInfos[idx].second, rtdCookies[idx]);
new Max31865ReaderCookie(RTD_INFOS[idx].first, idx, RTD_INFOS[idx].second, rtdCookies[idx]);
rtds[idx] =
new Max31865EiveHandler(rtdInfos[idx].first, objects::SPI_RTD_COM_IF, rtdLowLevelCookie);
rtds[idx]->setDeviceInfo(idx, rtdInfos[idx].second);
new Max31865EiveHandler(RTD_INFOS[idx].first, objects::SPI_RTD_COM_IF, rtdLowLevelCookie);
rtds[idx]->setDeviceInfo(idx, RTD_INFOS[idx].second);
ReturnValue_t result = rtds[idx]->connectModeTreeParent(*tcsBoardAss);
if (result != returnvalue::OK) {
sif::error << "Connecting RTD " << static_cast<int>(idx) << " to RTD Assembly failed"
<< std::endl;
}
rtdFdir = new RtdFdir(rtdInfos[idx].first);
rtdFdir = new RtdFdir(RTD_INFOS[idx].first);
rtds[idx]->setCustomFdir(rtdFdir);
#if OBSW_DEBUG_RTD == 1
rtds[idx]->setDebugMode(true, 5);

View File

@ -20,7 +20,7 @@ class AcsController;
namespace ObjectFactory {
void createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiComIF, PowerSwitchIF* pwrSwitcher,
void createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiComIF, PowerSwitchIF& pwrSwitcher,
std::string spiDev, bool swap0And6);
void createRtdComponents(std::string spiDev, GpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher,
SpiComIF* comIF);

View File

@ -4,6 +4,7 @@
#include <fsfw/cfdp/handler/CfdpHandler.h>
#include <fsfw/cfdp/handler/RemoteConfigTableIF.h>
#include <fsfw/controller/ControllerBase.h>
#include <fsfw/controller/ExtendedControllerBase.h>
#include <fsfw/events/EventManager.h>
#include <fsfw/health/HealthTable.h>
#include <fsfw/internalerror/InternalErrorReporter.h>
@ -26,6 +27,10 @@
#include <mission/controller/ThermalController.h>
#include <mission/devices/HeaterHandler.h>
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
#include <mission/system/objects/AcsBoardAssembly.h>
#include <mission/system/objects/RwAssembly.h>
#include <mission/system/objects/SusAssembly.h>
#include <mission/system/objects/TcsBoardAssembly.h>
#include <mission/tmtc/CfdpTmFunnel.h>
#include <mission/tmtc/PusTmFunnel.h>
#include <mission/tmtc/TmFunnelHandler.h>
@ -35,6 +40,8 @@
#include "eive/definitions.h"
#include "fsfw/pus/Service11TelecommandScheduling.h"
#include "mission/cfdp/Config.h"
#include "mission/system/objects/RwAssembly.h"
#include "mission/system/tree/acsModeTree.h"
#include "mission/system/tree/tcsModeTree.h"
#include "objects/systemObjectList.h"
#include "tmtc/pusIds.h"
@ -218,3 +225,68 @@ void ObjectFactory::createThermalController(HeaterHandler& heaterHandler) {
auto* tcsCtrl = new ThermalController(objects::THERMAL_CONTROLLER, heaterHandler);
tcsCtrl->connectModeTreeParent(satsystem::tcs::SUBSYSTEM);
}
void ObjectFactory::createRwAssy(PowerSwitchIF& pwrSwitcher, power::Switch_t theSwitch,
std::array<DeviceHandlerBase*, 4> rws,
std::array<object_id_t, 4> rwIds) {
RwHelper rwHelper(rwIds);
auto* rwAss = new RwAssembly(objects::RW_ASS, &pwrSwitcher, theSwitch, rwHelper);
for (uint8_t idx = 0; idx < rwIds.size(); idx++) {
ReturnValue_t result = rws[idx]->connectModeTreeParent(*rwAss);
if (result != returnvalue::OK) {
sif::error << "Connecting RW " << static_cast<int>(idx) << " to RW assembly failed"
<< std::endl;
}
}
rwAss->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
}
void ObjectFactory::createSusAssy(PowerSwitchIF& pwrSwitcher,
std::array<DeviceHandlerBase*, 12> suses) {
std::array<object_id_t, 12> susIds = {
objects::SUS_0_N_LOC_XFYFZM_PT_XF, objects::SUS_1_N_LOC_XBYFZM_PT_XB,
objects::SUS_2_N_LOC_XFYBZB_PT_YB, objects::SUS_3_N_LOC_XFYBZF_PT_YF,
objects::SUS_4_N_LOC_XMYFZF_PT_ZF, objects::SUS_5_N_LOC_XFYMZB_PT_ZB,
objects::SUS_6_R_LOC_XFYBZM_PT_XF, objects::SUS_7_R_LOC_XBYBZM_PT_XB,
objects::SUS_8_R_LOC_XBYBZB_PT_YB, objects::SUS_9_R_LOC_XBYBZB_PT_YF,
objects::SUS_10_N_LOC_XMYBZF_PT_ZF, objects::SUS_11_R_LOC_XBYMZB_PT_ZB};
SusAssHelper susAssHelper = SusAssHelper(susIds);
auto susAss = new SusAssembly(objects::SUS_BOARD_ASS, &pwrSwitcher, susAssHelper);
for (auto& sus : suses) {
if (sus != nullptr) {
ReturnValue_t result = sus->connectModeTreeParent(*susAss);
if (result != returnvalue::OK) {
sif::error << "Connecting SUS " << sus->getObjectId() << " to SUS assembly failed"
<< std::endl;
}
}
}
susAss->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
}
void ObjectFactory::createAcsBoardAssy(PowerSwitchIF& pwrSwitcher,
std::array<DeviceHandlerBase*, 8> assemblyDhbs,
ExtendedControllerBase* gpsCtrl, GpioIF* gpioComIF) {
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,
objects::GYRO_2_ADIS_HANDLER, objects::GYRO_3_L3G_HANDLER, objects::GPS_CONTROLLER);
auto acsAss =
new AcsBoardAssembly(objects::ACS_BOARD_ASS, &pwrSwitcher, acsBoardHelper, gpioComIF);
for (auto& assChild : assemblyDhbs) {
ReturnValue_t result = assChild->connectModeTreeParent(*acsAss);
if (result != returnvalue::OK) {
sif::error << "Connecting assembly for ACS board component " << assChild->getObjectId()
<< " failed" << std::endl;
}
}
gpsCtrl->connectModeTreeParent(*acsAss);
acsAss->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
}
TcsBoardAssembly* ObjectFactory::createTcsBoardAssy(PowerSwitchIF& pwrSwitcher) {
TcsBoardHelper helper(RTD_INFOS);
TcsBoardAssembly* tcsBoardAss = new TcsBoardAssembly(
objects::TCS_BOARD_ASS, &pwrSwitcher, pcdu::Switches::PDU1_CH0_TCS_BOARD_3V3, helper);
tcsBoardAss->connectModeTreeParent(satsystem::tcs::SUBSYSTEM);
return tcsBoardAss;
}

View File

@ -1,13 +1,38 @@
#ifndef MISSION_CORE_GENERICFACTORY_H_
#define MISSION_CORE_GENERICFACTORY_H_
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include "fsfw/objectmanager/SystemObjectIF.h"
#include "fsfw/power/PowerSwitchIF.h"
#include "fsfw_hal/common/gpio/GpioIF.h"
#include "mission/devices/devicedefinitions/Max31865Definitions.h"
class HeaterHandler;
class HealthTableIF;
class PusTmFunnel;
class CfdpTmFunnel;
class ExtendedControllerBase;
class TcsBoardAssembly;
const std::array<std::pair<object_id_t, std::string>, EiveMax31855::NUM_RTDS> RTD_INFOS = {{
{objects::RTD_0_IC3_PLOC_HEATSPREADER, "RTD_0_PLOC_HSPD"},
{objects::RTD_1_IC4_PLOC_MISSIONBOARD, "RTD_1_PLOC_MISSIONBRD"},
{objects::RTD_2_IC5_4K_CAMERA, "RTD_2_4K_CAMERA"},
{objects::RTD_3_IC6_DAC_HEATSPREADER, "RTD_3_DAC_HSPD"},
{objects::RTD_4_IC7_STARTRACKER, "RTD_4_STARTRACKER"},
{objects::RTD_5_IC8_RW1_MX_MY, "RTD_5_RW1_MX_MY"},
{objects::RTD_6_IC9_DRO, "RTD_6_DRO"},
{objects::RTD_7_IC10_SCEX, "RTD_7_SCEX"},
{objects::RTD_8_IC11_X8, "RTD_8_X8"},
{objects::RTD_9_IC12_HPA, "RTD_9_HPA"},
{objects::RTD_10_IC13_PL_TX, "RTD_10_PL_TX,"},
{objects::RTD_11_IC14_MPA, "RTD_11_MPA"},
{objects::RTD_12_IC15_ACU, "RTD_12_ACU"},
{objects::RTD_13_IC16_PLPCDU_HEATSPREADER, "RTD_13_PLPCDU_HSPD"},
{objects::RTD_14_IC17_TCS_BOARD, "RTD_14_TCS_BOARD"},
{objects::RTD_15_IC18_IMTQ, "RTD_15_IMTQ"},
}};
namespace ObjectFactory {
@ -17,6 +42,13 @@ void createGenericHeaterComponents(GpioIF& gpioIF, PowerSwitchIF& pwrSwitcher,
HeaterHandler*& heaterHandler);
void createThermalController(HeaterHandler& heaterHandler);
void createRwAssy(PowerSwitchIF& pwrSwitcher, power::Switch_t theSwitch,
std::array<DeviceHandlerBase*, 4> rws, std::array<object_id_t, 4> rwIds);
void createSusAssy(PowerSwitchIF& pwrSwitcher, std::array<DeviceHandlerBase*, 12> suses);
void createAcsBoardAssy(PowerSwitchIF& pwrSwitcher, std::array<DeviceHandlerBase*, 8> assemblyDhbs,
ExtendedControllerBase* gpsCtrl, GpioIF* gpioComIF);
TcsBoardAssembly* createTcsBoardAssy(PowerSwitchIF& pwrSwitcher);
} // namespace ObjectFactory
#endif /* MISSION_CORE_GENERICFACTORY_H_ */