2022-09-19 15:17:39 +02:00
|
|
|
#ifndef GUIDANCE_H_
|
|
|
|
#define GUIDANCE_H_
|
|
|
|
|
2022-11-03 10:43:27 +01:00
|
|
|
#include <time.h>
|
2022-09-19 15:17:39 +02:00
|
|
|
|
2022-11-03 10:43:27 +01:00
|
|
|
#include "../controllerdefinitions/AcsCtrlDefinitions.h"
|
2022-09-27 11:06:11 +02:00
|
|
|
#include "AcsParameters.h"
|
|
|
|
#include "SensorValues.h"
|
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();
|
2022-09-19 15:17:39 +02:00
|
|
|
|
2023-01-10 11:20:28 +01:00
|
|
|
// Function to get the target quaternion and refence rotation rate from gps position and
|
|
|
|
// position of the ground station
|
2023-02-21 10:22:02 +01:00
|
|
|
void targetQuatPtgSingleAxis(timeval now, double posSatE[3], double velSatE[3], double sunDirI[3],
|
|
|
|
double refDirB[3], double quatBI[4], double targetQuat[4],
|
|
|
|
double targetSatRotRate[3]);
|
2023-02-17 14:46:41 +01:00
|
|
|
void targetQuatPtgThreeAxes(timeval now, double posSatE[3], double velSatE[3], double quatIX[4],
|
2023-02-20 11:52:53 +01:00
|
|
|
double targetSatRotRate[3]);
|
2023-02-20 15:59:01 +01:00
|
|
|
void targetQuatPtgGs(timeval now, double posSatE[3], double sunDirI[3], double quatIX[4],
|
|
|
|
double targetSatRotRate[3]);
|
2022-09-19 15:17:39 +02:00
|
|
|
|
2022-12-13 11:51:03 +01:00
|
|
|
// Function to get the target quaternion and refence rotation rate for sun pointing after ground
|
|
|
|
// station
|
2023-02-20 15:59:01 +01:00
|
|
|
void targetQuatPtgSun(double sunDirI[3], double targetQuat[4], double refSatRate[3]);
|
2022-10-28 18:18:28 +02:00
|
|
|
|
2022-12-13 11:51:03 +01:00
|
|
|
// Function to get the target quaternion and refence rotation rate from gps position for Nadir
|
|
|
|
// pointing
|
2023-02-21 10:44:02 +01:00
|
|
|
void targetQuatPtgNadirSingleAxis(timeval now, double posSatE[3], double quatBI[4],
|
|
|
|
double targetQuat[4], double refDirB[3], double refSatRate[3]);
|
2023-02-20 16:20:54 +01:00
|
|
|
void targetQuatPtgNadirThreeAxes(timeval now, double posSatE[3], double velSatE[3],
|
|
|
|
double targetQuat[4], double refSatRate[3]);
|
2022-11-14 17:16:47 +01:00
|
|
|
|
2023-02-20 11:52:53 +01:00
|
|
|
// @note: Calculates the error quaternion between the current orientation and the target
|
|
|
|
// quaternion, considering a reference quaternion. Additionally the difference between the actual
|
|
|
|
// and a desired satellite rotational rate is calculated, again considering a reference rotational
|
|
|
|
// rate. Lastly gives back the error angle of the error quaternion.
|
|
|
|
void comparePtg(double currentQuat[4], double currentSatRotRate[3], double targetQuat[4],
|
|
|
|
double targetSatRotRate[3], double refQuat[4], double refSatRotRate[3],
|
|
|
|
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],
|
|
|
|
double errorAngle);
|
2022-11-03 10:43:27 +01:00
|
|
|
|
2023-02-20 11:52:53 +01:00
|
|
|
void targetRotationRate(int8_t timeElapsedMax, timeval now, double quatInertialTarget[4],
|
|
|
|
double *targetSatRotRate);
|
2023-01-10 11:20:28 +01:00
|
|
|
|
2023-02-17 15:57:07 +01:00
|
|
|
// @note: will give back the pseudoinverse matrix for the reaction wheel depending on the valid
|
2022-11-03 10:43:27 +01:00
|
|
|
// reation wheel maybe can be done in "commanding.h"
|
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;
|
|
|
|
|
2022-11-03 10:43:27 +01:00
|
|
|
bool strBlindAvoidFlag = false;
|
2023-01-12 15:19:21 +01:00
|
|
|
timeval timeSavedQuaternion;
|
|
|
|
double savedQuaternion[4] = {0, 0, 0, 0};
|
|
|
|
double omegaRefSaved[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_ */
|