@ -29,7 +29,7 @@ const AP_Param::GroupInfo AP_MotorsHeli_Single::var_info[] = {
@@ -29,7 +29,7 @@ const AP_Param::GroupInfo AP_MotorsHeli_Single::var_info[] = {
// @Param: TAIL_TYPE
// @DisplayName: Tail Type
// @Description: Tail type selection. Simpler yaw controller used if external gyro is selected. Direct Drive Variable Pitch is used for tails that have a motor that is governed at constant speed by an ESC. Tail pitch is still accomplished with a servo. Direct Drive Fixed Pitch (DDFP) CW is used for helicopters with a rotor that spins clockwise when viewed from above. Direct Drive Fixed Pitch (DDFP) CCW is used for helicopters with a rotor that spins counter clockwise when viewed from above. In both DDFP cases, no servo is used for the tail and the tail motor esc is controlled by the yaw axis.
// @Values: 0:Servo only,1:Servo with ExtGyro,2:DirectDrive VarPitch,3:DirectDrive FixedPitch CW,4:DirectDrive FixedPitch CCW
// @Values: 0:Servo only,1:Servo with ExtGyro,2:DirectDrive VarPitch,3:DirectDrive FixedPitch CW,4:DirectDrive FixedPitch CCW,5:DDVP with external governor
// @User: Standard
AP_GROUPINFO ( " TAIL_TYPE " , 4 , AP_MotorsHeli_Single , _tail_type , AP_MOTORS_HELI_SINGLE_TAILTYPE_SERVO ) ,
@ -176,7 +176,7 @@ bool AP_MotorsHeli_Single::init_outputs()
@@ -176,7 +176,7 @@ bool AP_MotorsHeli_Single::init_outputs()
// initialize main rotor servo
_main_rotor . init_servo ( ) ;
if ( _tail_type = = AP_MOTORS_HELI_SINGLE_TAILTYPE_DIRECTDRIVE_VARPITCH ) {
if ( _tail_type = = AP_MOTORS_HELI_SINGLE_TAILTYPE_DIRECTDRIVE_VARPITCH | | _tail_type = = AP_MOTORS_HELI_SINGLE_TAILTYPE_DIRECTDRIVE_VARPIT_EXT_GOV ) {
_tail_rotor . init_servo ( ) ;
} else if ( _tail_type = = AP_MOTORS_HELI_SINGLE_TAILTYPE_SERVO_EXTGYRO ) {
// external gyro output
@ -184,6 +184,21 @@ bool AP_MotorsHeli_Single::init_outputs()
@@ -184,6 +184,21 @@ bool AP_MotorsHeli_Single::init_outputs()
}
}
// set signal value for main rotor external governor to know when to use autorotation bailout ramp up
if ( _main_rotor . _rsc_mode . get ( ) = = ROTOR_CONTROL_MODE_SPEED_SETPOINT | | _main_rotor . _rsc_mode . get ( ) = = ROTOR_CONTROL_MODE_SPEED_PASSTHROUGH ) {
_main_rotor . set_ext_gov_arot_bail ( _main_rotor . _ext_gov_arot_pct . get ( ) ) ;
} else {
_main_rotor . set_ext_gov_arot_bail ( 0 ) ;
}
// set signal value for tail rotor external governor to know when to use autorotation bailout ramp up
if ( _tail_type = = AP_MOTORS_HELI_SINGLE_TAILTYPE_DIRECTDRIVE_VARPIT_EXT_GOV ) {
// set point for tail rsc is the same as for main rotor to save on parameters
_tail_rotor . set_ext_gov_arot_bail ( _main_rotor . _ext_gov_arot_pct . get ( ) ) ;
} else {
_tail_rotor . set_ext_gov_arot_bail ( 0 ) ;
}
if ( _tail_type = = AP_MOTORS_HELI_SINGLE_TAILTYPE_SERVO_EXTGYRO ) {
// External Gyro uses PWM output thus servo endpoints are forced
SRV_Channels : : set_output_min_max ( SRV_Channels : : get_motor_function ( AP_MOTORS_HELI_SINGLE_EXTGYRO ) , 1000 , 2000 ) ;
@ -287,6 +302,18 @@ void AP_MotorsHeli_Single::calculate_armed_scalars()
@@ -287,6 +302,18 @@ void AP_MotorsHeli_Single::calculate_armed_scalars()
// set bailout ramp time
_main_rotor . use_bailout_ramp_time ( _heliflags . enable_bailout ) ;
_tail_rotor . use_bailout_ramp_time ( _heliflags . enable_bailout ) ;
// allow use of external governor autorotation bailout
if ( _main_rotor . _ext_gov_arot_pct . get ( ) > 0 ) {
// RSC only needs to know that the vehicle is in an autorotation if using the bailout window on an external governor
if ( _main_rotor . _rsc_mode . get ( ) = = ROTOR_CONTROL_MODE_SPEED_SETPOINT | | _main_rotor . _rsc_mode . get ( ) = = ROTOR_CONTROL_MODE_SPEED_PASSTHROUGH ) {
_main_rotor . set_autorotaion_flag ( _heliflags . in_autorotation ) ;
}
if ( _tail_type = = AP_MOTORS_HELI_SINGLE_TAILTYPE_DIRECTDRIVE_VARPIT_EXT_GOV ) {
_tail_rotor . set_autorotaion_flag ( _heliflags . in_autorotation ) ;
}
}
}
// calculate_scalars - recalculates various scalers used.
@ -311,7 +338,7 @@ void AP_MotorsHeli_Single::calculate_scalars()
@@ -311,7 +338,7 @@ void AP_MotorsHeli_Single::calculate_scalars()
calculate_armed_scalars ( ) ;
// send setpoints to DDVP rotor controller and trigger recalculation of scalars
if ( _tail_type = = AP_MOTORS_HELI_SINGLE_TAILTYPE_DIRECTDRIVE_VARPITCH ) {
if ( _tail_type = = AP_MOTORS_HELI_SINGLE_TAILTYPE_DIRECTDRIVE_VARPITCH | | _tail_type = = AP_MOTORS_HELI_SINGLE_TAILTYPE_DIRECTDRIVE_VARPIT_EXT_GOV ) {
_tail_rotor . set_control_mode ( ROTOR_CONTROL_MODE_SPEED_SETPOINT ) ;
_tail_rotor . set_ramp_time ( _main_rotor . _ramp_time . get ( ) ) ;
_tail_rotor . set_runup_time ( _main_rotor . _runup_time . get ( ) ) ;
@ -342,7 +369,7 @@ uint16_t AP_MotorsHeli_Single::get_motor_mask()
@@ -342,7 +369,7 @@ uint16_t AP_MotorsHeli_Single::get_motor_mask()
mask | = 1U < < AP_MOTORS_HELI_SINGLE_EXTGYRO ;
}
if ( _tail_type = = AP_MOTORS_HELI_SINGLE_TAILTYPE_DIRECTDRIVE_VARPITCH ) {
if ( _tail_type = = AP_MOTORS_HELI_SINGLE_TAILTYPE_DIRECTDRIVE_VARPITCH | | _tail_type = = AP_MOTORS_HELI_SINGLE_TAILTYPE_DIRECTDRIVE_VARPIT_EXT_GOV ) {
mask | = 1U < < AP_MOTORS_HELI_SINGLE_TAILRSC ;
}