@ -160,6 +160,20 @@ void AC_PosControl::set_alt_target_from_climb_rate(float climb_rate_cms, float d
@@ -160,6 +160,20 @@ void AC_PosControl::set_alt_target_from_climb_rate(float climb_rate_cms, float d
}
}
/// relax_alt_hold_controllers - set all desired and targets to measured
void AC_PosControl : : relax_alt_hold_controllers ( float throttle_setting )
{
_pos_target . z = _inav . get_altitude ( ) ;
_vel_desired . z = 0.0f ;
_vel_target . z = _inav . get_velocity_z ( ) ;
_vel_last . z = _inav . get_velocity_z ( ) ;
_accel_feedforward . z = 0.0f ;
_accel_last_z_cms = 0.0f ;
_accel_target . z = - ( _ahrs . get_accel_ef_blended ( ) . z + GRAVITY_MSS ) * 100.0f ;
_flags . reset_accel_to_throttle = true ;
_pid_accel_z . set_integrator ( throttle_setting ) ;
}
// get_alt_error - returns altitude error in cm
float AC_PosControl : : get_alt_error ( ) const
{