Browse Source

Merge pull request #193 from PX4/pr-haglInit

Pr hagl init
master
Paul Riseborough 8 years ago committed by GitHub
parent
commit
b29174d86b
  1. 4
      EKF/ekf.cpp
  2. 4
      EKF/terrain_estimator.cpp

4
EKF/ekf.cpp

@ -413,8 +413,8 @@ bool Ekf::initialiseFilter(void) @@ -413,8 +413,8 @@ bool Ekf::initialiseFilter(void)
// initialise the state covariance matrix
initialiseCovariance();
// initialise the terrain estimator
initHagl();
// try to initialise the terrain estimator
_terrain_initialised = initHagl();
// reset the essential fusion timeout counters
_time_last_hgt_fuse = _time_last_imu;

4
EKF/terrain_estimator.cpp

@ -47,9 +47,9 @@ bool Ekf::initHagl() @@ -47,9 +47,9 @@ bool Ekf::initHagl()
// get most recent range measurement from buffer
rangeSample latest_measurement = _range_buffer.get_newest();
if ((_time_last_imu - latest_measurement.time_us) < 2e5) {
if ((_time_last_imu - latest_measurement.time_us) < 2e5 && _R_to_earth(2,2) > 0.7071f) {
// if we have a fresh measurement, use it to initialise the terrain estimator
_terrain_vpos = _state.pos(2) + latest_measurement.rng;
_terrain_vpos = _state.pos(2) + latest_measurement.rng * _R_to_earth(2, 2);
// initialise state variance to variance of measurement
_terrain_var = sq(_params.range_noise);
// success

Loading…
Cancel
Save