Skip to content

Commit

Permalink
Remove dangerous _primary_hgt_source variable
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilritz authored and bresch committed Dec 11, 2019
1 parent 66f707e commit 042d9b6
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 7 deletions.
5 changes: 0 additions & 5 deletions EKF/ekf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,6 @@ bool Ekf::initialiseFilter()
}
}

// set the default height source from the adjustable parameter
if (_hgt_counter == 0) {
_primary_hgt_source = _params.vdist_sensor_type;
}

// accumulate enough height measurements to be confident in the quality of the data
// we use baro height initially and switch to GPS/range/EV finder later when it passes checks.
if (_baro_buffer.pop_first_older_than(_imu_sample_delayed.time_us, &_baro_sample_delayed)) {
Expand Down
1 change: 0 additions & 1 deletion EKF/ekf.h
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,6 @@ class Ekf : public EstimatorInterface
bool _baro_hgt_faulty{false}; ///< true if valid baro data is unavailable for use
bool _gps_hgt_intermittent{false}; ///< true if gps height into the buffer is intermittent
bool _rng_hgt_valid{false}; ///< true if range finder sample retrieved from buffer is valid
int _primary_hgt_source{VDIST_SENSOR_BARO}; ///< specifies primary source of height data
uint64_t _time_bad_rng_signal_quality{0}; ///< timestamp at which range finder signal quality was 0 (used for hysteresis)

// imu fault status
Expand Down
2 changes: 1 addition & 1 deletion EKF/gps_checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ bool Ekf::collect_gps(const gps_message &gps)
_gps_origin_epv = gps.epv;

// if the user has selected GPS as the primary height source, switch across to using it
if (_primary_hgt_source == VDIST_SENSOR_GPS) {
if (_params.vdist_sensor_type == VDIST_SENSOR_GPS) {
ECL_INFO_TIMESTAMPED("EKF GPS checks passed (WGS-84 origin set, using GPS height)");
_control_status.flags.baro_hgt = false;
_control_status.flags.gps_hgt = true;
Expand Down

0 comments on commit 042d9b6

Please sign in to comment.