Skip to content

Commit

Permalink
Added a custom mixer and a vtail mixer and deleted the passthrough mixer
Browse files Browse the repository at this point in the history
  • Loading branch information
JMoore5353 committed Jan 25, 2024
1 parent 2c56690 commit af7b100
Showing 1 changed file with 49 additions and 32 deletions.
81 changes: 49 additions & 32 deletions include/mixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ class Mixer : public ParamListenerInterface
X8 = 8,
TRICOPTER = 9,
FIXEDWING = 10,
PASSTHROUGH = 11,
VTAIL = 11,
CUSTOM = 12,
NUM_MIXERS,
INVALID_MIXER = 255
};
Expand Down Expand Up @@ -105,12 +106,14 @@ class Mixer : public ParamListenerInterface
void write_motor(uint8_t index, float value);
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
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // X Mix
490};
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
{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // X Mix
490};

const mixer_t quadcopter_plus_mixing = {
{M, M, M, M, NONE, NONE, NONE, NONE}, // output_type
Expand All @@ -121,13 +124,14 @@ class Mixer : public ParamListenerInterface
{1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // Z Mix
490};

const mixer_t quadcopter_x_mixing = {{M, M, M, M, NONE, NONE, NONE, NONE}, // output_type
const mixer_t quadcopter_x_mixing = {
{M, M, M, M, NONE, NONE, NONE, NONE}, // output_type

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

const mixer_t hex_plus_mixing = {
{M, M, M, M, M, M, M, M}, // output_type
Expand Down Expand Up @@ -174,13 +178,14 @@ class Mixer : public ParamListenerInterface
{1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f}, // Z Mix
490};

const mixer_t X8_mixing = {{M, M, M, M, M, M, M, M}, // output_type
const mixer_t X8_mixing = {
{M, M, M, M, M, M, M, M}, // output_type

{1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f}, // F Mix
{-1.0f, -1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f}, // X Mix
{1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, 1.0f}, // Y Mix
{1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f}, // Z Mix
490};
{1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f}, // F Mix
{-1.0f, -1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f}, // X Mix
{1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, 1.0f}, // Y Mix
{1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f}, // Z Mix
490};

const mixer_t tricopter_mixing = {
{M, M, M, S, NONE, NONE, NONE, NONE}, // output_type
Expand All @@ -191,21 +196,32 @@ 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
{0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // Y Mix
{0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // Z Mix
50};

const mixer_t fixedwing_vtail_mixing = {
{M, S, S, S, S, S, S, S}, // output type - Motor | LAil | RAil | LRudVator | RRudVator | LAirBrake | RAirBrake | LandingGear

{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, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // Y Mix
{0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // Z Mix
50};
{1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // F Mix
{0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, // X Mix
{0.0f, 0.0f, 0.0f, -0.5f, 0.5f, 0.0f, 0.0f, 0.0f}, // Y Mix
{0.0f, 0.0f, 0.0f, 0.5f, 0.5f, 0.0f, 0.0f, 0.0f}, // Z Mix
50};

const mixer_t passthrough_mixing = {{NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE},
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};
{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_;

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

public:
Expand Down

0 comments on commit af7b100

Please sign in to comment.