Plane: add to LAND_NEUTRL behavior

offer netrual vs disabled outputs
This commit is contained in:
Tom Pittenger 2016-02-24 18:16:00 -08:00
parent ead51a9d19
commit 993e5b438c
2 changed files with 12 additions and 6 deletions

View File

@ -1084,16 +1084,22 @@ void Plane::set_servos(void)
}
#endif
if (g.land_then_servos_neutral &&
if (g.land_then_servos_neutral > 0 &&
control_mode == AUTO &&
g.land_disarm_delay > 0 &&
auto_state.land_complete &&
!arming.is_armed()) {
// after an auto land and auto disarm, set the servos to be neutral just
// in case we're upside down or some crazy angle and straining the servos.
channel_roll->servo_out = 0;
channel_pitch->servo_out = 0;
channel_throttle->servo_out = 0;
channel_rudder->servo_out = 0;
if (g.land_then_servos_neutral == 1) {
channel_roll->radio_out = channel_roll->radio_trim;
channel_pitch->radio_out = channel_pitch->radio_trim;
channel_rudder->radio_out = channel_rudder->radio_trim;
} else if (g.land_then_servos_neutral == 2) {
channel_roll->disable_out();
channel_pitch->disable_out();
channel_rudder->disable_out();
}
}
// send values to the PWM timers for output

View File

@ -291,7 +291,7 @@ const AP_Param::Info Plane::var_info[] = {
// @Param: LAND_THEN_NEUTRL
// @DisplayName: Set servos to neutral after landing
// @Description: When enabled, after an autoland and auto-disarm via LAND_DISARMDELAY happens then set all servos to neutral. This is helpful when an aircraft has a rough landing upside down or a crazy angle causing the servos to strain.
// @Values: 0:Disabled, 1:Enabled
// @Values: 0:Disabled, 1:Servos to Neutral, 2:Servos to Zero PWM
// @User: Advanced
GSCALAR(land_then_servos_neutral, "LAND_THEN_NEUTRL", 0),