diff --git a/ArduCopter/ArduCopter.pde b/ArduCopter/ArduCopter.pde index 02b47dde49..5ac3f9429b 100644 --- a/ArduCopter/ArduCopter.pde +++ b/ArduCopter/ArduCopter.pde @@ -1967,7 +1967,7 @@ void update_throttle_mode(void) case THROTTLE_AUTO: // auto pilot altitude controller with target altitude held in next_WP.alt if(motors.auto_armed() == true) { - get_throttle_althold_with_slew(wp_nav.get_destination_alt(), g.auto_velocity_z_min, g.auto_velocity_z_max); + get_throttle_althold_with_slew(wp_nav.get_target_alt(), g.auto_velocity_z_min, g.auto_velocity_z_max); } break; diff --git a/libraries/AC_WPNav/AC_WPNav.h b/libraries/AC_WPNav/AC_WPNav.h index f2bdf07acf..d6b4d1a299 100644 --- a/libraries/AC_WPNav/AC_WPNav.h +++ b/libraries/AC_WPNav/AC_WPNav.h @@ -39,6 +39,9 @@ public: /// get_loiter_target - get loiter target as position vector (from home in cm) Vector3f get_loiter_target() { return _target; } + /// get_target_alt - get loiter's target altitude + float get_target_alt() { return _target.z; } + /// set_loiter_target in cm from home void set_loiter_target(const Vector3f& position) { _target = position; }