v1.13.0 #285

Merged
muellerr merged 30 commits from develop into main 2022-08-24 16:36:50 +02:00
4 changed files with 33 additions and 29 deletions
Showing only changes of commit e7cbcee873 - Show all commits

View File

@ -1,9 +1,9 @@
#include <fsfw/datapool/PoolReadGuard.h>
#include "AcsController.h"
#include <fsfw/datapool/PoolReadGuard.h>
AcsController::AcsController(object_id_t objectId)
: ExtendedControllerBase(objectId, objects::NO_OBJECT),
mgmData(this) {}
: ExtendedControllerBase(objectId, objects::NO_OBJECT), mgmData(this) {}
ReturnValue_t AcsController::handleCommandMessage(CommandMessage *message) {
return HasReturnvaluesIF::RETURN_OK;
@ -32,7 +32,7 @@ void AcsController::performControlOperation() {
{
PoolReadGuard pg(&mgmData);
if (pg.getReadResult() == RETURN_OK) {
copyMgmData();
copyMgmData();
}
}
}
@ -45,7 +45,7 @@ ReturnValue_t AcsController::initializeLocalDataPool(localpool::DataPool &localD
localDataPoolMap.emplace(acsctrl::PoolIds::MGM_3_RM3100_UT, &mgm3PoolVec);
localDataPoolMap.emplace(acsctrl::PoolIds::MGM_IMTQ_CAL_NT, &imtqMgmPoolVec);
localDataPoolMap.emplace(acsctrl::PoolIds::MGM_IMTQ_CAL_ACT_STATUS, &imtqCalActStatus);
poolManager.subscribeForPeriodicPacket(mgmData.getSid(), false, 5.0, false);
poolManager.subscribeForPeriodicPacket(mgmData.getSid(), false, 5.0, false);
return HasReturnvaluesIF::RETURN_OK;
}
@ -64,31 +64,31 @@ ReturnValue_t AcsController::checkModeCommand(Mode_t mode, Submode_t submode,
void AcsController::copyMgmData() {
{
PoolReadGuard pg(&mgm0Lis3Set);
if(pg.getReadResult() == RETURN_OK) {
if (pg.getReadResult() == RETURN_OK) {
std::memcpy(mgmData.mgm0Lis3.value, mgm0Lis3Set.fieldStrengths.value, 3 * sizeof(float));
}
}
{
PoolReadGuard pg(&mgm1Rm3100Set);
if(pg.getReadResult() == RETURN_OK) {
if (pg.getReadResult() == RETURN_OK) {
std::memcpy(mgmData.mgm1Rm3100.value, mgm1Rm3100Set.fieldStrengths.value, 3 * sizeof(float));
}
}
{
PoolReadGuard pg(&mgm2Lis3Set);
if(pg.getReadResult() == RETURN_OK) {
if (pg.getReadResult() == RETURN_OK) {
std::memcpy(mgmData.mgm2Lis3.value, mgm2Lis3Set.fieldStrengths.value, 3 * sizeof(float));
}
}
{
PoolReadGuard pg(&mgm3Rm3100Set);
if(pg.getReadResult() == RETURN_OK) {
if (pg.getReadResult() == RETURN_OK) {
std::memcpy(mgmData.mgm3Rm3100.value, mgm3Rm3100Set.fieldStrengths.value, 3 * sizeof(float));
}
}
{
PoolReadGuard pg(&imtqMgmSet);
if(pg.getReadResult() == RETURN_OK) {
if (pg.getReadResult() == RETURN_OK) {
std::memcpy(mgmData.imtqCal.value, imtqMgmSet.mgmXyz.value, 3 * sizeof(int32_t));
mgmData.actuationCalStatus.value = imtqMgmSet.coilActuationStatus.value;
}

View File

@ -2,8 +2,9 @@
#define MISSION_CONTROLLER_ACSCONTROLLER_H_
#include <commonObjects.h>
#include "controllerdefinitions/AcsCtrlDefinitions.h"
#include <fsfw/controller/ExtendedControllerBase.h>
#include "controllerdefinitions/AcsCtrlDefinitions.h"
#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h"
#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h"
#include "mission/devices/devicedefinitions/IMTQHandlerDefinitions.h"
@ -33,11 +34,16 @@ class AcsController : public ExtendedControllerBase {
// MGMs
acsctrl::MgmData mgmData;
MGMLIS3MDL::MgmPrimaryDataset mgm0Lis3Set = MGMLIS3MDL::MgmPrimaryDataset(objects::MGM_0_LIS3_HANDLER);
RM3100::Rm3100PrimaryDataset mgm1Rm3100Set = RM3100::Rm3100PrimaryDataset(objects::MGM_1_RM3100_HANDLER);
MGMLIS3MDL::MgmPrimaryDataset mgm2Lis3Set = MGMLIS3MDL::MgmPrimaryDataset(objects::MGM_2_LIS3_HANDLER);
RM3100::Rm3100PrimaryDataset mgm3Rm3100Set = RM3100::Rm3100PrimaryDataset(objects::MGM_3_RM3100_HANDLER);
IMTQ::CalibratedMtmMeasurementSet imtqMgmSet = IMTQ::CalibratedMtmMeasurementSet(objects::IMTQ_HANDLER);
MGMLIS3MDL::MgmPrimaryDataset mgm0Lis3Set =
MGMLIS3MDL::MgmPrimaryDataset(objects::MGM_0_LIS3_HANDLER);
RM3100::Rm3100PrimaryDataset mgm1Rm3100Set =
RM3100::Rm3100PrimaryDataset(objects::MGM_1_RM3100_HANDLER);
MGMLIS3MDL::MgmPrimaryDataset mgm2Lis3Set =
MGMLIS3MDL::MgmPrimaryDataset(objects::MGM_2_LIS3_HANDLER);
RM3100::Rm3100PrimaryDataset mgm3Rm3100Set =
RM3100::Rm3100PrimaryDataset(objects::MGM_3_RM3100_HANDLER);
IMTQ::CalibratedMtmMeasurementSet imtqMgmSet =
IMTQ::CalibratedMtmMeasurementSet(objects::IMTQ_HANDLER);
PoolEntry<float> mgm0PoolVec = PoolEntry<float>(3);
PoolEntry<float> mgm1PoolVec = PoolEntry<float>(3);

View File

@ -1,15 +1,14 @@
#ifndef MISSION_CONTROLLER_CONTROLLERDEFINITIONS_ACSCTRLDEFINITIONS_H_
#define MISSION_CONTROLLER_CONTROLLERDEFINITIONS_ACSCTRLDEFINITIONS_H_
#include <fsfw/datapoollocal/localPoolDefinitions.h>
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
#include <fsfw/datapoollocal/localPoolDefinitions.h>
#include <cstdint>
namespace acsctrl {
enum SetIds : uint32_t {
MGM_SENSOR_DATA
};
enum SetIds : uint32_t { MGM_SENSOR_DATA };
enum PoolIds : lp_id_t {
MGM_0_LIS3_UT,
@ -20,14 +19,13 @@ enum PoolIds : lp_id_t {
MGM_IMTQ_CAL_ACT_STATUS
};
static constexpr uint8_t MGM_SET_ENTRIES = 10;
/**
* @brief This dataset can be used to store the collected temperatures of all temperature sensors
*/
class MgmData : public StaticLocalDataSet<MGM_SET_ENTRIES> {
public:
public:
MgmData(HasLocalDataPoolIF* hkOwner) : StaticLocalDataSet(hkOwner, MGM_SENSOR_DATA) {}
// The ACS board measurement are in floating point uT
@ -37,12 +35,12 @@ public:
lp_vec_t<float, 3> mgm3Rm3100 = lp_vec_t<float, 3>(sid.objectId, MGM_3_RM3100_UT, this);
// The IMTQ measurements are in integer nT
lp_vec_t<int32_t, 3> imtqCal = lp_vec_t<int32_t, 3>(sid.objectId, MGM_IMTQ_CAL_NT, this);
lp_var_t<uint8_t> actuationCalStatus = lp_var_t<uint8_t>(sid.objectId,
MGM_IMTQ_CAL_ACT_STATUS, this);
private:
lp_var_t<uint8_t> actuationCalStatus =
lp_var_t<uint8_t>(sid.objectId, MGM_IMTQ_CAL_ACT_STATUS, this);
private:
};
}
} // namespace acsctrl
#endif /* MISSION_CONTROLLER_CONTROLLERDEFINITIONS_ACSCTRLDEFINITIONS_H_ */

View File

@ -750,13 +750,13 @@ void IMTQHandler::fillCalibratedMtmDataset(const uint8_t* packet) {
calMtmMeasurementSet.setValidity(true, true);
int8_t offset = 2;
calMtmMeasurementSet.mgmXyz[0] = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
*(packet + offset + 1) << 8 | *(packet + offset);
*(packet + offset + 1) << 8 | *(packet + offset);
offset += 4;
calMtmMeasurementSet.mgmXyz[1] = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
*(packet + offset + 1) << 8 | *(packet + offset);
*(packet + offset + 1) << 8 | *(packet + offset);
offset += 4;
calMtmMeasurementSet.mgmXyz[2] = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
*(packet + offset + 1) << 8 | *(packet + offset);
*(packet + offset + 1) << 8 | *(packet + offset);
offset += 4;
calMtmMeasurementSet.coilActuationStatus = (*(packet + offset + 3) << 24) |
(*(packet + offset + 2) << 16) |