fixed calculation of sun vector
Some checks are pending
EIVE/eive-obsw/pipeline/head Build started...
EIVE/eive-obsw/pipeline/pr-v3.1.1-reduced-to-bare-minimum This commit looks good

This commit is contained in:
2023-06-19 16:33:04 +02:00
parent b2a666d432
commit 4b0062e3b2
3 changed files with 139 additions and 263 deletions

View File

@ -1,8 +1,4 @@
#ifndef MISSION_CONTROLLER_ACS_SUSCONVERTER_H_
#define MISSION_CONTROLLER_ACS_SUSCONVERTER_H_
#include <fsfw/datapoollocal/LocalPoolVector.h>
#include <stdint.h>
#include <fsfw/globalfunctions/math/VectorOperations.h>
#include "AcsParameters.h"
@ -10,24 +6,11 @@ class SusConverter {
public:
SusConverter() {}
bool checkSunSensorData(const uint16_t susChannel[6]);
void calcAngle(const uint16_t susChannel[6]);
void calibration(const float coeffAlpha[9][10], const float coeffBeta[9][10]);
float* calculateSunVector();
float* getSunVectorSensorFrame(const uint16_t susChannel[6], const float coeffAlpha[9][10],
const float coeffBeta[9][10]);
uint64_t checkSunSensorData(const uint16_t susChannel[6]);
bool checkValidity(bool* susValid, const uint64_t brightness[12], const float threshold);
void calculateSunVector(float* sunVectorSensorFrame, const uint16_t susChannel[6]);
private:
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;
// =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;
@ -35,16 +18,14 @@ class SusConverter {
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;
static constexpr uint16_t SUS_ALBEDO_CHECK = 1000;
// [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;
static constexpr float S = 0.03; // S=[mm] gap between diodes
static constexpr float D = 5; // D=[mm] edge length of the quadratic aperture
static constexpr float H = 1; // H=[mm] distance between diodes and aperture
AcsParameters acsParameters;
};
#endif /* MISSION_CONTROLLER_ACS_SUSCONVERTER_H_ */