#ifndef SAFECTRL_H_ #define SAFECTRL_H_ #include #include #include #include #include class SafeCtrl { public: SafeCtrl(AcsParameters *acsParameters_); virtual ~SafeCtrl(); uint8_t safeCtrlStrategy(const bool magFieldValid, const ReturnValue_t mekfValid, const bool satRotRateValid, const bool sunDirValid); void safeMekf(const double *magFieldB, const double *satRotRateB, const double *sunDirModelI, const double *quatBI, const double *sunDirRefB, const double satRotRateRef, const double inertiaMatrix[3][3], double *magMomB, double &errorAngle); void safeNonMekf(const double *magFieldB, const double *satRotRateB, const double *sunDirB, const double *sunDirRefB, const double satRotRateRef, const double inertiaMatrix[3][3], double *magMomB, double &errorAngle); void safeRateDamping(const double *magFieldB, const double *satRotRateB, const double satRotRateRef, const double *sunDirRefB, double *magMomB, double &errorAngle); void splitRotationalRate(const double *satRotRateB, const double *sunDirB); void calculateRotationalRateTorque(const double satRotRateRef, const double *sunDirB, const double *sunDirRefB, double &errorAngle, const double gainParallel, const double gainOrtho); void calculateAngleErrorTorque(const double *sunDirB, const double *sunDirRefB, const double gainAlign, const double inertiaMatrix[3][3]); void calculateMagneticMoment(double *magMomB); protected: private: AcsParameters *acsParameters; double magFieldBT[3] = {0, 0, 0}; double satRotRateParallelB[3] = {0, 0, 0}; double satRotRateOrthogonalB[3] = {0, 0, 0}; double cmdParallel[3] = {0, 0, 0}; double cmdOrtho[3] = {0, 0, 0}; double cmdAlign[3] = {0, 0, 0}; double cmdTorque[3] = {0, 0, 0}; }; #endif /* ACS_CONTROL_SAFECTRL_H_ */