use more constants
Some checks are pending
EIVE/eive-obsw/pipeline/head This commit looks good
EIVE/eive-obsw/pipeline/pr-develop Build started...

This commit is contained in:
Robin Müller 2023-02-23 18:39:14 +01:00
parent 59b80807ba
commit 0907e8f5e5
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 21 additions and 29 deletions

View File

@ -433,15 +433,12 @@ ReturnValue_t AcsController::commandActuators(int16_t xDipole, int16_t yDipole,
}
void AcsController::updateActuatorCmdData(const int16_t *mtqTargetDipole) {
double rwTargetTorque[4] = {0.0, 0.0, 0.0, 0.0};
int32_t rwTargetSpeed[4] = {0, 0, 0, 0};
updateActuatorCmdData(rwTargetTorque, rwTargetSpeed, mtqTargetDipole);
updateActuatorCmdData(RW_OFF_TORQUE, RW_OFF_SPEED, mtqTargetDipole);
}
void AcsController::updateActuatorCmdData(const double *rwTargetTorque,
const int32_t *rwTargetSpeed,
const int16_t *mtqTargetDipole) {
{
PoolReadGuard pg(&actuatorCmdData);
if (pg.getReadResult() == returnvalue::OK) {
std::memcpy(actuatorCmdData.rwTargetTorque.value, rwTargetTorque, 4 * sizeof(double));
@ -450,7 +447,6 @@ void AcsController::updateActuatorCmdData(const double *rwTargetTorque,
actuatorCmdData.setValidity(true, true);
}
}
}
void AcsController::updateCtrlValData(double errAng) {
PoolReadGuard pg(&ctrlValData);
@ -466,7 +462,6 @@ void AcsController::updateCtrlValData(double errAng) {
}
void AcsController::updateCtrlValData(const double *tgtQuat, const double *errQuat, double errAng) {
{
PoolReadGuard pg(&ctrlValData);
if (pg.getReadResult() == returnvalue::OK) {
std::memcpy(ctrlValData.tgtQuat.value, tgtQuat, 4 * sizeof(double));
@ -475,21 +470,16 @@ void AcsController::updateCtrlValData(const double *tgtQuat, const double *errQu
ctrlValData.setValidity(true, true);
}
}
}
void AcsController::disableCtrlValData() {
double unitQuat[4] = {0, 0, 0, 1};
double errAng = 0;
{
PoolReadGuard pg(&ctrlValData);
if (pg.getReadResult() == returnvalue::OK) {
std::memcpy(ctrlValData.tgtQuat.value, unitQuat, 4 * sizeof(double));
std::memcpy(ctrlValData.errQuat.value, unitQuat, 4 * sizeof(double));
ctrlValData.errAng.value = errAng;
std::memcpy(ctrlValData.tgtQuat.value, UNIT_QUAT, 4 * sizeof(double));
std::memcpy(ctrlValData.errQuat.value, UNIT_QUAT, 4 * sizeof(double));
ctrlValData.errAng.value = 0;
ctrlValData.setValidity(false, true);
}
}
}
ReturnValue_t AcsController::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {

View File

@ -41,6 +41,8 @@ class AcsController : public ExtendedControllerBase, public ReceivesParameterMes
private:
static constexpr double UNIT_QUAT[4] = {0, 0, 0, 1};
static constexpr double RW_OFF_TORQUE[4] = {0.0, 0.0, 0.0, 0.0};
static constexpr int32_t RW_OFF_SPEED[4] = {0, 0, 0, 0};
AcsParameters acsParameters;
SensorProcessing sensorProcessing;