ekf2: setEkfGlobalOrigin() reset baro and hgt sensor offsets if necessary

- handle uninitalized _gps_alt_ref
 - add basic lat/lon/alt sanity checks
This commit is contained in:
Daniel Agar
2022-06-16 00:59:54 -04:00
committed by GitHub
parent fc3d88bb67
commit 1980b5c5e8
5 changed files with 71 additions and 44 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ void Ekf::updateGpsPos(const gpsSample &gps_sample)
position(1) = gps_sample.pos(1);
// vertical position - gps measurement has opposite sign to earth z axis
position(2) = -(gps_sample.hgt - _gps_alt_ref - _gps_hgt_offset);
position(2) = -(gps_sample.hgt - getEkfGlobalOriginAltitude() - _gps_hgt_offset);
const float lower_limit = fmaxf(_params.gps_pos_noise, 0.01f);