Skip to content

Commit

Permalink
ekf2-rng-kin: allow invalidating at any vertical speed
Browse files Browse the repository at this point in the history
The issue is that when the HAGL is low, the drone will usually
decelerate and then the check would run anymore. If the low HAGL
estimate is due to bad sensor readings (e.g.: reflections), it will be
stuck in that state.
  • Loading branch information
bresch committed Nov 1, 2024
1 parent e8f8bc9 commit 6abbeb6
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,15 @@ void RangeFinderConsistencyCheck::update(float dist_bottom, float dist_bottom_va

void RangeFinderConsistencyCheck::updateConsistency(float vz, uint64_t time_us)
{
if (fabsf(vz) < _min_vz_for_valid_consistency) {
// We can only check consistency if there is vertical motion
return;
}

if (fabsf(_signed_test_ratio_lpf.getState()) >= 1.f) {
if ((time_us - _time_last_horizontal_motion) > _signed_test_ratio_tau) {
_is_kinematically_consistent = false;
_time_last_inconsistent_us = time_us;
}

} else {
if ((_test_ratio < 1.f)
if ((fabsf(vz) < _min_vz_for_valid_consistency)
&& (_test_ratio < 1.f)
&& ((time_us - _time_last_inconsistent_us) > _consistency_hyst_time_us)
) {
_is_kinematically_consistent = true;
Expand Down

0 comments on commit 6abbeb6

Please sign in to comment.