Skip to content

Commit

Permalink
Update Kalman.h
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrouch authored Sep 7, 2024
1 parent c7a45ad commit c328db9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions bbn_wave_freq_m5atomS3/Kalman.h
Original file line number Diff line number Diff line change
Expand Up @@ -558,19 +558,27 @@ void kalman_init_process_noise(matrix_t *Q, float dt, float variance) {
void kalman_predict_x(register kalman_t *const kf) {
// matrices and vectors
const matrix_t *const A = &kf->F;
const matrix_t *const B = &kf->B;
matrix_t *const x = &kf->x;

matrix_t *const u = &kf->u;

// temporaries
matrix_t *const xpredicted = &kf->temporary.predicted_x;

/************************************************************************/
/* Predict next state using system dynamics */
/* x = A*x */
/* x = A*x + B*u */
/************************************************************************/

// x = A*x
matrix_mult_rowvector(A, x, xpredicted);
matrix_copy(xpredicted, x);

// x += B*u
if (kf->B.rows > 0) {
matrix_mult_rowvector(B, u, xpredicted);
matrix_add_inplace(x, xpredicted);
}
}

/*!
Expand Down

0 comments on commit c328db9

Please sign in to comment.