# New Mixer Parameters

I am trying to write a mixer file and I am confused about how the parameters work.

Here’s the documentation for a summing mixer:

M: [control count]
O: [-ve scale] [+ve scale] [offset] [lower limit] [upper limit]
S: [group] [index] [-ve scale] [+ve scale] [offset] [lower limit] [upper limit]

I understand the [group] and [index] portion of the summing element. I am a little confused by the other 5 parameters.

Do [-ve scale] and [+ve scale] represent the absolute maximum values that come from the channel? Ex: Throttle input would be 0 to 2000, so:
S: 0 3 0 10000

Continuing with the throttle example, if i want my entire throttle output to be mapped to 1000 to 1800, I assume I use [offset] [lower limit] [upper limit] to scale it. So:
S: 0 3 0 10000 0 5000 9000

Now if I am on the right track, I’ll continue by adding another input channel to the mixer.
M: 2
O: …
S: 0 2 -10000 10000 0 -10000 10000
S: 0 3 0 10000 0 5000 9000

I believe this scales the throttle channel and sums it with an unscaled yaw channel. Now to send those on the output:

M: 2
O: -5000 19000 0 -10000 10000
S: 0 2 -10000 10000 0 -10000 10000
S: 0 3 0 10000 0 5000 9000

I used [-ve scale] of -5000 because that’s the minimum sum for the two channels and [+ve scale] of 19000 using the same reasoning.

Am I demonstrating how to use these parameters in the mixer definition? Any help is appreciated. Thanks!

Found the comments in Firmware/src/modules/systemlib/mixer/mixer.h that really help explain the math. I think this should be enough for me to write the mixer.

``````* Scaling
* -------
*
* Each scaler allows the input value to be scaled independently for
* inputs greater/less than zero. An offset can be applied to the output,
* as well as lower and upper boundary constraints.
* Negative scaling factors cause the output to be inverted (negative input
* produces positive output).
*
* Scaler pseudocode:
*
* if (input < 0)
*     output = (input * NEGATIVE_SCALE) + OFFSET
* else
*     output = (input * POSITIVE_SCALE) + OFFSET
*
* if (output < LOWER_LIMIT)
*     output = LOWER_LIMIT
* if (output > UPPER_LIMIT)
*     output = UPPER_LIMIT``````

Guys any idea how control group 0 and control group 1 work? I am making a mixer for a VTOL. My understanding is that group 0 works in MC mode and group 1 in FW. Is that correct?

1 Like