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

77 lines
2.4 KiB
C
Raw Normal View History

2022-09-23 09:56:32 +02:00
/*
* SusConverter.h
*
* Created on: Sep 22, 2022
* Author: marius
*/
#ifndef MISSION_CONTROLLER_ACS_SUSCONVERTER_H_
#define MISSION_CONTROLLER_ACS_SUSCONVERTER_H_
2022-09-27 11:06:11 +02:00
#include "AcsParameters.h"
2022-09-23 09:56:32 +02:00
#include <stdint.h>
class SunSensor {
public:
SunSensor() {}
2022-09-27 11:06:11 +02:00
void checkSunSensorData(uint8_t susNumber);
void calcAngle(uint8_t susNumber);
void setCalibrationCoefficients(uint8_t susNumber);
void Calibration(uint8_t susNumber);
void CalculateSunVector(uint8_t susNumber);
2022-09-23 09:56:32 +02:00
2022-09-27 11:06:11 +02:00
bool getValidFlag(uint8_t susNumber);
2022-09-27 11:57:15 +02:00
float* getSunVectorBodyFrame(uint8_t susNumber);
2022-09-23 14:27:05 +02:00
float* TransferSunVector();
2022-09-23 09:56:32 +02:00
private:
2022-09-27 11:57:15 +02:00
// ToDo: remove statics and replace with actual data
uint16_t susChannelValues[12][4] = {
{3913, 3912, 3799, 4056},
{3913, 3912, 3799, 4056},
{3913, 3912, 3799, 4056},
{3913, 3912, 3799, 4056},
{3913, 3912, 3799, 4056},
{3913, 3912, 3799, 4056},
{3913, 3912, 3799, 4056},
{3913, 3912, 3799, 4056},
{3913, 3912, 3799, 4056},
{3913, 3912, 3799, 4056},
{3913, 3912, 3799, 4056},
{3913, 3912, 3799, 4056}}; //[Bit]
2022-09-27 11:06:11 +02:00
float alphaBetaRaw[12][2]; //[°]
float alphaBetaCalibrated[12][2]; //[°]
float sunVectorBodyFrame[12][3]; //[-]
2022-09-23 09:56:32 +02:00
2022-09-27 11:57:15 +02:00
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};
2022-09-23 09:56:32 +02:00
2022-09-27 11:06:11 +02:00
uint16_t channelValueCheckHigh =
2022-09-23 09:56:32 +02:00
4096; //=2^12[Bit]high borderline for the channel values of one sun sensor for validity Check
2022-09-27 11:06:11 +02:00
uint8_t channelValueCheckLow =
2022-09-23 09:56:32 +02:00
0; //[Bit]low borderline for the channel values of one sun sensor for validity Check
2022-09-27 11:06:11 +02:00
uint16_t channelValueSumHigh =
2022-09-23 09:56:32 +02:00
100; // 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
2022-09-27 11:06:11 +02:00
uint8_t channelValueSumLow =
2022-09-23 09:56:32 +02:00
0; //[Bit]low borderline for check if the sun sensor is illuminated
// by the sun or by the reflection of sunlight from the moon/earth
2022-09-27 11:06:11 +02:00
uint8_t completeCellWidth = 140,
halfCellWidth = 70; //[°] Width of the calibration cells --> necessary for checking in
2022-09-23 09:56:32 +02:00
// which cell a data point should be
2022-09-27 11:06:11 +02:00
float coeffAlpha[12][9][10];
float coeffBeta[12][9][10];
2022-09-23 09:56:32 +02:00
AcsParameters acsParameters;
};
#endif /* MISSION_CONTROLLER_ACS_SUSCONVERTER_H_ */