enabled possibility to disable safe controller during eclipse
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
parent
13844bce65
commit
2af1735cfd
@ -28,6 +28,7 @@ enum SafeModeStrategy : uint8_t {
|
|||||||
SAFECTRL_ACTIVE_MEKF = 10,
|
SAFECTRL_ACTIVE_MEKF = 10,
|
||||||
SAFECTRL_WITHOUT_MEKF = 11,
|
SAFECTRL_WITHOUT_MEKF = 11,
|
||||||
SAFECTRL_ECLIPSE_DAMPING = 12,
|
SAFECTRL_ECLIPSE_DAMPING = 12,
|
||||||
|
SAFECTRL_ECLIPSE_IDELING = 13,
|
||||||
SAFECTRL_DETUMBLE_FULL = 20,
|
SAFECTRL_DETUMBLE_FULL = 20,
|
||||||
SAFECTRL_DETUMBLE_DETERIORATED = 21,
|
SAFECTRL_DETUMBLE_DETERIORATED = 21,
|
||||||
};
|
};
|
||||||
|
@ -172,7 +172,8 @@ void AcsController::performSafe() {
|
|||||||
double magMomMtq[3] = {0, 0, 0}, errAng = 0.0;
|
double magMomMtq[3] = {0, 0, 0}, errAng = 0.0;
|
||||||
uint8_t safeCtrlStrat = safeCtrl.safeCtrlStrategy(
|
uint8_t safeCtrlStrat = safeCtrl.safeCtrlStrategy(
|
||||||
mgmDataProcessed.mgmVecTot.isValid(), not mekfInvalidFlag,
|
mgmDataProcessed.mgmVecTot.isValid(), not mekfInvalidFlag,
|
||||||
gyrDataProcessed.gyrVecTot.isValid(), susDataProcessed.susVecTot.isValid());
|
gyrDataProcessed.gyrVecTot.isValid(), susDataProcessed.susVecTot.isValid(),
|
||||||
|
acsParameters.safeModeControllerParameters.dampingDuringEclipse);
|
||||||
switch (safeCtrlStrat) {
|
switch (safeCtrlStrat) {
|
||||||
case (acs::SafeModeStrategy::SAFECTRL_ACTIVE_MEKF):
|
case (acs::SafeModeStrategy::SAFECTRL_ACTIVE_MEKF):
|
||||||
safeCtrl.safeMekf(mgmDataProcessed.mgmVecTot.value, mekfData.satRotRateMekf.value,
|
safeCtrl.safeMekf(mgmDataProcessed.mgmVecTot.value, mekfData.satRotRateMekf.value,
|
||||||
@ -194,6 +195,10 @@ void AcsController::performSafe() {
|
|||||||
safeCtrlFailureFlag = false;
|
safeCtrlFailureFlag = false;
|
||||||
safeCtrlFailureCounter = 0;
|
safeCtrlFailureCounter = 0;
|
||||||
break;
|
break;
|
||||||
|
case (acs::SafeModeStrategy::SAFECTRL_ECLIPSE_IDELING):
|
||||||
|
safeCtrlFailureFlag = false;
|
||||||
|
safeCtrlFailureCounter = 0;
|
||||||
|
break;
|
||||||
case (acs::SafeModeStrategy::SAFECTRL_NO_MAG_FIELD_FOR_CONTROL):
|
case (acs::SafeModeStrategy::SAFECTRL_NO_MAG_FIELD_FOR_CONTROL):
|
||||||
safeCtrlFailure(1, 0);
|
safeCtrlFailure(1, 0);
|
||||||
break;
|
break;
|
||||||
|
@ -49,8 +49,9 @@ void PtgCtrl::ptgLaw(AcsParameters::PointingLawParameters *pointingLawParameters
|
|||||||
gainMatrixDiagonal[0][0] = gainVector[0];
|
gainMatrixDiagonal[0][0] = gainVector[0];
|
||||||
gainMatrixDiagonal[1][1] = gainVector[1];
|
gainMatrixDiagonal[1][1] = gainVector[1];
|
||||||
gainMatrixDiagonal[2][2] = gainVector[2];
|
gainMatrixDiagonal[2][2] = gainVector[2];
|
||||||
MatrixOperations<double>::multiply(
|
MatrixOperations<double>::multiply(*gainMatrixDiagonal,
|
||||||
*gainMatrixDiagonal, *(acsParameters->inertiaEIVE.inertiaMatrix), *gainMatrix, 3, 3, 3);
|
*(acsParameters->inertiaEIVE.inertiaMatrixDeployed),
|
||||||
|
*gainMatrix, 3, 3, 3);
|
||||||
|
|
||||||
// Inverse of gainMatrix
|
// Inverse of gainMatrix
|
||||||
double gainMatrixInverse[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
|
double gainMatrixInverse[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
|
||||||
@ -60,7 +61,7 @@ void PtgCtrl::ptgLaw(AcsParameters::PointingLawParameters *pointingLawParameters
|
|||||||
|
|
||||||
double pMatrix[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
|
double pMatrix[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
|
||||||
MatrixOperations<double>::multiply(
|
MatrixOperations<double>::multiply(
|
||||||
*gainMatrixInverse, *(acsParameters->inertiaEIVE.inertiaMatrix), *pMatrix, 3, 3, 3);
|
*gainMatrixInverse, *(acsParameters->inertiaEIVE.inertiaMatrixDeployed), *pMatrix, 3, 3, 3);
|
||||||
MatrixOperations<double>::multiplyScalar(*pMatrix, kInt, *pMatrix, 3, 3);
|
MatrixOperations<double>::multiplyScalar(*pMatrix, kInt, *pMatrix, 3, 3);
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
@ -85,7 +86,7 @@ void PtgCtrl::ptgLaw(AcsParameters::PointingLawParameters *pointingLawParameters
|
|||||||
|
|
||||||
// torque for rate error
|
// torque for rate error
|
||||||
double torqueRate[3] = {0, 0, 0};
|
double torqueRate[3] = {0, 0, 0};
|
||||||
MatrixOperations<double>::multiply(*(acsParameters->inertiaEIVE.inertiaMatrix), deltaRate,
|
MatrixOperations<double>::multiply(*(acsParameters->inertiaEIVE.inertiaMatrixDeployed), deltaRate,
|
||||||
torqueRate, 3, 3, 1);
|
torqueRate, 3, 3, 1);
|
||||||
VectorOperations<double>::mulScalar(torqueRate, cInt, torqueRate, 3);
|
VectorOperations<double>::mulScalar(torqueRate, cInt, torqueRate, 3);
|
||||||
VectorOperations<double>::mulScalar(torqueRate, -1, torqueRate, 3);
|
VectorOperations<double>::mulScalar(torqueRate, -1, torqueRate, 3);
|
||||||
@ -116,7 +117,7 @@ void PtgCtrl::ptgDesaturation(AcsParameters::PointingLawParameters *pointingLawP
|
|||||||
MatrixOperations<double>::multiply(*(acsParameters->rwMatrices.alignmentMatrix), momentumRwU,
|
MatrixOperations<double>::multiply(*(acsParameters->rwMatrices.alignmentMatrix), momentumRwU,
|
||||||
momentumRw, 3, 4, 1);
|
momentumRw, 3, 4, 1);
|
||||||
double momentumSat[3] = {0, 0, 0}, momentumTotal[3] = {0, 0, 0};
|
double momentumSat[3] = {0, 0, 0}, momentumTotal[3] = {0, 0, 0};
|
||||||
MatrixOperations<double>::multiply(*(acsParameters->inertiaEIVE.inertiaMatrix), satRate,
|
MatrixOperations<double>::multiply(*(acsParameters->inertiaEIVE.inertiaMatrixDeployed), satRate,
|
||||||
momentumSat, 3, 3, 1);
|
momentumSat, 3, 3, 1);
|
||||||
VectorOperations<double>::add(momentumSat, momentumRw, momentumTotal, 3);
|
VectorOperations<double>::add(momentumSat, momentumRw, momentumTotal, 3);
|
||||||
// calculating momentum error
|
// calculating momentum error
|
||||||
|
@ -10,15 +10,18 @@ SafeCtrl::SafeCtrl(AcsParameters *acsParameters_) { acsParameters = acsParameter
|
|||||||
SafeCtrl::~SafeCtrl() {}
|
SafeCtrl::~SafeCtrl() {}
|
||||||
|
|
||||||
uint8_t SafeCtrl::safeCtrlStrategy(const bool magFieldValid, const ReturnValue_t mekfValid,
|
uint8_t SafeCtrl::safeCtrlStrategy(const bool magFieldValid, const ReturnValue_t mekfValid,
|
||||||
const bool satRotRateValid, const bool sunDirValid) {
|
const bool satRotRateValid, const bool sunDirValid,
|
||||||
|
const uint8_t dampingEnabled) {
|
||||||
if (not magFieldValid) {
|
if (not magFieldValid) {
|
||||||
return acs::SafeModeStrategy::SAFECTRL_NO_MAG_FIELD_FOR_CONTROL;
|
return acs::SafeModeStrategy::SAFECTRL_NO_MAG_FIELD_FOR_CONTROL;
|
||||||
} else if (mekfValid) {
|
} else if (mekfValid) {
|
||||||
return acs::SafeModeStrategy::SAFECTRL_ACTIVE_MEKF;
|
return acs::SafeModeStrategy::SAFECTRL_ACTIVE_MEKF;
|
||||||
} else if (satRotRateValid and sunDirValid) {
|
} else if (satRotRateValid and sunDirValid) {
|
||||||
return acs::SafeModeStrategy::SAFECTRL_WITHOUT_MEKF;
|
return acs::SafeModeStrategy::SAFECTRL_WITHOUT_MEKF;
|
||||||
} else if (satRotRateValid and not sunDirValid) {
|
} else if (dampingEnabled and satRotRateValid and not sunDirValid) {
|
||||||
return acs::SafeModeStrategy::SAFECTRL_ECLIPSE_DAMPING;
|
return acs::SafeModeStrategy::SAFECTRL_ECLIPSE_DAMPING;
|
||||||
|
} else if (not dampingEnabled and satRotRateValid and not sunDirValid) {
|
||||||
|
return acs::SafeModeStrategy::SAFECTRL_ECLIPSE_IDELING;
|
||||||
} else {
|
} else {
|
||||||
return acs::SafeModeStrategy::SAFECTRL_NO_SENSORS_FOR_CONTROL;
|
return acs::SafeModeStrategy::SAFECTRL_NO_SENSORS_FOR_CONTROL;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,8 @@ class SafeCtrl {
|
|||||||
virtual ~SafeCtrl();
|
virtual ~SafeCtrl();
|
||||||
|
|
||||||
uint8_t safeCtrlStrategy(const bool magFieldValid, const ReturnValue_t mekfValid,
|
uint8_t safeCtrlStrategy(const bool magFieldValid, const ReturnValue_t mekfValid,
|
||||||
const bool satRotRateValid, const bool sunDirValid);
|
const bool satRotRateValid, const bool sunDirValid,
|
||||||
|
const uint8_t dampingEnabled);
|
||||||
|
|
||||||
void safeMekf(const double *magFieldB, const double *satRotRateB, const double *sunDirModelI,
|
void safeMekf(const double *magFieldB, const double *satRotRateB, const double *sunDirModelI,
|
||||||
const double *quatBI, const double *sunDirRefB, const double satRotRateRef,
|
const double *quatBI, const double *sunDirRefB, const double satRotRateRef,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user