Copter: Tradheli to check rotor speed control input before arming

Also, force rsc_control input to 0 when disarmed.  This prevents condition where AP_MotorsHeli can receive a rotor speed command greater than zero while disarmed, which was causing the ColYaw function to move the rudder servo.  These two changes are somewhat tied together as it required changing the arming_check to check the RSC_Control not desired_speed from AP_MotorsHeli.
This commit is contained in:
Robert Lefebvre 2015-07-08 16:24:43 -04:00 committed by Randy Mackay
parent abb6eba291
commit e3a0f1568d
3 changed files with 28 additions and 20 deletions

View File

@ -501,6 +501,8 @@ private:
// governor. Even a single "off" frame can cause the rotor to slow dramatically and take a long time to restart. // governor. Even a single "off" frame can cause the rotor to slow dramatically and take a long time to restart.
ModeFilterInt16_Size5 rotor_speed_deglitch_filter {4}; ModeFilterInt16_Size5 rotor_speed_deglitch_filter {4};
int16_t rsc_control_deglitched;
// Tradheli flags // Tradheli flags
struct { struct {
uint8_t dynamic_flight : 1; // 0 // true if we are moving at a significant speed (used to turn on/off leaky I terms) uint8_t dynamic_flight : 1; // 0 // true if we are moving at a significant speed (used to turn on/off leaky I terms)

View File

@ -137,8 +137,10 @@ void Copter::heli_update_rotor_speed_targets()
// get rotor control method // get rotor control method
uint8_t rsc_control_mode = motors.get_rsc_mode(); uint8_t rsc_control_mode = motors.get_rsc_mode();
int16_t rsc_control_deglitched = rotor_speed_deglitch_filter.apply(g.rc_8.control_in);
rsc_control_deglitched = rotor_speed_deglitch_filter.apply(g.rc_8.control_in);
if (motors.armed()) {
switch (rsc_control_mode) { switch (rsc_control_mode) {
case AP_MOTORS_HELI_RSC_MODE_NONE: case AP_MOTORS_HELI_RSC_MODE_NONE:
// even though pilot passes rotors speed directly to rotor ESC via receiver, motor lib needs to know if // even though pilot passes rotors speed directly to rotor ESC via receiver, motor lib needs to know if
@ -156,6 +158,10 @@ void Copter::heli_update_rotor_speed_targets()
} }
break; break;
} }
} else {
// if disarmed, force desired_rotor_speed to Zero
motors.set_desired_rotor_speed(0);
}
// when rotor_runup_complete changes to true, log event // when rotor_runup_complete changes to true, log event
if (!rotor_runup_complete_last && motors.rotor_runup_complete()){ if (!rotor_runup_complete_last && motors.rotor_runup_complete()){

View File

@ -704,7 +704,7 @@ bool Copter::arm_checks(bool display_failure, bool arming_from_gcs)
// always check if rotor is spinning on heli // always check if rotor is spinning on heli
#if FRAME_CONFIG == HELI_FRAME #if FRAME_CONFIG == HELI_FRAME
// heli specific arming check // heli specific arming check
if (!motors.allow_arming()){ if ((rsc_control_deglitched > 0) || !motors.allow_arming()){
if (display_failure) { if (display_failure) {
gcs_send_text_P(SEVERITY_HIGH,PSTR("Arm: Rotor Control Engaged")); gcs_send_text_P(SEVERITY_HIGH,PSTR("Arm: Rotor Control Engaged"));
} }