imqt base functions

This commit is contained in:
Jakob Meier 2021-04-26 07:56:02 +02:00
parent 191f4b6d0c
commit ad48d5888d
4 changed files with 304 additions and 50 deletions

View File

@ -6,7 +6,8 @@
#include <fsfwconfig/OBSWConfig.h>
IMTQHandler::IMTQHandler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie) :
DeviceHandlerBase(objectId, comIF, comCookie), engHkDataset(this) {
DeviceHandlerBase(objectId, comIF, comCookie), engHkDataset(this), calMtmMeasurementSet(
this), rawMtmMeasurementSet(this) {
if (comCookie == NULL) {
sif::error << "IMTQHandler: Invalid com cookie" << std::endl;
}
@ -29,7 +30,28 @@ void IMTQHandler::doShutDown(){
ReturnValue_t IMTQHandler::buildNormalDeviceCommand(
DeviceCommandId_t * id) {
*id = IMTQ::GET_ENG_HK_DATA;
switch (communicationStep) {
case CommunicationStep::GET_ENG_HK_DATA:
*id = IMTQ::GET_ENG_HK_DATA;
communicationStep = CommunicationStep::START_MTM_MEASUREMENT;
break;
case CommunicationStep::START_MTM_MEASUREMENT:
*id = IMTQ::START_MTM_MEASUREMENT;
communicationStep = CommunicationStep::GET_CAL_MTM_MEASUREMENT;
break;
case CommunicationStep::GET_CAL_MTM_MEASUREMENT:
*id = IMTQ::GET_CAL_MTM_MEASUREMENT;
communicationStep = CommunicationStep::GET_RAW_MTM_MEASUREMENT;
break;
case CommunicationStep::GET_RAW_MTM_MEASUREMENT:
*id = IMTQ::GET_RAW_MTM_MEASUREMENT;
communicationStep = CommunicationStep::GET_ENG_HK_DATA;
break;
default:
sif::debug << "IMTQHandler::buildNormalDeviceCommand: Invalid communication step"
<< std::endl;
break;
}
return buildCommandFromCommand(*id, NULL, 0);
}
@ -69,6 +91,24 @@ ReturnValue_t IMTQHandler::buildCommandFromCommand(
rawPacketLen = 1;
return RETURN_OK;
}
case(IMTQ::START_MTM_MEASUREMENT): {
commandBuffer[0] = IMTQ::CC::START_MTM_MEASUREMENT;
rawPacket = commandBuffer;
rawPacketLen = 1;
return RETURN_OK;
}
case(IMTQ::GET_CAL_MTM_MEASUREMENT): {
commandBuffer[0] = IMTQ::CC::GET_CAL_MTM_MEASUREMENT;
rawPacket = commandBuffer;
rawPacketLen = 1;
return RETURN_OK;
}
case(IMTQ::GET_RAW_MTM_MEASUREMENT): {
commandBuffer[0] = IMTQ::CC::GET_RAW_MTM_MEASUREMENT;
rawPacket = commandBuffer;
rawPacketLen = 1;
return RETURN_OK;
}
default:
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
}
@ -81,7 +121,13 @@ void IMTQHandler::fillCommandAndReplyMap() {
this->insertInCommandAndReplyMap(IMTQ::GET_ENG_HK_DATA, 1, &engHkDataset,
IMTQ::SIZE_ENG_HK_DATA_REPLY);
this->insertInCommandAndReplyMap(IMTQ::GET_COMMANDED_DIPOLE, 1, nullptr,
IMTQ::SIZE_ENG_HK_DATA_REPLY);
IMTQ::SIZE_GET_COMMANDED_DIPOLE_REPLY);
this->insertInCommandAndReplyMap(IMTQ::START_MTM_MEASUREMENT, 1, nullptr,
IMTQ::SIZE_STATUS_REPLY);
this->insertInCommandAndReplyMap(IMTQ::GET_CAL_MTM_MEASUREMENT, 1, &calMtmMeasurementSet,
IMTQ::SIZE_GET_CAL_MTM_MEASUREMENT);
this->insertInCommandAndReplyMap(IMTQ::GET_RAW_MTM_MEASUREMENT, 1, &rawMtmMeasurementSet,
IMTQ::SIZE_GET_RAW_MTM_MEASUREMENT);
}
ReturnValue_t IMTQHandler::scanForReply(const uint8_t *start,
@ -94,6 +140,10 @@ ReturnValue_t IMTQHandler::scanForReply(const uint8_t *start,
*foundLen = IMTQ::SIZE_STATUS_REPLY;
*foundId = IMTQ::START_ACTUATION_DIPOLE;
break;
case(IMTQ::CC::START_MTM_MEASUREMENT):
*foundLen = IMTQ::SIZE_STATUS_REPLY;
*foundId = IMTQ::START_MTM_MEASUREMENT;
break;
case(IMTQ::CC::GET_ENG_HK_DATA):
*foundLen = IMTQ::SIZE_ENG_HK_DATA_REPLY;
*foundId = IMTQ::GET_ENG_HK_DATA;
@ -102,6 +152,14 @@ ReturnValue_t IMTQHandler::scanForReply(const uint8_t *start,
*foundLen = IMTQ::SIZE_GET_COMMANDED_DIPOLE_REPLY;
*foundId = IMTQ::GET_COMMANDED_DIPOLE;
break;
case(IMTQ::CC::GET_CAL_MTM_MEASUREMENT):
*foundLen = IMTQ::SIZE_GET_CAL_MTM_MEASUREMENT;
*foundId = IMTQ::GET_CAL_MTM_MEASUREMENT;
break;
case(IMTQ::CC::GET_RAW_MTM_MEASUREMENT):
*foundLen = IMTQ::SIZE_GET_RAW_MTM_MEASUREMENT;
*foundId = IMTQ::GET_RAW_MTM_MEASUREMENT;
break;
default:
sif::debug << "IMTQHandler::scanForReply: Reply contains invalid command code" << std::endl;
result = IGNORE_REPLY_DATA;
@ -124,7 +182,8 @@ ReturnValue_t IMTQHandler::interpretDeviceReply(DeviceCommandId_t id,
switch (id) {
case (IMTQ::START_ACTUATION_DIPOLE):
// Replies only the status byte which is already handled with parseStatusByte
case (IMTQ::START_MTM_MEASUREMENT):
/* Replies only the status byte which is already handled with parseStatusByte */
break;
case (IMTQ::GET_ENG_HK_DATA):
fillEngHkDataset(packet);
@ -132,6 +191,12 @@ ReturnValue_t IMTQHandler::interpretDeviceReply(DeviceCommandId_t id,
case (IMTQ::GET_COMMANDED_DIPOLE):
handleGetCommandedDipoleReply(packet);
break;
case (IMTQ::GET_CAL_MTM_MEASUREMENT):
fillCalibratedMtmDataset(packet);
break;
case (IMTQ::GET_RAW_MTM_MEASUREMENT):
fillRawMtmDataset(packet);
break;
default: {
sif::debug << "IMTQHandler::interpretDeviceReply: Unknown device reply id" << std::endl;
return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY;
@ -152,18 +217,31 @@ uint32_t IMTQHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo){
ReturnValue_t IMTQHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) {
/** Entries of engineering housekeeping dataset */
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_A, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(IMTQ::ANALOG_CURRENT_A, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(IMTQ::COIL_X_CURRENT_A, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(IMTQ::COIL_Y_CURRENT_A, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(IMTQ::COIL_Z_CURRENT_A, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(IMTQ::DIGITAL_CURRENT, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(IMTQ::ANALOG_CURRENT, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(IMTQ::COIL_X_CURRENT, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(IMTQ::COIL_Y_CURRENT, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(IMTQ::COIL_Z_CURRENT, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(IMTQ::COIL_X_TEMPERATURE, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(IMTQ::COIL_Y_TEMPERATURE, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(IMTQ::COIL_Z_TEMPERATURE, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(IMTQ::MCU_TEMPERATURE, new PoolEntry<uint16_t>( { 0 }));
/** Entries of calibrated MTM measurement dataset */
localDataPoolMap.emplace(IMTQ::MTM_CAL_X, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(IMTQ::MTM_CAL_Y, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(IMTQ::MTM_CAL_Z, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(IMTQ::ACTUATION_CAL_STATUS, new PoolEntry<uint8_t>( { 0 }));
/** Entries of raw MTM measurement dataset */
localDataPoolMap.emplace(IMTQ::MTM_RAW_X, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(IMTQ::MTM_RAW_Y, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(IMTQ::MTM_RAW_Z, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(IMTQ::ACTUATION_RAW_STATUS, new PoolEntry<uint8_t>( { 0 }));
return HasReturnvaluesIF::RETURN_OK;
}
@ -200,36 +278,36 @@ ReturnValue_t IMTQHandler::parseStatusByte(const uint8_t* packet) {
void IMTQHandler::fillEngHkDataset(const uint8_t* packet) {
uint8_t offset = 2;
engHkDataset.digitalVoltageMv = *(packet + offset + 1) | *(packet + offset);
engHkDataset.digitalVoltageMv = *(packet + offset + 1) << 8 | *(packet + offset);
offset += 2;
engHkDataset.analogVoltageMv = *(packet + offset + 1) | *(packet + offset);
engHkDataset.analogVoltageMv = *(packet + offset + 1) << 8 | *(packet + offset);
offset += 2;
engHkDataset.digitalCurrentA = (*(packet + offset + 1) | *(packet + offset)) * 0.0001;
engHkDataset.digitalCurrentmA = (*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
offset += 2;
engHkDataset.analogCurrentA = (*(packet + offset + 1) | *(packet + offset)) * 0.0001;
engHkDataset.analogCurrentmA = (*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
offset += 2;
engHkDataset.coilXcurrentA = (*(packet + offset + 1) | *(packet + offset)) * 0.0001;
engHkDataset.coilXCurrentmA = (*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
offset += 2;
engHkDataset.coilYcurrentA = (*(packet + offset + 1) | *(packet + offset)) * 0.0001;
engHkDataset.coilYCurrentmA = (*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
offset += 2;
engHkDataset.coilZcurrentA = (*(packet + offset + 1) | *(packet + offset)) * 0.0001;
engHkDataset.coilZCurrentmA = (*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
offset += 2;
engHkDataset.coilXTemperature = (*(packet + offset + 1) | *(packet + offset));
engHkDataset.coilXTemperature = (*(packet + offset + 1) << 8 | *(packet + offset));
offset += 2;
engHkDataset.coilYTemperature = (*(packet + offset + 1) | *(packet + offset));
engHkDataset.coilYTemperature = (*(packet + offset + 1) << 8 | *(packet + offset));
offset += 2;
engHkDataset.coilZTemperature = (*(packet + offset + 1) | *(packet + offset));
engHkDataset.coilZTemperature = (*(packet + offset + 1) << 8 | *(packet + offset));
offset += 2;
engHkDataset.mcuTemperature = (*(packet + offset + 1) | *(packet + offset));
engHkDataset.mcuTemperature = (*(packet + offset + 1) << 8 | *(packet + offset));
#if OBSW_VERBOSE_LEVEL >= 1 && IMQT_DEBUG == 1
sif::info << "IMTQ digital voltage: " << engHkDataset.digitalVoltageMv << " mV" << std::endl;
sif::info << "IMTQ analog voltage: " << engHkDataset.analogVoltageMv << " mV" << std::endl;
sif::info << "IMTQ digital current: " << engHkDataset.digitalCurrentA << " A" << std::endl;
sif::info << "IMTQ analog current: " << engHkDataset.analogCurrentA << " A" << std::endl;
sif::info << "IMTQ coil X current: " << engHkDataset.coilXcurrentA << " A" << std::endl;
sif::info << "IMTQ coil Y current: " << engHkDataset.coilYcurrentA << " A" << std::endl;
sif::info << "IMTQ coil Z current: " << engHkDataset.coilZcurrentA << " A" << std::endl;
sif::info << "IMTQ digital current: " << engHkDataset.digitalCurrentmA << " mA" << std::endl;
sif::info << "IMTQ analog current: " << engHkDataset.analogCurrentmA << " mA" << std::endl;
sif::info << "IMTQ coil X current: " << engHkDataset.coilXCurrentmA << " mA" << std::endl;
sif::info << "IMTQ coil Y current: " << engHkDataset.coilYCurrentmA << " mA" << std::endl;
sif::info << "IMTQ coil Z current: " << engHkDataset.coilZCurrentmA << " mA" << std::endl;
sif::info << "IMTQ coil X temperature: " << engHkDataset.coilXTemperature << " °C"
<< std::endl;
sif::info << "IMTQ coil Y temperature: " << engHkDataset.coilYTemperature << " °C"
@ -245,15 +323,11 @@ void IMTQHandler::setModeNormal() {
mode = MODE_NORMAL;
}
void IMTQHandler::handleDeviceTM(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId) {
ReturnValue_t result = RETURN_OK;
if (wiretappingMode == RAW) {
/* Data already sent in doGetRead() */
return result;
return;
}
DeviceReplyMap::iterator iter = deviceReplyMap.find(replyId);
@ -267,8 +341,71 @@ void IMTQHandler::handleDeviceTM(const uint8_t* data, size_t dataSize, DeviceCom
return;
}
result = actionHelper.reportData(queueId, replyId, data, dataSize);
ReturnValue_t result = actionHelper.reportData(queueId, replyId, data, dataSize);
if (result != RETURN_OK) {
sif::debug << "IMTQHandler::handleDeviceTM: Failed to report data" << std::endl;
return;
}
}
void IMTQHandler::handleGetCommandedDipoleReply(const uint8_t* packet) {
uint8_t tmData[6];
/* Switching endianess of received dipole values */
tmData[0] = *(packet + 3);
tmData[1] = *(packet + 2);
tmData[2] = *(packet + 5);
tmData[3] = *(packet + 4);
tmData[4] = *(packet + 7);
tmData[5] = *(packet + 6);
handleDeviceTM(tmData, sizeof(tmData), IMTQ::GET_COMMANDED_DIPOLE);
}
void IMTQHandler::fillCalibratedMtmDataset(const uint8_t* packet) {
int8_t offset = 2;
calMtmMeasurementSet.mtmXnT = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16
| *(packet + offset + 1) << 8 | *(packet + offset);
offset += 4;
calMtmMeasurementSet.mtmYnT = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16
| *(packet + offset + 1) << 8 | *(packet + offset);
offset += 4;
calMtmMeasurementSet.mtmZnT = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16
| *(packet + offset + 1) << 8 | *(packet + offset);
offset += 4;
calMtmMeasurementSet.coilActuationStatus = (*(packet + offset + 3) << 24)
| (*(packet + offset + 2) << 16) | (*(packet + offset + 1) << 8) | (*(packet + offset));
#if OBSW_VERBOSE_LEVEL >= 1 && IMQT_DEBUG == 1
sif::info << "IMTQ calibrated MTM measurement X: " << calMtmMeasurementSet.mtmXnT << " nT"
<< std::endl;
sif::info << "IMTQ calibrated MTM measurement Y: " << calMtmMeasurementSet.mtmYnT << " nT"
<< std::endl;
sif::info << "IMTQ calibrated MTM measurement Z: " << calMtmMeasurementSet.mtmZnT << " nT"
<< std::endl;
sif::info << "IMTQ coil actuation status during MTM measurement: "
<< (unsigned int) calMtmMeasurementSet.coilActuationStatus.value << std::endl;
#endif
}
void IMTQHandler::fillRawMtmDataset(const uint8_t* packet) {
int8_t offset = 2;
rawMtmMeasurementSet.mtmXnT = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16
| *(packet + offset + 1) << 8 | *(packet + offset)) * 7.5;
offset += 4;
rawMtmMeasurementSet.mtmYnT = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16
| *(packet + offset + 1) << 8 | *(packet + offset)) * 7.5;
offset += 4;
rawMtmMeasurementSet.mtmZnT = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16
| *(packet + offset + 1) << 8 | *(packet + offset)) * 7.5;
offset += 4;
rawMtmMeasurementSet.coilActuationStatus = (*(packet + offset + 3) << 24)
| (*(packet + offset + 2) << 16) | (*(packet + offset + 1) << 8) | (*(packet + offset));
#if OBSW_VERBOSE_LEVEL >= 1 && IMQT_DEBUG == 1
sif::info << "IMTQ raw MTM measurement X: " << rawMtmMeasurementSet.mtmXnT << " nT"
<< std::endl;
sif::info << "IMTQ raw MTM measurement Y: " << rawMtmMeasurementSet.mtmYnT << " nT"
<< std::endl;
sif::info << "IMTQ raw MTM measurement Z: " << rawMtmMeasurementSet.mtmZnT << " nT"
<< std::endl;
sif::info << "IMTQ coil actuation status during MTM measurement: "
<< (unsigned int) rawMtmMeasurementSet.coilActuationStatus.value << std::endl;
#endif
}

View File

@ -52,9 +52,20 @@ private:
IMTQ::EngHkDataset engHkDataset;
IMTQ::CalibratedMtmMeasurementSet calMtmMeasurementSet;
IMTQ::RawMtmMeasurementSet rawMtmMeasurementSet;
uint8_t commandBuffer[IMTQ::MAX_COMMAND_SIZE];
enum class CommunicationStep {
GET_ENG_HK_DATA,
START_MTM_MEASUREMENT,
GET_CAL_MTM_MEASUREMENT,
GET_RAW_MTM_MEASUREMENT
};
CommunicationStep communicationStep = CommunicationStep::GET_ENG_HK_DATA;
/**
* @brief Each reply contains a status byte giving information about a request. This function
* parses this byte and returns the associated failure message.
@ -72,6 +83,36 @@ private:
*
*/
void fillEngHkDataset(const uint8_t* packet);
/**
* @brief This function sends a command reply to the requesting queue.
*
* @param data Pointer to the data to send.
* @param dataSize Size of the data to send.
* @param relplyId Reply id which will be inserted at the beginning of the action message.
*/
void handleDeviceTM(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId);
/**
* @brief This function handles the reply containing the commanded dipole.
*
* @param packet Pointer to the reply data.
*/
void handleGetCommandedDipoleReply(const uint8_t* packet);
/**
* @brief This function parses the reply containing the calibrated MTM measurement and writes
* the values to the appropriate dataset.
* @param packet Pointer to the reply data.
*/
void fillCalibratedMtmDataset(const uint8_t* packet);
/**
* @brief This function copies the raw MTM measurements to the MTM raw dataset.
* @param packet Pointer to the reply data requested with the GET_RAW_MTM_MEASUREMENTS
* command.
*/
void fillRawMtmDataset(const uint8_t* packet);
};
#endif /* MISSION_DEVICES_IMTQHANDLER_H_ */

View File

@ -7,49 +7,71 @@ namespace IMTQ {
static const DeviceCommandId_t GET_ENG_HK_DATA = 0x1;
static const DeviceCommandId_t START_ACTUATION_DIPOLE = 0x2;
static const DeviceCommandId_t GET_COMMANDED_DIPOLE = 0x3;
/** Generates new measurement of the magnetic field */
static const DeviceCommandId_t START_MTM_MEASUREMENT = 0x4;
/** Requests the calibrated magnetometer measurement */
static const DeviceCommandId_t GET_CAL_MTM_MEASUREMENT = 0x5;
/** Requests the raw values measured by the built-in MTM XEN1210 */
static const DeviceCommandId_t GET_RAW_MTM_MEASUREMENT = 0x6;
static const uint8_t GET_TEMP_REPLY_SIZE = 2;
static const uint8_t CFGR_CMD_SIZE = 3;
static const uint8_t POINTER_REG_SIZE = 1;
static const uint32_t ENG_HK_DATA_SET_ID = GET_ENG_HK_DATA;
static const uint32_t CAL_MTM_SET = GET_CAL_MTM_MEASUREMENT;
static const uint8_t SIZE_ENG_HK_COMMAND = 1;
static const uint8_t SIZE_STATUS_REPLY = 2;
static const uint8_t SIZE_ENG_HK_DATA_REPLY = 24;
static const uint8_t SIZE_GET_COMMANDED_DIPOLE_REPLY = 8;
static const uint8_t SIZE_GET_CAL_MTM_MEASUREMENT = 15;
static const uint8_t SIZE_GET_RAW_MTM_MEASUREMENT = 15;
static const uint8_t MAX_REPLY_SIZE = SIZE_ENG_HK_DATA_REPLY;
static const uint8_t MAX_COMMAND_SIZE = 9;
static const uint8_t POOL_ENTRIES = 11;
static const uint8_t ENG_HK_SET_POOL_ENTRIES = 11;
static const uint8_t CAL_MTM_POOL_ENTRIES = 4;
/**
* Command code definitions. Each command or reply of an IMTQ request will begin with one of
* the following command codes.
*/
namespace CC {
static const uint8_t START_MTM_MEASUREMENT = 0x4;
static const uint8_t START_ACTUATION_DIPOLE = 0x6;
static const uint8_t SOFTWARE_RESET = 0xAA;
static const uint8_t GET_ENG_HK_DATA = 0x4A;
static const uint8_t GET_COMMANDED_DIPOLE = 0x46;
static const uint8_t GET_RAW_MTM_MEASUREMENT = 0x42;
static const uint8_t GET_CAL_MTM_MEASUREMENT = 0x43;
};
enum IMTQPoolIds: lp_id_t {
DIGITAL_VOLTAGE_MV,
ANALOG_VOLTAGE_MV,
DIGITAL_CURRENT_A,
ANALOG_CURRENT_A,
COIL_X_CURRENT_A,
COIL_Y_CURRENT_A,
COIL_Z_CURRENT_A,
DIGITAL_CURRENT,
ANALOG_CURRENT,
COIL_X_CURRENT,
COIL_Y_CURRENT,
COIL_Z_CURRENT,
COIL_X_TEMPERATURE,
COIL_Y_TEMPERATURE,
COIL_Z_TEMPERATURE,
MCU_TEMPERATURE
MCU_TEMPERATURE,
MTM_CAL_X,
MTM_CAL_Y,
MTM_CAL_Z,
ACTUATION_CAL_STATUS,
MTM_RAW_X,
MTM_RAW_Y,
MTM_RAW_Z,
ACTUATION_RAW_STATUS
};
class EngHkDataset:
public StaticLocalDataSet<POOL_ENTRIES> {
public StaticLocalDataSet<ENG_HK_SET_POOL_ENTRIES> {
public:
EngHkDataset(HasLocalDataPoolIF* owner):
@ -64,16 +86,16 @@ public:
DIGITAL_VOLTAGE_MV, this);
lp_var_t<uint16_t> analogVoltageMv = lp_var_t<uint16_t>(sid.objectId,
ANALOG_VOLTAGE_MV, this);
lp_var_t<float> digitalCurrentA = lp_var_t<float>(sid.objectId,
DIGITAL_CURRENT_A, this);
lp_var_t<float> analogCurrentA = lp_var_t<float>(sid.objectId,
ANALOG_CURRENT_A, this);
lp_var_t<float> coilXcurrentA = lp_var_t<float>(sid.objectId,
COIL_X_CURRENT_A, this);
lp_var_t<float> coilYcurrentA = lp_var_t<float>(sid.objectId,
COIL_Y_CURRENT_A, this);
lp_var_t<float> coilZcurrentA = lp_var_t<float>(sid.objectId,
COIL_Z_CURRENT_A, this);
lp_var_t<float> digitalCurrentmA = lp_var_t<float>(sid.objectId,
DIGITAL_CURRENT, this);
lp_var_t<float> analogCurrentmA = lp_var_t<float>(sid.objectId,
ANALOG_CURRENT, this);
lp_var_t<float> coilXCurrentmA = lp_var_t<float>(sid.objectId,
COIL_X_CURRENT, this);
lp_var_t<float> coilYCurrentmA = lp_var_t<float>(sid.objectId,
COIL_Y_CURRENT, this);
lp_var_t<float> coilZCurrentmA = lp_var_t<float>(sid.objectId,
COIL_Z_CURRENT, this);
/** All temperatures in [°C] */
lp_var_t<uint16_t> coilXTemperature = lp_var_t<uint16_t>(sid.objectId,
COIL_X_TEMPERATURE, this);
@ -85,6 +107,60 @@ public:
MCU_TEMPERATURE, this);
};
/**
* @brief This dataset holds the raw MTM measurements.
*/
class CalibratedMtmMeasurementSet:
public StaticLocalDataSet<CAL_MTM_POOL_ENTRIES> {
public:
CalibratedMtmMeasurementSet(HasLocalDataPoolIF* owner):
StaticLocalDataSet(owner, CAL_MTM_SET) {
}
CalibratedMtmMeasurementSet(object_id_t objectId):
StaticLocalDataSet(sid_t(objectId, CAL_MTM_SET)) {
}
/** The unit of all measurements is nT */
lp_var_t<int32_t> mtmXnT = lp_var_t<int32_t>(sid.objectId,
MTM_CAL_X, this);
lp_var_t<int32_t> mtmYnT = lp_var_t<int32_t>(sid.objectId,
MTM_CAL_Y, this);
lp_var_t<int32_t> mtmZnT = lp_var_t<int32_t>(sid.objectId,
MTM_CAL_Z, this);
/** 1 if coils were actuating during measurement otherwise 0 */
lp_var_t<uint8_t> coilActuationStatus = lp_var_t<uint8_t>(sid.objectId,
ACTUATION_CAL_STATUS, this);
};
/**
* @brief This dataset holds the last calibrated MTM measurement.
*/
class RawMtmMeasurementSet:
public StaticLocalDataSet<CAL_MTM_POOL_ENTRIES> {
public:
RawMtmMeasurementSet(HasLocalDataPoolIF* owner):
StaticLocalDataSet(owner, CAL_MTM_SET) {
}
RawMtmMeasurementSet(object_id_t objectId):
StaticLocalDataSet(sid_t(objectId, CAL_MTM_SET)) {
}
/** The unit of all measurements is nT */
lp_var_t<float> mtmXnT = lp_var_t<float>(sid.objectId,
MTM_RAW_X, this);
lp_var_t<float> mtmYnT = lp_var_t<float>(sid.objectId,
MTM_RAW_Y, this);
lp_var_t<float> mtmZnT = lp_var_t<float>(sid.objectId,
MTM_RAW_Z, this);
/** 1 if coils were actuating during measurement otherwise 0 */
lp_var_t<uint8_t> coilActuationStatus = lp_var_t<uint8_t>(sid.objectId,
ACTUATION_RAW_STATUS, this);
};
/**
* @brief This class can be used to ease the generation of an action message commanding the
* IMTQHandler to configure the magnettorquer with the desired dipoles.

2
tmtc

@ -1 +1 @@
Subproject commit 3e466f06ef7737f2f1bab8c3d68feb633da76dbc
Subproject commit 4d2b7a61509a41e67cf62ecaa2864bba3acd9ef4