Browse Source

ekf: extract range finder noise computation

v1.13.0-BW
bresch 3 years ago committed by Mathieu Bresciani
parent
commit
064518f57a
  1. 3
      src/modules/ekf2/EKF/ekf.h
  2. 8
      src/modules/ekf2/EKF/ekf_helper.cpp

3
src/modules/ekf2/EKF/ekf.h

@ -930,8 +930,9 @@ private: @@ -930,8 +930,9 @@ private:
void updateGroundEffect();
// return an estimation of the GPS altitude variance
// return an estimation of the sensor altitude variance
float getGpsHeightVariance();
float getRngHeightVariance() const;
// calculate the measurement variance for the optical flow sensor
float calcOptFlowMeasVar();

8
src/modules/ekf2/EKF/ekf_helper.cpp

@ -1361,6 +1361,14 @@ void Ekf::updateBaroHgtBias() @@ -1361,6 +1361,14 @@ void Ekf::updateBaroHgtBias()
}
}
float Ekf::getRngHeightVariance() const
{
const float dist_dependant_var = sq(_params.range_noise_scaler * _range_sensor.getDistBottom());
const float var = sq(_params.range_noise) + dist_dependant_var;
const float var_sat = fmaxf(var, 0.01f);
return var_sat;
}
void Ekf::updateGroundEffect()
{
if (_control_status.flags.in_air && !_control_status.flags.fixed_wing) {

Loading…
Cancel
Save