helicopter: add switch to engage main motor

For helicopters it's useful (e.g. during bringup) to be able to disable
the main rotor while the tail is still controlled to safely land.
This commit is contained in:
Beat Küng
2022-09-07 08:00:26 +02:00
parent f32d931117
commit 7e75b497ae
7 changed files with 70 additions and 17 deletions
+44
View File
@@ -1855,6 +1855,34 @@ PARAM_DEFINE_INT32(RC_MAP_PARAM2, 0);
*/
PARAM_DEFINE_INT32(RC_MAP_PARAM3, 0);
/**
* RC channel to engage the main motor (for helicopters)
*
* @min 0
* @max 18
* @group Radio Calibration
* @value 0 Unassigned
* @value 1 Channel 1
* @value 2 Channel 2
* @value 3 Channel 3
* @value 4 Channel 4
* @value 5 Channel 5
* @value 6 Channel 6
* @value 7 Channel 7
* @value 8 Channel 8
* @value 9 Channel 9
* @value 10 Channel 10
* @value 11 Channel 11
* @value 12 Channel 12
* @value 13 Channel 13
* @value 14 Channel 14
* @value 15 Channel 15
* @value 16 Channel 16
* @value 17 Channel 17
* @value 18 Channel 18
*/
PARAM_DEFINE_INT32(RC_MAP_ENG_MOT, 0);
/**
* Failsafe channel PWM threshold.
*
@@ -1985,6 +2013,22 @@ PARAM_DEFINE_FLOAT(RC_TRANS_TH, 0.75f);
*/
PARAM_DEFINE_FLOAT(RC_GEAR_TH, 0.75f);
/**
* Threshold for selecting main motor engage
*
* 0-1 indicate where in the full channel range the threshold sits
* 0 : min
* 1 : max
* sign indicates polarity of comparison
* positive : true when channel>th
* negative : true when channel<th
*
* @min -1
* @max 1
* @group Radio Switches
*/
PARAM_DEFINE_FLOAT(RC_ENG_MOT_TH, 0.75f);
/**
* PWM input channel that provides RSSI.
*
+6 -2
View File
@@ -56,7 +56,8 @@ static bool operator ==(const manual_control_switches_s &a, const manual_control
a.transition_switch == b.transition_switch &&
a.gear_switch == b.gear_switch &&
a.photo_switch == b.photo_switch &&
a.video_switch == b.video_switch);
a.video_switch == b.video_switch &&
a.engage_main_motor_switch == b.engage_main_motor_switch);
}
static bool operator !=(const manual_control_switches_s &a, const manual_control_switches_s &b) { return !(a == b); }
@@ -231,6 +232,8 @@ void RCUpdate::update_rc_functions()
_rc.function[rc_channels_s::FUNCTION_PARAM_1 + i] = _parameters.rc_map_param[i] - 1;
}
_rc.function[rc_channels_s::FUNCTION_ENGAGE_MAIN_MOTOR] = _param_rc_map_eng_mot.get() - 1;
map_flight_modes_buttons();
}
@@ -643,7 +646,8 @@ void RCUpdate::UpdateManualSwitches(const hrt_abstime &timestamp_sample)
switches.arm_switch = get_rc_sw2pos_position(rc_channels_s::FUNCTION_ARMSWITCH, _param_rc_armswitch_th.get());
switches.transition_switch = get_rc_sw2pos_position(rc_channels_s::FUNCTION_TRANSITION, _param_rc_trans_th.get());
switches.gear_switch = get_rc_sw2pos_position(rc_channels_s::FUNCTION_GEAR, _param_rc_gear_th.get());
switches.engage_main_motor_switch = get_rc_sw2pos_position(rc_channels_s::FUNCTION_ENGAGE_MAIN_MOTOR,
_param_rc_eng_mot_th.get());
#if defined(ATL_MANTIS_RC_INPUT_HACKS)
switches.photo_switch = get_rc_sw2pos_position(rc_channels_s::FUNCTION_AUX_3, 0.5f);
switches.video_switch = get_rc_sw2pos_position(rc_channels_s::FUNCTION_AUX_4, 0.5f);
+3
View File
@@ -226,6 +226,8 @@ public:
(ParamInt<px4::params::RC_MAP_AUX5>) _param_rc_map_aux5,
(ParamInt<px4::params::RC_MAP_AUX6>) _param_rc_map_aux6,
(ParamInt<px4::params::RC_MAP_ENG_MOT>) _param_rc_map_eng_mot,
(ParamInt<px4::params::RC_FAILS_THR>) _param_rc_fails_thr,
(ParamFloat<px4::params::RC_LOITER_TH>) _param_rc_loiter_th,
@@ -235,6 +237,7 @@ public:
(ParamFloat<px4::params::RC_TRANS_TH>) _param_rc_trans_th,
(ParamFloat<px4::params::RC_GEAR_TH>) _param_rc_gear_th,
(ParamFloat<px4::params::RC_RETURN_TH>) _param_rc_return_th,
(ParamFloat<px4::params::RC_ENG_MOT_TH>) _param_rc_eng_mot_th,
(ParamInt<px4::params::RC_CHAN_CNT>) _param_rc_chan_cnt
)