From e550c1e9a3a831f8dcb9f2562330835a32083bc2 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Mon, 4 Aug 2014 16:54:04 +0900 Subject: [PATCH] AC_PosControl: add set_alt_target_to_current_alt method --- libraries/AC_AttitudeControl/AC_PosControl.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/AC_AttitudeControl/AC_PosControl.h b/libraries/AC_AttitudeControl/AC_PosControl.h index 85d2c8361f..9d84daf3ab 100644 --- a/libraries/AC_AttitudeControl/AC_PosControl.h +++ b/libraries/AC_AttitudeControl/AC_PosControl.h @@ -108,6 +108,9 @@ public: /// target will also be stopped if the motors hit their limits or leash length is exceeded void set_alt_target_from_climb_rate(float climb_rate_cms, float dt); + /// set_alt_target_to_current_alt - set altitude target to current altitude + void set_alt_target_to_current_alt() { _pos_target.z = _inav.get_altitude(); } + /// get_alt_target, get_desired_alt - get desired altitude (in cm above home) from loiter or wp controller which should be fed into throttle controller /// To-Do: remove one of the two functions below float get_alt_target() const { return _pos_target.z; }