From 12f5f3f96e0a749126da108b592306c140f84da6 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 5 Nov 2011 12:31:30 +0800 Subject: [PATCH] TradHeli - fix to allow tail servo to be reversed. Also increase max movement of tail servo to 45 degrees. --- ArduCopter/Attitude.pde | 8 ++++++-- ArduCopter/heli.pde | 5 +---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ArduCopter/Attitude.pde b/ArduCopter/Attitude.pde index 2d222dd159..24a5cf416c 100644 --- a/ArduCopter/Attitude.pde +++ b/ArduCopter/Attitude.pde @@ -72,15 +72,19 @@ get_stabilize_yaw(long target_angle) error = rate - (long)(degrees(omega.z) * 100.0); rate = g.pi_rate_yaw.get_pi(error, G_Dt); } + + // output control: + return (int)constrain(rate, -4500, 4500); #else // Rate P: error = rate - (long)(degrees(omega.z) * 100.0); rate = g.pi_rate_yaw.get_pi(error, G_Dt); //Serial.printf("%d\t%d\n", (int)error, (int)rate); -#endif - + // output control: return (int)constrain(rate, -2500, 2500); +#endif + } #define ALT_ERROR_MAX 300 diff --git a/ArduCopter/heli.pde b/ArduCopter/heli.pde index 4dd3719b29..0d0cad434c 100644 --- a/ArduCopter/heli.pde +++ b/ArduCopter/heli.pde @@ -100,10 +100,7 @@ static void heli_move_swash(int roll_out, int pitch_out, int coll_out, int yaw_o if( g.heli_servo_3.get_reverse() ) g.heli_servo_3.servo_out = 3000 - g.heli_servo_3.servo_out; - if( g.heli_servo_4.get_reverse() ) - g.heli_servo_4.servo_out = -yaw_out; // should probably just use rc_4 directly like we do for a tricopter - else - g.heli_servo_4.servo_out = yaw_out; + g.heli_servo_4.servo_out = yaw_out; // use servo_out to calculate pwm_out and radio_out g.heli_servo_1.calc_pwm();