Line data Source code
1 : #pragma once 2 : 3 : /// @file AC_InputManager_Heli.h 4 : /// @brief Pilot manual control input library for Conventional Helicopter 5 : 6 : #include <AP_Param/AP_Param.h> 7 : #include <AP_Common/AP_Common.h> 8 : #include "AC_InputManager.h" 9 : 10 : # define AC_ATTITUDE_HELI_STAB_COLLECTIVE_MIN_DEFAULT 0 11 : # define AC_ATTITUDE_HELI_STAB_COLLECTIVE_LOW_DEFAULT 40 12 : # define AC_ATTITUDE_HELI_STAB_COLLECTIVE_HIGH_DEFAULT 60 13 : # define AC_ATTITUDE_HELI_STAB_COLLECTIVE_MAX_DEFAULT 100 14 : 15 : /// @class AP_InputManager_Heli 16 : /// @brief Class managing the pilot's control inputs for Conventional Helicopter 17 : class AC_InputManager_Heli : public AC_InputManager { 18 : public: 19 : // Constructor 20 83 : AC_InputManager_Heli() 21 83 : : AC_InputManager() 22 : { 23 : // setup parameter defaults 24 83 : AP_Param::setup_object_defaults(this, var_info); 25 83 : } 26 : 27 : /* Do not allow copies */ 28 : CLASS_NO_COPY(AC_InputManager_Heli); 29 : 30 : //pass the last collective output from non-manual throttle mode 31 87 : void set_last_coll_output(float collective) { _old_flightmode_col_output = collective; } 32 : 33 : // get_pilot_desired_collective - rescale's pilot collective pitch input in Stabilize and Acro modes 34 : float get_pilot_desired_collective(int16_t control_in); 35 : 36 : // set_use_stab_col - setter function 37 99 : void set_use_stab_col(bool use) { _im_flags_heli.use_stab_col = use; } 38 : 39 : // set collective_ramp - setter function 40 99 : void set_collective_ramp(float ramp) { _ramp = constrain_float(ramp, 0.0, 1.0); } 41 : 42 : // parameter_check - returns true if input manager specific parameters are sensible, used for pre-arm check 43 : bool parameter_check(char* fail_msg, uint8_t fail_msg_len) const; 44 : 45 : static const struct AP_Param::GroupInfo var_info[]; 46 : 47 : private: 48 : struct InputManagerHeliFlags { 49 : bool use_stab_col; // 1 if we should use Stabilise mode collective range, 0 for Acro range 50 : } _im_flags_heli; 51 : 52 : // previous flight mode collective output 53 : float _old_flightmode_col_output; 54 : 55 : // ramp factor from previous mode to current mode collective output 56 : float _ramp; 57 : 58 : AP_Int16 _heli_stab_col_min; // minimum collective pitch setting at zero throttle input in Stabilize mode 59 : AP_Int16 _heli_stab_col_low; // collective pitch setting at mid-low throttle input in Stabilize mode 60 : AP_Int16 _heli_stab_col_high; // collective pitch setting at mid-high throttle input in Stabilize mode 61 : AP_Int16 _heli_stab_col_max; // maximum collective pitch setting at full throttle input in Stabilize mode 62 : AP_Float _acro_col_expo; // used to soften collective pitch inputs near center point in Acro mode 63 : 64 : };