ekf2: correctly compute vel variance from flow variance

Co-authored-by: Marco Hauswirth <marco.hauswirth@auterion.com>
This commit is contained in:
bresch 2024-08-26 16:37:17 +02:00 committed by Daniel Agar
parent 1a4e8a7341
commit 9183c479a5

View File

@ -217,7 +217,9 @@ void Ekf::resetFlowFusion()
{
ECL_INFO("reset velocity to flow");
_information_events.flags.reset_vel_to_flow = true;
resetHorizontalVelocityTo(_flow_vel_ne, calcOptFlowMeasVar(_flow_sample_delayed));
const float flow_vel_var = sq(predictFlowRange()) * calcOptFlowMeasVar(_flow_sample_delayed);
resetHorizontalVelocityTo(_flow_vel_ne, flow_vel_var);
// reset position, estimate is relative to initial position in this mode, so we start with zero error
if (!_control_status.flags.in_air) {