2022-09-19 15:17:39 +02:00
|
|
|
/*
|
|
|
|
* Guidance.h
|
|
|
|
*
|
|
|
|
* Created on: 6 Jun 2022
|
|
|
|
* Author: Robin Marquardt
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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
|
|
|
|
2022-11-03 10:43:27 +01:00
|
|
|
void getTargetParamsSafe(double sunTargetSafe[3], double satRateRef[3]);
|
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
|
2022-12-14 11:46:58 +01:00
|
|
|
void targetQuatPtgThreeAxes(ACS::SensorValues *sensorValues,
|
|
|
|
acsctrl::GpsDataProcessed *gpsDataProcessed,
|
|
|
|
acsctrl::MekfData *mekfData, timeval now, double targetQuat[4],
|
|
|
|
double refSatRate[3]);
|
2023-01-10 09:05:27 +01:00
|
|
|
void targetQuatPtgGs(ACS::SensorValues *sensorValues, acsctrl::MekfData *mekfData,
|
|
|
|
acsctrl::SusDataProcessed *susDataProcessed,
|
|
|
|
acsctrl::GpsDataProcessed *gpsDataProcessed, timeval now,
|
|
|
|
double targetQuat[4], double refSatRate[3]);
|
2022-12-14 11:46:58 +01:00
|
|
|
void targetQuatPtgSingleAxis(ACS::SensorValues *sensorValues, acsctrl::MekfData *mekfData,
|
|
|
|
acsctrl::SusDataProcessed *susDataProcessed,
|
|
|
|
acsctrl::GpsDataProcessed *gpsDataProcessed, timeval now,
|
2022-12-13 11:51:03 +01:00
|
|
|
double targetQuat[4], double refSatRate[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
|
2022-12-14 11:46:58 +01:00
|
|
|
void sunQuatPtg(ACS::SensorValues *sensorValues, acsctrl::MekfData *mekfData,
|
|
|
|
acsctrl::SusDataProcessed *susDataProcessed,
|
|
|
|
acsctrl::GpsDataProcessed *gpsDataProcessed, timeval now, 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
|
2022-12-14 11:46:58 +01:00
|
|
|
void quatNadirPtgThreeAxes(ACS::SensorValues *sensorValues,
|
|
|
|
acsctrl::GpsDataProcessed *gpsDataProcessed,
|
|
|
|
acsctrl::MekfData *mekfData, timeval now, double targetQuat[4],
|
|
|
|
double refSatRate[3]);
|
|
|
|
void quatNadirPtgSingleAxis(ACS::SensorValues *sensorValues, acsctrl::MekfData *mekfData,
|
2022-12-13 11:51:03 +01:00
|
|
|
timeval now, double targetQuat[4], double refSatRate[3]);
|
2022-11-08 13:48:50 +01:00
|
|
|
|
2022-12-13 11:51:03 +01:00
|
|
|
// Function to get the target quaternion and refence rotation rate from parameters for inertial
|
|
|
|
// pointing
|
|
|
|
void inertialQuatPtg(double targetQuat[4], double refSatRate[3]);
|
2022-11-14 17:16:47 +01:00
|
|
|
|
2022-11-03 10:43:27 +01:00
|
|
|
// @note: compares target Quaternion and reference quaternion, also actual satellite rate and
|
|
|
|
// desired
|
2023-01-23 16:34:52 +01:00
|
|
|
void comparePtg(double targetQuat[4], acsctrl::MekfData *mekfData, double quatRef[4],
|
|
|
|
double refSatRate[3], double quatErrorComplete[4], double quatError[3],
|
|
|
|
double deltaRate[3]);
|
2022-11-03 10:43:27 +01:00
|
|
|
|
2023-01-23 16:34:52 +01:00
|
|
|
void refRotationRate(int8_t timeElapsedMax, timeval now, double quatInertialTarget[4],
|
|
|
|
double *refSatRate);
|
2023-01-10 11:20:28 +01:00
|
|
|
|
2022-11-03 10:43:27 +01:00
|
|
|
// @note: will give back the pseudoinverse matrix for the reaction wheel depending on the valid
|
|
|
|
// reation wheel maybe can be done in "commanding.h"
|
|
|
|
void getDistributionMatrixRw(ACS::SensorValues *sensorValues, double *rwPseudoInv);
|
|
|
|
|
|
|
|
private:
|
|
|
|
AcsParameters acsParameters;
|
|
|
|
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
|
|
|
|
|
|
|
static constexpr char SD_0_SKEWED_PTG_FILE[] = "/mnt/sd0/conf/deployment";
|
|
|
|
static constexpr char SD_1_SKEWED_PTG_FILE[] = "/mnt/sd1/conf/deployment";
|
2022-09-19 15:17:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* ACS_GUIDANCE_H_ */
|