Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
EKF: fix indexing bug (#387)
Browse files Browse the repository at this point in the history
Should use index 9 for vertical position.
  • Loading branch information
priseborough committed Jan 29, 2018
1 parent 4f3b97a commit cd95d0e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion EKF/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ void Ekf::controlHeightSensorTimeouts()
baroSample baro_init = _baro_buffer.get_newest();
bool baro_data_fresh = ((_time_last_imu - baro_init.time_us) < 2 * BARO_MAX_INTERVAL);
float baro_innov = _state.pos(2) - (_hgt_sensor_offset - baro_init.hgt + _baro_hgt_offset);
bool baro_data_consistent = fabsf(baro_innov) < (sq(_params.baro_noise) + P[8][8]) * sq(_params.baro_innov_gate);
bool baro_data_consistent = fabsf(baro_innov) < (sq(_params.baro_noise) + P[9][9]) * sq(_params.baro_innov_gate);

// if baro data is acceptable and GPS data is inaccurate, reset height to baro
bool reset_to_baro = baro_data_consistent && baro_data_fresh && !_baro_hgt_faulty && !gps_hgt_accurate;
Expand Down

0 comments on commit cd95d0e

Please sign in to comment.