mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-25 00:30:50 +08:00
fix(sensors): skip baro GNSS offset without baro samples (#29634)
Backport of the baro change from #28943 to release/1.18: with a baro
publishing at or below SENS_BARO_RATE (e.g. DroneCAN baros), the 50 ms
backup run can reach the offset calibration with zero accumulated baro
samples, and the _data_sum_count division yields NaN that feeds the
baro-GNSS altitude offset LPF.
Guard the division the same way as on main (e6db1b3a14), adapted to
the release/1.18 subscription (_vehicle_gps_position_sub), which main
has since renamed to _vehicle_gnss_sub.
Assisted-by: GLM:glm-5.3-flash
Signed-off-by: jiakun <53556221+ddwolf87@users.noreply.github.com>
This commit is contained in:
1 parent
8c8de17ede
commit
fedc33bdea
1 file changed
+2
-1
@@ -490,7 +490,8 @@ bool VehicleAirData::BaroGNSSAltitudeOffset()
|
||||
|
||||
sensor_gps_s gps_pos;
|
||||
|
||||
if (!_vehicle_gps_position_sub.update(&gps_pos)) {
|
||||
// no baro samples accumulated yet, leave the GNSS sample for the next run
|
||||
if ((_data_sum_count[_selected_sensor_sub_index] == 0) || !_vehicle_gps_position_sub.update(&gps_pos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user