AC_WPNav: take references to inav's position rather than a copy

This commit is contained in:
Peter Barker 2019-07-12 19:50:04 +10:00 committed by Randy Mackay
parent cabd6aec8f
commit f21fcca9d0
1 changed files with 4 additions and 4 deletions

View File

@ -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;