Fix MEKF Inits #896

Merged
muellerr merged 6 commits from fix-mekf-inits into main 2024-05-29 10:12:36 +02:00
Showing only changes of commit 6025ea5663 - Show all commits

View File

@ -114,12 +114,12 @@ ReturnValue_t MultiplicativeKalmanFilter::mekfEst(
return result;
}
double measSensMatrix[matrixDimensionFactor][6] = {{0}},
measCovMatrix[matrixDimensionFactor][matrixDimensionFactor] = {{0}},
measVec[matrixDimensionFactor] = {0}, estVec[matrixDimensionFactor] = {0};
double measSensMatrix[matrixDimensionFactor][6] = {},
measCovMatrix[matrixDimensionFactor][matrixDimensionFactor] = {},
measVec[matrixDimensionFactor] = {}, estVec[matrixDimensionFactor] = {};
kfUpdate(susData, mgmData, *measSensMatrix, *measCovMatrix, measVec, estVec);
double kalmanGain[6][matrixDimensionFactor] = {{0}};
double kalmanGain[6][matrixDimensionFactor] = {};
result = kfGain(*measSensMatrix, *measCovMatrix, *kalmanGain, attitudeEstimationData);
if (result != returnvalue::OK) {
reset(attitudeEstimationData);
@ -342,10 +342,10 @@ ReturnValue_t MultiplicativeKalmanFilter::kfGain(
double *measSensMatrix, double *measCovMatrix, double *kalmanGain,
acsctrl::AttitudeEstimationData *attitudeEstimationData) {
// Kalman Gain: K = P * H' / (H * P * H' + R)
double kalmanGainDen[matrixDimensionFactor][matrixDimensionFactor] = {{0}},
invKalmanGainDen[matrixDimensionFactor][matrixDimensionFactor] = {{0}},
residualCov[6][matrixDimensionFactor] = {{0}},
measSensMatrixTransposed[6][matrixDimensionFactor] = {{0}};
double kalmanGainDen[matrixDimensionFactor][matrixDimensionFactor] = {},
invKalmanGainDen[matrixDimensionFactor][matrixDimensionFactor] = {},
residualCov[6][matrixDimensionFactor] = {},
measSensMatrixTransposed[6][matrixDimensionFactor] = {};
MatrixOperations<double>::transpose(measSensMatrix, *measSensMatrixTransposed,
matrixDimensionFactor, 6);
@ -383,7 +383,7 @@ void MultiplicativeKalmanFilter::kfCovAposteriori(double *kalmanGain, double *me
void MultiplicativeKalmanFilter::kfStateAposteriori(double *kalmanGain, double *measVec,
double *estVec) {
double stateVecErr[6] = {0, 0, 0, 0, 0, 0};
double plantOutputDiff[matrixDimensionFactor] = {0};
double plantOutputDiff[matrixDimensionFactor] = {};
VectorOperations<double>::subtract(measVec, estVec, plantOutputDiff, matrixDimensionFactor);
MatrixOperations<double>::multiply(kalmanGain, plantOutputDiff, stateVecErr, 6,
matrixDimensionFactor, 1);