mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-03-11 17:13:56 -03:00
AC_WPNav: take references to inav's position rather than a copy
This commit is contained in:
parent
cabd6aec8f
commit
f21fcca9d0
@ -283,7 +283,7 @@ void AC_WPNav::shift_wp_origin_to_current_pos()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get current and target locations
|
// 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();
|
const Vector3f pos_target = _pos_control.get_pos_target();
|
||||||
|
|
||||||
// calculate difference between current position and 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
|
bool reached_leash_limit = false; // true when track has reached leash limit and we need to slow down the target point
|
||||||
|
|
||||||
// get current location
|
// get current location
|
||||||
Vector3f curr_pos = _inav.get_position();
|
const Vector3f &curr_pos = _inav.get_position();
|
||||||
|
|
||||||
// calculate terrain adjustments
|
// calculate terrain adjustments
|
||||||
float terr_offset = 0.0f;
|
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
|
float AC_WPNav::get_wp_distance_to_destination() const
|
||||||
{
|
{
|
||||||
// get current location
|
// get current location
|
||||||
Vector3f curr = _inav.get_position();
|
const Vector3f &curr = _inav.get_position();
|
||||||
return norm(_destination.x-curr.x,_destination.y-curr.y);
|
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();
|
calculate_wp_leash_length();
|
||||||
|
|
||||||
// get current location
|
// 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)
|
// 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;
|
float terr_offset = 0.0f;
|
||||||
|
Loading…
Reference in New Issue
Block a user