Skip to content

Commit

Permalink
Use State::size in KF_orientation.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas committed Oct 20, 2024
1 parent b2bcc0c commit 62a692c
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace vision_target_estimator
void KF_orientation_unified::predictState(float dt)
{

matrix::SquareMatrix<float, 2> phi = getPhi(dt);
matrix::SquareMatrix<float, State::size> phi = getPhi(dt);
_state = phi * _state;

for (int i = 0; i < State::size; i++) {
Expand All @@ -59,7 +59,7 @@ void KF_orientation_unified::predictState(float dt)

void KF_orientation_unified::predictCov(float dt)
{
matrix::SquareMatrix<float, 2> phi = getPhi(dt);
matrix::SquareMatrix<float, State::size> phi = getPhi(dt);
_state_covariance = phi * _state_covariance * phi.transpose();
}

Expand All @@ -78,11 +78,11 @@ bool KF_orientation_unified::update()
return false;
}

const matrix::Matrix<float, 2, 1> kalmanGain = _state_covariance * _meas_matrix_row_vect / _innov_cov;
const matrix::Matrix<float, State::size, 1> kalmanGain = _state_covariance * _meas_matrix_row_vect / _innov_cov;

_state = _state + kalmanGain * _innov;

for (int i = 0; i < 2; i++) {
for (int i = 0; i < State::size; i++) {
_state(i) = matrix::wrap_pi(_state(i));
}

Expand All @@ -94,10 +94,10 @@ bool KF_orientation_unified::update()
void KF_orientation_unified::syncState(float dt)
{

matrix::SquareMatrix<float, 2> phi = getPhi(dt);
matrix::SquareMatrix<float, State::size> phi = getPhi(dt);
_sync_state = matrix::inv(phi) * _state;

for (int i = 0; i < 2; i++) {
for (int i = 0; i < State::size; i++) {
_sync_state(i) = matrix::wrap_pi(_sync_state(i));
}
}
Expand Down

0 comments on commit 62a692c

Please sign in to comment.