this makes more sense

This commit is contained in:
Marius Eggert 2024-01-29 11:08:47 +01:00
parent 0064cf13cb
commit f7c997980c
5 changed files with 24 additions and 27 deletions

View File

@ -450,7 +450,7 @@ void AcsController::performPointingCtrl() {
bool allRwAvailable = true;
double rwPseudoInv[4][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
ReturnValue_t result = guidance.getDistributionMatrixRw(&sensorValues, *rwPseudoInv);
if (result == Guidance::MULTIPLE_RW_UNAVAILABLE) {
if (result == acsctrl::MULTIPLE_RW_UNAVAILABLE) {
if (multipleRwUnavailableCounter >=
acsParameters.rwHandlingParameters.multipleRwInvalidTimeout) {
triggerEvent(acs::MULTIPLE_RW_INVALID);
@ -460,7 +460,7 @@ void AcsController::performPointingCtrl() {
return;
}
multipleRwUnavailableCounter = 0;
if (result == Guidance::SINGLE_RW_UNAVAILABLE) {
if (result == acsctrl::SINGLE_RW_UNAVAILABLE) {
allRwAvailable = false;
}
@ -1087,7 +1087,7 @@ ReturnValue_t AcsController::writeTleToFs(const uint8_t *tle) {
tleFile << "\n";
tleFile.write(reinterpret_cast<const char *>(tle + 69), 69);
} else {
return WRITE_FILE_FAILED;
return acsctrl::WRITE_FILE_FAILED;
}
tleFile.close();
return returnvalue::OK;
@ -1111,12 +1111,12 @@ ReturnValue_t AcsController::readTleFromFs(uint8_t *line1, uint8_t *line2) {
std::memcpy(line2, tleLine2.c_str(), 69);
} else {
triggerEvent(acs::TLE_FILE_READ_FAILED);
return READ_FILE_FAILED;
return acsctrl::READ_FILE_FAILED;
}
tleFile.close();
} else {
triggerEvent(acs::TLE_FILE_READ_FAILED);
return READ_FILE_FAILED;
return acsctrl::READ_FILE_FAILED;
}
return returnvalue::OK;
}

View File

@ -108,16 +108,6 @@ class AcsController : public ExtendedControllerBase, public ReceivesParameterMes
static const DeviceCommandId_t UPDATE_TLE = 0x3;
static const DeviceCommandId_t READ_TLE = 0x4;
//! [EXPORT] : [COMMENT] File deletion failed and at least one file is still existent.
static constexpr ReturnValue_t FILE_DELETION_FAILED =
returnvalue::makeCode(acsctrl::IF_ACS_CTRL_ID, 0);
//! [EXPORT] : [COMMENT] Writing the TLE to the file has failed.
static constexpr ReturnValue_t WRITE_FILE_FAILED =
returnvalue::makeCode(acsctrl::IF_ACS_CTRL_ID, 1);
//! [EXPORT] : [COMMENT] Reading the TLE to the file has failed.
static constexpr ReturnValue_t READ_FILE_FAILED =
returnvalue::makeCode(acsctrl::IF_ACS_CTRL_ID, 2);
ReturnValue_t initialize() override;
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
void performControlOperation() override;

View File

@ -474,21 +474,21 @@ ReturnValue_t Guidance::getDistributionMatrixRw(ACS::SensorValues *sensorValues,
} else if (not rw1valid and rw2valid and rw3valid and rw4valid) {
std::memcpy(rwPseudoInv, acsParameters->rwMatrices.pseudoInverseWithoutRW1,
12 * sizeof(double));
return SINGLE_RW_UNAVAILABLE;
return acsctrl::SINGLE_RW_UNAVAILABLE;
} else if (rw1valid and not rw2valid and rw3valid and rw4valid) {
std::memcpy(rwPseudoInv, acsParameters->rwMatrices.pseudoInverseWithoutRW2,
12 * sizeof(double));
return SINGLE_RW_UNAVAILABLE;
return acsctrl::SINGLE_RW_UNAVAILABLE;
} else if (rw1valid and rw2valid and not rw3valid and rw4valid) {
std::memcpy(rwPseudoInv, acsParameters->rwMatrices.pseudoInverseWithoutRW3,
12 * sizeof(double));
return SINGLE_RW_UNAVAILABLE;
return acsctrl::SINGLE_RW_UNAVAILABLE;
} else if (rw1valid and rw2valid and rw3valid and not rw4valid) {
std::memcpy(rwPseudoInv, acsParameters->rwMatrices.pseudoInverseWithoutRW4,
12 * sizeof(double));
return SINGLE_RW_UNAVAILABLE;
return acsctrl::SINGLE_RW_UNAVAILABLE;
}
return MULTIPLE_RW_UNAVAILABLE;
return acsctrl::MULTIPLE_RW_UNAVAILABLE;
}
void Guidance::resetValues() { std::memcpy(quatIXprev, ZERO_VEC4, sizeof(quatIXprev)); }

View File

@ -65,13 +65,6 @@ class Guidance {
// reation wheel maybe can be done in "commanding.h"
ReturnValue_t getDistributionMatrixRw(ACS::SensorValues *sensorValues, double *rwPseudoInv);
//! [EXPORT] : [COMMENT] A single RW has failed.
static constexpr ReturnValue_t SINGLE_RW_UNAVAILABLE =
returnvalue::makeCode(acsctrl::IF_ACS_CTRL_ID, 3);
//! [EXPORT] : [COMMENT] Multiple RWs have failed.
static constexpr ReturnValue_t MULTIPLE_RW_UNAVAILABLE =
returnvalue::makeCode(acsctrl::IF_ACS_CTRL_ID, 4);
private:
const AcsParameters *acsParameters;

View File

@ -10,6 +10,20 @@
namespace acsctrl {
static const uint8_t IF_ACS_CTRL_ID = CLASS_ID::ACS_CTRL;
//! [EXPORT] : [COMMENT] File deletion failed and at least one file is still existent.
static constexpr ReturnValue_t FILE_DELETION_FAILED =
returnvalue::makeCode(acsctrl::IF_ACS_CTRL_ID, 0);
//! [EXPORT] : [COMMENT] Writing the TLE to the file has failed.
static constexpr ReturnValue_t WRITE_FILE_FAILED =
returnvalue::makeCode(acsctrl::IF_ACS_CTRL_ID, 1);
//! [EXPORT] : [COMMENT] Reading the TLE to the file has failed.
static constexpr ReturnValue_t READ_FILE_FAILED = returnvalue::makeCode(acsctrl::IF_ACS_CTRL_ID, 2);
//! [EXPORT] : [COMMENT] A single RW has failed.
static constexpr ReturnValue_t SINGLE_RW_UNAVAILABLE =
returnvalue::makeCode(acsctrl::IF_ACS_CTRL_ID, 3);
//! [EXPORT] : [COMMENT] Multiple RWs have failed.
static constexpr ReturnValue_t MULTIPLE_RW_UNAVAILABLE =
returnvalue::makeCode(acsctrl::IF_ACS_CTRL_ID, 4);
enum SetIds : uint32_t {
MGM_SENSOR_DATA,