Copter: clear thr accel I term on take-off
This commit is contained in:
parent
05248738e2
commit
24d15517ff
@ -1977,6 +1977,12 @@ void update_throttle_mode(void)
|
|||||||
if(ap.auto_armed) {
|
if(ap.auto_armed) {
|
||||||
// alt hold plus pilot input of climb rate
|
// alt hold plus pilot input of climb rate
|
||||||
pilot_climb_rate = get_pilot_desired_climb_rate(g.rc_3.control_in);
|
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_alt_health >= SONAR_ALT_HEALTH_MAX ) {
|
||||||
// if sonar is ok, use surface tracking
|
// if sonar is ok, use surface tracking
|
||||||
get_throttle_surface_tracking(pilot_climb_rate); // this function calls set_target_alt_for_reporting for us
|
get_throttle_surface_tracking(pilot_climb_rate); // this function calls set_target_alt_for_reporting for us
|
||||||
|
@ -859,6 +859,14 @@ void throttle_accel_deactivate()
|
|||||||
throttle_accel_controller_active = false;
|
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
|
// get_throttle_accel - accelerometer based throttle controller
|
||||||
// returns an actual throttle output (0 ~ 1000) to be sent to the motors
|
// returns an actual throttle output (0 ~ 1000) to be sent to the motors
|
||||||
static int16_t
|
static int16_t
|
||||||
|
Loading…
Reference in New Issue
Block a user