|
|
|
@ -184,16 +184,18 @@ void Copter::poshold_run()
@@ -184,16 +184,18 @@ void Copter::poshold_run()
|
|
|
|
|
|
|
|
|
|
// if landed initialise loiter targets, set throttle to zero and exit
|
|
|
|
|
if (ap.land_complete) { |
|
|
|
|
// if throttle zero reset attitude and exit immediately
|
|
|
|
|
if (ap.throttle_zero) { |
|
|
|
|
// set motors to spin-when-armed if throttle below deadzone, otherwise full range (but motors will only spin at min throttle)
|
|
|
|
|
if (target_climb_rate < 0.0f) { |
|
|
|
|
motors.set_desired_spool_state(AP_Motors::DESIRED_SPIN_WHEN_ARMED); |
|
|
|
|
} else { |
|
|
|
|
motors.set_desired_spool_state(AP_Motors::DESIRED_THROTTLE_UNLIMITED); |
|
|
|
|
} |
|
|
|
|
wp_nav.init_loiter_target(); |
|
|
|
|
// move throttle to between minimum and non-takeoff-throttle to keep us on the ground
|
|
|
|
|
attitude_control.set_throttle_out(get_throttle_pre_takeoff(channel_throttle->get_control_in()),false,g.throttle_filt); |
|
|
|
|
pos_control.relax_alt_hold_controllers(0.0f); |
|
|
|
|
attitude_control.reset_rate_controller_I_terms(); |
|
|
|
|
attitude_control.set_yaw_target_to_current_heading(); |
|
|
|
|
attitude_control.input_euler_angle_roll_pitch_euler_rate_yaw(0, 0, 0, get_smoothing_gain()); |
|
|
|
|
pos_control.relax_alt_hold_controllers(0.0f); // forces throttle output to go to zero
|
|
|
|
|
pos_control.update_z_controller(); |
|
|
|
|
return; |
|
|
|
|
}else{ |
|
|
|
|
// convert pilot input to lean angles
|
|
|
|
|