diff --git a/src/filter/kalman.c b/src/filter/kalman.c index fd89333b..dab59a62 100644 --- a/src/filter/kalman.c +++ b/src/filter/kalman.c @@ -84,9 +84,9 @@ void update_kalman_covariance(volatile axisData_t *gyroRateData) arm_sqrt_f32(varStruct.yVar * varStruct.zVar, &squirt); varStruct.yzCorrelation = varStruct.xyCoVar/squirt; - kalmanFilterStateRate[ROLL].r = ABS((varStruct.xMean + (varStruct.yMean * varStruct.xyCorrelation) + (varStruct.zMean * varStruct.xyCorrelation)) * VARIANCE_SCALE; - kalmanFilterStateRate[PITCH].r = ABS((varStruct.yMean + (varStruct.xMean * varStruct.xyCorrelation) + (varStruct.zMean * varStruct.yzCorrelation)) * VARIANCE_SCALE; - kalmanFilterStateRate[YAW].r = ABS((varStruct.zMean + (varStruct.yMean * varStruct.yzCorrelation) + (varStruct.xMean * varStruct.xzCorrelation)) * VARIANCE_SCALE; + kalmanFilterStateRate[ROLL].r = ABS((varStruct.xMean + (varStruct.yMean * varStruct.xyCorrelation) + (varStruct.zMean * varStruct.xyCorrelation))) * VARIANCE_SCALE; + kalmanFilterStateRate[PITCH].r = ABS((varStruct.yMean + (varStruct.xMean * varStruct.xyCorrelation) + (varStruct.zMean * varStruct.yzCorrelation))) * VARIANCE_SCALE; + kalmanFilterStateRate[YAW].r = ABS((varStruct.zMean + (varStruct.yMean * varStruct.yzCorrelation) + (varStruct.xMean * varStruct.xzCorrelation))) * VARIANCE_SCALE; } inline float kalman_process(kalman_t* kalmanState, volatile float input, volatile float accReading) {