diff --git a/msg/manual_control_switches.msg b/msg/manual_control_switches.msg index d343a3ab52..4d1cbab232 100644 --- a/msg/manual_control_switches.msg +++ b/msg/manual_control_switches.msg @@ -29,4 +29,6 @@ uint8 transition_switch # VTOL transition switch: _HOVER, FORWARD_FLIGH uint8 photo_switch # Photo trigger switch uint8 video_switch # Photo trigger switch +uint8 engage_main_motor_switch # Engage the main motor (for helicopters) + uint32 switch_changes # number of switch changes diff --git a/msg/rc_channels.msg b/msg/rc_channels.msg index e44812d70d..546755f66f 100644 --- a/msg/rc_channels.msg +++ b/msg/rc_channels.msg @@ -27,13 +27,14 @@ uint8 FUNCTION_FLTBTN_SLOT_3 = 23 uint8 FUNCTION_FLTBTN_SLOT_4 = 24 uint8 FUNCTION_FLTBTN_SLOT_5 = 25 uint8 FUNCTION_FLTBTN_SLOT_6 = 26 +uint8 FUNCTION_ENGAGE_MAIN_MOTOR = 27 uint8 FUNCTION_FLTBTN_SLOT_COUNT = 6 uint64 timestamp_last_valid # Timestamp of last valid RC signal float32[18] channels # Scaled to -1..1 (throttle: 0..1) uint8 channel_count # Number of valid channels -int8[27] function # Functions mapping +int8[28] function # Functions mapping uint8 rssi # Receive signal strength index bool signal_lost # Control signal lost, should be checked together with topic timeout uint32 frame_drop_count # Number of dropped frames diff --git a/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessHelicopter.cpp b/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessHelicopter.cpp index dfb17578d6..e38fedd94f 100644 --- a/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessHelicopter.cpp +++ b/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessHelicopter.cpp @@ -132,7 +132,8 @@ void ActuatorEffectivenessHelicopter::updateSetpoint(const matrix::Vector #include +#include class ActuatorEffectivenessHelicopter : public ModuleParams, public ActuatorEffectiveness { @@ -77,6 +78,7 @@ public: ActuatorVector &actuator_sp) override; private: float throttleSpoolupProgress(); + bool mainMotorEnaged(); void updateParams() override; @@ -104,4 +106,7 @@ private: uORB::Subscription _vehicle_status_sub{ORB_ID(vehicle_status)}; bool _armed{false}; uint64_t _armed_time{0}; + + uORB::Subscription _manual_control_switches_sub{ORB_ID(manual_control_switches)}; + bool _main_motor_engaged{true}; }; diff --git a/src/modules/rc_update/params.c b/src/modules/rc_update/params.c index 72ea4b8ee6..737d061be9 100644 --- a/src/modules/rc_update/params.c +++ b/src/modules/rc_update/params.c @@ -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) _param_rc_map_aux5, (ParamInt) _param_rc_map_aux6, + (ParamInt) _param_rc_map_eng_mot, + (ParamInt) _param_rc_fails_thr, (ParamFloat) _param_rc_loiter_th, @@ -235,6 +237,7 @@ public: (ParamFloat) _param_rc_trans_th, (ParamFloat) _param_rc_gear_th, (ParamFloat) _param_rc_return_th, + (ParamFloat) _param_rc_eng_mot_th, (ParamInt) _param_rc_chan_cnt )