From 908afad65c28d5d050a0ddb2990e3171ce9092e7 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Thu, 16 Jul 2015 13:20:05 +0900 Subject: [PATCH] Copter: reset yaw angle target when disarmed or landed in AltHold --- ArduCopter/control_althold.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/ArduCopter/control_althold.cpp b/ArduCopter/control_althold.cpp index 85bb769789..f7b2bd9554 100644 --- a/ArduCopter/control_althold.cpp +++ b/ArduCopter/control_althold.cpp @@ -46,20 +46,6 @@ void Copter::althold_run() #if FRAME_CONFIG == HELI_FRAME // helicopters are held on the ground until rotor speed runup has finished bool takeoff_triggered = (ap.land_complete && (channel_throttle->control_in > get_takeoff_trigger_throttle()) && motors.rotor_runup_complete()); - - if(!motors.armed()) { - heli_flags.init_targets_on_arming=true; - attitude_control.set_yaw_target_to_current_heading(); - } - - // if we have recently armed and rotor is just ramping up speed, relax yaw controller - if(motors.armed() && heli_flags.init_targets_on_arming) { - attitude_control.relax_bf_rate_controller(); - attitude_control.set_yaw_target_to_current_heading(); - if (motors.rotor_speed_above_critical()) { - heli_flags.init_targets_on_arming=false; - } - } #else bool takeoff_triggered = (ap.land_complete && (channel_throttle->control_in > get_takeoff_trigger_throttle())); #endif @@ -81,6 +67,7 @@ void Copter::althold_run() case AltHold_Disarmed: #if FRAME_CONFIG == HELI_FRAME // Helicopters always stabilize roll/pitch/yaw + attitude_control.set_yaw_target_to_current_heading(); // call attitude controller attitude_control.angle_ef_roll_pitch_rate_ef_yaw_smooth(target_roll, target_pitch, target_yaw_rate, get_smoothing_gain()); attitude_control.set_throttle_out(0,false,g.throttle_filt); @@ -116,6 +103,7 @@ void Copter::althold_run() case AltHold_Landed: #if FRAME_CONFIG == HELI_FRAME // Helicopters always stabilize roll/pitch/yaw + attitude_control.set_yaw_target_to_current_heading(); // call attitude controller attitude_control.angle_ef_roll_pitch_rate_ef_yaw_smooth(target_roll, target_pitch, target_yaw_rate, get_smoothing_gain()); attitude_control.set_throttle_out(get_throttle_pre_takeoff(channel_throttle->control_in),false,g.throttle_filt);