First Version of ACS Controller #329
@ -6,14 +6,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <ActuatorCmd.h>
|
#include "ActuatorCmd.h"
|
||||||
|
#include "util/MathOperations.h"
|
||||||
|
#include "util/CholeskyDecomposition.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <acs/util/MathOperations.h>
|
|
||||||
#include <fsfw/globalfunctions/constants.h>
|
#include <fsfw/globalfunctions/constants.h>
|
||||||
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
||||||
#include <fsfw/globalfunctions/math/MatrixOperations.h>
|
#include <fsfw/globalfunctions/math/MatrixOperations.h>
|
||||||
#include <fsfw/globalfunctions/math/QuaternionOperations.h>
|
#include <fsfw/globalfunctions/math/QuaternionOperations.h>
|
||||||
#include <util/CholeskyDecomposition.h>
|
|
||||||
|
|
||||||
ActuatorCmd::ActuatorCmd(AcsParameters *acsParameters_) {
|
ActuatorCmd::ActuatorCmd(AcsParameters *acsParameters_) {
|
||||||
acsParameters = *acsParameters_;
|
acsParameters = *acsParameters_;
|
||||||
|
@ -9,11 +9,11 @@
|
|||||||
#define ACTUATORCMD_H_
|
#define ACTUATORCMD_H_
|
||||||
|
|
||||||
|
|
||||||
#include <AcsParameters.h>
|
#include "AcsParameters.h"
|
||||||
#include <SensorProcessing.h>
|
#include "SensorProcessing.h"
|
||||||
#include <MultiplicativeKalmanFilter.h>
|
#include "MultiplicativeKalmanFilter.h"
|
||||||
#include <SensorValues.h>
|
#include "SensorValues.h"
|
||||||
#include <OutputValues.h>
|
#include "OutputValues.h"
|
||||||
|
|
||||||
class ActuatorCmd{
|
class ActuatorCmd{
|
||||||
public:
|
public:
|
||||||
|
@ -8,12 +8,12 @@
|
|||||||
|
|
||||||
#include "Guidance.h"
|
#include "Guidance.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
#include "util/MathOperations.h"
|
||||||
|
#include "util/CholeskyDecomposition.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <acs/util/MathOperations.h>
|
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
||||||
#include <fsfw/src/fsfw/globalfunctions/math/VectorOperations.h>
|
#include <fsfw/globalfunctions/math/MatrixOperations.h>
|
||||||
#include <fsfw/src/fsfw/globalfunctions/math/MatrixOperations.h>
|
#include <fsfw/globalfunctions/math/QuaternionOperations.h>
|
||||||
#include <fsfw/src/fsfw/globalfunctions/math/QuaternionOperations.h>
|
|
||||||
#include <acs/util/CholeskyDecomposition.h>
|
|
||||||
|
|
||||||
Guidance::Guidance(AcsParameters *acsParameters_) {
|
Guidance::Guidance(AcsParameters *acsParameters_) {
|
||||||
acsParameters = *acsParameters_;
|
acsParameters = *acsParameters_;
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
#define GUIDANCE_H_
|
#define GUIDANCE_H_
|
||||||
|
|
||||||
|
|
||||||
#include <AcsParameters.h>
|
#include "AcsParameters.h"
|
||||||
#include <SensorValues.h>
|
#include "SensorValues.h"
|
||||||
#include <OutputValues.h>
|
#include "OutputValues.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,15 +6,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Igrf13Model.h"
|
#include "Igrf13Model.h"
|
||||||
|
#include "util/MathOperations.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
//#include <time.h>
|
//#include <time.h>
|
||||||
#include <fsfw/src/fsfw/globalfunctions/constants.h>
|
#include <fsfw/globalfunctions/constants.h>
|
||||||
#include <fsfw/src/fsfw/globalfunctions/math/MatrixOperations.h>
|
#include <fsfw/globalfunctions/math/MatrixOperations.h>
|
||||||
#include <fsfw/src/fsfw/globalfunctions/math/QuaternionOperations.h>
|
#include <fsfw/globalfunctions/math/QuaternionOperations.h>
|
||||||
#include <fsfw/src/fsfw/globalfunctions/math/VectorOperations.h>
|
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
||||||
#include <acs/util/MathOperations.h>
|
|
||||||
|
|
||||||
|
|
||||||
Igrf13Model::Igrf13Model(){
|
Igrf13Model::Igrf13Model(){
|
||||||
|
@ -16,11 +16,11 @@
|
|||||||
#ifndef IGRF13MODEL_H_
|
#ifndef IGRF13MODEL_H_
|
||||||
#define IGRF13MODEL_H_
|
#define IGRF13MODEL_H_
|
||||||
|
|
||||||
#include <fsfw/parameters/HasParametersIF.h>
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <fsfw/parameters/HasParametersIF.h>
|
||||||
|
|
||||||
|
|
||||||
// Output should be transformed to [T] instead of [nT]
|
// Output should be transformed to [T] instead of [nT]
|
||||||
|
@ -5,14 +5,14 @@
|
|||||||
* Author: rooob
|
* Author: rooob
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "MultiplicativeKalmanFilter.h"
|
||||||
|
#include "util/CholeskyDecomposition.h"
|
||||||
|
#include "util/MathOperations.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <fsfw/src/fsfw/globalfunctions/math/MatrixOperations.h>
|
#include <fsfw/globalfunctions/math/MatrixOperations.h>
|
||||||
#include <fsfw/src/fsfw/globalfunctions/math/QuaternionOperations.h>
|
#include <fsfw/globalfunctions/math/QuaternionOperations.h>
|
||||||
#include <fsfw/src/fsfw/globalfunctions/math/VectorOperations.h>
|
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
||||||
#include "MultiplicativeKalmanFilter.h"
|
|
||||||
#include <acs/util/CholeskyDecomposition.h>
|
|
||||||
#include <acs/util/MathOperations.h>
|
|
||||||
|
|
||||||
/*Initialisation of values for parameters in constructor*/
|
/*Initialisation of values for parameters in constructor*/
|
||||||
MultiplicativeKalmanFilter::MultiplicativeKalmanFilter(AcsParameters *acsParameters_) :
|
MultiplicativeKalmanFilter::MultiplicativeKalmanFilter(AcsParameters *acsParameters_) :
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
#ifndef MULTIPLICATIVEKALMANFILTER_H_
|
#ifndef MULTIPLICATIVEKALMANFILTER_H_
|
||||||
#define MULTIPLICATIVEKALMANFILTER_H_
|
#define MULTIPLICATIVEKALMANFILTER_H_
|
||||||
|
|
||||||
|
#include "config/classIds.h"
|
||||||
#include <stdint.h> //uint8_t
|
#include <stdint.h> //uint8_t
|
||||||
#include <time.h> /*purpose, timeval ?*/
|
#include <time.h> /*purpose, timeval ?*/
|
||||||
#include "acs/config/classIds.h"
|
|
||||||
//#include <_timeval.h>
|
//#include <_timeval.h>
|
||||||
|
|
||||||
#include "AcsParameters.h"
|
#include "AcsParameters.h"
|
||||||
|
@ -6,12 +6,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Navigation.h"
|
#include "Navigation.h"
|
||||||
|
#include "util/MathOperations.h"
|
||||||
|
#include "util/CholeskyDecomposition.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <acs/util/MathOperations.h>
|
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
||||||
#include <fsfw/src/fsfw/globalfunctions/math/VectorOperations.h>
|
#include <fsfw/globalfunctions/math/MatrixOperations.h>
|
||||||
#include <fsfw/src/fsfw/globalfunctions/math/MatrixOperations.h>
|
#include <fsfw/globalfunctions/math/QuaternionOperations.h>
|
||||||
#include <fsfw/src/fsfw/globalfunctions/math/QuaternionOperations.h>
|
|
||||||
#include <acs/util/CholeskyDecomposition.h>
|
|
||||||
|
|
||||||
Navigation::Navigation(AcsParameters *acsParameters_): multiplicativeKalmanFilter(acsParameters_){
|
Navigation::Navigation(AcsParameters *acsParameters_): multiplicativeKalmanFilter(acsParameters_){
|
||||||
acsParameters = *acsParameters_;
|
acsParameters = *acsParameters_;
|
||||||
|
@ -9,11 +9,11 @@
|
|||||||
#define NAVIGATION_H_
|
#define NAVIGATION_H_
|
||||||
|
|
||||||
|
|
||||||
#include <AcsParameters.h>
|
#include "AcsParameters.h"
|
||||||
#include <SensorProcessing.h>
|
#include "SensorProcessing.h"
|
||||||
#include <MultiplicativeKalmanFilter.h>
|
#include "MultiplicativeKalmanFilter.h"
|
||||||
#include <SensorValues.h>
|
#include "SensorValues.h"
|
||||||
#include <OutputValues.h>
|
#include "OutputValues.h"
|
||||||
|
|
||||||
class Navigation{
|
class Navigation{
|
||||||
public:
|
public:
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Created on: 30 Mar 2022
|
* Created on: 30 Mar 2022
|
||||||
* Author: rooob
|
* Author: rooob
|
||||||
*/
|
*/
|
||||||
#include <OutputValues.h>
|
#include "OutputValues.h"
|
||||||
|
|
||||||
namespace ACS {
|
namespace ACS {
|
||||||
|
|
||||||
|
@ -6,14 +6,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SensorProcessing.h"
|
#include "SensorProcessing.h"
|
||||||
|
#include "Igrf13Model.h"
|
||||||
|
#include "util/MathOperations.h"
|
||||||
|
#include <math.h>
|
||||||
#include <fsfw/globalfunctions/constants.h>
|
#include <fsfw/globalfunctions/constants.h>
|
||||||
#include <fsfw/globalfunctions/math/MatrixOperations.h>
|
#include <fsfw/globalfunctions/math/MatrixOperations.h>
|
||||||
#include <fsfw/globalfunctions/math/QuaternionOperations.h>
|
#include <fsfw/globalfunctions/math/QuaternionOperations.h>
|
||||||
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
||||||
#include <fsfw/globalfunctions/timevalOperations.h>
|
#include <fsfw/globalfunctions/timevalOperations.h>
|
||||||
#include <util/MathOperations.h>
|
|
||||||
#include <Igrf13Model.h>
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
using namespace Math;
|
using namespace Math;
|
||||||
// Thought: Maybe separate file for transforming of sensor values
|
// Thought: Maybe separate file for transforming of sensor values
|
||||||
|
@ -5,13 +5,14 @@
|
|||||||
#ifndef SENSORPROCESSING_H_
|
#ifndef SENSORPROCESSING_H_
|
||||||
#define SENSORPROCESSING_H_
|
#define SENSORPROCESSING_H_
|
||||||
|
|
||||||
|
#include "AcsParameters.h"
|
||||||
|
#include "SensorValues.h"
|
||||||
|
#include "OutputValues.h"
|
||||||
|
#include "config/classIds.h"
|
||||||
#include <stdint.h> //uint8_t
|
#include <stdint.h> //uint8_t
|
||||||
#include <time.h> /*purpose, timeval ?*/
|
#include <time.h> /*purpose, timeval ?*/
|
||||||
#include <config/classIds.h>
|
#include <fsfw/returnvalues/returnvalue.h>
|
||||||
#include <fsfw/src/fsfw/returnvalues/returnvalue.h>
|
|
||||||
#include <AcsParameters.h>
|
|
||||||
#include <SensorValues.h>
|
|
||||||
#include <OutputValues.h>
|
|
||||||
|
|
||||||
/*Planned:
|
/*Planned:
|
||||||
* - Fusion of Sensor Measurements -
|
* - Fusion of Sensor Measurements -
|
||||||
|
@ -4,11 +4,10 @@
|
|||||||
* Created on: 30 Mar 2022
|
* Created on: 30 Mar 2022
|
||||||
* Author: rooob
|
* Author: rooob
|
||||||
*/
|
*/
|
||||||
#include <SensorValues.h>
|
#include "SensorValues.h"
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <fsfw/src/fsfw/datapoollocal/LocalPoolVariable.h>
|
#include <fsfw/datapoollocal/LocalPoolVariable.h>
|
||||||
|
|
||||||
namespace ACS {
|
namespace ACS {
|
||||||
|
|
||||||
|
@ -5,13 +5,15 @@
|
|||||||
* Author: Timon Schwarz
|
* Author: Timon Schwarz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "SusConverter.h"
|
||||||
#include <math.h> //for atan2
|
#include <math.h> //for atan2
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <SusConverter.h>
|
|
||||||
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
||||||
|
#include <fsfw/datapoollocal/LocalPoolVariable.h>
|
||||||
|
#include <fsfw/datapoollocal/LocalPoolVector.h>
|
||||||
|
|
||||||
void SunSensor::setSunSensorData() {
|
void SunSensor::setSunSensorData() {
|
||||||
// Creates dummy sensordata, replace with SUS devicehandler / channel readout
|
// ToDo: exchange dummy values with DataPool
|
||||||
susChannelValues[0] = {3913, 3912, 3799, 4056};
|
susChannelValues[0] = {3913, 3912, 3799, 4056};
|
||||||
susChannelValues[1] = {3913, 3912, 3799, 4056};
|
susChannelValues[1] = {3913, 3912, 3799, 4056};
|
||||||
susChannelValues[2] = {3913, 3912, 3799, 4056};
|
susChannelValues[2] = {3913, 3912, 3799, 4056};
|
||||||
@ -26,71 +28,73 @@ void SunSensor::setSunSensorData() {
|
|||||||
susChannelValues[11] = {3913, 3912, 3799, 4056};
|
susChannelValues[11] = {3913, 3912, 3799, 4056};
|
||||||
}
|
}
|
||||||
|
|
||||||
void SunSensor::checkSunSensorData(uint8_t Sensornumber) {
|
void SunSensor::checkSunSensorData(uint8_t susNumber) {
|
||||||
uint16_t ChannelValueSum;
|
uint16_t channelValueSum;
|
||||||
|
|
||||||
// Check individual channel values
|
// Check individual channel values
|
||||||
for (int k = 0; k < 4; k++) { // iteration above all photodiode quarters
|
for (int k = 0; k < 4; k++) { // iteration above all photodiode quarters
|
||||||
|
|
||||||
if (susChannelValues[Sensornumber][k] <= ChannelValueCheckLow ||
|
if (susChannelValues[susNumber][k] <= channelValueCheckLow ||
|
||||||
susChannelValues[Sensornumber][k] > ChannelValueCheckHigh) { // Channel values out of range for 12 bit SUS
|
susChannelValues[susNumber][k] > channelValueCheckHigh) { // Channel values out of range for 12 bit SUS
|
||||||
// channel measurement range?
|
// channel measurement range?
|
||||||
ValidityNumber[Sensornumber] = false; // false --> Data not valid
|
validFlag[susNumber] = returnvalue::FAILED;
|
||||||
/*printf(
|
/*printf(
|
||||||
"The value of channel %i from sun sensor %i is not inside the borders of valid data with "
|
"The value of channel %i from sun sensor %i is not inside the borders of valid data with "
|
||||||
"a value of %i \n",
|
"a value of %i \n",
|
||||||
k, Sensornumber, ChannelValue[k]);*/
|
k, susNumber, ChannelValue[k]);*/
|
||||||
} else if (susChannelValues[Sensornumber][k] >
|
} else if (susChannelValues[susNumber][k] >
|
||||||
susChannelValues[Sensornumber][4]) { // Channel values higher than zero current threshold GNDREF?
|
susChannelValues[susNumber][4]) { // Channel values higher than zero current threshold GNDREF?
|
||||||
ValidityNumber[Sensornumber] = false;
|
validFlag[susNumber] = returnvalue::FAILED;
|
||||||
/*printf(
|
/*printf(
|
||||||
"The value of channel %i from sun sensor %i is higher than the zero current threshold "
|
"The value of channel %i from sun sensor %i is higher than the zero current threshold "
|
||||||
"GNDREF\n",
|
"GNDREF\n",
|
||||||
k, Sensornumber);*/
|
k, susNumber);*/
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// check sum of all channel values to check if sun sensor is illuminated by the sun (sum is
|
// check sum of all channel values to check if sun sensor is illuminated by the sun (sum is
|
||||||
// smaller than a treshold --> sun sensor is not illuminated by the sun, but by the moon
|
// smaller than a treshold --> sun sensor is not illuminated by the sun, but by the moon
|
||||||
// reflection or earth albedo)
|
// reflection or earth albedo)
|
||||||
ChannelValueSum =
|
channelValueSum =
|
||||||
4 * susChannelValues[Sensornumber][4] - (susChannelValues[Sensornumber][0] +
|
4 * susChannelValues[susNumber][4] - (susChannelValues[susNumber][0] +
|
||||||
susChannelValues[Sensornumber][1] + susChannelValues[Sensornumber][2] +
|
susChannelValues[susNumber][1] + susChannelValues[susNumber][2] +
|
||||||
susChannelValues[Sensornumber][3]);
|
susChannelValues[susNumber][3]);
|
||||||
if ((ChannelValueSum < ChannelValueSumHigh) && (ChannelValueSum > ChannelValueSumLow)) {
|
if ((channelValueSum < channelValueSumHigh) && (channelValueSum > channelValueSumLow)) {
|
||||||
ValidityNumber[Sensornumber] = false;
|
validFlag[susNumber] = returnvalue::FAILED;
|
||||||
//printf("Sun sensor %i is not illuminated by the sun\n", Sensornumber);
|
//printf("Sun sensor %i is not illuminated by the sun\n", susNumber);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void SunSensor::AngleCalculation(uint8_t Sensornumber) {
|
void SunSensor::calcAngle(uint8_t susNumber) {
|
||||||
float xout, yout, s = 0.03; // s=[mm]
|
float xout, yout;
|
||||||
uint8_t d = 5, h = 1; // d=[mm] h=[mm]
|
float s = 0.03; // s=[mm] gap between diodes
|
||||||
|
uint8_t d = 5; // d=[mm] edge length of the quadratic aperture
|
||||||
|
uint8_t h = 1; // h=[mm] distance between diodes and aperture
|
||||||
int ch0, ch1, ch2, ch3;
|
int ch0, ch1, ch2, ch3;
|
||||||
// Substract measurement values from GNDREF zero current threshold
|
// Substract measurement values from GNDREF zero current threshold
|
||||||
ch0 = susChannelValues[Sensornumber][4] - susChannelValues[Sensornumber][0];
|
ch0 = susChannelValues[susNumber][4] - susChannelValues[susNumber][0];
|
||||||
ch1 = susChannelValues[Sensornumber][4] - susChannelValues[Sensornumber][1];
|
ch1 = susChannelValues[susNumber][4] - susChannelValues[susNumber][1];
|
||||||
ch2 = susChannelValues[Sensornumber][4] - susChannelValues[Sensornumber][2];
|
ch2 = susChannelValues[susNumber][4] - susChannelValues[susNumber][2];
|
||||||
ch3 = susChannelValues[Sensornumber][4] - susChannelValues[Sensornumber][3];
|
ch3 = susChannelValues[susNumber][4] - susChannelValues[susNumber][3];
|
||||||
|
|
||||||
// Calculation of x and y
|
// Calculation of x and y
|
||||||
xout = ((d - s) / 2) * (ch2 - ch3 - ch0 + ch1) / (ch0 + ch1 + ch2 + ch3); //[mm]
|
xout = ((d - s) / 2) * (ch2 - ch3 - ch0 + ch1) / (ch0 + ch1 + ch2 + ch3); //[mm]
|
||||||
yout = ((d - s) / 2) * (ch2 + ch3 - ch0 - ch1) / (ch0 + ch1 + ch2 + ch3); //[mm]
|
yout = ((d - s) / 2) * (ch2 + ch3 - ch0 - ch1) / (ch0 + ch1 + ch2 + ch3); //[mm]
|
||||||
|
|
||||||
// Calculation of the angles
|
// Calculation of the angles
|
||||||
AlphaBetaRaw[Sensornumber][0] = atan2(xout, h) * (180 / M_PI); //[°]
|
alphaBetaRaw[susNumber][0] = atan2(xout, h) * (180 / M_PI); //[°]
|
||||||
AlphaBetaRaw[Sensornumber][1] = atan2(yout, h) * (180 / M_PI); //[°]
|
alphaBetaRaw[susNumber][1] = atan2(yout, h) * (180 / M_PI); //[°]
|
||||||
}
|
}
|
||||||
|
|
||||||
void SunSensor::setCalibrationCoefficients(uint8_t Sensornumber) {
|
void SunSensor::setCalibrationCoefficients(uint8_t susNumber) {
|
||||||
switch (Sensornumber) { // search for the correct calibration coefficients for each SUS
|
switch (susNumber) { // search for the correct calibration coefficients for each SUS
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
for (uint8_t row = 0; row < 9;
|
for (uint8_t row = 0; row < 9;
|
||||||
row++) { // save the correct coefficients in the right SUS class
|
row++) { // save the correct coefficients in the right SUS class
|
||||||
for (uint8_t column = 0; column < 10; column++) {
|
for (uint8_t column = 0; column < 10; column++) {
|
||||||
CoeffAlpha[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus0coeffAlpha[row][column];
|
coeffAlpha[susNumber][row][column] = acsParameters.susHandlingParameters.sus0coeffAlpha[row][column];
|
||||||
CoeffBeta[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus0coeffBeta[row][column];
|
coeffBeta[susNumber][row][column] = acsParameters.susHandlingParameters.sus0coeffBeta[row][column];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -98,8 +102,8 @@ void SunSensor::setCalibrationCoefficients(uint8_t Sensornumber) {
|
|||||||
case 1:
|
case 1:
|
||||||
for (uint8_t row = 0; row < 9; row++) {
|
for (uint8_t row = 0; row < 9; row++) {
|
||||||
for (uint8_t column = 0; column < 10; column++) {
|
for (uint8_t column = 0; column < 10; column++) {
|
||||||
CoeffAlpha[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus1coeffAlpha[row][column];
|
coeffAlpha[susNumber][row][column] = acsParameters.susHandlingParameters.sus1coeffAlpha[row][column];
|
||||||
CoeffBeta[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus1coeffBeta[row][column];
|
coeffBeta[susNumber][row][column] = acsParameters.susHandlingParameters.sus1coeffBeta[row][column];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -107,8 +111,8 @@ void SunSensor::setCalibrationCoefficients(uint8_t Sensornumber) {
|
|||||||
case 2:
|
case 2:
|
||||||
for (uint8_t row = 0; row < 9; row++) {
|
for (uint8_t row = 0; row < 9; row++) {
|
||||||
for (uint8_t column = 0; column < 10; column++) {
|
for (uint8_t column = 0; column < 10; column++) {
|
||||||
CoeffAlpha[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus2coeffAlpha[row][column];
|
coeffAlpha[susNumber][row][column] = acsParameters.susHandlingParameters.sus2coeffAlpha[row][column];
|
||||||
CoeffBeta[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus2coeffBeta[row][column];
|
coeffBeta[susNumber][row][column] = acsParameters.susHandlingParameters.sus2coeffBeta[row][column];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -116,8 +120,8 @@ void SunSensor::setCalibrationCoefficients(uint8_t Sensornumber) {
|
|||||||
case 3:
|
case 3:
|
||||||
for (uint8_t row = 0; row < 9; row++) {
|
for (uint8_t row = 0; row < 9; row++) {
|
||||||
for (uint8_t column = 0; column < 10; column++) {
|
for (uint8_t column = 0; column < 10; column++) {
|
||||||
CoeffAlpha[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus3coeffAlpha[row][column];
|
coeffAlpha[susNumber][row][column] = acsParameters.susHandlingParameters.sus3coeffAlpha[row][column];
|
||||||
CoeffBeta[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus3coeffBeta[row][column];
|
coeffBeta[susNumber][row][column] = acsParameters.susHandlingParameters.sus3coeffBeta[row][column];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -125,8 +129,8 @@ void SunSensor::setCalibrationCoefficients(uint8_t Sensornumber) {
|
|||||||
case 4:
|
case 4:
|
||||||
for (uint8_t row = 0; row < 9; row++) {
|
for (uint8_t row = 0; row < 9; row++) {
|
||||||
for (uint8_t column = 0; column < 10; column++) {
|
for (uint8_t column = 0; column < 10; column++) {
|
||||||
CoeffAlpha[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus4coeffAlpha[row][column];
|
coeffAlpha[susNumber][row][column] = acsParameters.susHandlingParameters.sus4coeffAlpha[row][column];
|
||||||
CoeffBeta[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus4coeffBeta[row][column];
|
coeffBeta[susNumber][row][column] = acsParameters.susHandlingParameters.sus4coeffBeta[row][column];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -134,8 +138,8 @@ void SunSensor::setCalibrationCoefficients(uint8_t Sensornumber) {
|
|||||||
case 5:
|
case 5:
|
||||||
for (uint8_t row = 0; row < 9; row++) {
|
for (uint8_t row = 0; row < 9; row++) {
|
||||||
for (uint8_t column = 0; column < 10; column++) {
|
for (uint8_t column = 0; column < 10; column++) {
|
||||||
CoeffAlpha[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus5coeffAlpha[row][column];
|
coeffAlpha[susNumber][row][column] = acsParameters.susHandlingParameters.sus5coeffAlpha[row][column];
|
||||||
CoeffBeta[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus5coeffBeta[row][column];
|
coeffBeta[susNumber][row][column] = acsParameters.susHandlingParameters.sus5coeffBeta[row][column];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -143,8 +147,8 @@ void SunSensor::setCalibrationCoefficients(uint8_t Sensornumber) {
|
|||||||
case 6:
|
case 6:
|
||||||
for (uint8_t row = 0; row < 9; row++) {
|
for (uint8_t row = 0; row < 9; row++) {
|
||||||
for (uint8_t column = 0; column < 10; column++) {
|
for (uint8_t column = 0; column < 10; column++) {
|
||||||
CoeffAlpha[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus6coeffAlpha[row][column];
|
coeffAlpha[susNumber][row][column] = acsParameters.susHandlingParameters.sus6coeffAlpha[row][column];
|
||||||
CoeffBeta[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus6coeffBeta[row][column];
|
coeffBeta[susNumber][row][column] = acsParameters.susHandlingParameters.sus6coeffBeta[row][column];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -152,8 +156,8 @@ void SunSensor::setCalibrationCoefficients(uint8_t Sensornumber) {
|
|||||||
case 7:
|
case 7:
|
||||||
for (uint8_t row = 0; row < 9; row++) {
|
for (uint8_t row = 0; row < 9; row++) {
|
||||||
for (uint8_t column = 0; column < 10; column++) {
|
for (uint8_t column = 0; column < 10; column++) {
|
||||||
CoeffAlpha[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus7coeffAlpha[row][column];
|
coeffAlpha[susNumber][row][column] = acsParameters.susHandlingParameters.sus7coeffAlpha[row][column];
|
||||||
CoeffBeta[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus7coeffBeta[row][column];
|
coeffBeta[susNumber][row][column] = acsParameters.susHandlingParameters.sus7coeffBeta[row][column];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -161,8 +165,8 @@ void SunSensor::setCalibrationCoefficients(uint8_t Sensornumber) {
|
|||||||
case 8:
|
case 8:
|
||||||
for (uint8_t row = 0; row < 9; row++) {
|
for (uint8_t row = 0; row < 9; row++) {
|
||||||
for (uint8_t column = 0; column < 10; column++) {
|
for (uint8_t column = 0; column < 10; column++) {
|
||||||
CoeffAlpha[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus8coeffAlpha[row][column];
|
coeffAlpha[susNumber][row][column] = acsParameters.susHandlingParameters.sus8coeffAlpha[row][column];
|
||||||
CoeffBeta[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus8coeffBeta[row][column];
|
coeffBeta[susNumber][row][column] = acsParameters.susHandlingParameters.sus8coeffBeta[row][column];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -170,8 +174,8 @@ void SunSensor::setCalibrationCoefficients(uint8_t Sensornumber) {
|
|||||||
case 9:
|
case 9:
|
||||||
for (uint8_t row = 0; row < 9; row++) {
|
for (uint8_t row = 0; row < 9; row++) {
|
||||||
for (uint8_t column = 0; column < 10; column++) {
|
for (uint8_t column = 0; column < 10; column++) {
|
||||||
CoeffAlpha[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus9coeffAlpha[row][column];
|
coeffAlpha[susNumber][row][column] = acsParameters.susHandlingParameters.sus9coeffAlpha[row][column];
|
||||||
CoeffBeta[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus9coeffBeta[row][column];
|
coeffBeta[susNumber][row][column] = acsParameters.susHandlingParameters.sus9coeffBeta[row][column];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -179,8 +183,8 @@ void SunSensor::setCalibrationCoefficients(uint8_t Sensornumber) {
|
|||||||
case 10:
|
case 10:
|
||||||
for (uint8_t row = 0; row < 9; row++) {
|
for (uint8_t row = 0; row < 9; row++) {
|
||||||
for (uint8_t column = 0; column < 10; column++) {
|
for (uint8_t column = 0; column < 10; column++) {
|
||||||
CoeffAlpha[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus10coeffAlpha[row][column];
|
coeffAlpha[susNumber][row][column] = acsParameters.susHandlingParameters.sus10coeffAlpha[row][column];
|
||||||
CoeffBeta[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus10coeffBeta[row][column];
|
coeffBeta[susNumber][row][column] = acsParameters.susHandlingParameters.sus10coeffBeta[row][column];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -188,20 +192,20 @@ void SunSensor::setCalibrationCoefficients(uint8_t Sensornumber) {
|
|||||||
case 11:
|
case 11:
|
||||||
for (uint8_t row = 0; row < 9; row++) {
|
for (uint8_t row = 0; row < 9; row++) {
|
||||||
for (uint8_t column = 0; column < 10; column++) {
|
for (uint8_t column = 0; column < 10; column++) {
|
||||||
CoeffAlpha[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus11coeffAlpha[row][column];
|
coeffAlpha[susNumber][row][column] = acsParameters.susHandlingParameters.sus11coeffAlpha[row][column];
|
||||||
CoeffBeta[Sensornumber][row][column] = acsParameters.susHandlingParameters.sus11coeffBeta[row][column];
|
coeffBeta[susNumber][row][column] = acsParameters.susHandlingParameters.sus11coeffBeta[row][column];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SunSensor::Calibration(uint8_t Sensornumber) {
|
void SunSensor::Calibration(uint8_t susNumber) {
|
||||||
float alpha_m, beta_m, alpha_calibrated, beta_calibrated, k, l;
|
float alpha_m, beta_m, alpha_calibrated, beta_calibrated, k, l;
|
||||||
uint8_t index;
|
uint8_t index;
|
||||||
|
|
||||||
alpha_m = AlphaBetaRaw[Sensornumber][0]; //[°]
|
alpha_m = alphaBetaRaw[susNumber][0]; //[°]
|
||||||
beta_m = AlphaBetaRaw[Sensornumber][1]; //[°]
|
beta_m = alphaBetaRaw[susNumber][1]; //[°]
|
||||||
|
|
||||||
// while loop iterates above all calibration cells to use the different calibration functions in
|
// while loop iterates above all calibration cells to use the different calibration functions in
|
||||||
// each cell
|
// each cell
|
||||||
@ -212,47 +216,47 @@ void SunSensor::Calibration(uint8_t Sensornumber) {
|
|||||||
while (l < 3) {
|
while (l < 3) {
|
||||||
l = l + 1;
|
l = l + 1;
|
||||||
// if-condition to check in which cell the data point has to be
|
// if-condition to check in which cell the data point has to be
|
||||||
if ((alpha_m > ((CompleteCellWidth * ((k - 1) / 3)) - HalfCellWidth) &&
|
if ((alpha_m > ((completeCellWidth * ((k - 1) / 3)) - halfCellWidth) &&
|
||||||
alpha_m < ((CompleteCellWidth * (k / 3)) - HalfCellWidth)) &&
|
alpha_m < ((completeCellWidth * (k / 3)) - halfCellWidth)) &&
|
||||||
(beta_m > ((CompleteCellWidth * ((l - 1) / 3)) - HalfCellWidth) &&
|
(beta_m > ((completeCellWidth * ((l - 1) / 3)) - halfCellWidth) &&
|
||||||
beta_m < ((CompleteCellWidth * (l / 3)) - HalfCellWidth))) {
|
beta_m < ((completeCellWidth * (l / 3)) - halfCellWidth))) {
|
||||||
index = (3 * (k - 1) + l) - 1; // calculate the index of the datapoint for the right cell
|
index = (3 * (k - 1) + l) - 1; // calculate the index of the datapoint for the right cell
|
||||||
// -> first cell has number 0
|
// -> first cell has number 0
|
||||||
AlphaBetaCalibrated[Sensornumber][0] =
|
alphaBetaCalibrated[susNumber][0] =
|
||||||
CoeffAlpha[Sensornumber][index][0] + CoeffAlpha[Sensornumber][index][1] * alpha_m + CoeffAlpha[Sensornumber][index][2] * beta_m +
|
coeffAlpha[susNumber][index][0] + coeffAlpha[susNumber][index][1] * alpha_m + coeffAlpha[susNumber][index][2] * beta_m +
|
||||||
CoeffAlpha[Sensornumber][index][3] * alpha_m * alpha_m + CoeffAlpha[Sensornumber][index][4] * alpha_m * beta_m +
|
coeffAlpha[susNumber][index][3] * alpha_m * alpha_m + coeffAlpha[susNumber][index][4] * alpha_m * beta_m +
|
||||||
CoeffAlpha[Sensornumber][index][5] * beta_m * beta_m +
|
coeffAlpha[susNumber][index][5] * beta_m * beta_m +
|
||||||
CoeffAlpha[Sensornumber][index][6] * alpha_m * alpha_m * alpha_m +
|
coeffAlpha[susNumber][index][6] * alpha_m * alpha_m * alpha_m +
|
||||||
CoeffAlpha[Sensornumber][index][7] * alpha_m * alpha_m * beta_m +
|
coeffAlpha[susNumber][index][7] * alpha_m * alpha_m * beta_m +
|
||||||
CoeffAlpha[Sensornumber][index][8] * alpha_m * beta_m * beta_m +
|
coeffAlpha[susNumber][index][8] * alpha_m * beta_m * beta_m +
|
||||||
CoeffAlpha[Sensornumber][index][9] * beta_m * beta_m * beta_m; //[°]
|
coeffAlpha[susNumber][index][9] * beta_m * beta_m * beta_m; //[°]
|
||||||
AlphaBetaCalibrated[Sensornumber][1] =
|
alphaBetaCalibrated[susNumber][1] =
|
||||||
CoeffBeta[Sensornumber][index][0] + CoeffBeta[Sensornumber][index][1] * alpha_m +
|
coeffBeta[susNumber][index][0] + coeffBeta[susNumber][index][1] * alpha_m +
|
||||||
CoeffBeta[Sensornumber][index][2] * beta_m + CoeffBeta[Sensornumber][index][3] * alpha_m * alpha_m +
|
coeffBeta[susNumber][index][2] * beta_m + coeffBeta[susNumber][index][3] * alpha_m * alpha_m +
|
||||||
CoeffBeta[Sensornumber][index][4] * alpha_m * beta_m +
|
coeffBeta[susNumber][index][4] * alpha_m * beta_m +
|
||||||
CoeffBeta[Sensornumber][index][5] * beta_m * beta_m +
|
coeffBeta[susNumber][index][5] * beta_m * beta_m +
|
||||||
CoeffBeta[Sensornumber][index][6] * alpha_m * alpha_m * alpha_m +
|
coeffBeta[susNumber][index][6] * alpha_m * alpha_m * alpha_m +
|
||||||
CoeffBeta[Sensornumber][index][7] * alpha_m * alpha_m * beta_m +
|
coeffBeta[susNumber][index][7] * alpha_m * alpha_m * beta_m +
|
||||||
CoeffBeta[Sensornumber][index][8] * alpha_m * beta_m * beta_m +
|
coeffBeta[susNumber][index][8] * alpha_m * beta_m * beta_m +
|
||||||
CoeffBeta[Sensornumber][index][9] * beta_m * beta_m * beta_m; //[°]
|
coeffBeta[susNumber][index][9] * beta_m * beta_m * beta_m; //[°]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SunSensor::CalculateSunVector(uint8_t Sensornumber) {
|
void SunSensor::CalculateSunVector(uint8_t susNumber) {
|
||||||
float alpha, beta;
|
float alpha, beta;
|
||||||
alpha = AlphaBetaCalibrated[Sensornumber][0]; //[°]
|
alpha = alphaBetaCalibrated[susNumber][0]; //[°]
|
||||||
beta = AlphaBetaCalibrated[Sensornumber][1]; //[°]
|
beta = alphaBetaCalibrated[susNumber][1]; //[°]
|
||||||
|
|
||||||
// Calculate the normalized Sun Vector
|
// Calculate the normalized Sun Vector
|
||||||
SunVectorBodyFrame[Sensornumber][0] =
|
sunVectorBodyFrame[susNumber][0] =
|
||||||
(tan(alpha * (M_PI / 180)) /
|
(tan(alpha * (M_PI / 180)) /
|
||||||
(sqrt((powf(tan(alpha * (M_PI / 180)), 2)) + powf(tan((beta * (M_PI / 180))), 2) + (1))));
|
(sqrt((powf(tan(alpha * (M_PI / 180)), 2)) + powf(tan((beta * (M_PI / 180))), 2) + (1))));
|
||||||
SunVectorBodyFrame[Sensornumber][1] =
|
sunVectorBodyFrame[susNumber][1] =
|
||||||
(tan(beta * (M_PI / 180)) /
|
(tan(beta * (M_PI / 180)) /
|
||||||
(sqrt(powf((tan(alpha * (M_PI / 180))), 2) + powf(tan((beta * (M_PI / 180))), 2) + (1))));
|
(sqrt(powf((tan(alpha * (M_PI / 180))), 2) + powf(tan((beta * (M_PI / 180))), 2) + (1))));
|
||||||
SunVectorBodyFrame[Sensornumber][2] =
|
sunVectorBodyFrame[susNumber][2] =
|
||||||
(-1 /
|
(-1 /
|
||||||
(sqrt(powf((tan(alpha * (M_PI / 180))), 2) + powf((tan(beta * (M_PI / 180))), 2) + (1))));
|
(sqrt(powf((tan(alpha * (M_PI / 180))), 2) + powf((tan(beta * (M_PI / 180))), 2) + (1))));
|
||||||
}
|
}
|
||||||
@ -262,79 +266,79 @@ float* SunSensor::getSunVectorBodyFrame() {
|
|||||||
float* SunVectorBodyFrameReturn = 0;
|
float* SunVectorBodyFrameReturn = 0;
|
||||||
SunVectorBodyFrameReturn = new float[3];
|
SunVectorBodyFrameReturn = new float[3];
|
||||||
|
|
||||||
SunVectorBodyFrameReturn[0] = SunVectorBodyFrame[0];
|
SunVectorBodyFrameReturn[0] = sunVectorBodyFrame[0];
|
||||||
SunVectorBodyFrameReturn[1] = SunVectorBodyFrame[1];
|
SunVectorBodyFrameReturn[1] = sunVectorBodyFrame[1];
|
||||||
SunVectorBodyFrameReturn[2] = SunVectorBodyFrame[2];
|
SunVectorBodyFrameReturn[2] = sunVectorBodyFrame[2];
|
||||||
|
|
||||||
return SunVectorBodyFrameReturn;
|
return SunVectorBodyFrameReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SunSensor::getValidityNumber(uint8_t Sensornumber) {
|
bool SunSensor::getValidFlag(uint8_t susNumber) {
|
||||||
return ValidityNumber[Sensornumber];
|
return validFlag[susNumber];
|
||||||
}
|
}
|
||||||
|
|
||||||
float* SunSensor::TransferSunVector() {
|
float* SunSensor::TransferSunVector() {
|
||||||
float* SunVectorEIVE = 0;
|
float* sunVectorEIVE = 0;
|
||||||
SunVectorEIVE = new float[3];
|
sunVectorEIVE = new float[3];
|
||||||
|
|
||||||
uint8_t counter = 0;
|
uint8_t susAvail = 12;
|
||||||
int8_t BasisMatrixUse[3][3];
|
int8_t basisMatrixUse[3][3];
|
||||||
float SunVectorMatrixEIVE[3][12] = {0}, sum;
|
float sunVectorMatrixEIVE[3][12] = {0};
|
||||||
float SunVectorMatrixBodyFrame[3][12];
|
float sunVectorMatrixBodyFrame[3][12];
|
||||||
|
|
||||||
for (uint8_t Sensornumber = 0; Sensornumber < 12;
|
for (uint8_t susNumber = 0; susNumber < 12;
|
||||||
Sensornumber++) { // save the sun vector of each SUS in their body frame into an array for
|
susNumber++) { // save the sun vector of each SUS in their body frame into an array for
|
||||||
// further processing
|
// further processing
|
||||||
float* SunVectorBodyFrame = SunVectorBodyFrame[Sensornumber];
|
float* SunVectorBodyFrame = SunVectorBodyFrame[susNumber];
|
||||||
SunVectorMatrixBodyFrame[0][Sensornumber] = SunVectorBodyFrame[0];
|
sunVectorMatrixBodyFrame[0][susNumber] = SunVectorBodyFrame[0];
|
||||||
SunVectorMatrixBodyFrame[1][Sensornumber] = SunVectorBodyFrame[1];
|
sunVectorMatrixBodyFrame[1][susNumber] = SunVectorBodyFrame[1];
|
||||||
SunVectorMatrixBodyFrame[2][Sensornumber] = SunVectorBodyFrame[2];
|
sunVectorMatrixBodyFrame[2][susNumber] = SunVectorBodyFrame[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t Sensornumber = 0; Sensornumber < 12; Sensornumber++) {
|
for (uint8_t susNumber = 0; susNumber < 12; susNumber++) {
|
||||||
if (getValidityNumber(Sensornumber) == false) {
|
if (getValidFlag(susNumber) == returnvalue::FAILED) {
|
||||||
counter = counter + 1;
|
susAvail -= 1;
|
||||||
} // if the SUS data is not valid ->
|
} // if the SUS data is not valid ->
|
||||||
|
|
||||||
for (uint8_t c1 = 0; c1 < 3; c1++) {
|
for (uint8_t c1 = 0; c1 < 3; c1++) {
|
||||||
for (uint8_t c2 = 0; c2 < 3; c2++) {
|
for (uint8_t c2 = 0; c2 < 3; c2++) {
|
||||||
switch (Sensornumber) { // find right basis matrix for each SUS
|
switch (susNumber) {
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
BasisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus0orientationMatrix[c1][c2];
|
basisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus0orientationMatrix[c1][c2];
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
BasisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus1orientationMatrix[c1][c2];
|
basisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus1orientationMatrix[c1][c2];
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
BasisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus2orientationMatrix[c1][c2];
|
basisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus2orientationMatrix[c1][c2];
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
BasisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus3orientationMatrix[c1][c2];
|
basisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus3orientationMatrix[c1][c2];
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
BasisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus4orientationMatrix[c1][c2];
|
basisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus4orientationMatrix[c1][c2];
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
BasisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus5orientationMatrix[c1][c2];
|
basisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus5orientationMatrix[c1][c2];
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
BasisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus6orientationMatrix[c1][c2];
|
basisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus6orientationMatrix[c1][c2];
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
BasisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus7orientationMatrix[c1][c2];
|
basisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus7orientationMatrix[c1][c2];
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
BasisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus8orientationMatrix[c1][c2];
|
basisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus8orientationMatrix[c1][c2];
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
BasisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus9orientationMatrix[c1][c2];
|
basisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus9orientationMatrix[c1][c2];
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
BasisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus10orientationMatrix[c1][c2];
|
basisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus10orientationMatrix[c1][c2];
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
BasisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus11orientationMatrix[c1][c2];
|
basisMatrixUse[c1][c2] = acsParameters.susHandlingParameters.sus11orientationMatrix[c1][c2];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -344,34 +348,31 @@ float* SunSensor::TransferSunVector() {
|
|||||||
for (uint8_t p = 0; p < 3; p++) {
|
for (uint8_t p = 0; p < 3; p++) {
|
||||||
for (uint8_t q = 0; q < 3; q++) {
|
for (uint8_t q = 0; q < 3; q++) {
|
||||||
// normal matrix multiplication
|
// normal matrix multiplication
|
||||||
SunVectorMatrixEIVE[p][Sensornumber] +=
|
sunVectorMatrixEIVE[p][susNumber] +=
|
||||||
(BasisMatrixUse[p][q] * SunVectorMatrixBodyFrame[q][Sensornumber]);
|
(basisMatrixUse[p][q] * sunVectorMatrixBodyFrame[q][susNumber]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (counter < 12) { // Calculate one sun vector out of all sun vectors from the different SUS
|
if (susAvail > 0) { // Calculate one sun vector out of all sun vectors from the different SUS
|
||||||
for (uint8_t i = 0; i < 3; i++) {
|
for (uint8_t i = 0; i < 3; i++) {
|
||||||
sum = 0;
|
float sum = 0;
|
||||||
for (uint8_t Sensornumber = 0; Sensornumber < 12; Sensornumber++) {
|
for (uint8_t susNumber = 0; susNumber < 12; susNumber++) {
|
||||||
if (getValidityNumber(Sensornumber)){
|
if (getValidFlag(susNumber) == returnvalue::OK){
|
||||||
sum += SunVectorMatrixEIVE[i][Sensornumber];
|
sum += sunVectorMatrixEIVE[i][susNumber];
|
||||||
//printf("%f\n", SunVectorMatrixEIVE[i][Sensornumber]);
|
//printf("%f\n", SunVectorMatrixEIVE[i][susNumber]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ToDo: decide on length on sun vector
|
// ToDo: decide on length on sun vector
|
||||||
SunVectorEIVE[i] =
|
sunVectorEIVE[i] = sum;
|
||||||
sum/* / (12 - counter)*/; // FLAG Ergebnis ist falsch, kann an einem Fehler im Programm
|
|
||||||
// liegen, vermutlich aber an den falschen ChannelValues da die
|
|
||||||
// transformierten Sonnenvektoren jedes SUS plausibel sind
|
|
||||||
}
|
}
|
||||||
VectorOperations<float>::normalize(SunVectorEIVE, SunVectorEIVE, 3);
|
VectorOperations<float>::normalize(sunVectorEIVE, sunVectorEIVE, 3);
|
||||||
} else {
|
} else {
|
||||||
// No sus is valid
|
// No sus is valid
|
||||||
throw std::invalid_argument("No sun sensor is valid"); // throw error
|
throw std::invalid_argument("No sun sensor is valid"); // throw error
|
||||||
}
|
}
|
||||||
|
|
||||||
return SunVectorEIVE;
|
return sunVectorEIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,49 +8,48 @@
|
|||||||
#ifndef MISSION_CONTROLLER_ACS_SUSCONVERTER_H_
|
#ifndef MISSION_CONTROLLER_ACS_SUSCONVERTER_H_
|
||||||
#define MISSION_CONTROLLER_ACS_SUSCONVERTER_H_
|
#define MISSION_CONTROLLER_ACS_SUSCONVERTER_H_
|
||||||
|
|
||||||
|
#include "AcsParameters.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <AcsParameters.h>
|
|
||||||
|
|
||||||
class SunSensor {
|
class SunSensor {
|
||||||
public:
|
public:
|
||||||
SunSensor() {}
|
SunSensor() {}
|
||||||
|
|
||||||
void setSunSensorData();
|
void setSunSensorData();
|
||||||
void checkSunSensorData(uint8_t Sensornumber);
|
void checkSunSensorData(uint8_t susNumber);
|
||||||
void AngleCalculation(uint8_t Sensornumber);
|
void calcAngle(uint8_t susNumber);
|
||||||
void setCalibrationCoefficients(uint8_t Sensornumber);
|
void setCalibrationCoefficients(uint8_t susNumber);
|
||||||
void Calibration(uint8_t Sensornumber);
|
void Calibration(uint8_t susNumber);
|
||||||
void CalculateSunVector(uint8_t Sensornumber);
|
void CalculateSunVector(uint8_t susNumber);
|
||||||
|
|
||||||
bool getValidityNumber(uint8_t Sensornumber);
|
bool getValidFlag(uint8_t susNumber);
|
||||||
float* getSunVectorBodyFrame();
|
float* getSunVectorBodyFrame();
|
||||||
float* TransferSunVector();
|
float* TransferSunVector();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint16_t susChannelValues[12][4]; //[Bit]
|
uint16_t susChannelValues[12][4]; //[Bit]
|
||||||
float AlphaBetaRaw[12][2]; //[°]
|
float alphaBetaRaw[12][2]; //[°]
|
||||||
float AlphaBetaCalibrated[12][2]; //[°]
|
float alphaBetaCalibrated[12][2]; //[°]
|
||||||
float SunVectorBodyFrame[12][3]; //[-]
|
float sunVectorBodyFrame[12][3]; //[-]
|
||||||
|
|
||||||
bool ValidityNumber[12] = true;
|
bool validFlag[12] = returnvalue::OK;
|
||||||
|
|
||||||
uint16_t ChannelValueCheckHigh =
|
uint16_t channelValueCheckHigh =
|
||||||
4096; //=2^12[Bit]high borderline for the channel values of one sun sensor for validity Check
|
4096; //=2^12[Bit]high borderline for the channel values of one sun sensor for validity Check
|
||||||
uint8_t ChannelValueCheckLow =
|
uint8_t channelValueCheckLow =
|
||||||
0; //[Bit]low borderline for the channel values of one sun sensor for validity Check
|
0; //[Bit]low borderline for the channel values of one sun sensor for validity Check
|
||||||
uint16_t ChannelValueSumHigh =
|
uint16_t channelValueSumHigh =
|
||||||
100; // 4096[Bit]high borderline for check if the sun sensor is illuminated by the sun or by
|
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
|
// the reflection of sunlight from the moon/earth
|
||||||
uint8_t ChannelValueSumLow =
|
uint8_t channelValueSumLow =
|
||||||
0; //[Bit]low borderline for check if the sun sensor is illuminated
|
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
|
// by the sun or by the reflection of sunlight from the moon/earth
|
||||||
uint8_t CompleteCellWidth = 140,
|
uint8_t completeCellWidth = 140,
|
||||||
HalfCellWidth = 70; //[°] Width of the calibration cells --> necessary for checking in
|
halfCellWidth = 70; //[°] Width of the calibration cells --> necessary for checking in
|
||||||
// which cell a data point should be
|
// which cell a data point should be
|
||||||
|
|
||||||
float CoeffAlpha[12][9][10];
|
float coeffAlpha[12][9][10];
|
||||||
float CoeffBeta[12][9][10];
|
float coeffBeta[12][9][10];
|
||||||
|
|
||||||
AcsParameters acsParameters;
|
AcsParameters acsParameters;
|
||||||
};
|
};
|
||||||
|
@ -7,13 +7,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <Detumble.h>
|
#include "Detumble.h"
|
||||||
|
#include "../util/MathOperations.h"
|
||||||
|
#include <math.h>
|
||||||
#include <fsfw/globalfunctions/constants.h>
|
#include <fsfw/globalfunctions/constants.h>
|
||||||
#include <fsfw/globalfunctions/math/MatrixOperations.h>
|
#include <fsfw/globalfunctions/math/MatrixOperations.h>
|
||||||
#include <acs/util/MathOperations.h>
|
|
||||||
#include <fsfw/globalfunctions/math/QuaternionOperations.h>
|
#include <fsfw/globalfunctions/math/QuaternionOperations.h>
|
||||||
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
||||||
#include <math.h>
|
|
||||||
#include <fsfw/globalfunctions/sign.h>
|
#include <fsfw/globalfunctions/sign.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,14 +8,15 @@
|
|||||||
#ifndef ACS_CONTROL_DETUMBLE_H_
|
#ifndef ACS_CONTROL_DETUMBLE_H_
|
||||||
#define ACS_CONTROL_DETUMBLE_H_
|
#define ACS_CONTROL_DETUMBLE_H_
|
||||||
|
|
||||||
|
#include "../SensorValues.h"
|
||||||
|
#include "../OutputValues.h"
|
||||||
|
#include "../AcsParameters.h"
|
||||||
|
#include "../config/classIds.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <acs/SensorValues.h>
|
|
||||||
#include <acs/OutputValues.h>
|
|
||||||
#include <acs/AcsParameters.h>
|
|
||||||
#include <acs/config/classIds.h>
|
|
||||||
#include <fsfw/returnvalues/returnvalue.h>
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <fsfw/returnvalues/returnvalue.h>
|
||||||
|
|
||||||
|
|
||||||
class Detumble{
|
class Detumble{
|
||||||
|
|
||||||
|
@ -8,12 +8,12 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "PtgCtrl.h"
|
#include "PtgCtrl.h"
|
||||||
#include <fsfw/src/fsfw/globalfunctions/constants.h>
|
#include "../util/MathOperations.h"
|
||||||
#include <fsfw/src/fsfw/globalfunctions/math/MatrixOperations.h>
|
#include <fsfw/globalfunctions/constants.h>
|
||||||
#include <acs/util/MathOperations.h>
|
#include <fsfw/globalfunctions/math/MatrixOperations.h>
|
||||||
#include <fsfw/src/fsfw/globalfunctions/math/QuaternionOperations.h>
|
#include <fsfw/globalfunctions/math/QuaternionOperations.h>
|
||||||
#include <fsfw/src/fsfw/globalfunctions/math/VectorOperations.h>
|
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
||||||
#include <fsfw/src/fsfw/globalfunctions/sign.h>
|
#include <fsfw/globalfunctions/sign.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
PtgCtrl::PtgCtrl(AcsParameters *acsParameters_){
|
PtgCtrl::PtgCtrl(AcsParameters *acsParameters_){
|
||||||
|
@ -14,12 +14,12 @@
|
|||||||
#ifndef PTGCTRL_H_
|
#ifndef PTGCTRL_H_
|
||||||
#define PTGCTRL_H_
|
#define PTGCTRL_H_
|
||||||
|
|
||||||
|
#include "../SensorValues.h"
|
||||||
|
#include "../OutputValues.h"
|
||||||
|
#include "../AcsParameters.h"
|
||||||
|
#include "../config/classIds.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <acs/SensorValues.h>
|
|
||||||
#include <acs/OutputValues.h>
|
|
||||||
#include <acs/AcsParameters.h>
|
|
||||||
#include <acs/config/classIds.h>
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
class PtgCtrl{
|
class PtgCtrl{
|
||||||
@ -53,7 +53,7 @@ private:
|
|||||||
AcsParameters::PointingModeControllerParameters* pointingModeControllerParameters;
|
AcsParameters::PointingModeControllerParameters* pointingModeControllerParameters;
|
||||||
AcsParameters::RwHandlingParameters* rwHandlingParameters;
|
AcsParameters::RwHandlingParameters* rwHandlingParameters;
|
||||||
AcsParameters::InertiaEIVE* inertiaEIVE;
|
AcsParameters::InertiaEIVE* inertiaEIVE;
|
||||||
AcsParameters::RWMatrices* rwMatrices;
|
AcsParameters::RwMatrices* rwMatrices;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* ACS_CONTROL_PTGCTRL_H_ */
|
#endif /* ACS_CONTROL_PTGCTRL_H_ */
|
||||||
|
@ -6,12 +6,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SafeCtrl.h"
|
#include "SafeCtrl.h"
|
||||||
#include <fsfw/src/fsfw/globalfunctions/constants.h>
|
#include "../util/MathOperations.h"
|
||||||
#include <fsfw/src/fsfw/globalfunctions/math/MatrixOperations.h>
|
|
||||||
#include <acs/util/MathOperations.h>
|
|
||||||
#include <fsfw/src/fsfw/globalfunctions/math/QuaternionOperations.h>
|
|
||||||
#include <fsfw/src/fsfw/globalfunctions/math/VectorOperations.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <fsfw/globalfunctions/constants.h>
|
||||||
|
#include <fsfw/globalfunctions/math/MatrixOperations.h>
|
||||||
|
#include <fsfw/globalfunctions/math/QuaternionOperations.h>
|
||||||
|
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
||||||
|
|
||||||
|
|
||||||
SafeCtrl::SafeCtrl(AcsParameters *acsParameters_){
|
SafeCtrl::SafeCtrl(AcsParameters *acsParameters_){
|
||||||
loadAcsParameters(acsParameters_);
|
loadAcsParameters(acsParameters_);
|
||||||
|
@ -8,14 +8,15 @@
|
|||||||
#ifndef SAFECTRL_H_
|
#ifndef SAFECTRL_H_
|
||||||
#define SAFECTRL_H_
|
#define SAFECTRL_H_
|
||||||
|
|
||||||
|
#include "../SensorValues.h"
|
||||||
|
#include "../OutputValues.h"
|
||||||
|
#include "../AcsParameters.h"
|
||||||
|
#include "../config/classIds.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <acs/SensorValues.h>
|
|
||||||
#include <acs/OutputValues.h>
|
|
||||||
#include <acs/AcsParameters.h>
|
|
||||||
#include "acs/config/classIds.h"
|
|
||||||
#include <fsfw/src/fsfw/returnvalues/HasReturnvaluesIF.h>
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
|
|
||||||
|
|
||||||
class SafeCtrl{
|
class SafeCtrl{
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user