eive-obsw/mission/controller/acs/control/SafeCtrl.h

47 lines
1.6 KiB
C
Raw Normal View History

2022-09-20 13:46:42 +02:00
#ifndef SAFECTRL_H_
#define SAFECTRL_H_
#include <stdio.h>
2022-10-20 11:07:45 +02:00
#include <string.h>
2022-09-20 13:46:42 +02:00
#include <time.h>
2022-10-20 11:07:45 +02:00
#include "../AcsParameters.h"
#include "../SensorValues.h"
#include "eive/resultClassIds.h"
2022-09-20 13:46:42 +02:00
2022-10-20 11:07:45 +02:00
class SafeCtrl {
public:
SafeCtrl(AcsParameters *acsParameters_);
virtual ~SafeCtrl();
2022-09-20 13:46:42 +02:00
static const uint8_t INTERFACE_ID = CLASS_ID::ACS_SAFE;
2022-10-20 11:07:45 +02:00
static const ReturnValue_t SAFECTRL_MEKF_INPUT_INVALID = MAKE_RETURN_CODE(0x01);
2022-09-20 13:46:42 +02:00
ReturnValue_t safeMekf(timeval now, double *quatBJ, bool quatBJValid, double *magFieldModel,
bool magFieldModelValid, double *sunDirModel, bool sunDirModelValid,
double *satRateMekf, bool rateMekfValid, double *sunDirRef,
2022-10-20 11:07:45 +02:00
double *satRatRef, // From Guidance (!)
double *outputAngle, double *outputMagMomB);
2022-09-20 13:46:42 +02:00
2023-03-21 17:19:27 +01:00
ReturnValue_t safeNoMekf(const double *magneticFieldVector,
const double *magneticFieldVectorDerivative, const double *sunVector,
const double *sunvectorDerivative, double omegaRef,
double *torqueCommand, double *spinAxis);
double estimateRotationAroundSun(const double *magneticFieldVector,
const double *magneticFieldVectorDerivative,
const double *sunvector, bool *updated);
2022-09-20 13:46:42 +02:00
2022-10-20 11:07:45 +02:00
protected:
private:
2023-02-28 09:18:44 +01:00
AcsParameters *acsParameters;
2022-10-20 11:07:45 +02:00
double gainMatrixInertia[3][3];
2022-09-20 13:46:42 +02:00
2022-10-20 11:07:45 +02:00
double magFieldBState[3];
timeval magFieldBStateTime;
2023-03-21 17:19:27 +01:00
float lastCalculatedOmega = 0.0;
2022-09-20 13:46:42 +02:00
};
#endif /* ACS_CONTROL_SAFECTRL_H_ */