From 0c92565d23b3facfef4d24d6ff8e7fe154b3da3c Mon Sep 17 00:00:00 2001 From: Robert Lefebvre Date: Thu, 18 Jun 2015 19:38:37 -0400 Subject: [PATCH] AP_MotorsHeli: add Critical Rotor Speed param, use to switch off runup_complete --- libraries/AP_Motors/AP_MotorsHeli.cpp | 10 +++++++++- libraries/AP_Motors/AP_MotorsHeli.h | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Motors/AP_MotorsHeli.cpp b/libraries/AP_Motors/AP_MotorsHeli.cpp index f128aac314..024c51384e 100644 --- a/libraries/AP_Motors/AP_MotorsHeli.cpp +++ b/libraries/AP_Motors/AP_MotorsHeli.cpp @@ -204,6 +204,14 @@ const AP_Param::GroupInfo AP_MotorsHeli::var_info[] PROGMEM = { // @User: Standard AP_GROUPINFO("TAIL_SPEED", 21, AP_MotorsHeli, _direct_drive_tailspeed, AP_MOTOR_HELI_DDTAIL_DEFAULT), + // @Param: RSC_CRITICAL + // @DisplayName: Critical Rotor Speed + // @Description: Rotor speed below which flight is not possible + // @Range: 0 1000 + // @Increment: 10 + // @User: Standard + AP_GROUPINFO("RSC_CRITICAL", 22, AP_MotorsHeli, _rsc_critical, AP_MOTORS_HELI_RSC_CRITICAL), + // parameters 1 ~ 29 reserved for tradheli // parameters 30 ~ 39 reserved for tricopter // parameters 40 ~ 49 for single copter and coax copter (these have identical parameter files) @@ -748,7 +756,7 @@ void AP_MotorsHeli::rotor_ramp(int16_t rotor_target) if (!_heliflags.rotor_runup_complete && rotor_target > 0 && _rotor_speed_estimate >= rotor_target) { _heliflags.rotor_runup_complete = true; } - if (_heliflags.rotor_runup_complete && rotor_target == 0 && _rotor_speed_estimate <= 0) { + if (_heliflags.rotor_runup_complete && _rotor_speed_estimate <= _rsc_critical) { _heliflags.rotor_runup_complete = false; } diff --git a/libraries/AP_Motors/AP_MotorsHeli.h b/libraries/AP_Motors/AP_MotorsHeli.h index 4b98a01da5..305fc5319d 100644 --- a/libraries/AP_Motors/AP_MotorsHeli.h +++ b/libraries/AP_Motors/AP_MotorsHeli.h @@ -70,6 +70,9 @@ // default main rotor speed (ch8 out) as a number from 0 ~ 1000 #define AP_MOTORS_HELI_RSC_SETPOINT 700 +// default main rotor critical speed +#define AP_MOTORS_HELI_RSC_CRITICAL 500 + // default main rotor ramp up time in seconds #define AP_MOTORS_HELI_RSC_RAMP_TIME 1 // 1 second to ramp output to main rotor ESC to full power (most people use exterrnal govenors so we can ramp up quickly) #define AP_MOTORS_HELI_RSC_RUNUP_TIME 10 // 10 seconds for rotor to reach full speed @@ -292,6 +295,7 @@ private: AP_Int8 _flybar_mode; // Flybar present or not. Affects attitude controller used during ACRO flight mode AP_Int16 _land_collective_min; // Minimum collective when landed or landing AP_Int16 _direct_drive_tailspeed; // Direct Drive VarPitch Tail ESC speed (0 ~ 1000) + AP_Int16 _rsc_critical; // Rotor speed below which flight is not possible // internal variables float _rollFactor[AP_MOTORS_HELI_NUM_SWASHPLATE_SERVOS];