2022-09-20 13:46:42 +02:00
|
|
|
/*
|
|
|
|
* safeCtrl.h
|
|
|
|
*
|
|
|
|
* Created on: 19 Apr 2022
|
|
|
|
* Author: rooob
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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 "../config/classIds.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
|
|
|
|
2022-10-20 11:07:45 +02:00
|
|
|
static const uint8_t INTERFACE_ID = CLASS_ID::SAFE;
|
|
|
|
static const ReturnValue_t SAFECTRL_MEKF_INPUT_INVALID = MAKE_RETURN_CODE(0x01);
|
2022-09-20 13:46:42 +02:00
|
|
|
|
2022-10-20 11:07:45 +02:00
|
|
|
void loadAcsParameters(AcsParameters *acsParameters_);
|
2022-09-20 13:46:42 +02:00
|
|
|
|
2022-11-03 10:43:27 +01: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 (!)
|
2022-11-03 10:43:27 +01:00
|
|
|
double *outputAngle, double *outputMagMomB, bool *outputValid);
|
2022-09-20 13:46:42 +02:00
|
|
|
|
2022-11-03 10:43:27 +01:00
|
|
|
void safeNoMekf(timeval now, double *susDirB, bool susDirBValid, double *sunRateB,
|
|
|
|
bool sunRateBValid, double *magFieldB, bool magFieldBValid, double *magRateB,
|
|
|
|
bool magRateBValid, double *sunDirRef, double *satRateRef, double *outputAngle,
|
|
|
|
double *outputMagMomB, bool *outputValid);
|
2022-09-20 13:46:42 +02:00
|
|
|
|
2022-10-20 11:07:45 +02:00
|
|
|
void idleSunPointing(); // with reaction wheels
|
2022-09-20 13:46:42 +02:00
|
|
|
|
2022-10-20 11:07:45 +02:00
|
|
|
protected:
|
|
|
|
private:
|
|
|
|
AcsParameters::SafeModeControllerParameters *safeModeControllerParameters;
|
|
|
|
AcsParameters::InertiaEIVE *inertiaEIVE;
|
|
|
|
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;
|
2022-09-20 13:46:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* ACS_CONTROL_SAFECTRL_H_ */
|