mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-08-01 20:27:57 +08:00
FlightTask: Fix ekf2 reset race condition during task switch (#14692)
* FlightTask: Fix ekf2 reset race condition during task switch During a loss of GPS data when using GPS as primary height source, the height is reset to baro and the local position gets invalid at the same time. This triggers a switch to altitude flight task and a setpoint reset. This combination of events had the effect to ignore the height reset, the large sudden height error could create an abrupt change of altitude or even a crash. The ekf2 reset is now done at the beginning of each update call.
This commit is contained in:
committed by
GitHub
parent
e82880d6d7
commit
be2bb4a479
@@ -49,6 +49,7 @@ bool FlightTaskAutoMapper::activate(vehicle_local_position_setpoint_s last_setpo
|
||||
|
||||
bool FlightTaskAutoMapper::update()
|
||||
{
|
||||
bool ret = FlightTaskAuto::update();
|
||||
// always reset constraints because they might change depending on the type
|
||||
_setDefaultConstraints();
|
||||
|
||||
@@ -107,7 +108,7 @@ bool FlightTaskAutoMapper::update()
|
||||
// update previous type
|
||||
_type_previous = _type;
|
||||
|
||||
return true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void FlightTaskAutoMapper::_reset()
|
||||
|
||||
Reference in New Issue
Block a user