From 9eea44f4ab4d7d51339b17194d4efeec416720c6 Mon Sep 17 00:00:00 2001 From: kritz Date: Thu, 2 Jul 2020 14:53:59 +0200 Subject: [PATCH] Return type of resets (#859) * Reset position/velocity return type is void * Delete not needed comments --- EKF/ekf.h | 5 ++--- EKF/ekf_helper.cpp | 13 ++++--------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/EKF/ekf.h b/EKF/ekf.h index f12c92147b..16e70e6728 100644 --- a/EKF/ekf.h +++ b/EKF/ekf.h @@ -578,8 +578,7 @@ private: // fuse single velocity and position measurement void fuseVelPosHeight(const float innov, const float innov_var, const int obs_index); - // reset velocity states of the ekf - bool resetVelocity(); + void resetVelocity(); void resetVelocityToGps(); @@ -595,7 +594,7 @@ private: inline void resetVerticalVelocityTo(float new_vert_vel); - bool resetHorizontalPosition(); + void resetHorizontalPosition(); void resetHorizontalPositionToGps(); diff --git a/EKF/ekf_helper.cpp b/EKF/ekf_helper.cpp index a75d0f4be7..30cca7f95b 100644 --- a/EKF/ekf_helper.cpp +++ b/EKF/ekf_helper.cpp @@ -45,9 +45,8 @@ #include #include -// Reset the velocity states. If we have a recent and valid -// gps measurement then use for velocity initialisation -bool Ekf::resetVelocity() + +void Ekf::resetVelocity() { if (_control_status.flags.gps && isTimedOut(_last_gps_fail_us, (uint64_t)_min_gps_health_time_us)) { // this reset is only called if we have new gps data at the fusion time horizon @@ -62,7 +61,6 @@ bool Ekf::resetVelocity() } else { resetHorizontalVelocityToZero(); } - return true; } void Ekf::resetVelocityToGps() { @@ -150,9 +148,8 @@ void Ekf::resetVerticalVelocityTo(float new_vert_vel) { _state_reset_status.velD_counter++; } -// Reset position states. If we have a recent and valid -// gps measurement then use for position initialisation -bool Ekf::resetHorizontalPosition() + +void Ekf::resetHorizontalPosition() { // let the next odometry update know that the previous value of states cannot be used to calculate the change in position _hpos_prev_available = false; @@ -184,8 +181,6 @@ bool Ekf::resetHorizontalPosition() resetHorizontalPositionTo(_last_known_posNE); P.uncorrelateCovarianceSetVariance<2>(7, sq(_params.pos_noaid_noise)); } - - return true; } void Ekf::resetHorizontalPositionToGps() {