make it work for EM
Some checks failed
EIVE/eive-obsw/pipeline/pr-v2.0.4-branch There was a failure building this commit

This commit is contained in:
Robin Müller 2023-06-18 14:02:53 +02:00
parent 68f84e71ff
commit a87a01d072
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
10 changed files with 179 additions and 23 deletions

View File

@ -146,8 +146,11 @@ set(OBSW_ADD_TMP_DEVICES
${INIT_VAL}
CACHE STRING "Add TMP devices")
set(OBSW_ADD_GOMSPACE_PCDU
${INIT_VAL}
1
CACHE STRING "Add GomSpace PCDU modules")
set(OBSW_ADD_GOMSPACE_ACU
${INIT_VAL}
CACHE STRING "Add GomSpace ACU submodule")
set(OBSW_ADD_RW
${INIT_VAL}
CACHE STRING "Add RW modules")

View File

@ -22,6 +22,9 @@
#define OBSW_COMMAND_SAFE_MODE_AT_STARTUP 1
#define OBSW_ADD_GOMSPACE_PCDU @OBSW_ADD_GOMSPACE_PCDU@
// This define is necessary because the EM setup has the P60 dock module, but no ACU on the P60
// module because it broke.
#define OBSW_ADD_GOMSPACE_ACU @OBSW_ADD_GOMSPACE_ACU@
#define OBSW_ADD_MGT @OBSW_ADD_MGT@
#define OBSW_ADD_BPX_BATTERY_HANDLER @OBSW_ADD_BPX_BATTERY_HANDLER@
#define OBSW_ADD_STAR_TRACKER @OBSW_ADD_STAR_TRACKER@

View File

