Skip to content

Commit

Permalink
Merge pull request #421 from rosflight/416-update-mixing-system-to-be…
Browse files Browse the repository at this point in the history
…-more-flexible

416 update mixing system to be more flexible
  • Loading branch information
JMoore5353 authored Feb 26, 2024
2 parents a4a7c8c + 1477510 commit 258f003
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions include/mixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class Mixer : public ParamListenerInterface
TRICOPTER = 9,
FIXEDWING = 10,
PASSTHROUGH = 11,
VTAIL = 12,
CUSTOM = 13,
NUM_MIXERS,
INVALID_MIXER = 255
};
Expand Down Expand Up @@ -106,6 +108,7 @@ class Mixer : public ParamListenerInterface
void write_servo(uint8_t index, float value);

const mixer_t esc_calibration_mixing = {{M, M, M, M, M, M, NONE, NONE},

{1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f}, // F Mix
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // X Mix
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // X Mix
Expand Down Expand Up @@ -191,7 +194,7 @@ class Mixer : public ParamListenerInterface
{0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // Z Mix
490};

const mixer_t fixedwing_mixing = {{S, S, M, S, S, M, NONE, NONE},
const mixer_t fixedwing_mixing = {{S, S, M, S, S, M, NONE, NONE}, // output type

{0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // F Mix
{1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // X Mix
Expand All @@ -207,6 +210,23 @@ class Mixer : public ParamListenerInterface
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // Z Mix
50};

const mixer_t fixedwing_vtail_mixing = {
{S, S, M, S, NONE, NONE, NONE, NONE}, // Ailerons, LRuddervator, Motor, RRuddervator

{0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // F Mix
{1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // X Mix
{0.0f, -0.5f, 0.0f, 0.5f, 0.0f, 0.0f, 0.0f, 0.0f}, // Y Mix
{0.0f, 0.5f, 0.0f, 0.5f, 0.0f, 0.0f, 0.0f, 0.0f}, // Z Mix
50};

const mixer_t custom_mixing = {{NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE}, // output type

{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // F Mix
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // X Mix
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // Y Mix
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // Z Mix
50};

const mixer_t * mixer_to_use_;

// clang-format off
Expand All @@ -221,7 +241,9 @@ class Mixer : public ParamListenerInterface
&X8_mixing,
&tricopter_mixing,
&fixedwing_mixing,
&passthrough_mixing};
&passthrough_mixing,
&fixedwing_vtail_mixing,
&custom_mixing};
// clang-format on

public:
Expand Down

0 comments on commit 258f003

Please sign in to comment.