fill collection sets before executing acsctrl and actually use tgtRotRate in ctrlValData
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
e349bb8a7f
commit
d671de7efb
@ -79,6 +79,25 @@ void AcsController::performControlOperation() {
|
|||||||
#if OBSW_THREAD_TRACING == 1
|
#if OBSW_THREAD_TRACING == 1
|
||||||
trace::threadTrace(opCounter, "ACS & TCS PST");
|
trace::threadTrace(opCounter, "ACS & TCS PST");
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
PoolReadGuard pg(&mgmDataRaw);
|
||||||
|
if (pg.getReadResult() == returnvalue::OK) {
|
||||||
|
copyMgmData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
PoolReadGuard pg(&susDataRaw);
|
||||||
|
if (pg.getReadResult() == returnvalue::OK) {
|
||||||
|
copySusData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
PoolReadGuard pg(&gyrDataRaw);
|
||||||
|
if (pg.getReadResult() == returnvalue::OK) {
|
||||||
|
copyGyrData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (internalState) {
|
switch (internalState) {
|
||||||
case InternalState::STARTUP: {
|
case InternalState::STARTUP: {
|
||||||
initialCountdown.resetTimer();
|
initialCountdown.resetTimer();
|
||||||
@ -114,25 +133,6 @@ void AcsController::performControlOperation() {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
PoolReadGuard pg(&mgmDataRaw);
|
|
||||||
if (pg.getReadResult() == returnvalue::OK) {
|
|
||||||
copyMgmData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
PoolReadGuard pg(&susDataRaw);
|
|
||||||
if (pg.getReadResult() == returnvalue::OK) {
|
|
||||||
copySusData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
PoolReadGuard pg(&gyrDataRaw);
|
|
||||||
if (pg.getReadResult() == returnvalue::OK) {
|
|
||||||
copyGyrData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AcsController::performSafe() {
|
void AcsController::performSafe() {
|
||||||
@ -415,7 +415,7 @@ void AcsController::performPointingCtrl() {
|
|||||||
sensorValues.rw4Set.currSpeed.value, torqueRwsScaled, cmdSpeedRws);
|
sensorValues.rw4Set.currSpeed.value, torqueRwsScaled, cmdSpeedRws);
|
||||||
actuatorCmd.cmdDipolMtq(mgtDpDes, cmdDipolMtqs);
|
actuatorCmd.cmdDipolMtq(mgtDpDes, cmdDipolMtqs);
|
||||||
|
|
||||||
updateCtrlValData(targetQuat, errorQuat, errorAngle);
|
updateCtrlValData(targetQuat, errorQuat, errorAngle, targetSatRotRate);
|
||||||
updateActuatorCmdData(rwTrqNs, cmdSpeedRws, cmdDipolMtqs);
|
updateActuatorCmdData(rwTrqNs, cmdSpeedRws, cmdDipolMtqs);
|
||||||
// commandActuators(cmdDipolMtqs[0], cmdDipolMtqs[1], cmdDipolMtqs[2],
|
// commandActuators(cmdDipolMtqs[0], cmdDipolMtqs[1], cmdDipolMtqs[2],
|
||||||
// acsParameters.magnetorquesParameter.torqueDuration, cmdSpeedRws[0],
|
// acsParameters.magnetorquesParameter.torqueDuration, cmdSpeedRws[0],
|
||||||
@ -477,16 +477,20 @@ void AcsController::updateCtrlValData(double errAng) {
|
|||||||
ctrlValData.errQuat.setValid(false);
|
ctrlValData.errQuat.setValid(false);
|
||||||
ctrlValData.errAng.value = errAng;
|
ctrlValData.errAng.value = errAng;
|
||||||
ctrlValData.errAng.setValid(true);
|
ctrlValData.errAng.setValid(true);
|
||||||
|
std::memcpy(ctrlValData.tgtRotRate.value, ZERO_VEC, 3 * sizeof(double));
|
||||||
|
ctrlValData.tgtRotRate.setValid(false);
|
||||||
ctrlValData.setValidity(true, false);
|
ctrlValData.setValidity(true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AcsController::updateCtrlValData(const double *tgtQuat, const double *errQuat, double errAng) {
|
void AcsController::updateCtrlValData(const double *tgtQuat, const double *errQuat, double errAng,
|
||||||
|
const double *tgtRotRate) {
|
||||||
PoolReadGuard pg(&ctrlValData);
|
PoolReadGuard pg(&ctrlValData);
|
||||||
if (pg.getReadResult() == returnvalue::OK) {
|
if (pg.getReadResult() == returnvalue::OK) {
|
||||||
std::memcpy(ctrlValData.tgtQuat.value, tgtQuat, 4 * sizeof(double));
|
std::memcpy(ctrlValData.tgtQuat.value, tgtQuat, 4 * sizeof(double));
|
||||||
std::memcpy(ctrlValData.errQuat.value, errQuat, 4 * sizeof(double));
|
std::memcpy(ctrlValData.errQuat.value, errQuat, 4 * sizeof(double));
|
||||||
ctrlValData.errAng.value = errAng;
|
ctrlValData.errAng.value = errAng;
|
||||||
|
std::memcpy(ctrlValData.tgtRotRate.value, tgtRotRate, 3 * sizeof(double));
|
||||||
ctrlValData.setValidity(true, true);
|
ctrlValData.setValidity(true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -497,6 +501,7 @@ void AcsController::disableCtrlValData() {
|
|||||||
std::memcpy(ctrlValData.tgtQuat.value, UNIT_QUAT, 4 * sizeof(double));
|
std::memcpy(ctrlValData.tgtQuat.value, UNIT_QUAT, 4 * sizeof(double));
|
||||||
std::memcpy(ctrlValData.errQuat.value, UNIT_QUAT, 4 * sizeof(double));
|
std::memcpy(ctrlValData.errQuat.value, UNIT_QUAT, 4 * sizeof(double));
|
||||||
ctrlValData.errAng.value = 0;
|
ctrlValData.errAng.value = 0;
|
||||||
|
std::memcpy(ctrlValData.tgtRotRate.value, ZERO_VEC, 3 * sizeof(double));
|
||||||
ctrlValData.setValidity(false, true);
|
ctrlValData.setValidity(false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ class AcsController : public ExtendedControllerBase, public ReceivesParameterMes
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr double UNIT_QUAT[4] = {0, 0, 0, 1};
|
static constexpr double UNIT_QUAT[4] = {0, 0, 0, 1};
|
||||||
|
static constexpr double ZERO_VEC[3] = {0, 0, 0};
|
||||||
static constexpr double RW_OFF_TORQUE[4] = {0.0, 0.0, 0.0, 0.0};
|
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};
|
static constexpr int32_t RW_OFF_SPEED[4] = {0, 0, 0, 0};
|
||||||
|
|
||||||
@ -102,7 +103,8 @@ class AcsController : public ExtendedControllerBase, public ReceivesParameterMes
|
|||||||
void updateActuatorCmdData(const double* rwTargetTorque, const int32_t* rwTargetSpeed,
|
void updateActuatorCmdData(const double* rwTargetTorque, const int32_t* rwTargetSpeed,
|
||||||
const int16_t* mtqTargetDipole);
|
const int16_t* mtqTargetDipole);
|
||||||
void updateCtrlValData(double errAng);
|
void updateCtrlValData(double errAng);
|
||||||
void updateCtrlValData(const double* tgtQuat, const double* errQuat, double errAng);
|
void updateCtrlValData(const double* tgtQuat, const double* errQuat, double errAng,
|
||||||
|
const double* tgtRotRate);
|
||||||
void disableCtrlValData();
|
void disableCtrlValData();
|
||||||
|
|
||||||
/* ACS Sensor Values */
|
/* ACS Sensor Values */
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "util/CholeskyDecomposition.h"
|
#include "util/CholeskyDecomposition.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user