Output offset in simple mixer does not work

Hey guys,
I am working on PX4 firmware for a differential drive rover. My main problem is that the output in my simple mixer does not get any impact from the output offset value at all. An example of my mixer is:
M: 2
O: -20000 20000 -XXXXX -10000 10000
S: 0 1 8889 8889 0 -10000 10000
S: 0 0 1111 1111 -YYYYY -10000 10000

The output is the PWM value to control a brushed motor. I have another output to control the direction of motor rotation.

My main problem is that this value -XXXXX does not have any impact on the output.

Any help or advice would help me a lot and thank you in advance for your support :slight_smile:

Note that I have tried even without S line to see if I can see the offset in the output like this:
M: 0
O: -20000 20000 -XXXXX -10000 10000
still no impact on the output from the offset. I get impact from the scalers and the interval boundaries but not the offset of output.
I even get impact from the offset of inputs (-YYYYY) but not the outputs (-XXXXX).

Hi!
I am having nearly the exact same issue in a very similar application. When using just the S: input lines, I can get my output to offset the way I need it to but adding in the output adjustment line (in an attempt to limit or scale the overall outputs) causes the offset of the input signal to be ignored in addition to an offset in the O: line having no effect on the output.

I’ve even done some searching through the firmware source code and it seems like the output line is handled by the same function as the input lines so it makes no sense for it to have no affect on the output signal (especially since offsetting the input does work when used without the O: line present). I’ve also found that using the output line as in your second example completely locks out the functionality of any future parts of the mixer file and gives no output itself.

If you’ve had any luck on fixing the output offset having no effect since this was originally posted that would be a huge help!

Otherwise, I’m hoping that by adding to this thread we may eventually get an answer. :slight_smile:

Thanks in advance!

I recently faced the same problem.
when I define a simple mixer, If I use the “O:” tag, the offset doesn’t have any effect.
for example:
M: 3
O: 10000 10000 -9000 -10000 10000
S: 0 0 -1000 0 0 -10000 10000
S: 0 1 -1000 0 0 -10000 10000
S: 0 2 -1000 0 0 -10000 10000

in this case, the -9000 (offset) is not applied to the output.
After checking the source code and some debugging, I found out that in the PWMOut.cpp file the software reads the values from PWM_MAIN_TRIMx (0 by default) and replaces the output offset (-9000) from the mixer file!

_mixing_output.mixers()->set_trims(values, _num_outputs);
in other words, the output offset in the mixer file never gets used.

I don’t think the PWM_MAIN_TRIMx parameter is a good replacement for the output offset in the mixer file (if it is at least they should mention it in the docs or remove it from the mixer altogether).