2022-09-19 15:44:14 +02:00
|
|
|
#ifndef SENSORPROCESSING_H_
|
|
|
|
#define SENSORPROCESSING_H_
|
|
|
|
|
2023-08-07 16:44:03 +02:00
|
|
|
#include <common/config/eive/resultClassIds.h>
|
2023-08-14 10:15:33 +02:00
|
|
|
#include <fsfw/datapool/PoolReadGuard.h>
|
|
|
|
#include <fsfw/globalfunctions/constants.h>
|
|
|
|
#include <fsfw/globalfunctions/math/MatrixOperations.h>
|
|
|
|
#include <fsfw/globalfunctions/math/QuaternionOperations.h>
|
|
|
|
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
|
|
|
#include <fsfw/globalfunctions/timevalOperations.h>
|
2022-10-06 15:38:23 +02:00
|
|
|
#include <fsfw/returnvalues/returnvalue.h>
|
2023-08-07 16:44:03 +02:00
|
|
|
#include <mission/acs/defs.h>
|
|
|
|
#include <mission/controller/acs/AcsParameters.h>
|
2023-08-14 10:15:33 +02:00
|
|
|
#include <mission/controller/acs/Igrf13Model.h>
|
2023-08-07 16:44:03 +02:00
|
|
|
#include <mission/controller/acs/SensorValues.h>
|
|
|
|
#include <mission/controller/acs/SusConverter.h>
|
2023-08-14 10:15:33 +02:00
|
|
|
#include <mission/controller/acs/util/MathOperations.h>
|
2023-08-07 16:44:03 +02:00
|
|
|
#include <mission/controller/controllerdefinitions/AcsCtrlDefinitions.h>
|
2022-09-19 15:44:14 +02:00
|
|
|
|
2023-08-14 10:15:33 +02:00
|
|
|
#include <cmath>
|
2022-09-19 15:44:14 +02:00
|
|
|
|
2022-10-06 15:38:23 +02:00
|
|
|
class SensorProcessing {
|
|
|
|
public:
|
2023-02-27 16:38:59 +01:00
|
|
|
SensorProcessing();
|
2022-10-06 15:38:23 +02:00
|
|
|
virtual ~SensorProcessing();
|
|
|
|
|
2023-10-16 13:26:56 +02:00
|
|
|
void process(timeval timeAbsolute, double timeDelta, ACS::SensorValues *sensorValues,
|
2022-10-26 17:13:23 +02:00
|
|
|
acsctrl::MgmDataProcessed *mgmDataProcessed,
|
|
|
|
acsctrl::SusDataProcessed *susDataProcessed,
|
|
|
|
acsctrl::GyrDataProcessed *gyrDataProcessed,
|
2023-10-16 11:38:07 +02:00
|
|
|
acsctrl::GpsDataProcessed *gpsDataProcessed, const AcsParameters *acsParameters);
|
|
|
|
|
2022-10-06 15:38:23 +02:00
|
|
|
private:
|
2023-06-15 18:16:24 +02:00
|
|
|
static constexpr float ZERO_VEC_F[3] = {0, 0, 0};
|
2023-06-15 20:07:33 +02:00
|
|
|
static constexpr double ZERO_VEC_D[3] = {0, 0, 0};
|
2023-08-07 16:44:03 +02:00
|
|
|
static constexpr double ECCENTRICITY_WGS84 = 0.0818195;
|
2023-06-15 18:16:24 +02:00
|
|
|
|
2022-10-06 15:38:23 +02:00
|
|
|
protected:
|
2022-10-26 17:13:23 +02:00
|
|
|
void processMgm(const float *mgm0Value, bool mgm0valid, const float *mgm1Value, bool mgm1valid,
|
2022-10-06 15:38:23 +02:00
|
|
|
const float *mgm2Value, bool mgm2valid, const float *mgm3Value, bool mgm3valid,
|
2023-10-16 11:38:07 +02:00
|
|
|
const float *mgm4Value, bool mgm4valid, timeval timeAbsolute, double timeDelta,
|
2022-10-06 15:38:23 +02:00
|
|
|
const AcsParameters::MgmHandlingParameters *mgmParameters,
|
2023-08-09 10:46:43 +02:00
|
|
|
acsctrl::GpsDataProcessed *gpsDataProcessed,
|
|
|
|
acsctrl::MgmDataProcessed *mgmDataProcessed);
|
2022-10-06 15:38:23 +02:00
|
|
|
|
2022-10-10 16:02:57 +02:00
|
|
|
void processSus(const uint16_t *sus0Value, bool sus0valid, const uint16_t *sus1Value,
|
|
|
|
bool sus1valid, const uint16_t *sus2Value, bool sus2valid,
|
|
|
|
const uint16_t *sus3Value, bool sus3valid, const uint16_t *sus4Value,
|
|
|
|
bool sus4valid, const uint16_t *sus5Value, bool sus5valid,
|
|
|
|
const uint16_t *sus6Value, bool sus6valid, const uint16_t *sus7Value,
|
|
|
|
bool sus7valid, const uint16_t *sus8Value, bool sus8valid,
|
|
|
|
const uint16_t *sus9Value, bool sus9valid, const uint16_t *sus10Value,
|
|
|
|
bool sus10valid, const uint16_t *sus11Value, bool sus11valid,
|
2023-10-16 11:38:07 +02:00
|
|
|
timeval timeAbsolute, double timeDelta,
|
2022-10-06 15:38:23 +02:00
|
|
|
const AcsParameters::SusHandlingParameters *susParameters,
|
2022-10-26 17:13:23 +02:00
|
|
|
const AcsParameters::SunModelParameters *sunModelParameters,
|
|
|
|
acsctrl::SusDataProcessed *susDataProcessed);
|
2022-10-06 15:38:23 +02:00
|
|
|
|
2022-10-11 15:01:32 +02:00
|
|
|
void processGyr(const double gyr0axXvalue, bool gyr0axXvalid, const double gyr0axYvalue,
|
|
|
|
bool gyr0axYvalid, const double gyr0axZvalue, bool gyr0axZvalid,
|
|
|
|
const double gyr1axXvalue, bool gyr1axXvalid, const double gyr1axYvalue,
|
|
|
|
bool gyr1axYvalid, const double gyr1axZvalue, bool gyr1axZvalid,
|
|
|
|
const double gyr2axXvalue, bool gyr2axXvalid, const double gyr2axYvalue,
|
|
|
|
bool gyr2axYvalid, const double gyr2axZvalue, bool gyr2axZvalid,
|
|
|
|
const double gyr3axXvalue, bool gyr3axXvalid, const double gyr3axYvalue,
|
|
|
|
bool gyr3axYvalid, const double gyr3axZvalue, bool gyr3axZvalid,
|
2022-10-26 17:13:23 +02:00
|
|
|
const AcsParameters::GyrHandlingParameters *gyrParameters,
|
|
|
|
acsctrl::GyrDataProcessed *gyrDataProcessed);
|
2022-10-06 15:38:23 +02:00
|
|
|
|
2022-12-14 10:04:37 +01:00
|
|
|
void processGps(const double gpsLatitude, const double gpsLongitude, const double gpsAltitude,
|
|
|
|
const double gpsUnixSeconds, const bool validGps,
|
|
|
|
const AcsParameters::GpsParameters *gpsParameters,
|
2022-10-26 17:13:23 +02:00
|
|
|
acsctrl::GpsDataProcessed *gpsDataProcessed);
|
2022-10-06 15:38:23 +02:00
|
|
|
|
2023-04-05 11:25:44 +02:00
|
|
|
void lowPassFilter(double *newValue, double *oldValue, const double weight);
|
|
|
|
|
2022-12-14 10:31:20 +01:00
|
|
|
double savedMgmVecTot[3] = {0.0, 0.0, 0.0};
|
|
|
|
double savedSusVecTot[3] = {0.0, 0.0, 0.0};
|
2022-10-06 15:38:23 +02:00
|
|
|
|
2022-12-14 10:31:20 +01:00
|
|
|
double savedPosSatE[3] = {0.0, 0.0, 0.0};
|
|
|
|
bool validSavedPosSatE = false;
|
2022-10-21 14:23:31 +02:00
|
|
|
|
2022-10-06 15:38:23 +02:00
|
|
|
SusConverter susConverter;
|
2022-09-19 15:44:14 +02:00
|
|
|
};
|
|
|
|
|
2022-09-27 11:57:15 +02:00
|
|
|
#endif /*SENSORPROCESSING_H_*/
|