@ -197,7 +197,6 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI
CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_SIZE, addresses::P60DOCK, 500);
CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_SIZE, addresses::PDU1, 500);
CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_SIZE, addresses::PDU2, 500);
CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_SIZE, addresses::ACU, 500);
auto p60Fdir = new GomspacePowerFdir(objects::P60DOCK_HANDLER);
P60DockHandler* p60dockhandler = new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF,
@ -210,10 +209,12 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI
auto pdu2Fdir = new GomspacePowerFdir(objects::PDU2_HANDLER);
Pdu2Handler* pdu2handler = new Pdu2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF,
pdu2CspCookie, pdu2Fdir, enableHkSets);
#if OBSW_ADD_GOMSPACE_ACU == 1
CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_SIZE, addresses::ACU, 500);
auto acuFdir = new GomspacePowerFdir(objects::ACU_HANDLER);
ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie,
acuFdir, enableHkSets);
#endif
auto pcduHandler = new PcduHandler(objects::PCDU_HANDLER, 50);
/**
@ -223,7 +224,9 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI
p60dockhandler->setModeNormal();
pdu1handler->setModeNormal();
pdu2handler->setModeNormal();
#if OBSW_ADD_GOMSPACE_ACU == 1
acuhandler->setModeNormal();
#endif
if (pwrSwitcher != nullptr) {
*pwrSwitcher = pcduHandler;
}

View File

@ -51,15 +51,21 @@ void ObjectFactory::produce(void* args) {
// level components.
dummy::DummyCfg dummyCfg;
dummyCfg.addCoreCtrlCfg = false;
dummyCfg.addCamSwitcherDummy = false;
#if OBSW_ADD_SYRLINKS == 1
dummyCfg.addSyrlinksDummies = false;
#endif
#if OBSW_ADD_GOMSPACE_PCDU == 1
dummyCfg.addPowerDummies = false;
// The ACU broke.
dummyCfg.addOnlyAcuDummy = true;
#endif
#if OBSW_ADD_ACS_BOARD == 1
dummyCfg.addAcsBoardDummies = false;
#endif
#if OBSW_ADD_BPX_BATTERY_HANDLER == 1
dummyCfg.addBpxBattDummy = false;
#endif
PowerSwitchIF* pwrSwitcher = nullptr;
#if OBSW_ADD_GOMSPACE_PCDU == 0
@ -69,7 +75,7 @@ void ObjectFactory::produce(void* args) {
#endif
satsystem::EIVE_SYSTEM.setI2cRecoveryParams(pwrSwitcher);
dummy::createDummies(dummyCfg, *pwrSwitcher, gpioComIF);
dummy::createDummies(dummyCfg, *pwrSwitcher, gpioComIF, enableHkSets);
new CoreController(objects::CORE_CONTROLLER, enableHkSets);
@ -117,6 +123,8 @@ void ObjectFactory::produce(void* args) {
createStrComponents(pwrSwitcher);
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
createPayloadComponents(gpioComIF, *pwrSwitcher);
#if OBSW_ADD_CCSDS_IP_CORES == 1
CcsdsIpCoreHandler* ipCoreHandler = nullptr;
CcsdsComponentArgs ccsdsArgs(*gpioComIF, *ipcStore, *tmStore, stores, *pusFunnel, *cfdpFunnel,

View File

@ -2,8 +2,11 @@
#include <mission/power/gsDefs.h>
AcuDummy::AcuDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
: DeviceHandlerBase(objectId, comif, comCookie) {}
AcuDummy::AcuDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie, bool enableHkSets)
: DeviceHandlerBase(objectId, comif, comCookie),
coreHk(this),
auxHk(this),
enableHkSets(enableHkSets) {}
AcuDummy::~AcuDummy() {}
@ -37,7 +40,49 @@ uint32_t AcuDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return
ReturnValue_t AcuDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
using namespace ACU;
localDataPoolMap.emplace(pool::ACU_CURRENT_IN_CHANNELS, new PoolEntry<int16_t>(6));
localDataPoolMap.emplace(pool::ACU_VOLTAGE_IN_CHANNELS, new PoolEntry<uint16_t>(6));
localDataPoolMap.emplace(pool::ACU_VCC, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::ACU_VBAT, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(ACU::pool::ACU_TEMPERATURES,
new PoolEntry<float>({10.0, 10.0, 10.0}, true));
localDataPoolMap.emplace(pool::ACU_MPPT_MODE, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(pool::ACU_VBOOST_IN_CHANNELS, new PoolEntry<uint16_t>(6));
localDataPoolMap.emplace(pool::ACU_POWER_IN_CHANNELS, new PoolEntry<uint16_t>(6));
localDataPoolMap.emplace(pool::ACU_DAC_ENABLES, new PoolEntry<uint8_t>(3));
localDataPoolMap.emplace(pool::ACU_DAC_RAW_CHANNELS, new PoolEntry<uint16_t>(6));
localDataPoolMap.emplace(pool::ACU_BOOTCAUSE, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::ACU_BOOTCNT, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::ACU_UPTIME, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::ACU_RESET_CAUSE, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::ACU_MPPT_TIME, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::ACU_MPPT_PERIOD, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(pool::ACU_DEVICES, new PoolEntry<uint8_t>(8));
localDataPoolMap.emplace(pool::ACU_DEVICES_STATUS, new PoolEntry<uint8_t>(8));
localDataPoolMap.emplace(pool::ACU_WDT_CNT_GND, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(pool::ACU_WDT_GND_LEFT, new PoolEntry<uint32_t>({0}));
poolManager.subscribeForDiagPeriodicPacket(
subdp::DiagnosticsHkPeriodicParams(coreHk.getSid(), enableHkSets, 30.0));
poolManager.subscribeForRegularPeriodicPacket(
subdp::RegularHkPeriodicParams(auxHk.getSid(), enableHkSets, 6000.0));
return returnvalue::OK;
}
LocalPoolDataSetBase *AcuDummy::getDataSetHandle(sid_t sid) {
if (sid == coreHk.getSid()) {
return &coreHk;
} else if (sid == auxHk.getSid()) {
return &auxHk;
}
return nullptr;
}

View File

@ -2,6 +2,7 @@
#define DUMMIES_ACUDUMMY_H_
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <mission/power/gsDefs.h>
class AcuDummy : public DeviceHandlerBase {
public:
@ -11,10 +12,14 @@ class AcuDummy : public DeviceHandlerBase {
static const uint8_t SIMPLE_COMMAND_DATA = 1;
static const uint8_t PERIODIC_REPLY_DATA = 2;
AcuDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie);
AcuDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie, bool enableHkSets);
virtual ~AcuDummy();
protected:
ACU::CoreHk coreHk;
ACU::AuxHk auxHk;
bool enableHkSets;
void doStartUp() override;
void doShutDown() override;
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
@ -28,6 +33,7 @@ class AcuDummy : public DeviceHandlerBase {
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) override;
LocalPoolDataSetBase *getDataSetHandle(sid_t sid) override;
};
#endif /* DUMMIES_ACUDUMMY_H_ */

View File

