mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-03 02:01:35 +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:
@@ -42,8 +42,9 @@ using namespace matrix;
|
||||
|
||||
bool FlightTaskAutoFollowMe::update()
|
||||
{
|
||||
bool ret = FlightTaskAuto::update();
|
||||
_position_setpoint = _target;
|
||||
matrix::Vector2f vel_sp = _getTargetVelocityXY();
|
||||
_velocity_setpoint = matrix::Vector3f(vel_sp(0), vel_sp(1), 0.0f);
|
||||
return true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user