From 76f393dcb0882e8298be07a12fd19aa9e249df8e Mon Sep 17 00:00:00 2001 From: Paul Riseborough Date: Sun, 16 Aug 2020 16:49:53 +1000 Subject: [PATCH] EKF: Use const reference instead of local copy --- EKF/drag_fusion.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/EKF/drag_fusion.cpp b/EKF/drag_fusion.cpp index 8e56f0344a..a0cc3a31ab 100644 --- a/EKF/drag_fusion.cpp +++ b/EKF/drag_fusion.cpp @@ -60,19 +60,19 @@ void Ekf::fuseDrag() const Vector2f ballistic_coef_inv_xy(1.f / _params.bcoef_x, 1.f / _params.bcoef_y); // get latest estimated orientation - const float q0 = _state.quat_nominal(0); - const float q1 = _state.quat_nominal(1); - const float q2 = _state.quat_nominal(2); - const float q3 = _state.quat_nominal(3); + const float &q0 = _state.quat_nominal(0); + const float &q1 = _state.quat_nominal(1); + const float &q2 = _state.quat_nominal(2); + const float &q3 = _state.quat_nominal(3); // get latest velocity in earth frame - const float vn = _state.vel(0); - const float ve = _state.vel(1); - const float vd = _state.vel(2); + const float &vn = _state.vel(0); + const float &ve = _state.vel(1); + const float &vd = _state.vel(2); // get latest wind velocity in earth frame - const float vwn = _state.wind_vel(0); - const float vwe = _state.wind_vel(1); + const float &vwn = _state.wind_vel(0); + const float &vwe = _state.wind_vel(1); // predicted specific forces // calculate relative wind velocity in earth frame and rotate into body frame