2022-09-20 13:43:26 +02:00
|
|
|
/*
|
|
|
|
* PtgCtrl.h
|
|
|
|
*
|
|
|
|
* Created on: 17 Jul 2022
|
|
|
|
* Author: Robin Marquardt
|
|
|
|
*
|
2022-10-12 15:06:24 +02:00
|
|
|
* @brief: This class handles the pointing control mechanism. Calculation of an commanded
|
|
|
|
* torque for the reaction wheels, and magnetic Field strength for magnetorques for desaturation
|
2022-09-20 13:43:26 +02:00
|
|
|
*
|
|
|
|
* @note: A description of the used algorithms can be found in
|
|
|
|
* https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_Studenten/Marquardt_Robin&openfile=896110
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PTGCTRL_H_
|
|
|
|
#define PTGCTRL_H_
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2022-10-12 15:06:24 +02:00
|
|
|
#include <string.h>
|
2022-09-20 13:43:26 +02:00
|
|
|
#include <time.h>
|
|
|
|
|
2022-10-12 15:06:24 +02:00
|
|
|
#include "../AcsParameters.h"
|
|
|
|
#include "../SensorValues.h"
|
|
|
|
#include "../config/classIds.h"
|
2022-09-20 13:43:26 +02:00
|
|
|
|
2022-10-12 15:06:24 +02:00
|
|
|
class PtgCtrl {
|
|
|
|
public:
|
|
|
|
/* @brief: Constructor
|
|
|
|
* @param: acsParameters_ Pointer to object which defines the ACS configuration parameters
|
|
|
|
*/
|
|
|
|
PtgCtrl(AcsParameters *acsParameters_);
|
|
|
|
virtual ~PtgCtrl();
|
|
|
|
|
|
|
|
static const uint8_t INTERFACE_ID = CLASS_ID::PTG;
|
|
|
|
static const ReturnValue_t PTGCTRL_MEKF_INPUT_INVALID = MAKE_RETURN_CODE(0x01);
|
|
|
|
|
2022-10-28 18:18:28 +02:00
|
|
|
/* @brief: Load AcsParameters for this class
|
2022-10-12 15:06:24 +02:00
|
|
|
* @param: acsParameters_ Pointer to object which defines the ACS configuration parameters
|
|
|
|
*/
|
|
|
|
void loadAcsParameters(AcsParameters *acsParameters_);
|
|
|
|
|
|
|
|
/* @brief: Calculates the needed torque for the pointing control mechanism
|
|
|
|
* @param: acsParameters_ Pointer to object which defines the ACS configuration parameters
|
|
|
|
*/
|
2022-11-04 17:21:17 +01:00
|
|
|
void ptgLaw(const double mode, const double *qError, const double *deltaRate,
|
2022-12-13 11:51:03 +01:00
|
|
|
const double *rwPseudoInv, double *torqueRws);
|
2022-10-12 15:06:24 +02:00
|
|
|
|
2022-11-03 10:43:27 +01:00
|
|
|
void ptgDesaturation(double *magFieldEst, bool magFieldEstValid, double *satRate,
|
2022-10-12 15:06:24 +02:00
|
|
|
int32_t *speedRw0, int32_t *speedRw1, int32_t *speedRw2, int32_t *speedRw3,
|
|
|
|
double *mgtDpDes);
|
|
|
|
|
|
|
|
void ptgNullspace(const int32_t *speedRw0, const int32_t *speedRw1, const int32_t *speedRw2,
|
|
|
|
const int32_t *speedRw3, double *rwTrqNs);
|
|
|
|
|
2022-11-08 13:48:50 +01:00
|
|
|
/* @brief: Commands the stiction torque in case wheel speed is to low
|
|
|
|
* @param: rwAvailable Boolean Flag for all reaction wheels
|
|
|
|
* omegaRw current wheel speed of reaction wheels
|
|
|
|
* torqueCommand modified torque after antistiction
|
|
|
|
*/
|
2022-12-13 11:51:03 +01:00
|
|
|
void rwAntistiction(const bool *rwAvailable, const int32_t *omegaRw, double *torqueCommand);
|
2022-11-08 13:48:50 +01:00
|
|
|
|
2022-10-12 15:06:24 +02:00
|
|
|
private:
|
|
|
|
AcsParameters::PointingModeControllerParameters *pointingModeControllerParameters;
|
|
|
|
AcsParameters::RwHandlingParameters *rwHandlingParameters;
|
|
|
|
AcsParameters::InertiaEIVE *inertiaEIVE;
|
|
|
|
AcsParameters::RwMatrices *rwMatrices;
|
2022-11-08 13:48:50 +01:00
|
|
|
|
|
|
|
double torqueMemory[4];
|
|
|
|
double omegaMemory[4];
|
2022-09-20 13:43:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* ACS_CONTROL_PTGCTRL_H_ */
|