Line data Source code
1 : #pragma once
2 :
3 : #include <AP_Tuning/AP_Tuning_config.h>
4 :
5 : #if AP_TUNING_ENABLED
6 :
7 : #include <AP_Tuning/AP_Tuning.h>
8 :
9 : /*
10 : Plane transmitter tuning
11 : */
12 : class AP_Tuning_Plane : public AP_Tuning
13 : {
14 : private:
15 : // table of tuning sets
16 : static const tuning_set tuning_sets[];
17 :
18 : // table of tuning parameter names for reporting
19 : static const tuning_name tuning_names[];
20 :
21 : public:
22 : // constructor
23 692 : AP_Tuning_Plane(void) : AP_Tuning(tuning_sets, tuning_names) {}
24 :
25 : static const struct AP_Param::GroupInfo var_info[];
26 :
27 : private:
28 :
29 : // individual tuning parameters
30 : enum tuning_func {
31 : TUNING_NONE = 0,
32 :
33 : // quadplane tuning
34 : TUNING_RATE_ROLL_PI = 1,
35 : TUNING_RATE_ROLL_P = 2,
36 : TUNING_RATE_ROLL_I = 3,
37 : TUNING_RATE_ROLL_D = 4,
38 :
39 : TUNING_RATE_PITCH_PI = 5,
40 : TUNING_RATE_PITCH_P = 6,
41 : TUNING_RATE_PITCH_I = 7,
42 : TUNING_RATE_PITCH_D = 8,
43 :
44 : TUNING_RATE_YAW_PI = 9,
45 : TUNING_RATE_YAW_P = 10,
46 : TUNING_RATE_YAW_I = 11,
47 : TUNING_RATE_YAW_D = 12,
48 :
49 : TUNING_ANG_ROLL_P = 13,
50 : TUNING_ANG_PITCH_P = 14,
51 : TUNING_ANG_YAW_P = 15,
52 :
53 : TUNING_PXY_P = 16,
54 : TUNING_PZ_P = 17,
55 :
56 : TUNING_VXY_P = 18,
57 : TUNING_VXY_I = 19,
58 : TUNING_VZ_P = 20,
59 :
60 : TUNING_AZ_P = 21,
61 : TUNING_AZ_I = 22,
62 : TUNING_AZ_D = 23,
63 :
64 : TUNING_RATE_PITCH_FF = 24,
65 : TUNING_RATE_ROLL_FF = 25,
66 : TUNING_RATE_YAW_FF = 26,
67 :
68 : // fixed wing tuning
69 : TUNING_FIXED_WING_BASE = 50,
70 : TUNING_RLL_P = 50,
71 : TUNING_RLL_I = 51,
72 : TUNING_RLL_D = 52,
73 : TUNING_RLL_FF = 53,
74 :
75 : TUNING_PIT_P = 54,
76 : TUNING_PIT_I = 55,
77 : TUNING_PIT_D = 56,
78 : TUNING_PIT_FF = 57,
79 :
80 : TUNING_Q_FWD_THR = 58,
81 : };
82 :
83 : /*
84 : sets of tuning values, chosen with TUNE_PARMSET over 100
85 : */
86 : enum tuning_sets {
87 : TUNING_SET_RATE_ROLL_PITCH = 1,
88 : TUNING_SET_RATE_ROLL = 2,
89 : TUNING_SET_RATE_PITCH = 3,
90 : TUNING_SET_RATE_YAW = 4,
91 : TUNING_SET_ANG_ROLL_PITCH = 5,
92 : TUNING_SET_VXY = 6,
93 : TUNING_SET_AZ = 7,
94 : TUNING_SET_RATE_PITCHDP = 8,
95 : TUNING_SET_RATE_ROLLDP = 9,
96 : TUNING_SET_RATE_YAWDP = 10,
97 : TUNING_SET_DP_ROLL_PITCH = 11,
98 : TUNING_SET_PIDFF_ROLL = 12,
99 : TUNING_SET_PIDFF_PITCH = 13,
100 : };
101 :
102 : AP_Float *get_param_pointer(uint8_t parm) override;
103 : void save_value(uint8_t parm) override;
104 : void reload_value(uint8_t parm) override;
105 : void set_value(uint8_t parm, float value) override;
106 :
107 : // tuning set arrays
108 : static const uint8_t tuning_set_rate_roll_pitch[];
109 : static const uint8_t tuning_set_rate_roll[];
110 : static const uint8_t tuning_set_rate_pitch[];
111 : static const uint8_t tuning_set_rate_yaw[];
112 : static const uint8_t tuning_set_ang_roll_pitch[];
113 : static const uint8_t tuning_set_vxy[];
114 : static const uint8_t tuning_set_az[];
115 : static const uint8_t tuning_set_rate_pitchDP[];
116 : static const uint8_t tuning_set_rate_rollDP[];
117 : static const uint8_t tuning_set_rate_yawDP[];
118 : static const uint8_t tuning_set_dp_roll_pitch[];
119 : static const uint8_t tuning_set_pidff_roll[];
120 : static const uint8_t tuning_set_pidff_pitch[];
121 :
122 : // mask of what params have been set
123 : uint64_t have_set;
124 : };
125 :
126 : #endif // AP_TUNING_ENABLED
|