2022-09-19 15:17:39 +02:00
|
|
|
#ifndef GUIDANCE_H_
|
|
|
|
#define GUIDANCE_H_
|
|
|
|
|
2024-02-02 14:32:12 +01:00
|
|
|
#include <fsfw/coordinates/CoordinateTransformations.h>
|
2024-01-26 11:16:59 +01:00
|
|
|
#include <fsfw/datapool/PoolReadGuard.h>
|
|
|
|
#include <fsfw/globalfunctions/math/MatrixOperations.h>
|
|
|
|
#include <fsfw/globalfunctions/math/QuaternionOperations.h>
|
|
|
|
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
2024-01-26 13:37:30 +01:00
|
|
|
#include <mission/controller/acs/AcsParameters.h>
|
|
|
|
#include <mission/controller/acs/SensorValues.h>
|
2024-01-26 11:16:59 +01:00
|
|
|
#include <mission/controller/controllerdefinitions/AcsCtrlDefinitions.h>
|
2022-09-19 15:17:39 +02:00
|
|
|
|
2024-01-26 11:16:59 +01:00
|
|
|
#include <cmath>
|
|
|
|
#include <filesystem>
|
|
|
|
#include <string>
|
|
|
|
|
2022-09-19 15:17:39 +02:00
|
|
|
class Guidance {
|
2022-11-03 10:43:27 +01:00
|
|
|
public:
|
|
|
|
Guidance(AcsParameters *acsParameters_);
|
|
|
|
virtual ~Guidance();
|
2022-09-19 15:17:39 +02:00
|
|
|
|
2023-04-14 11:37:23 +02:00
|
|
|
void getTargetParamsSafe(double sunTargetSafe[3]);
|
2023-02-22 17:08:42 +01:00
|
|
|
ReturnValue_t solarArrayDeploymentComplete();
|
2024-01-26 11:16:59 +01:00
|
|
|
void resetValues();
|
2022-09-19 15:17:39 +02:00
|
|
|
|
2024-02-05 09:39:35 +01:00
|
|
|
void targetQuatPtgIdle(timeval timeAbsolute, const double timeDelta, const double sunDirI[3],
|
2024-02-02 15:04:26 +01:00
|
|
|
const double posSatF[4], double targetQuat[4], double targetSatRotRate[3]);
|
2024-02-13 16:59:50 +01:00
|
|
|
void targetQuatPtgTarget(timeval timeAbsolute, const double timeDelta, const double posSatF[3],
|
|
|
|
const double velSatE[3], double quatIX[4], double targetSatRotRate[3]);
|
2024-02-13 15:58:44 +01:00
|
|
|
void targetQuatPtgGs(timeval timeAbsolute, const double timeDelta, const double posSatF[3],
|
|
|
|
const double sunDirI[3], double quatIX[4], double targetSatRotRate[3]);
|
2024-02-13 16:59:50 +01:00
|
|
|
void targetQuatPtgNadir(timeval timeAbsolute, const double timeDelta, const double posSatF[3],
|
|
|
|
const double velSatF[3], double targetQuat[4], double refSatRate[3]);
|
2022-09-19 15:17:39 +02:00
|
|
|
|
2024-02-02 14:32:12 +01:00
|
|
|
void targetRotationRate(const double timeDelta, double quatInertialTarget[4],
|
|
|
|
double *targetSatRotRate);
|
2022-10-28 18:18:28 +02:00
|
|
|
|
2024-02-22 15:04:30 +01:00
|
|
|
void limitReferenceRotation(const double xAxisIX[3], double quatIX[4]);
|
|
|
|
|
2023-02-20 11:52:53 +01:00
|
|
|
void comparePtg(double currentQuat[4], double currentSatRotRate[3], double targetQuat[4],
|
|
|
|
double targetSatRotRate[3], double refQuat[4], double refSatRotRate[3],
|
2023-05-26 09:57:03 +02:00
|
|
|
double errorQuat[4], double errorSatRotRate[3], double &errorAngle);
|
2023-02-20 15:59:01 +01:00
|
|
|
void comparePtg(double currentQuat[4], double currentSatRotRate[3], double targetQuat[4],
|
|
|
|
double targetSatRotRate[3], double errorQuat[4], double errorSatRotRate[3],
|
2023-05-26 09:57:03 +02:00
|
|
|
double &errorAngle);
|
2022-11-03 10:43:27 +01:00
|
|
|
|
2023-02-16 15:40:16 +01:00
|
|
|
ReturnValue_t getDistributionMatrixRw(ACS::SensorValues *sensorValues, double *rwPseudoInv);
|
2022-11-03 10:43:27 +01:00
|
|
|
|
|
|
|
private:
|
2023-02-27 17:08:48 +01:00
|
|
|
const AcsParameters *acsParameters;
|
|
|
|
|
2024-01-26 11:16:59 +01:00
|
|
|
static constexpr double ZERO_VEC3[3] = {0, 0, 0};
|
2024-01-26 13:37:30 +01:00
|
|
|
static constexpr double ZERO_VEC4[4] = {0, 0, 0, 0};
|
2024-01-26 11:16:59 +01:00
|
|
|
|
2022-11-03 10:43:27 +01:00
|
|
|
bool strBlindAvoidFlag = false;
|
2024-01-26 11:16:59 +01:00
|
|
|
double quatIXprev[4] = {0, 0, 0, 0};
|
2024-02-22 15:04:30 +01:00
|
|
|
double xAxisIXprev[3] = {0, 0, 0};
|
2023-01-12 14:49:37 +01:00
|
|
|
|
2023-03-07 14:07:37 +01:00
|
|
|
static constexpr char SD_0_SKEWED_PTG_FILE[] = "/mnt/sd0/conf/acsDeploymentConfirm";
|
|
|
|
static constexpr char SD_1_SKEWED_PTG_FILE[] = "/mnt/sd1/conf/acsDeploymentConfirm";
|
2022-09-19 15:17:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* ACS_GUIDANCE_H_ */
|