eive-obsw/mission/controller/acs/control/SafeCtrl.h
meggert 9d8dfdfd4f
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
nearly there
2023-03-24 11:35:46 +01:00

44 lines
1.8 KiB
C++

#ifndef SAFECTRL_H_
#define SAFECTRL_H_
#include <eive/resultClassIds.h>
#include <mission/controller/acs/AcsParameters.h>
#include <mission/controller/acs/SensorValues.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
class SafeCtrl {
public:
SafeCtrl(AcsParameters *acsParameters_);
virtual ~SafeCtrl();
static constexpr uint8_t IF_SAFE_ID = CLASS_ID::ACS_SAFE;
static constexpr ReturnValue_t SAFECTRL_NO_MAG_FIELD_FOR_CONTROL =
returnvalue::makeCode(IF_SAFE_ID, 2);
static constexpr ReturnValue_t SAFECTRL_USE_MEKF = returnvalue::makeCode(IF_SAFE_ID, 3);
static constexpr ReturnValue_t SAFECTRL_USE_NONMEKF = returnvalue::makeCode(IF_SAFE_ID, 4);
static constexpr ReturnValue_t SAFECTRL_USE_DAMPING = returnvalue::makeCode(IF_SAFE_ID, 5);
static constexpr ReturnValue_t SAFECTRL_NO_SENSORS_FOR_CONTROL =
returnvalue::makeCode(IF_SAFE_ID, 6);
ReturnValue_t safeCtrlStrategy(const bool magFieldValid, const ReturnValue_t mekfValid,
const bool satRotRateValid, const bool sunDirValid);
ReturnValue_t safeMekf(timeval now, double *quatBJ, bool quatBJValid, double *magFieldModel,
bool magFieldModelValid, double *sunDirModel, bool sunDirModelValid,
double *satRateMekf, bool rateMekfValid, double *sunDirRef,
double *satRatRef, // From Guidance (!)
double *outputAngle, double *outputMagMomB);
void safeNoMekf(const double *magFieldB, const double *satRotRateB, const double *sunDirB,
const double *sunDirRefB, const double *satRotRateRefB, double *magMomB,
double &errorAngle);
protected:
private:
AcsParameters *acsParameters;
};
#endif /* ACS_CONTROL_SAFECTRL_H_ */