541 lines
23 KiB
C++
541 lines
23 KiB
C++
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_IMTQDEFINITIONS_H_
|
||
#define MISSION_DEVICES_DEVICEDEFINITIONS_IMTQDEFINITIONS_H_
|
||
|
||
namespace IMTQ {
|
||
|
||
static const DeviceCommandId_t NONE = 0x0;
|
||
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 DeviceCommandId_t SELF_TEST_CMD = 0x7;
|
||
static const DeviceCommandId_t GET_SELF_TEST_RESULT = 0x8;
|
||
|
||
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 uint32_t SELF_TEST_DATA_SET = GET_SELF_TEST_RESULT;
|
||
|
||
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;
|
||
|
||
/** Define entries in IMTQ specific dataset */
|
||
static const uint8_t ENG_HK_SET_POOL_ENTRIES = 11;
|
||
static const uint8_t CAL_MTM_POOL_ENTRIES = 4;
|
||
static const uint8_t SELF_TEST_DATASET_ENTRIES = 104;
|
||
|
||
/** Error codes for interpreting the self test error byte */
|
||
static const uint8_t I2C_FAILURE_MASK = 0x1;
|
||
static const uint8_t SPI_FAILURE_MASK = 0x2; // MTM connectivity
|
||
static const uint8_t ADC_FAILURE_MASK = 0x4; // Current/Temp measurement
|
||
static const uint8_t PWM_FAILURE_MASK = 0x8; // Coil actuation
|
||
static const uint8_t TC_FAILURE_MASK = 0x10; // System failure
|
||
static const uint8_t MTM_RANGE_FAILURE_MASK = 0x20; // MTM values outside of expected range
|
||
static const uint8_t COIL_CURRENT_FAILURE_MASK = 0x40; // Coil currents outside of expected range
|
||
|
||
/**
|
||
* 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 SELF_TEST_CMD = 0x8;
|
||
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;
|
||
static const uint8_t GET_SELF_TEST_RESULT = 0x47;
|
||
};
|
||
|
||
namespace SELF_TEST_AXIS {
|
||
static const uint8_t ALL = 0x0;
|
||
static const uint8_t X_POSITIVE = 0x1;
|
||
static const uint8_t X_NEGATIVE = 0x2;
|
||
static const uint8_t Y_POSITIVE = 0x3;
|
||
static const uint8_t Y_NEGATIVE = 0x4;
|
||
static const uint8_t Z_POSITIVE = 0x5;
|
||
static const uint8_t Z_NEGATIVE = 0x6;
|
||
}
|
||
|
||
namespace SELF_TEST_STEPS {
|
||
static const uint8_t INIT = 0x0;
|
||
static const uint8_t X_POSITIVE = 0x1;
|
||
static const uint8_t X_NEGATIVE = 0x2;
|
||
static const uint8_t Y_POSITIVE = 0x3;
|
||
static const uint8_t Y_NEGATIVE = 0x4;
|
||
static const uint8_t Z_POSITIVE = 0x5;
|
||
static const uint8_t Z_NEGATIVE = 0x6;
|
||
static const uint8_t FINA = 0x7;
|
||
}
|
||
|
||
enum IMTQPoolIds: lp_id_t {
|
||
DIGITAL_VOLTAGE_MV,
|
||
ANALOG_VOLTAGE_MV,
|
||
DIGITAL_CURRENT,
|
||
ANALOG_CURRENT,
|
||
COIL_X_CURRENT,
|
||
COIL_Y_CURRENT,
|
||
COIL_Z_CURRENT,
|
||
COIL_X_TEMPERATURE,
|
||
COIL_Y_TEMPERATURE,
|
||
COIL_Z_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,
|
||
|
||
INIT_ERR,
|
||
INIT_RAW_MAG_X,
|
||
INIT_RAW_MAG_Y,
|
||
INIT_RAW_MAG_Z,
|
||
INIT_CAL_MAG_X,
|
||
INIT_CAL_MAG_Y,
|
||
INIT_CAL_MAG_Z,
|
||
INIT_COIL_X_CURRENT,
|
||
INIT_COIL_Y_CURRENT,
|
||
INIT_COIL_Z_CURRENT,
|
||
INIT_COIL_X_TEMPERATURE,
|
||
INIT_COIL_Y_TEMPERATURE,
|
||
INIT_COIL_Z_TEMPERATURE,
|
||
|
||
POS_X_ERR,
|
||
POS_X_RAW_MAG_X,
|
||
POS_X_RAW_MAG_Y,
|
||
POS_X_RAW_MAG_Z,
|
||
POS_X_CAL_MAG_X,
|
||
POS_X_CAL_MAG_Y,
|
||
POS_X_CAL_MAG_Z,
|
||
POS_X_COIL_X_CURRENT,
|
||
POS_X_COIL_Y_CURRENT,
|
||
POS_X_COIL_Z_CURRENT,
|
||
POS_X_COIL_X_TEMPERATURE,
|
||
POS_X_COIL_Y_TEMPERATURE,
|
||
POS_X_COIL_Z_TEMPERATURE,
|
||
|
||
NEG_X_ERR,
|
||
NEG_X_RAW_MAG_X,
|
||
NEG_X_RAW_MAG_Y,
|
||
NEG_X_RAW_MAG_Z,
|
||
NEG_X_CAL_MAG_X,
|
||
NEG_X_CAL_MAG_Y,
|
||
NEG_X_CAL_MAG_Z,
|
||
NEG_X_COIL_X_CURRENT,
|
||
NEG_X_COIL_Y_CURRENT,
|
||
NEG_X_COIL_Z_CURRENT,
|
||
NEG_X_COIL_X_TEMPERATURE,
|
||
NEG_X_COIL_Y_TEMPERATURE,
|
||
NEG_X_COIL_Z_TEMPERATURE,
|
||
|
||
POS_Y_ERR,
|
||
POS_Y_RAW_MAG_X,
|
||
POS_Y_RAW_MAG_Y,
|
||
POS_Y_RAW_MAG_Z,
|
||
POS_Y_CAL_MAG_X,
|
||
POS_Y_CAL_MAG_Y,
|
||
POS_Y_CAL_MAG_Z,
|
||
POS_Y_COIL_X_CURRENT,
|
||
POS_Y_COIL_Y_CURRENT,
|
||
POS_Y_COIL_Z_CURRENT,
|
||
POS_Y_COIL_X_TEMPERATURE,
|
||
POS_Y_COIL_Y_TEMPERATURE,
|
||
POS_Y_COIL_Z_TEMPERATURE,
|
||
|
||
NEG_Y_ERR,
|
||
NEG_Y_RAW_MAG_X,
|
||
NEG_Y_RAW_MAG_Y,
|
||
NEG_Y_RAW_MAG_Z,
|
||
NEG_Y_CAL_MAG_X,
|
||
NEG_Y_CAL_MAG_Y,
|
||
NEG_Y_CAL_MAG_Z,
|
||
NEG_Y_COIL_X_CURRENT,
|
||
NEG_Y_COIL_Y_CURRENT,
|
||
NEG_Y_COIL_Z_CURRENT,
|
||
NEG_Y_COIL_X_TEMPERATURE,
|
||
NEG_Y_COIL_Y_TEMPERATURE,
|
||
NEG_Y_COIL_Z_TEMPERATURE,
|
||
|
||
POS_Z_ERR,
|
||
POS_Z_RAW_MAG_X,
|
||
POS_Z_RAW_MAG_Y,
|
||
POS_Z_RAW_MAG_Z,
|
||
POS_Z_CAL_MAG_X,
|
||
POS_Z_CAL_MAG_Y,
|
||
POS_Z_CAL_MAG_Z,
|
||
POS_Z_COIL_X_CURRENT,
|
||
POS_Z_COIL_Y_CURRENT,
|
||
POS_Z_COIL_Z_CURRENT,
|
||
POS_Z_COIL_X_TEMPERATURE,
|
||
POS_Z_COIL_Y_TEMPERATURE,
|
||
POS_Z_COIL_Z_TEMPERATURE,
|
||
|
||
NEG_Z_ERR,
|
||
NEG_Z_RAW_MAG_X,
|
||
NEG_Z_RAW_MAG_Y,
|
||
NEG_Z_RAW_MAG_Z,
|
||
NEG_Z_CAL_MAG_X,
|
||
NEG_Z_CAL_MAG_Y,
|
||
NEG_Z_CAL_MAG_Z,
|
||
NEG_Z_COIL_X_CURRENT,
|
||
NEG_Z_COIL_Y_CURRENT,
|
||
NEG_Z_COIL_Z_CURRENT,
|
||
NEG_Z_COIL_X_TEMPERATURE,
|
||
NEG_Z_COIL_Y_TEMPERATURE,
|
||
NEG_Z_COIL_Z_TEMPERATURE,
|
||
|
||
FINA_ERR,
|
||
FINA_RAW_MAG_X,
|
||
FINA_RAW_MAG_Y,
|
||
FINA_RAW_MAG_Z,
|
||
FINA_CAL_MAG_X,
|
||
FINA_CAL_MAG_Y,
|
||
FINA_CAL_MAG_Z,
|
||
FINA_COIL_X_CURRENT,
|
||
FINA_COIL_Y_CURRENT,
|
||
FINA_COIL_Z_CURRENT,
|
||
FINA_COIL_X_TEMPERATURE,
|
||
FINA_COIL_Y_TEMPERATURE,
|
||
FINA_COIL_Z_TEMPERATURE,
|
||
};
|
||
|
||
class EngHkDataset: public StaticLocalDataSet<ENG_HK_SET_POOL_ENTRIES> {
|
||
public:
|
||
|
||
EngHkDataset(HasLocalDataPoolIF* owner) :
|
||
StaticLocalDataSet(owner, ENG_HK_DATA_SET_ID) {
|
||
}
|
||
|
||
EngHkDataset(object_id_t objectId) :
|
||
StaticLocalDataSet(sid_t(objectId, ENG_HK_DATA_SET_ID)) {
|
||
}
|
||
|
||
lp_var_t<uint16_t> digitalVoltageMv = lp_var_t<uint16_t>(sid.objectId, 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> 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 [<5B>C] */
|
||
lp_var_t<uint16_t> coilXTemperature = lp_var_t<uint16_t>(sid.objectId, COIL_X_TEMPERATURE,
|
||
this);
|
||
lp_var_t<uint16_t> coilYTemperature = lp_var_t<uint16_t>(sid.objectId, COIL_Y_TEMPERATURE,
|
||
this);
|
||
lp_var_t<uint16_t> coilZTemperature = lp_var_t<uint16_t>(sid.objectId, COIL_Z_TEMPERATURE,
|
||
this);
|
||
lp_var_t<uint16_t> mcuTemperature = lp_var_t<uint16_t>(sid.objectId, 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 dataset can be used to store the self test results.
|
||
*
|
||
* @details Units of measurements:
|
||
* Currents: [10^-4 A]
|
||
* Raw MTM data: [7.5 * 10^-9 T]
|
||
* Calibrated MTM data: [10^-9 T]
|
||
* Temperature: [<5B>C]
|
||
* The self test generates for each axis the positive and negative dipole and measures
|
||
* the magnetic field with the built-in MTM. The procedure of the test is as follows:
|
||
* 1. All coils off (INIT step)
|
||
* 2. +X
|
||
* 3. -X
|
||
* 4. +Y
|
||
* 5. -Y
|
||
* 6. +Z
|
||
* 7. -Z
|
||
* 8. All coils off (FINA step)
|
||
*/
|
||
class SelfTestDataset: public StaticLocalDataSet<SELF_TEST_DATASET_ENTRIES> {
|
||
public:
|
||
|
||
SelfTestDataset(HasLocalDataPoolIF* owner) :
|
||
StaticLocalDataSet(owner, SELF_TEST_DATA_SET) {
|
||
}
|
||
|
||
SelfTestDataset(object_id_t objectId) :
|
||
StaticLocalDataSet(sid_t(objectId, SELF_TEST_DATA_SET)) {
|
||
}
|
||
|
||
/** INIT block */
|
||
lp_var_t<uint8_t> initErr = lp_var_t<uint8_t>(sid.objectId, INIT_ERR, this);
|
||
lp_var_t<uint32_t> initRawMagX = lp_var_t<uint32_t>(sid.objectId, INIT_RAW_MAG_X, this);
|
||
lp_var_t<uint32_t> initRawMagY = lp_var_t<uint32_t>(sid.objectId, INIT_RAW_MAG_Y, this);
|
||
lp_var_t<uint32_t> initRawMagZ = lp_var_t<uint32_t>(sid.objectId, INIT_RAW_MAG_Z, this);
|
||
lp_var_t<uint32_t> initCalMagX = lp_var_t<uint32_t>(sid.objectId, INIT_CAL_MAG_X, this);
|
||
lp_var_t<uint32_t> initCalMagY = lp_var_t<uint32_t>(sid.objectId, INIT_CAL_MAG_Y, this);
|
||
lp_var_t<uint32_t> initCalMagZ = lp_var_t<uint32_t>(sid.objectId, INIT_CAL_MAG_Z, this);
|
||
lp_var_t<uint16_t> initCoilXCurrent = lp_var_t<uint16_t>(sid.objectId, INIT_COIL_X_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> initCoilYCurrent = lp_var_t<uint16_t>(sid.objectId, INIT_COIL_Y_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> initCoilZCurrent = lp_var_t<uint16_t>(sid.objectId, INIT_COIL_Z_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> initCoilXTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
INIT_COIL_X_TEMPERATURE, this);
|
||
lp_var_t<uint16_t> initCoilYTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
INIT_COIL_Y_TEMPERATURE, this);
|
||
lp_var_t<uint16_t> initCoilZTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
INIT_COIL_Z_TEMPERATURE, this);
|
||
|
||
/** +X block */
|
||
lp_var_t<uint8_t> posXErr = lp_var_t<uint8_t>(sid.objectId, POS_X_ERR, this);
|
||
lp_var_t<uint32_t> posXRawMagX = lp_var_t<uint32_t>(sid.objectId, POS_X_RAW_MAG_X, this);
|
||
lp_var_t<uint32_t> posXRawMagY = lp_var_t<uint32_t>(sid.objectId, POS_X_RAW_MAG_Y, this);
|
||
lp_var_t<uint32_t> posXRawMagZ = lp_var_t<uint32_t>(sid.objectId, POS_X_RAW_MAG_Z, this);
|
||
lp_var_t<uint32_t> posXCalMagX = lp_var_t<uint32_t>(sid.objectId, POS_X_CAL_MAG_X, this);
|
||
lp_var_t<uint32_t> posXCalMagY = lp_var_t<uint32_t>(sid.objectId, POS_X_CAL_MAG_Y, this);
|
||
lp_var_t<uint32_t> posXCalMagZ = lp_var_t<uint32_t>(sid.objectId, POS_X_CAL_MAG_Z, this);
|
||
lp_var_t<uint16_t> posXCoilXCurrent = lp_var_t<uint16_t>(sid.objectId, POS_X_COIL_X_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> posXCoilYCurrent = lp_var_t<uint16_t>(sid.objectId, POS_X_COIL_Y_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> posXCoilZCurrent = lp_var_t<uint16_t>(sid.objectId, POS_X_COIL_Z_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> posXCoilXTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
POS_X_COIL_X_TEMPERATURE, this);
|
||
lp_var_t<uint16_t> posXCoilYTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
POS_X_COIL_Y_TEMPERATURE, this);
|
||
lp_var_t<uint16_t> posXCoilZTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
POS_X_COIL_Z_TEMPERATURE, this);
|
||
|
||
/** -X block */
|
||
lp_var_t<uint8_t> negXErr = lp_var_t<uint8_t>(sid.objectId, NEG_X_ERR, this);
|
||
lp_var_t<uint32_t> negXRawMagX = lp_var_t<uint32_t>(sid.objectId, NEG_X_RAW_MAG_X, this);
|
||
lp_var_t<uint32_t> negXRawMagY = lp_var_t<uint32_t>(sid.objectId, NEG_X_RAW_MAG_Y, this);
|
||
lp_var_t<uint32_t> negXRawMagZ = lp_var_t<uint32_t>(sid.objectId, NEG_X_RAW_MAG_Z, this);
|
||
lp_var_t<uint32_t> negXCalMagX = lp_var_t<uint32_t>(sid.objectId, NEG_X_CAL_MAG_X, this);
|
||
lp_var_t<uint32_t> negXCalMagY = lp_var_t<uint32_t>(sid.objectId, NEG_X_CAL_MAG_Y, this);
|
||
lp_var_t<uint32_t> negXCalMagZ = lp_var_t<uint32_t>(sid.objectId, NEG_X_CAL_MAG_Z, this);
|
||
lp_var_t<uint16_t> negXCoilXCurrent = lp_var_t<uint16_t>(sid.objectId, NEG_X_COIL_X_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> negXCoilYCurrent = lp_var_t<uint16_t>(sid.objectId, NEG_X_COIL_Y_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> negXCoilZCurrent = lp_var_t<uint16_t>(sid.objectId, NEG_X_COIL_Z_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> negXCoilXTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
NEG_X_COIL_X_TEMPERATURE, this);
|
||
lp_var_t<uint16_t> negXCoilYTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
NEG_X_COIL_Y_TEMPERATURE, this);
|
||
lp_var_t<uint16_t> negXCoilZTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
NEG_X_COIL_Z_TEMPERATURE, this);
|
||
|
||
/** +Y block */
|
||
lp_var_t<uint8_t> posYErr = lp_var_t<uint8_t>(sid.objectId, POS_Y_ERR, this);
|
||
lp_var_t<uint32_t> posYRawMagX = lp_var_t<uint32_t>(sid.objectId, POS_Y_RAW_MAG_X, this);
|
||
lp_var_t<uint32_t> posYRawMagY = lp_var_t<uint32_t>(sid.objectId, POS_Y_RAW_MAG_Y, this);
|
||
lp_var_t<uint32_t> posYRawMagZ = lp_var_t<uint32_t>(sid.objectId, POS_Y_RAW_MAG_Z, this);
|
||
lp_var_t<uint32_t> posYCalMagX = lp_var_t<uint32_t>(sid.objectId, POS_Y_CAL_MAG_X, this);
|
||
lp_var_t<uint32_t> posYCalMagY = lp_var_t<uint32_t>(sid.objectId, POS_Y_CAL_MAG_Y, this);
|
||
lp_var_t<uint32_t> posYCalMagZ = lp_var_t<uint32_t>(sid.objectId, POS_Y_CAL_MAG_Z, this);
|
||
lp_var_t<uint16_t> posYCoilXCurrent = lp_var_t<uint16_t>(sid.objectId, POS_Y_COIL_X_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> posYCoilYCurrent = lp_var_t<uint16_t>(sid.objectId, POS_Y_COIL_Y_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> posYCoilZCurrent = lp_var_t<uint16_t>(sid.objectId, POS_Y_COIL_Z_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> posYCoilXTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
POS_Y_COIL_X_TEMPERATURE, this);
|
||
lp_var_t<uint16_t> posYCoilYTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
POS_Y_COIL_Y_TEMPERATURE, this);
|
||
lp_var_t<uint16_t> posYCoilZTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
POS_Y_COIL_Z_TEMPERATURE, this);
|
||
|
||
/** -Y block */
|
||
lp_var_t<uint8_t> negYErr = lp_var_t<uint8_t>(sid.objectId, NEG_Y_ERR, this);
|
||
lp_var_t<uint32_t> negYRawMagX = lp_var_t<uint32_t>(sid.objectId, NEG_Y_RAW_MAG_X, this);
|
||
lp_var_t<uint32_t> negYRawMagY = lp_var_t<uint32_t>(sid.objectId, NEG_Y_RAW_MAG_Y, this);
|
||
lp_var_t<uint32_t> negYRawMagZ = lp_var_t<uint32_t>(sid.objectId, NEG_Y_RAW_MAG_Z, this);
|
||
lp_var_t<uint32_t> negYCalMagX = lp_var_t<uint32_t>(sid.objectId, NEG_Y_CAL_MAG_X, this);
|
||
lp_var_t<uint32_t> negYCalMagY = lp_var_t<uint32_t>(sid.objectId, NEG_Y_CAL_MAG_Y, this);
|
||
lp_var_t<uint32_t> negYCalMagZ = lp_var_t<uint32_t>(sid.objectId, NEG_Y_CAL_MAG_Z, this);
|
||
lp_var_t<uint16_t> negYCoilXCurrent = lp_var_t<uint16_t>(sid.objectId, NEG_Y_COIL_X_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> negYCoilYCurrent = lp_var_t<uint16_t>(sid.objectId, NEG_Y_COIL_Y_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> negYCoilZCurrent = lp_var_t<uint16_t>(sid.objectId, NEG_Y_COIL_Z_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> negYCoilXTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
NEG_Y_COIL_X_TEMPERATURE, this);
|
||
lp_var_t<uint16_t> negYCoilYTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
NEG_Y_COIL_Y_TEMPERATURE, this);
|
||
lp_var_t<uint16_t> negYCoilZTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
NEG_Y_COIL_Z_TEMPERATURE, this);
|
||
|
||
/** +Z block */
|
||
lp_var_t<uint8_t> posZErr = lp_var_t<uint8_t>(sid.objectId, POS_Z_ERR, this);
|
||
lp_var_t<uint32_t> posZRawMagX = lp_var_t<uint32_t>(sid.objectId, POS_Z_RAW_MAG_X, this);
|
||
lp_var_t<uint32_t> posZRawMagY = lp_var_t<uint32_t>(sid.objectId, POS_Z_RAW_MAG_Y, this);
|
||
lp_var_t<uint32_t> posZRawMagZ = lp_var_t<uint32_t>(sid.objectId, POS_Z_RAW_MAG_Z, this);
|
||
lp_var_t<uint32_t> posZCalMagX = lp_var_t<uint32_t>(sid.objectId, POS_Z_CAL_MAG_X, this);
|
||
lp_var_t<uint32_t> posZCalMagY = lp_var_t<uint32_t>(sid.objectId, POS_Z_CAL_MAG_Y, this);
|
||
lp_var_t<uint32_t> posZCalMagZ = lp_var_t<uint32_t>(sid.objectId, POS_Z_CAL_MAG_Z, this);
|
||
lp_var_t<uint16_t> posZCoilXCurrent = lp_var_t<uint16_t>(sid.objectId, POS_Z_COIL_X_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> posZCoilYCurrent = lp_var_t<uint16_t>(sid.objectId, POS_Z_COIL_Y_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> posZCoilZCurrent = lp_var_t<uint16_t>(sid.objectId, POS_Z_COIL_Z_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> posZCoilXTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
POS_Z_COIL_X_TEMPERATURE, this);
|
||
lp_var_t<uint16_t> posZCoilYTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
POS_Z_COIL_Y_TEMPERATURE, this);
|
||
lp_var_t<uint16_t> posZCoilZTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
POS_Z_COIL_Z_TEMPERATURE, this);
|
||
|
||
/** -Z block */
|
||
lp_var_t<uint8_t> negZErr = lp_var_t<uint8_t>(sid.objectId, NEG_Z_ERR, this);
|
||
lp_var_t<uint32_t> negZRawMagX = lp_var_t<uint32_t>(sid.objectId, NEG_Z_RAW_MAG_X, this);
|
||
lp_var_t<uint32_t> negZRawMagY = lp_var_t<uint32_t>(sid.objectId, NEG_Z_RAW_MAG_Y, this);
|
||
lp_var_t<uint32_t> negZRawMagZ = lp_var_t<uint32_t>(sid.objectId, NEG_Z_RAW_MAG_Z, this);
|
||
lp_var_t<uint32_t> negZCalMagX = lp_var_t<uint32_t>(sid.objectId, NEG_Z_CAL_MAG_X, this);
|
||
lp_var_t<uint32_t> negZCalMagY = lp_var_t<uint32_t>(sid.objectId, NEG_Z_CAL_MAG_Y, this);
|
||
lp_var_t<uint32_t> negZCalMagZ = lp_var_t<uint32_t>(sid.objectId, NEG_Z_CAL_MAG_Z, this);
|
||
lp_var_t<uint16_t> negZCoilXCurrent = lp_var_t<uint16_t>(sid.objectId, NEG_Z_COIL_X_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> negZCoilYCurrent = lp_var_t<uint16_t>(sid.objectId, NEG_Z_COIL_Y_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> negZCoilZCurrent = lp_var_t<uint16_t>(sid.objectId, NEG_Z_COIL_Z_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> negZCoilXTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
NEG_Z_COIL_X_TEMPERATURE, this);
|
||
lp_var_t<uint16_t> negZCoilYTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
NEG_Z_COIL_Y_TEMPERATURE, this);
|
||
lp_var_t<uint16_t> negZCoilZTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
NEG_Z_COIL_Z_TEMPERATURE, this);
|
||
|
||
/** FINA block */
|
||
lp_var_t<uint8_t> finaErr = lp_var_t<uint8_t>(sid.objectId, FINA_ERR, this);
|
||
lp_var_t<uint32_t> finaRawMagX = lp_var_t<uint32_t>(sid.objectId, FINA_RAW_MAG_X, this);
|
||
lp_var_t<uint32_t> finaRawMagY = lp_var_t<uint32_t>(sid.objectId, FINA_RAW_MAG_Y, this);
|
||
lp_var_t<uint32_t> finaRawMagZ = lp_var_t<uint32_t>(sid.objectId, FINA_RAW_MAG_Z, this);
|
||
lp_var_t<uint32_t> finaCalMagX = lp_var_t<uint32_t>(sid.objectId, FINA_CAL_MAG_X, this);
|
||
lp_var_t<uint32_t> finaCalMagY = lp_var_t<uint32_t>(sid.objectId, FINA_CAL_MAG_Y, this);
|
||
lp_var_t<uint32_t> finaCalMagZ = lp_var_t<uint32_t>(sid.objectId, FINA_CAL_MAG_Z, this);
|
||
lp_var_t<uint16_t> finaCoilXCurrent = lp_var_t<uint16_t>(sid.objectId, FINA_COIL_X_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> finaCoilYCurrent = lp_var_t<uint16_t>(sid.objectId, FINA_COIL_Y_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> finaCoilZCurrent = lp_var_t<uint16_t>(sid.objectId, FINA_COIL_Z_CURRENT,
|
||
this);
|
||
lp_var_t<uint16_t> finaCoilXTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
FINA_COIL_X_TEMPERATURE, this);
|
||
lp_var_t<uint16_t> finaCoilYTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
FINA_COIL_Y_TEMPERATURE, this);
|
||
lp_var_t<uint16_t> finaCoilZTemperature = lp_var_t<uint16_t>(sid.objectId,
|
||
FINA_COIL_Z_TEMPERATURE, 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.
|
||
*
|
||
* @details Deserialize the packet, write the deserialized data to the ipc store and store the
|
||
* the ipc store address in the action message.
|
||
*/
|
||
class CommandDipolePacket : public SerialLinkedListAdapter<SerializeIF> {
|
||
public:
|
||
|
||
CommandDipolePacket() {
|
||
setLinks();
|
||
}
|
||
|
||
private:
|
||
|
||
/**
|
||
* @brief Constructor
|
||
*
|
||
* @param xDipole The dipole of the x coil in 10 ^ -4 * Am^2
|
||
* @param yDipole The dipole of the y coil in 10 ^ -4 * Am^2
|
||
* @param zDipole The dipole of the z coil in 10 ^ -4 * Am^2
|
||
* @param duration The duration in milliseconds the dipole will be generated by the coils.
|
||
* When set to 0, the dipole will be generated until a new dipole actuation
|
||
* command is sent.
|
||
*/
|
||
CommandDipolePacket(uint16_t xDipole, uint16_t yDipole, uint16_t zDipole, uint16_t duration) :
|
||
xDipole(xDipole), yDipole(yDipole), zDipole(zDipole), duration(duration) {
|
||
}
|
||
void setLinks() {
|
||
setStart(&xDipole);
|
||
xDipole.setNext(&yDipole);
|
||
yDipole.setNext(&zDipole);
|
||
zDipole.setNext(&duration);
|
||
}
|
||
SerializeElement<uint16_t> xDipole;
|
||
SerializeElement<uint16_t> yDipole;
|
||
SerializeElement<uint16_t> zDipole;
|
||
SerializeElement<uint16_t> duration;
|
||
};
|
||
}
|
||
|
||
|
||
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_IMTQDEFINITIONS_H_ */
|