Line data Source code
1 : #include "AC_CommandModel.h" 2 : #include <AP_HAL/AP_HAL.h> 3 : 4 : // The Command Model class holds parameters that shape the pilot desired angular rate input. This class can 5 : // be expanded to hold the methods that shape the pilot desired input. 6 : 7 : extern const AP_HAL::HAL& hal; 8 : 9 : // table of user settable parameters 10 : const AP_Param::GroupInfo AC_CommandModel::var_info[] = { 11 : 12 : // @Param: RATE 13 : // @DisplayName: Maximum Controlled Rate 14 : // @Description: Sets the maximum rate commanded. 15 : // @Units: deg/s 16 : // @Range: 1 360 17 : // @User: Standard 18 : AP_GROUPINFO_FLAGS_DEFAULT_POINTER("RATE", 1, AC_CommandModel, rate, default_rate), 19 : 20 : // @Param: EXPO 21 : // @DisplayName: Controlled Expo 22 : // @Description: Controlled expo to allow faster rotation when stick at edges 23 : // @Values: 0:Disabled,0.1:Very Low,0.2:Low,0.3:Medium,0.4:High,0.5:Very High 24 : // @Range: -0.5 1.0 25 : // @User: Advanced 26 : AP_GROUPINFO_FLAGS_DEFAULT_POINTER("EXPO", 2, AC_CommandModel, expo, default_expo), 27 : 28 : // @Param: RATE_TC 29 : // @DisplayName: Rate control input time constant 30 : // @Description: Rate control input time constant. Low numbers lead to sharper response, higher numbers to softer response 31 : // @Units: s 32 : // @Range: 0 1 33 : // @Increment: 0.01 34 : // @Values: 0.5:Very Soft, 0.2:Soft, 0.15:Medium, 0.1:Crisp, 0.05:Very Crisp 35 : // @User: Standard 36 : AP_GROUPINFO_FLAGS_DEFAULT_POINTER("RATE_TC", 3, AC_CommandModel, rate_tc, default_rate_tc), 37 : 38 : AP_GROUPEND 39 : }; 40 : 41 : // Constructor 42 3695 : AC_CommandModel::AC_CommandModel(float initial_rate, float initial_expo, float initial_tc) : 43 3695 : default_rate_tc(initial_tc), 44 3695 : default_rate(initial_rate), 45 3695 : default_expo(initial_expo) 46 : { 47 3695 : AP_Param::setup_object_defaults(this, var_info); 48 3695 : } 49 :