Files
PX4-Autopilot/src
Eurus dad1889610 fix(ekf2): guard EV position bias updates on active fusion (#27304)
* EKF2: guard EV position bias updates on active fusion

Horizontal position resets were updating the external vision position bias
estimator even when EV position fusion was not active.

This is the same bug pattern as #27094. In resetAltitudeTo(), the height bias
estimators are only shifted when the corresponding height source is currently
being fused, for example _ev_hgt_b_est is updated only when
_control_status.flags.ev_hgt is true. That guard prevents an inactive EV height
bias estimator from being modified by an EKF state reset.

The horizontal reset paths did not have the equivalent guard. Both
resetHorizontalPositionTo() and resetLatLonTo() unconditionally applied
delta_horz_pos to _ev_pos_b_est. However, controlEvPosFusion() treats
_control_status.flags.ev_pos as the active EV position fusion state, and the
position observation is later computed as:

  measurement - _ev_pos_b_est.getBias()

This means a horizontal position reset from another source could shift the EV
position bias estimator while EV position fusion was inactive. When EV position
fusion later resumed, the stale shifted bias could be used in the EV observation
path and produce incorrect innovations.

Only update _ev_pos_b_est during horizontal resets when EV position fusion is
currently active, matching the guarded resetAltitudeTo() behavior fixed by

* Update src/modules/ekf2/EKF/position_fusion.cpp

Co-authored-by: Jacob Dahl <37091262+dakejahl@users.noreply.github.com>

---------

Co-authored-by: Jacob Dahl <37091262+dakejahl@users.noreply.github.com>
2026-05-09 23:30:32 -06:00
..