@ -2,8 +2,13 @@
#include <mission/acs/imtqHelpers.h>
ImtqDummy::ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
: DeviceHandlerBase(objectId, comif, comCookie) {}
ImtqDummy::ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie,
power::Switch_t pwrSwitcher, bool enableHkSets)
: DeviceHandlerBase(objectId, comif, comCookie),
setNoTorque(this),
setWithTorque(this),
enableHkSets(enableHkSets),
switcher(pwrSwitcher) {}
ImtqDummy::~ImtqDummy() = default;
@ -11,6 +16,15 @@ void ImtqDummy::doStartUp() { setMode(MODE_NORMAL); }
void ImtqDummy::doShutDown() { setMode(_MODE_POWER_DOWN); }
ReturnValue_t ImtqDummy::getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) {
if (switcher != power::NO_SWITCH) {
*numberOfSwitches = 1;
*switches = &switcher;
return returnvalue::OK;
}
return DeviceHandlerBase::NO_SWITCH;
}
ReturnValue_t ImtqDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; }
ReturnValue_t ImtqDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
@ -45,5 +59,37 @@ ReturnValue_t ImtqDummy::initializeLocalDataPool(localpool::DataPool &localDataP
localDataPoolMap.emplace(imtq::ACTUATION_RAW_STATUS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(imtq::DIPOLES_ID, new PoolEntry<int16_t>({0, 0, 0}));
localDataPoolMap.emplace(imtq::CURRENT_TORQUE_DURATION, new PoolEntry<uint16_t>({0}));
// ENG HK No Torque
localDataPoolMap.emplace(imtq::DIGITAL_VOLTAGE_MV, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(imtq::ANALOG_VOLTAGE_MV, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(imtq::DIGITAL_CURRENT, new PoolEntry<float>({0}));
localDataPoolMap.emplace(imtq::ANALOG_CURRENT, new PoolEntry<float>({0}));
localDataPoolMap.emplace(imtq::COIL_CURRENTS, &coilCurrentsMilliampsNoTorque);
localDataPoolMap.emplace(imtq::COIL_TEMPERATURES, &coilTempsNoTorque);
localDataPoolMap.emplace(imtq::MCU_TEMPERATURE, new PoolEntry<int16_t>({0}));
// ENG HK With Torque
localDataPoolMap.emplace(imtq::DIGITAL_VOLTAGE_MV_WT, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(imtq::ANALOG_VOLTAGE_MV_WT, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(imtq::DIGITAL_CURRENT_WT, new PoolEntry<float>({0}));
localDataPoolMap.emplace(imtq::ANALOG_CURRENT_WT, new PoolEntry<float>({0}));
localDataPoolMap.emplace(imtq::COIL_CURRENTS_WT, &coilCurrentsMilliampsWithTorque);
localDataPoolMap.emplace(imtq::COIL_TEMPERATURES_WT, &coilTempsWithTorque);
localDataPoolMap.emplace(imtq::MCU_TEMPERATURE_WT, new PoolEntry<int16_t>({0}));
poolManager.subscribeForDiagPeriodicPacket(
subdp::DiagnosticsHkPeriodicParams(setNoTorque.getSid(), enableHkSets, 30.0));
poolManager.subscribeForDiagPeriodicPacket(
subdp::DiagnosticsHkPeriodicParams(setWithTorque.getSid(), enableHkSets, 30.0));
return DeviceHandlerBase::initializeLocalDataPool(localDataPoolMap, poolManager);
}
LocalPoolDataSetBase *ImtqDummy::getDataSetHandle(sid_t sid) {
if (sid == setNoTorque.getSid()) {
return &setNoTorque;
} else if (sid == setWithTorque.getSid()) {
return &setWithTorque;
}
return nullptr;
}

View File

@ -3,6 +3,8 @@
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include "mission/acs/imtqHelpers.h"
class ImtqDummy : public DeviceHandlerBase {
public:
static const DeviceCommandId_t SIMPLE_COMMAND = 1;
@ -11,10 +13,35 @@ class ImtqDummy : public DeviceHandlerBase {
static const uint8_t SIMPLE_COMMAND_DATA = 1;
static const uint8_t PERIODIC_REPLY_DATA = 2;
ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie);
ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie,
power::Switch_t pwrSwitcher, bool enableHkSets);
~ImtqDummy() override;
protected:
ReturnValue_t getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) override;
imtq::HkDatasetNoTorque setNoTorque;
imtq::HkDatasetWithTorque setWithTorque;
bool enableHkSets;
PoolEntry<uint8_t> statusMode = PoolEntry<uint8_t>({0});
PoolEntry<uint8_t> statusError = PoolEntry<uint8_t>({0});
PoolEntry<uint8_t> statusConfig = PoolEntry<uint8_t>({0});
PoolEntry<uint32_t> statusUptime = PoolEntry<uint32_t>({0});
PoolEntry<int32_t> mgmCalEntry = PoolEntry<int32_t>(3);
PoolEntry<int16_t> dipolesPoolEntry = PoolEntry<int16_t>({0, 0, 0}, false);
PoolEntry<uint16_t> torqueDurationEntry = PoolEntry<uint16_t>({0}, false);
PoolEntry<float> coilCurrentsMilliampsNoTorque = PoolEntry<float>(3);
PoolEntry<float> coilCurrentsMilliampsWithTorque = PoolEntry<float>(3);
PoolEntry<int16_t> coilTempsNoTorque = PoolEntry<int16_t>(3);
PoolEntry<int16_t> coilTempsWithTorque = PoolEntry<int16_t>(3);
PoolEntry<float> mtmRawNoTorque = PoolEntry<float>(3);
PoolEntry<uint8_t> actStatusNoTorque = PoolEntry<uint8_t>(1);
PoolEntry<float> mtmRawWithTorque = PoolEntry<float>(3);
PoolEntry<uint8_t> actStatusWithTorque = PoolEntry<uint8_t>(1);
power::Switch_t switcher = power::NO_SWITCH;
void doStartUp() override;
void doShutDown() override;
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
@ -28,6 +55,7 @@ class ImtqDummy : public DeviceHandlerBase {
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) override;
LocalPoolDataSetBase *getDataSetHandle(sid_t sid) override;
};
#endif /* DUMMIES_IMTQDUMMY_H_ */

View File

@ -42,10 +42,13 @@
#include "mission/system/tree/payloadModeTree.h"
#include "mission/tcs/defs.h"
void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpioIF) {
void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpioIF,
bool enableHkSets) {
new ComIFDummy(objects::DUMMY_COM_IF);
auto* comCookieDummy = new ComCookieDummy();
new BpxDummy(objects::BPX_BATT_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
if (cfg.addBpxBattDummy) {
new BpxDummy(objects::BPX_BATT_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
}
if (cfg.addCoreCtrlCfg) {
new CoreControllerDummy(objects::CORE_CONTROLLER);
}
@ -72,11 +75,15 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio
}
auto* imtqAssy = new ImtqAssembly(objects::IMTQ_ASSY);
imtqAssy->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
auto* imtqDummy = new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
auto* imtqDummy = new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy,
power::Switches::PDU1_CH3_MGT_5V, enableHkSets);
imtqDummy->enableThermalModule(ThermalStateCfg());
imtqDummy->setPowerSwitcher(&pwrSwitcher);
imtqDummy->connectModeTreeParent(*imtqAssy);
if (cfg.addPowerDummies) {
new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
if (cfg.addOnlyAcuDummy) {
new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy, enableHkSets);
} else if (cfg.addPowerDummies) {
new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy, enableHkSets);
new PduDummy(objects::PDU1_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new PduDummy(objects::PDU2_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new P60DockDummy(objects::P60DOCK_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
@ -195,10 +202,10 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio
objects::TMP1075_HANDLER_PLPCDU_0,
new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_0, objects::DUMMY_COM_IF, comCookieDummy));
// damaged.
// tmpSensorDummies.emplace(
// objects::TMP1075_HANDLER_PLPCDU_1,
// new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_1, objects::DUMMY_COM_IF,
// comCookieDummy));
// tmpSensorDummies.emplace(
// objects::TMP1075_HANDLER_PLPCDU_1,
// new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_1, objects::DUMMY_COM_IF,
// comCookieDummy));
tmpSensorDummies.emplace(
objects::TMP1075_HANDLER_IF_BOARD,
new Tmp1075Dummy(objects::TMP1075_HANDLER_IF_BOARD, objects::DUMMY_COM_IF, comCookieDummy));
@ -214,9 +221,11 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio
tmp.second->connectModeTreeParent(satsystem::tcs::SUBSYSTEM);
}
}
auto* camSwitcher =
new CamSwitcher(objects::CAM_SWITCHER, pwrSwitcher, power::Switches::PDU2_CH8_PAYLOAD_CAMERA);
camSwitcher->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
if (cfg.addCamSwitcherDummy) {
auto* camSwitcher = new CamSwitcher(objects::CAM_SWITCHER, pwrSwitcher,
power::Switches::PDU2_CH8_PAYLOAD_CAMERA);
camSwitcher->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
}
auto* scexDummy = new ScexDummy(objects::SCEX, objects::DUMMY_COM_IF, comCookieDummy);
scexDummy->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
auto* plPcduDummy =

View File

@ -6,17 +6,22 @@ class GpioIF;
namespace dummy {
// Default values targeted towards EM.
struct DummyCfg {
bool addCoreCtrlCfg = true;
// Special variant because the ACU broke. Overrides addPowerDummies, only ACU dummy will be added.
bool addOnlyAcuDummy = false;
bool addPowerDummies = true;
bool addBpxBattDummy = true;
bool addSyrlinksDummies = true;
bool addAcsBoardDummies = true;
bool addSusDummies = true;
bool addTempSensorDummies = true;
bool addRtdComIFDummy = true;
bool addPlocDummies = true;
bool addCamSwitcherDummy = false;
};
void createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitch, GpioIF* gpioIF);
void createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitch, GpioIF* gpioIF, bool enableHkSets);
} // namespace dummy