Thermal COntroller collecting Sus Temperatures
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
This commit is contained in:
@ -149,7 +149,11 @@ void initmission::initTasks() {
|
||||
"THERMAL_CTL_TASK", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
|
||||
result = dummyTask->addComponent(objects::RTD_0_IC3_PLOC_HEATSPREADER);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("RTD_0", objects::RTD_0_IC3_PLOC_HEATSPREADER);
|
||||
initmission::printAddObjectError("RTD_0_dummy", objects::RTD_0_IC3_PLOC_HEATSPREADER);
|
||||
}
|
||||
result = dummyTask->addComponent(objects::SUS_0_N_LOC_XFYFZM_PT_XF);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("SUS_0_dummy", objects::SUS_0_N_LOC_XFYFZM_PT_XF);
|
||||
}
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
result = testTask->addComponent(objects::TEST_TASK);
|
||||
|
@ -27,6 +27,7 @@
|
||||
#endif
|
||||
|
||||
#include "dummies/TemperatureSensorsDummy.h"
|
||||
#include "dummies/SusDummy.h"
|
||||
|
||||
void Factory::setStaticFrameworkObjectIds() {
|
||||
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||
@ -49,6 +50,7 @@ void ObjectFactory::produce(void* args) {
|
||||
|
||||
|
||||
new TemperatureSensorsDummy();
|
||||
new SusDummy();
|
||||
new ThermalController(objects::THERMAL_CONTROLLER, objects::NO_OBJECT);
|
||||
|
||||
//new TestTask(objects::TEST_TASK);
|
||||
|
@ -1 +1 @@
|
||||
target_sources(${OBSW_NAME} PUBLIC TemperatureSensorsDummy.cpp)
|
||||
target_sources(${OBSW_NAME} PUBLIC TemperatureSensorsDummy.cpp SusDummy.cpp)
|
||||
|
82
bsp_hosted/dummies/SusDummy.cpp
Normal file
82
bsp_hosted/dummies/SusDummy.cpp
Normal file
@ -0,0 +1,82 @@
|
||||
#include "SusDummy.h"
|
||||
|
||||
#include <objects/systemObjectList.h>
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
|
||||
SusDummy::SusDummy()
|
||||
: ExtendedControllerBase(objects::SUS_0_N_LOC_XFYFZM_PT_XF, objects::NO_OBJECT),
|
||||
susSet(this) {
|
||||
ObjectManager::instance()->insert(objects::SUS_6_R_LOC_XFYBZM_PT_XF, this);
|
||||
ObjectManager::instance()->insert(objects::SUS_1_N_LOC_XBYFZM_PT_XB, this);
|
||||
ObjectManager::instance()->insert(objects::SUS_7_R_LOC_XBYBZM_PT_XB, this);
|
||||
ObjectManager::instance()->insert(objects::SUS_2_N_LOC_XFYBZB_PT_YB, this);
|
||||
ObjectManager::instance()->insert(objects::SUS_8_R_LOC_XBYBZB_PT_YB, this);
|
||||
ObjectManager::instance()->insert(objects::SUS_3_N_LOC_XFYBZF_PT_YF, this);
|
||||
ObjectManager::instance()->insert(objects::SUS_9_R_LOC_XBYBZB_PT_YF, this);
|
||||
ObjectManager::instance()->insert(objects::SUS_4_N_LOC_XMYFZF_PT_ZF, this);
|
||||
ObjectManager::instance()->insert(objects::SUS_10_N_LOC_XMYBZF_PT_ZF, this);
|
||||
ObjectManager::instance()->insert(objects::SUS_5_N_LOC_XFYMZB_PT_ZB, this);
|
||||
ObjectManager::instance()->insert(objects::SUS_11_R_LOC_XBYMZB_PT_ZB, this);
|
||||
}
|
||||
|
||||
ReturnValue_t SusDummy::initialize() {
|
||||
static bool done = false;
|
||||
if (not done) {
|
||||
done = true;
|
||||
ReturnValue_t result = ExtendedControllerBase::initialize();
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t SusDummy::handleCommandMessage(CommandMessage* message) {
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
|
||||
void SusDummy::performControlOperation() {
|
||||
iteration++;
|
||||
value = sin(iteration / 80. * M_PI + 10) * 10 - 10;
|
||||
|
||||
susSet.read();
|
||||
susSet.temperatureCelcius = value;
|
||||
if ((iteration % 100) < 20) {
|
||||
susSet.setValidity(false, true);
|
||||
} else {
|
||||
susSet.setValidity(true, true);
|
||||
}
|
||||
susSet.commit();
|
||||
}
|
||||
|
||||
ReturnValue_t SusDummy::initializeLocalDataPool(
|
||||
localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) {
|
||||
localDataPoolMap.emplace(SUS::SusPoolIds::TEMPERATURE_C,
|
||||
new PoolEntry<float>({0}, 1, true));
|
||||
localDataPoolMap.emplace(SUS::SusPoolIds::CHANNEL_VEC, new PoolEntry<uint16_t>({0}));
|
||||
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
LocalPoolDataSetBase* SusDummy::getDataSetHandle(sid_t sid) {
|
||||
switch (sid.ownerSetId) {
|
||||
case SUS::SUS_DATA_SET_ID:
|
||||
return &susSet;
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t SusDummy::checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
uint32_t* msToReachTheMode) {
|
||||
if (submode != SUBMODE_NONE) {
|
||||
return INVALID_SUBMODE;
|
||||
}
|
||||
if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) {
|
||||
return INVALID_MODE;
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
27
bsp_hosted/dummies/SusDummy.h
Normal file
27
bsp_hosted/dummies/SusDummy.h
Normal file
@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include <fsfw/controller/ExtendedControllerBase.h>
|
||||
#include <mission/devices/devicedefinitions/SusDefinitions.h>
|
||||
|
||||
class SusDummy : public ExtendedControllerBase {
|
||||
public:
|
||||
SusDummy();
|
||||
|
||||
ReturnValue_t initialize() override;
|
||||
|
||||
protected:
|
||||
virtual ReturnValue_t handleCommandMessage(CommandMessage* message) override;
|
||||
virtual void performControlOperation() override;
|
||||
virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override;
|
||||
virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||
|
||||
// Mode abstract functions
|
||||
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
uint32_t* msToReachTheMode) override;
|
||||
|
||||
private:
|
||||
int iteration = 0;
|
||||
float value = 0;
|
||||
SUS::SusDataset susSet;
|
||||
};
|
@ -51,6 +51,11 @@ void TemperatureSensorsDummy::performControlOperation() {
|
||||
max31865Set.read();
|
||||
max31865Set.rtdValue = value - 5;
|
||||
max31865Set.temperatureCelcius = value;
|
||||
if ((iteration % 100) < 20) {
|
||||
max31865Set.setValidity(false, true);
|
||||
} else {
|
||||
max31865Set.setValidity(true, true);
|
||||
}
|
||||
max31865Set.commit();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user