Skip to content

Commit

Permalink
EKF: range finder aiding logic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
priseborough committed May 7, 2018
1 parent 0c0a660 commit 24b005e
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions EKF/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -882,10 +882,9 @@ void Ekf::controlHeightFusion()
}
}

} else if (!_in_range_aid_mode && _baro_data_ready && !_baro_hgt_faulty) {
} else if (!_range_aid_mode_selected && _baro_data_ready && !_baro_hgt_faulty) {
setControlBaroHeight();
_fuse_height = true;
_range_aid_mode_enabled = false;

// we have just switched to using baro height, we don't need to set a height sensor offset
// since we track a separate _baro_hgt_offset
Expand All @@ -907,7 +906,6 @@ void Ekf::controlHeightFusion()
} else if (_control_status.flags.gps_hgt && _gps_data_ready && !_gps_hgt_faulty) {
// switch to gps if there was a reset to gps
_fuse_height = true;
_range_aid_mode_enabled = false;

// we have just switched to using gps height, calculate height sensor offset such that current
// measurment matches our current height estimate
Expand Down Expand Up @@ -969,10 +967,9 @@ void Ekf::controlHeightFusion()
}
}

} else if (!_in_range_aid_mode && _gps_data_ready && !_gps_hgt_faulty) {
} else if (!_range_aid_mode_selected && _gps_data_ready && !_gps_hgt_faulty) {
setControlGPSHeight();
_fuse_height = true;
_range_aid_mode_enabled = false;

// we have just switched to using gps height, calculate height sensor offset such that current
// measurment matches our current height estimate
Expand All @@ -983,7 +980,6 @@ void Ekf::controlHeightFusion()
} else if (_control_status.flags.baro_hgt && _baro_data_ready && !_baro_hgt_faulty) {
// switch to baro if there was a reset to baro
_fuse_height = true;
_range_aid_mode_enabled = false;

// we have just switched to using baro height, we don't need to set a height sensor offset
// since we track a separate _baro_hgt_offset
Expand All @@ -998,7 +994,6 @@ void Ekf::controlHeightFusion()
if (_control_status.flags.baro_hgt && _baro_data_ready && !_baro_hgt_faulty) {
// switch to baro if there was a reset to baro
_fuse_height = true;
_range_aid_mode_enabled = false;

// we have just switched to using baro height, we don't need to set a height sensor offset
// since we track a separate _baro_hgt_offset
Expand Down

0 comments on commit 24b005e

Please sign in to comment.