Browse Source

Copter: use const reference when retrieving wpnav destination

mission-4.1.18
Randy Mackay 5 years ago
parent
commit
d6c913cc50
  1. 2
      ArduCopter/mode_auto.cpp
  2. 2
      ArduCopter/mode_guided.cpp
  3. 2
      ArduCopter/mode_zigzag.cpp

2
ArduCopter/mode_auto.cpp

@ -1524,7 +1524,7 @@ bool ModeAuto::verify_land() @@ -1524,7 +1524,7 @@ bool ModeAuto::verify_land()
// check if we've reached the location
if (copter.wp_nav->reached_wp_destination()) {
// get destination so we can use it for loiter target
Vector3f dest = copter.wp_nav->get_wp_destination();
const Vector3f& dest = copter.wp_nav->get_wp_destination();
// initialise landing controller
land_start(dest);

2
ArduCopter/mode_guided.cpp

@ -370,7 +370,7 @@ void ModeGuided::takeoff_run() @@ -370,7 +370,7 @@ void ModeGuided::takeoff_run()
{
auto_takeoff_run();
if (wp_nav->reached_wp_destination()) {
const Vector3f target = wp_nav->get_wp_destination();
const Vector3f& target = wp_nav->get_wp_destination();
set_destination(target);
}
}

2
ArduCopter/mode_zigzag.cpp

@ -123,7 +123,7 @@ void ModeZigZag::return_to_manual_control(bool maintain_target) @@ -123,7 +123,7 @@ void ModeZigZag::return_to_manual_control(bool maintain_target)
stage = MANUAL_REGAIN;
loiter_nav->clear_pilot_desired_acceleration();
if (maintain_target) {
const Vector3f wp_dest = wp_nav->get_wp_destination();
const Vector3f& wp_dest = wp_nav->get_wp_destination();
loiter_nav->init_target(wp_dest);
if (wp_nav->origin_and_destination_are_terrain_alt()) {
copter.surface_tracking.set_target_alt_cm(wp_dest.z);

Loading…
Cancel
Save