diff --git a/libraries/AC_AttitudeControl/AC_PosControl.cpp b/libraries/AC_AttitudeControl/AC_PosControl.cpp index 848e479496..48176a6b59 100644 --- a/libraries/AC_AttitudeControl/AC_PosControl.cpp +++ b/libraries/AC_AttitudeControl/AC_PosControl.cpp @@ -311,7 +311,6 @@ void AC_PosControl::rate_to_accel_z() { const Vector3f& curr_vel = _inav.get_velocity(); float p; // used to capture pid values for logging - float desired_accel; // the target acceleration if the accel based throttle is enabled, otherwise the output to be sent to the motors // check speed limits // To-Do: check these speed limits here or in the pos->rate controller @@ -361,10 +360,10 @@ void AC_PosControl::rate_to_accel_z() p = _p_vel_z.kP() * _vel_error.z; // consolidate and constrain target acceleration - desired_accel = _accel_feedforward.z + p; + _accel_target.z = _accel_feedforward.z + p; // set target for accel based throttle controller - accel_to_throttle(desired_accel); + accel_to_throttle(_accel_target.z); } // accel_to_throttle - alt hold's acceleration controller diff --git a/libraries/AC_AttitudeControl/AC_PosControl.h b/libraries/AC_AttitudeControl/AC_PosControl.h index cb1ce243b8..ef8be40cd9 100644 --- a/libraries/AC_AttitudeControl/AC_PosControl.h +++ b/libraries/AC_AttitudeControl/AC_PosControl.h @@ -93,6 +93,9 @@ public: /// get_speed_down - accessors for current down speed in cm/s. Will be a negative number float get_speed_down() const { return _speed_down_cms; } + /// get_vel_target_z - returns current vertical speed in cm/s + float get_vel_target_z() const { return _vel_target.z; } + /// set_accel_z - set vertical acceleration in cm/s/s /// leash length will be recalculated the next time update_z_controller() is called void set_accel_z(float accel_cmss);