eive-obsw/mission/controller/acs/SusConverter.h

51 lines
2.0 KiB
C
Raw Normal View History

2022-09-23 09:56:32 +02:00
#ifndef MISSION_CONTROLLER_ACS_SUSCONVERTER_H_
#define MISSION_CONTROLLER_ACS_SUSCONVERTER_H_
#include <fsfw/datapoollocal/LocalPoolVector.h>
2022-09-23 09:56:32 +02:00
#include <stdint.h>
#include "AcsParameters.h"
class SusConverter {
2022-09-23 09:56:32 +02:00
public:
SusConverter() {}
bool checkSunSensorData(const uint16_t susChannel[6]);
2022-09-23 09:56:32 +02:00
void calcAngle(const uint16_t susChannel[6]);
void calibration(const float coeffAlpha[9][10], const float coeffBeta[9][10]);
float* calculateSunVector();
2022-09-23 09:56:32 +02:00
float* getSunVectorSensorFrame(const uint16_t susChannel[6], const float coeffAlpha[9][10],
const float coeffBeta[9][10]);
2022-09-23 09:56:32 +02:00
private:
2022-12-01 15:56:55 +01:00
float alphaBetaRaw[2]; //[°]
float alphaBetaCalibrated[2]; //[°]
float sunVectorSensorFrame[3]; //[-]
bool validFlag[12] = {returnvalue::OK, returnvalue::OK, returnvalue::OK, returnvalue::OK,
returnvalue::OK, returnvalue::OK, returnvalue::OK, returnvalue::OK,
returnvalue::OK, returnvalue::OK, returnvalue::OK, returnvalue::OK};
static const uint8_t GNDREF = 4;
2023-06-16 21:16:39 +02:00
// =2^12[Bit]high borderline for the channel values of one sun sensor for validity Check
static constexpr uint16_t SUS_CHANNEL_VALUE_HIGH = 4096;
// [Bit]low borderline for the channel values of one sun sensor for validity Check
static constexpr uint8_t SUS_CHANNEL_VALUE_LOW = 0;
// 4096[Bit]high borderline for check if the sun sensor is illuminated by the sun or by the
// reflection of sunlight from the moon/earth
static constexpr uint16_t SUS_CHANNEL_SUM_HIGH = 100;
// [Bit]low borderline for check if the sun sensor is illuminated by the sun or by the reflection
// of sunlight from the moon/earth
static constexpr uint8_t SUS_CHANNEL_SUM_LOW = 0;
// [°] Width of the calibration cells --> necessary for checking in
// which cell a data point should be
static const uint8_t completeCellWidth = 140, halfCellWidth = 70;
uint16_t susChannelValueSum = 0;
2022-09-23 09:56:32 +02:00
AcsParameters acsParameters;
};
#endif /* MISSION_CONTROLLER_ACS_SUSCONVERTER_H_ */