Make correction step static

This commit is contained in:
Milo Priegnitz 2024-06-12 17:23:11 +02:00
parent 9b5b01908c
commit 570685b0bb
2 changed files with 2 additions and 2 deletions

View File

@ -78,7 +78,7 @@ public:
* @param R The measurement noise covariance matrix.
* @return The corrected state of the Kalman filter.
*/
KalmanState correct(KalmanState state, matrix z, matrix H, matrix R);
static KalmanState correct(KalmanState state, matrix z, matrix H, matrix R);
};
} // namespace math

View File

@ -60,7 +60,7 @@ KalmanState KalmanFilter::correct(KalmanState state, matrix z, matrix H, matrix
state.x = state.x + K * (z - H * state.x); //TODO check transpose
state.x.show_serial();
// Update the error covariance matrix
state.error = (identity_ - K * H) * state.error;
state.error = (matrix::eye(state.x.get_rows()) - K * H) * state.error;
return state;
}