Browse Source

Copter: clear thr accel I term on take-off

mission-4.1.18
Randy Mackay 12 years ago
parent
commit
24d15517ff
  1. 6
      ArduCopter/ArduCopter.pde
  2. 8
      ArduCopter/Attitude.pde

6
ArduCopter/ArduCopter.pde

@ -1977,6 +1977,12 @@ void update_throttle_mode(void) @@ -1977,6 +1977,12 @@ void update_throttle_mode(void)
if(ap.auto_armed) {
// alt hold plus pilot input of climb rate
pilot_climb_rate = get_pilot_desired_climb_rate(g.rc_3.control_in);
// clear i term when we're taking off
if (pilot_climb_rate > 0 && ap.land_complete) {
set_throttle_takeoff();
}
if( sonar_alt_health >= SONAR_ALT_HEALTH_MAX ) {
// if sonar is ok, use surface tracking
get_throttle_surface_tracking(pilot_climb_rate); // this function calls set_target_alt_for_reporting for us

8
ArduCopter/Attitude.pde

@ -859,6 +859,14 @@ void throttle_accel_deactivate() @@ -859,6 +859,14 @@ void throttle_accel_deactivate()
throttle_accel_controller_active = false;
}
// set_throttle_takeoff - allows parents to tell throttle controller we are taking off so I terms can be cleared
static void
set_throttle_takeoff()
{
if (g.pid_throttle_accel.get_integrator() < 0)
g.pid_throttle_accel.reset_I();
}
// get_throttle_accel - accelerometer based throttle controller
// returns an actual throttle output (0 ~ 1000) to be sent to the motors
static int16_t

Loading…
Cancel
Save