Skip to content

Commit 908e4d8

Browse files
M1tchM355JMoore5353
authored andcommitted
Added override type to mixer.h and added a row to each mixer header with the correct overrides
1 parent 802a6c2 commit 908e4d8

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

include/mixer.h

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,26 @@ class Mixer : public ParamListenerInterface
7878
G // GPIO
7979
} output_type_t;
8080

81+
typedef enum
82+
{
83+
THR, // Throttle
84+
ATT, // Attitude
85+
NEI // Neither, always give control of this channel to offboard computer
86+
} override_type_t;
87+
8188
typedef struct
8289
{
8390
output_type_t output_type[NUM_MIXER_OUTPUTS];
8491
float default_pwm_rate[NUM_MIXER_OUTPUTS];
92+
override_type_t override_type[NUM_MIXER_OUTPUTS];
8593
float u[NUM_MIXER_OUTPUTS][NUM_MIXER_OUTPUTS];
8694
} mixer_t;
8795

8896
typedef struct
8997
{
9098
output_type_t (*output_type)[NUM_MIXER_OUTPUTS];
9199
float (*default_pwm_rate)[NUM_MIXER_OUTPUTS];
100+
override_type_t (*override_type)[NUM_MIXER_OUTPUTS];
92101
float (*u[NUM_MIXER_OUTPUTS])[NUM_MIXER_OUTPUTS];
93102
} mixer_selection_t;
94103

@@ -125,6 +134,7 @@ class Mixer : public ParamListenerInterface
125134
const mixer_t esc_calibration_mixing = {
126135
{ M, M, M, M, M, M, M, M, M, M}, // output type
127136
{ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50}, // Rate (Hz)
137+
{ THR, THR, THR, THR, THR, THR, THR, THR, THR, THR}, // Override types (this is for each row of the mixer matrix)
128138
{ {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // F_x Mix
129139
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // F_y Mix
130140
{0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f}, // F_z Mix
@@ -139,6 +149,7 @@ class Mixer : public ParamListenerInterface
139149
const mixer_t quadcopter_plus_mixing = {
140150
{M, M, M, M, AUX, AUX, AUX, AUX, AUX, AUX}, // output type
141151
{490, 490, 490, 490, 50, 50, 50, 50, 50, 50}, // Rate (Hz)
152+
{ NEI, NEI, THR, ATT, ATT, ATT, NEI, NEI, NEI, NEI}, // Override types (this is for each row of the mixer matrix)
142153
{ { 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0, 0, 0}, // F_x Mix
143154
{ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0, 0, 0}, // F_y Mix
144155
{-0.2500f, -0.2500f, -0.2500f, -0.2500f, 0, 0, 0, 0, 0, 0}, // F_z Mix
@@ -153,6 +164,7 @@ class Mixer : public ParamListenerInterface
153164
const mixer_t quadcopter_x_mixing = {
154165
{M, M, M, M, AUX, AUX, AUX, AUX, AUX, AUX}, // output type
155166
{490, 490, 490, 490, 50, 50, 50, 50, 50, 50}, // Rate (Hz)
167+
{ NEI, NEI, THR, ATT, ATT, ATT, NEI, NEI, NEI, NEI}, // Override types (this is for each row of the mixer matrix)
156168
{ { 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0, 0, 0}, // F_x Mix
157169
{ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0, 0, 0}, // F_y Mix
158170
{-0.2500f, -0.2500f, -0.2500f, -0.2500f, 0, 0, 0, 0, 0, 0}, // F_z Mix
@@ -167,6 +179,7 @@ class Mixer : public ParamListenerInterface
167179
const mixer_t hex_plus_mixing = {
168180
{M, M, M, M, M, M, AUX, AUX, AUX, AUX}, // output type
169181
{490, 490, 490, 490, 490, 490, 490, 490, 50, 50}, // Rate (Hz)
182+
{ NEI, NEI, THR, ATT, ATT, ATT, NEI, NEI, NEI, NEI}, // Override types (this is for each row of the mixer matrix)
170183
{ { 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0}, // F_x Mix
171184
{ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0}, // F_y Mix
172185
{-0.1667f, -0.1667f, -0.1667f, -0.1667f, -0.1667f, -0.1667f, 0, 0, 0, 0}, // F_z Mix
@@ -181,6 +194,7 @@ class Mixer : public ParamListenerInterface
181194
const mixer_t hex_x_mixing = {
182195
{M, M, M, M, M, M, AUX, AUX, AUX, AUX}, // output type
183196
{490, 490, 490, 490, 490, 490, 490, 490, 50, 50}, // Rate (Hz)
197+
{ NEI, NEI, THR, ATT, ATT, ATT, NEI, NEI, NEI, NEI}, // Override types (this is for each row of the mixer matrix)
184198
{ { 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0}, // F_x Mix
185199
{ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0}, // F_y Mix
186200
{-0.1667f, -0.1667f, -0.1667f, -0.1667f, -0.1667f, -0.1667f, 0, 0, 0, 0}, // F_z Mix
@@ -195,6 +209,7 @@ class Mixer : public ParamListenerInterface
195209
const mixer_t octocopter_plus_mixing = {
196210
{M, M, M, M, M, M, M, M, AUX, AUX}, // output type
197211
{490, 490, 490, 490, 490, 490, 490, 490, 50, 50}, // Rate (Hz)
212+
{ NEI, NEI, THR, ATT, ATT, ATT, NEI, NEI, NEI, NEI}, // Override types (this is for each row of the mixer matrix)
198213
{ { 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0}, // F_x Mix
199214
{ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0}, // F_y Mix
200215
{-0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, 0, 0}, // F_z Mix
@@ -209,6 +224,7 @@ class Mixer : public ParamListenerInterface
209224
const mixer_t octocopter_x_mixing = {
210225
{M, M, M, M, M, M, M, M, AUX, AUX}, // output type
211226
{490, 490, 490, 490, 490, 490, 490, 490, 50, 50}, // Rate (Hz)
227+
{ NEI, NEI, THR, ATT, ATT, ATT, NEI, NEI, NEI, NEI}, // Override types (this is for each row of the mixer matrix)
212228
{ { 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0}, // F_x Mix
213229
{ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0}, // F_y Mix
214230
{-0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, 0, 0}, // F_z Mix
@@ -223,6 +239,7 @@ class Mixer : public ParamListenerInterface
223239
const mixer_t Y6_mixing = {
224240
{M, M, M, M, M, M, AUX, AUX, AUX, AUX}, // output type
225241
{490, 490, 490, 490, 490, 490, 490, 490, 50, 50}, // Rate (Hz)
242+
{ NEI, NEI, THR, ATT, ATT, ATT, NEI, NEI, NEI, NEI}, // Override types (this is for each row of the mixer matrix)
226243
{ { 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0}, // F_x Mix
227244
{ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0}, // F_y Mix
228245
{-0.1667f, -0.1667f, -0.1667f, -0.1667f, -0.1667f, -0.1667f, 0, 0, 0, 0}, // F_z Mix
@@ -237,6 +254,7 @@ class Mixer : public ParamListenerInterface
237254
const mixer_t X8_mixing = {
238255
{M, M, M, M, M, M, M, M, AUX, AUX}, // output type
239256
{490, 490, 490, 490, 490, 490, 490, 490, 50, 50}, // Rate (Hz)
257+
{ NEI, NEI, THR, ATT, ATT, ATT, NEI, NEI, NEI, NEI}, // Override types (this is for each row of the mixer matrix)
240258
{ { 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0}, // F_x Mix
241259
{ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0}, // F_y Mix
242260
{-0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, 0, 0}, // F_z Mix
@@ -250,7 +268,8 @@ class Mixer : public ParamListenerInterface
250268

251269
const mixer_t fixedwing_mixing = {
252270
{ S, S, S, AUX, M, AUX, AUX, AUX, AUX, AUX}, // output type
253-
{ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50}, // Rate (Hz)
271+
{ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50}, // Rate (Hz)
272+
{ THR, NEI, NEI, ATT, ATT, ATT, NEI, NEI, NEI, NEI}, // Override types (this is for each row of the mixer matrix)
254273
{ {0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // F_x Mix
255274
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // F_y Mix
256275
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // F_z Mix
@@ -265,20 +284,22 @@ class Mixer : public ParamListenerInterface
265284
const mixer_t fixedwing_inverted_vtail_mixing = {
266285
{ S, S, S, AUX, M, AUX, AUX, AUX, AUX, AUX}, // Ailerons, LRuddervator, RRuddervator, Motor
267286
{ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50}, // Rate (Hz)
287+
{ THR, NEI, NEI, ATT, ATT, ATT, NEI, NEI, NEI, NEI}, // Override types (this is for each row of the mixer matrix)
268288
{ {0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // F_x Mix
269289
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // F_y Mix
270290
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // F_z Mix
271291
{1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // Q_x Mix
272292
{0.0f, -0.5f, 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // Q_y Mix
273293
{0.0f, 0.5f, 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // Q_z Mix
274-
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
275-
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
276-
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
277-
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}}};
294+
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
295+
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
296+
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
297+
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}}};
278298

279299
const mixer_t vtol_quad_plane_mixing = {
280300
{M, M, M, M, AUX, S, S, S, AUX, M}, // output type
281301
{490, 490, 490, 490, 50, 50, 50, 50, 50, 50}, // Rate (Hz)
302+
{ NEI, NEI, THR, ATT, ATT, ATT, THR, ATT, ATT, ATT}, // Override types (this is for each row of the mixer matrix)
282303
{ { 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0, 0, 0}, // F_x Mix
283304
{ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0, 0, 0}, // F_y Mix
284305
{-0.2500f, -0.2500f, -0.2500f, -0.2500f, 0, 0, 0, 0, 0, 0}, // F_z Mix

0 commit comments

Comments
 (0)