Browse Source

HTE: relax validity condition when already valid (#17783)

The condition to get valid requires a low variance and test ratio. but
to stay valid, only the variance is required.

Co-authored-by: Daniel Agar <daniel@agar.ca>
release/1.12
Mathieu Bresciani 4 years ago committed by GitHub
parent
commit
9cedb169fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      src/modules/mc_hover_thrust_estimator/MulticopterHoverThrustEstimator.cpp

9
src/modules/mc_hover_thrust_estimator/MulticopterHoverThrustEstimator.cpp

@ -172,8 +172,13 @@ void MulticopterHoverThrustEstimator::Run() @@ -172,8 +172,13 @@ void MulticopterHoverThrustEstimator::Run()
_hover_thrust_ekf.fuseAccZ(-local_pos.az, -local_pos_sp.thrust[2]);
}
const bool valid = (_hover_thrust_ekf.getHoverThrustEstimateVar() < 0.001f)
&& (_hover_thrust_ekf.getInnovationTestRatio() < 1.f);
bool valid = (_hover_thrust_ekf.getHoverThrustEstimateVar() < 0.001f);
// The test ratio does not need to pass all the time to have a valid estimate
if (!_valid) {
valid = valid && (_hover_thrust_ekf.getInnovationTestRatio() < 1.f);
}
_valid_hysteresis.set_state_and_update(valid, local_pos.timestamp);
_valid = _valid_hysteresis.get_state();

Loading…
Cancel
Save