Skip to content

Commit 5781545

Browse files
committed
Added override type to mixer.h and added a row to each mixer header with the correct overrides
1 parent 71fdba5 commit 5781545

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

include/mixer.h

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,31 @@ 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+
<<<<<<< HEAD
92101
float *u[NUM_MIXER_OUTPUTS];
102+
=======
103+
override_type_t (*override_type)[NUM_MIXER_OUTPUTS];
104+
float (*u[NUM_MIXER_OUTPUTS])[NUM_MIXER_OUTPUTS];
105+
>>>>>>> 908e4d8 (Added override type to mixer.h and added a row to each mixer header with the correct overrides)
93106
} mixer_selection_t;
94107

95108
typedef struct
@@ -125,6 +138,7 @@ class Mixer : public ParamListenerInterface
125138
const mixer_t esc_calibration_mixing = {
126139
{ M, M, M, M, M, M, M, M, M, M}, // output type
127140
{ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50}, // Rate (Hz)
141+
{ THR, THR, THR, THR, THR, THR, THR, THR, THR, THR}, // Override types (this is for each row of the mixer matrix)
128142
{ {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // F_x Mix
129143
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // F_y Mix
130144
{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 +153,7 @@ class Mixer : public ParamListenerInterface
139153
const mixer_t quadcopter_plus_mixing = {
140154
{M, M, M, M, AUX, AUX, AUX, AUX, AUX, AUX}, // output type
141155
{490, 490, 490, 490, 50, 50, 50, 50, 50, 50}, // Rate (Hz)
156+
{ NEI, NEI, THR, ATT, ATT, ATT, NEI, NEI, NEI, NEI}, // Override types (this is for each row of the mixer matrix)
142157
{ { 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0, 0, 0}, // F_x Mix
143158
{ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0, 0, 0}, // F_y Mix
144159
{-0.2500f, -0.2500f, -0.2500f, -0.2500f, 0, 0, 0, 0, 0, 0}, // F_z Mix
@@ -153,6 +168,7 @@ class Mixer : public ParamListenerInterface
153168
const mixer_t quadcopter_x_mixing = {
154169
{M, M, M, M, AUX, AUX, AUX, AUX, AUX, AUX}, // output type
155170
{490, 490, 490, 490, 50, 50, 50, 50, 50, 50}, // Rate (Hz)
171+
{ NEI, NEI, THR, ATT, ATT, ATT, NEI, NEI, NEI, NEI}, // Override types (this is for each row of the mixer matrix)
156172
{ { 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0, 0, 0}, // F_x Mix
157173
{ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0, 0, 0}, // F_y Mix
158174
{-0.2500f, -0.2500f, -0.2500f, -0.2500f, 0, 0, 0, 0, 0, 0}, // F_z Mix
@@ -167,6 +183,7 @@ class Mixer : public ParamListenerInterface
167183
const mixer_t hex_plus_mixing = {
168184
{M, M, M, M, M, M, AUX, AUX, AUX, AUX}, // output type
169185
{490, 490, 490, 490, 490, 490, 490, 490, 50, 50}, // Rate (Hz)
186+
{ NEI, NEI, THR, ATT, ATT, ATT, NEI, NEI, NEI, NEI}, // Override types (this is for each row of the mixer matrix)
170187
{ { 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0}, // F_x Mix
171188
{ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0}, // F_y Mix
172189
{-0.1667f, -0.1667f, -0.1667f, -0.1667f, -0.1667f, -0.1667f, 0, 0, 0, 0}, // F_z Mix
@@ -181,6 +198,7 @@ class Mixer : public ParamListenerInterface
181198
const mixer_t hex_x_mixing = {
182199
{M, M, M, M, M, M, AUX, AUX, AUX, AUX}, // output type
183200
{490, 490, 490, 490, 490, 490, 490, 490, 50, 50}, // Rate (Hz)
201+
{ NEI, NEI, THR, ATT, ATT, ATT, NEI, NEI, NEI, NEI}, // Override types (this is for each row of the mixer matrix)
184202
{ { 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0}, // F_x Mix
185203
{ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0}, // F_y Mix
186204
{-0.1667f, -0.1667f, -0.1667f, -0.1667f, -0.1667f, -0.1667f, 0, 0, 0, 0}, // F_z Mix
@@ -195,6 +213,7 @@ class Mixer : public ParamListenerInterface
195213
const mixer_t octocopter_plus_mixing = {
196214
{M, M, M, M, M, M, M, M, AUX, AUX}, // output type
197215
{490, 490, 490, 490, 490, 490, 490, 490, 50, 50}, // Rate (Hz)
216+
{ NEI, NEI, THR, ATT, ATT, ATT, NEI, NEI, NEI, NEI}, // Override types (this is for each row of the mixer matrix)
198217
{ { 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0}, // F_x Mix
199218
{ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0}, // F_y Mix
200219
{-0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, 0, 0}, // F_z Mix
@@ -209,6 +228,7 @@ class Mixer : public ParamListenerInterface
209228
const mixer_t octocopter_x_mixing = {
210229
{M, M, M, M, M, M, M, M, AUX, AUX}, // output type
211230
{490, 490, 490, 490, 490, 490, 490, 490, 50, 50}, // Rate (Hz)
231+
{ NEI, NEI, THR, ATT, ATT, ATT, NEI, NEI, NEI, NEI}, // Override types (this is for each row of the mixer matrix)
212232
{ { 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0}, // F_x Mix
213233
{ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0}, // F_y Mix
214234
{-0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, 0, 0}, // F_z Mix
@@ -223,6 +243,7 @@ class Mixer : public ParamListenerInterface
223243
const mixer_t Y6_mixing = {
224244
{M, M, M, M, M, M, AUX, AUX, AUX, AUX}, // output type
225245
{490, 490, 490, 490, 490, 490, 490, 490, 50, 50}, // Rate (Hz)
246+
{ NEI, NEI, THR, ATT, ATT, ATT, NEI, NEI, NEI, NEI}, // Override types (this is for each row of the mixer matrix)
226247
{ { 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0}, // F_x Mix
227248
{ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0}, // F_y Mix
228249
{-0.1667f, -0.1667f, -0.1667f, -0.1667f, -0.1667f, -0.1667f, 0, 0, 0, 0}, // F_z Mix
@@ -237,6 +258,7 @@ class Mixer : public ParamListenerInterface
237258
const mixer_t X8_mixing = {
238259
{M, M, M, M, M, M, M, M, AUX, AUX}, // output type
239260
{490, 490, 490, 490, 490, 490, 490, 490, 50, 50}, // Rate (Hz)
261+
{ NEI, NEI, THR, ATT, ATT, ATT, NEI, NEI, NEI, NEI}, // Override types (this is for each row of the mixer matrix)
240262
{ { 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0}, // F_x Mix
241263
{ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0}, // F_y Mix
242264
{-0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, -0.1250f, 0, 0}, // F_z Mix
@@ -250,7 +272,8 @@ class Mixer : public ParamListenerInterface
250272

251273
const mixer_t fixedwing_mixing = {
252274
{ 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)
275+
{ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50}, // Rate (Hz)
276+
{ THR, NEI, NEI, ATT, ATT, ATT, NEI, NEI, NEI, NEI}, // Override types (this is for each row of the mixer matrix)
254277
{ {0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // F_x Mix
255278
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // F_y Mix
256279
{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 +288,22 @@ class Mixer : public ParamListenerInterface
265288
const mixer_t fixedwing_inverted_vtail_mixing = {
266289
{ S, S, S, AUX, M, AUX, AUX, AUX, AUX, AUX}, // Ailerons, LRuddervator, RRuddervator, Motor
267290
{ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50}, // Rate (Hz)
291+
{ THR, NEI, NEI, ATT, ATT, ATT, NEI, NEI, NEI, NEI}, // Override types (this is for each row of the mixer matrix)
268292
{ {0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // F_x Mix
269293
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // F_y Mix
270294
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // F_z Mix
271295
{1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // Q_x Mix
272296
{0.0f, -0.5f, 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // Q_y Mix
273297
{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}}};
298+
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
299+
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
300+
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
301+
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}}};
278302

279303
const mixer_t vtol_quad_plane_mixing = {
280304
{M, M, M, M, AUX, S, S, S, AUX, M}, // output type
281305
{490, 490, 490, 490, 50, 50, 50, 50, 50, 50}, // Rate (Hz)
306+
{ NEI, NEI, THR, ATT, ATT, ATT, THR, ATT, ATT, ATT}, // Override types (this is for each row of the mixer matrix)
282307
{ { 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0, 0, 0}, // F_x Mix
283308
{ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0, 0, 0, 0, 0, 0}, // F_y Mix
284309
{-0.2500f, -0.2500f, -0.2500f, -0.2500f, 0, 0, 0, 0, 0, 0}, // F_z Mix

0 commit comments

Comments
 (0)