Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Range finder kinematic consistency check #19340

Merged
merged 14 commits into from Apr 13, 2022
Merged

Conversation

bresch
Copy link
Member

@bresch bresch commented Mar 16, 2022

Describe problem solved by this pull request
It is quite common that range finders are reporting incorrect data due to clouds, water, LOS blockage (e.g.: when attaching a payload) or other malfunction of the sensor itself. In most of those issues, the sensor quality metric is not a reliable source of truth.

Describe your solution
A kinematic consistency check is done by comparing the time derivative of the vertical distance measurement ("vel_bottom") and the vertical velocity estimate of EKF2. An inconsistency is detected when the normalized innovation squared (NIS) is on average greater than a defined threshold.

When the data is said "inconsistent" it requires several conditions to be valid again:

  1. low averaged NIS for more than 1s
  2. low NIS
  3. significant vertical velocity

Test data / coverage
SITL testing for now

TODO:

  • logging

@bresch bresch added the EKF2 label Mar 16, 2022
@bresch bresch self-assigned this Mar 16, 2022
@bresch bresch marked this pull request as ready for review March 21, 2022 16:18
uint64_t _time_last_inconsistent_us{};

static constexpr float _vel_bottom_signed_test_ratio_tau = 2.f;
static constexpr float _vel_bottom_gate = 0.1f;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a small value for the gate. If this is what is required to achieve an acceptable false positive rate, then perhaps the process or observation noise values need to be tuned instead.

Copy link
Member Author

@bresch bresch Mar 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, in the log I was using to tune the gate, looking at the range finder derivative and its noise (based on range finder parameter noise), we can see that the range finder noise is over-sized.
DeepinScreenshot_select-area_20220323162211

Tuning a bit the static noise and range-based scaler (EKF2_RNG_NOISE = 0.01 (default = 0.1) and EKF2_RNG_SFE = 0.01 (default = 0.05)), we can now increase the gate to 1 to get a similar performance of the consistency check:
DeepinScreenshot_matplotlib_20220323164320

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@priseborough I increased the default gate size to 1 and added a note for the user in the parameter description in ad2ae35

@priseborough
Copy link
Contributor

The algorithm and its implementation look OK. We need some test data on physical hardware to validate the tuning as EKF vertical velocity errors caused by GPS and baro drift will need to be handled as will range finder noise when operating over long grass. I will check to see if I have a range finder hardware that is suitable for testing.

At each new valid range measurement, the time derivative of the distance
to the ground is computed and compared with the estimated velocity.
The average of a normalized innovation squared statistic check is used
to detect a bias in the derivative of distance measurement,
indicating that the distance measurements are kinematically inconsistent
with the filter.
To pass from invalid to valid:
- time hysteresis
- some vertical velocity
- test ratio < 1
- low-passed signed test ratio < 1

To pass from valid to invalid:
- low-passed signed test ratio >= 1
The check assumes a non-moving terrain height
The user needs to tune the range finder noise parameters properly and we
shouldn't need such a small gate
@bresch bresch merged commit 37cafe7 into master Apr 13, 2022
@bresch bresch deleted the pr-vel-bottom-consistency branch April 13, 2022 09:41
@DronecodeBot
Copy link

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/distance-sensor-faulty-readings-affecting-local-position-estimate-significantly-px4-v1-11-3/35924/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants