From f21fcca9d0262bbd52259ca1480afb2a2621f128 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 12 Jul 2019 19:50:04 +1000 Subject: [PATCH] AC_WPNav: take references to inav's position rather than a copy --- libraries/AC_WPNav/AC_WPNav.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/AC_WPNav/AC_WPNav.cpp b/libraries/AC_WPNav/AC_WPNav.cpp index 3e3cf78dce..3a2313fffe 100644 --- a/libraries/AC_WPNav/AC_WPNav.cpp +++ b/libraries/AC_WPNav/AC_WPNav.cpp @@ -283,7 +283,7 @@ void AC_WPNav::shift_wp_origin_to_current_pos() } // get current and target locations - const Vector3f curr_pos = _inav.get_position(); + const Vector3f &curr_pos = _inav.get_position(); const Vector3f pos_target = _pos_control.get_pos_target(); // calculate difference between current position and target @@ -321,7 +321,7 @@ bool AC_WPNav::advance_wp_target_along_track(float dt) bool reached_leash_limit = false; // true when track has reached leash limit and we need to slow down the target point // get current location - Vector3f curr_pos = _inav.get_position(); + const Vector3f &curr_pos = _inav.get_position(); // calculate terrain adjustments float terr_offset = 0.0f; @@ -470,7 +470,7 @@ bool AC_WPNav::advance_wp_target_along_track(float dt) float AC_WPNav::get_wp_distance_to_destination() const { // get current location - Vector3f curr = _inav.get_position(); + const Vector3f &curr = _inav.get_position(); return norm(_destination.x-curr.x,_destination.y-curr.y); } @@ -830,7 +830,7 @@ bool AC_WPNav::advance_spline_target_along_track(float dt) calculate_wp_leash_length(); // get current location - Vector3f curr_pos = _inav.get_position(); + const Vector3f &curr_pos = _inav.get_position(); // get terrain altitude offset for origin and current position (i.e. change in terrain altitude from a position vs ekf origin) float terr_offset = 0.0f;