This commit is contained in:
Marius Eggert 2023-04-06 10:37:59 +02:00
parent 57b01a5d2c
commit 205a672680
4 changed files with 6 additions and 35 deletions

View File

@ -37,9 +37,6 @@ enum commonClassIds : uint8_t {
SUPV_RETURN_VALUES_IF, // SPVRTVIF
ACS_CTRL, // ACSCTRL
ACS_MEKF, // ACSMEKF
ACS_SAFE, // ACSSAF
ACS_PTG, // ACSPTG
ACS_DETUMBLE, // ACSDTB
SD_CARD_MANAGER, // SDMA
LOCAL_PARAM_HANDLER, // LPH
PERSISTENT_TM_STORE, // PTM

View File

@ -24,9 +24,6 @@ class PtgCtrl {
PtgCtrl(AcsParameters *acsParameters_);
virtual ~PtgCtrl();
static const uint8_t INTERFACE_ID = CLASS_ID::ACS_PTG;
static const ReturnValue_t PTGCTRL_MEKF_INPUT_INVALID = MAKE_RETURN_CODE(0x01);
/* @brief: Calculates the needed torque for the pointing control mechanism
*/
void ptgLaw(AcsParameters::PointingLawParameters *pointingLawParameters, const double *qError,

View File

@ -1,14 +1,10 @@
#include "SafeCtrl.h"
#include <fsfw/globalfunctions/constants.h>
#include <fsfw/globalfunctions/math/MatrixOperations.h>
#include <fsfw/globalfunctions/math/QuaternionOperations.h>
#include <fsfw/globalfunctions/math/VectorOperations.h>
#include <fsfw/globalfunctions/sign.h>
#include <math.h>
#include "../util/MathOperations.h"
SafeCtrl::SafeCtrl(AcsParameters *acsParameters_) { acsParameters = acsParameters_; }
SafeCtrl::~SafeCtrl() {}
@ -16,15 +12,15 @@ SafeCtrl::~SafeCtrl() {}
uint8_t SafeCtrl::safeCtrlStrategy(const bool magFieldValid, const ReturnValue_t mekfValid,
const bool satRotRateValid, const bool sunDirValid) {
if (not magFieldValid) {
return SafeModeStrategy::SAFECTRL_NO_MAG_FIELD_FOR_CONTROL;
return acs::SafeModeStrategy::SAFECTRL_NO_MAG_FIELD_FOR_CONTROL;
} else if (mekfValid) {
return SafeModeStrategy::SAFECTRL_USE_MEKF;
return acs::SafeModeStrategy::SAFECTRL_ACTIVE_MEKF;
} else if (satRotRateValid and sunDirValid) {
return SafeModeStrategy::SAFECTRL_USE_NONMEKF;
return acs::SafeModeStrategy::SAFECTRL_WITHOUT_MEKF;
} else if (satRotRateValid and not sunDirValid) {
return SafeModeStrategy::SAFECTRL_USE_DAMPING;
return acs::SafeModeStrategy::SAFECTRL_ECLIPSE_DAMPING;
} else {
return SafeModeStrategy::SAFECTRL_NO_SENSORS_FOR_CONTROL;
return acs::SafeModeStrategy::SAFECTRL_NO_SENSORS_FOR_CONTROL;
}
}

View File

@ -2,35 +2,16 @@
#define SAFECTRL_H_
#include <eive/resultClassIds.h>
#include <mission/acs/defs.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);
enum SafeModeStrategy : uint8_t {
SAFECTRL_OFF = 0,
SAFECTRL_NO_MAG_FIELD_FOR_CONTROL = 1,
SAFECTRL_NO_SENSORS_FOR_CONTROL = 2,
SAFECTRL_USE_MEKF = 10,
SAFECTRL_USE_NONMEKF = 11,
SAFECTRL_USE_DAMPING = 12,
};
uint8_t safeCtrlStrategy(const bool magFieldValid, const ReturnValue_t mekfValid,
const bool satRotRateValid, const bool sunDirValid);