EKF: Enable fallback to baro alt when using range finder for height

This commit is contained in:
Paul Riseborough
2016-03-13 21:17:51 +11:00
parent 370f643f42
commit c58ab3e256
5 changed files with 52 additions and 20 deletions
+9
View File
@@ -96,6 +96,11 @@ void Ekf::resetHeight()
} else {
// TODO: reset to last known range based estimate
}
// reset the baro offset which is subtracted from the baro reading if we need to use it as a backup
baroSample baro_newest = _baro_buffer.get_newest();
_baro_hgt_offset = baro_newest.hgt + _state.pos(2);
} else if (_control_status.flags.baro_hgt) {
// initialize vertical position with newest baro measurement
baroSample baro_newest = _baro_buffer.get_newest();
@@ -106,6 +111,10 @@ void Ekf::resetHeight()
} else {
// TODO: reset to last known baro based estimate
}
// the baro height offset should be zero if baro is our primary height source
_baro_hgt_offset = 0.0f;
} else {
// TODO: reset to GPS height
}