From 600a5680f86fc171c5aaade0daa9f32997a51813 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 5 Jan 2012 10:15:14 +1100 Subject: [PATCH] ACM: reset all I terms on gyro calibration --- ArduCopter/system.pde | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/ArduCopter/system.pde b/ArduCopter/system.pde index 3d1cb57cad..4c4656a611 100644 --- a/ArduCopter/system.pde +++ b/ArduCopter/system.pde @@ -361,6 +361,28 @@ static void init_ardupilot() SendDebug("\nReady to FLY "); } +/* + reset all I integrators + */ +static void reset_I_all(void) +{ + g.pi_rate_roll.reset_I(); + g.pi_rate_pitch.reset_I(); + g.pi_rate_yaw.reset_I(); + g.pi_stabilize_roll.reset_I(); + g.pi_stabilize_pitch.reset_I(); + g.pi_stabilize_yaw.reset_I(); + g.pi_loiter_lat.reset_I(); + g.pi_loiter_lon.reset_I(); + g.pi_nav_lat.reset_I(); + g.pi_nav_lon.reset_I(); + g.pi_alt_hold.reset_I(); + g.pi_throttle.reset_I(); + g.pi_acro_roll.reset_I(); + g.pi_acro_pitch.reset_I(); +} + + //******************************************************************************** //This function does all the calibrations, etc. that we need during a ground start //******************************************************************************** @@ -380,6 +402,10 @@ static void startup_ground(void) // reset the leds // --------------------------- clear_leds(); + + // when we re-calibrate the gyros, all previous I values now + // make no sense + reset_I_all(); } /*