Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.

Critical wind estimation issue #399

Description

@CarlOlsson

Issue 1:

When a VTOL transitions into fixed wing flight airspeed and synthetic sideslip fusion are activated. However, this is done in different ways. Airspeed fusion is activated by the fact that ekf2_main starts to push airspeed data into ecl when the measurements are above 7 m/s, synthetic sideslip fusion on the other hand is activated by a flag being set in ekf2_main as soon as forward transition is finished.

This logic leads to the fact that ecl will always fuse beta before airspeed, hence initializing the wind states without airspeed measurements.

To test this, run standard_vtol in SITL, set EKF2_ARSP_THR to 7 and EKF2_FUSE_BETA to 1. Now the wind states will be initialized to zero.

Issue 2:

The issue documented above wouldn't be so critical if it wasn't for the following fact:
In the airspeed fusion logic the predicted measurement is the norm of the body velocity vector minus the wind speed. If ecl starts fusing airspeed when the wind states are zero, e.g. right after forward transition due to issue 1 above, the updated wind states are:

wind(k+1) = wind(k) - KalmanGain * innovation

wind(k) is zero and the innovation is

innovation = TAS_predicted - measurement = body_velocity_norm - measurment

Lets say that the airplane is moving straight north with a ground speed of 10 m/s and the airspeed sensor is measuring 12 m/s, I.e. the wind is actually -2 m/s.

The innovation is then -2 m/s and the wind

wind(k+1) = wind(k) - KalmanGain * innovation = 0 - KalmanGain * (-2) = 2 * KalmanGain

In this case the Kalman gain would be negative and the wind state would converge to -2 m/s, I.e. wind from the north.
normal_case

However, imagine the same situation but the VTOL airplane is taking off in a lot of wind. It is facing north during takeoff and performs the transition. However, due to the wind the horizontal north velocity is now slightly negative when the transition is finished and we start fusing airspeed and beta. The airspeed fusion is starting to fuse with wind states initialized to zero, due to issue 1.

wind(k+1) = wind(k) - KalmanGain * innovation

wind(k) is zero and the innovation is

innovation = TAS_predicted - measurement = body_velocity_norm - measurment

Lets say that the airplane is moving straight south (but heading north) with a ground speed of 3 m/s and the airspeed sensor is measuring 8 m/s, I.e. the wind is actually -11 m/s.

The innovation is then -5 m/s and the wind

wind(k+1) = wind(k) - KalmanGain * innovation = 0 - KalmanGain * (-5) = 5 * KalmanGain

In this case the Kalman gain is actually positive, leading to the wind states being estimated with the wrong sign and amplitude, I.e. the wind states are being estimated in the complete opposite direction of reality.
error_case

@priseborough I am happy to work on a fix for this, but would appreciate your inputs before I start implementing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions