Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

416 update mixing system to be more flexible #421

Merged
merged 8 commits into from
Feb 26, 2024
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
Loading