Skip to content

Commit

Permalink
ekf2: GNSS velocity control should own vertical velocity reset if hei…
Browse files Browse the repository at this point in the history
…ght faiing

 - GNSS height control using the velocity sample directly is ignoring
   potential position offsets
  • Loading branch information
dagar committed Jul 10, 2024
1 parent 2c3401d commit 66aad7a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
9 changes: 0 additions & 9 deletions src/modules/ekf2/EKF/aid_sources/gnss/gnss_height_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,6 @@ void Ekf::controlGnssHeightFusion(const gnssSample &gps_sample)
resetVerticalPositionTo(-(measurement - bias_est.getBias()), measurement_var);
bias_est.setBias(_state.pos(2) + measurement);

// reset vertical velocity
if (PX4_ISFINITE(gps_sample.vel(2)) && (_params.gnss_ctrl & static_cast<int32_t>(GnssCtrl::VEL))) {
// use 1.5 as a typical ratio of vacc/hacc
resetVerticalVelocityTo(gps_sample.vel(2), sq(math::max(1.5f * gps_sample.sacc, _params.gps_vel_noise)));

} else {
resetVerticalVelocityToZero();
}

aid_src.time_last_fuse = _time_delayed_us;

} else if (is_fusion_failing) {
Expand Down
16 changes: 11 additions & 5 deletions src/modules/ekf2/EKF/aid_sources/gnss/gps_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,23 @@ void Ekf::controlGpsFusion(const imuSample &imu_delayed)
}

if (do_vel_pos_reset) {
ECL_WARN("GPS fusion timeout, resetting velocity / position");
ECL_WARN("GPS fusion timeout, resetting");
}

if (gnss_vel_enabled) {
if (gnss_vel_enabled) {
if (do_vel_pos_reset) {
resetVelocityToGnss(_aid_src_gnss_vel);
}

if (gnss_pos_enabled) {
resetHorizontalPositionToGnss(_aid_src_gnss_pos);
} else if (isHeightResetRequired()) {
// reset vertical velocity if height is failing
resetVerticalVelocityTo(_aid_src_gnss_vel.observation[2], _aid_src_gnss_vel.observation_variance[2]);
}
}

if (gnss_pos_enabled && do_vel_pos_reset) {
resetHorizontalPositionToGnss(_aid_src_gnss_pos);
}

} else {
stopGpsFusion();
}
Expand Down

0 comments on commit 66aad7a

Please sign in to comment.