Arm/disarm pwm with IO_pass passthrough mixer

Hello Folks,

I’m trying to achieve a passthrough mixer matrix on a multirotor UAV mounting a Pixhawk mini with PX4 firmware (v1.7.3).

I set-up the mixer as IO_pass because our custom flight controller should publish the actuators setpoint (pwm) normalized between -1 and +1 using the actuator_controls_0 topic in order to directly drive the actuators (we would like to by-pass the px4 mixer).

The problem is: when the system is disarmed, only the fourth channel (the “throttle” signal, or in our case the fourth motor) turns out to have the desired pwm value (specified with “pwm disarmed” command) while the other channels have the pwm value which would result as in armed state, instead of the disarmed value.
When the system is armed all the channels have the desired pwm values.

Additional info:
We are using as SYS_AUTOSTART 4001 (the canonical quadrotor) and we are overriding the quad_x mixer using the SD card defining a file called /etc/mixers/quad_x.main.mix and copy/pasted inside the IO_pass definition:

Passthrough mixer for PX4IO

This file defines passthrough mixers suitable for testing.

Channel group 0, channels 0-7 are passed directly through to the outputs.

M: 1
O: 10000 10000 0 -10000 10000
S: 0 0 10000 10000 0 -10000 10000

M: 1
O: 10000 10000 0 -10000 10000
S: 0 1 10000 10000 0 -10000 10000

M: 1
O: 10000 10000 0 -10000 10000
S: 0 2 10000 10000 0 -10000 10000

M: 1
O: 10000 10000 0 -10000 10000
S: 0 3 10000 10000 0 -10000 10000

M: 1
O: 10000 10000 0 -10000 10000
S: 0 4 10000 10000 0 -10000 10000

M: 1
O: 10000 10000 0 -10000 10000
S: 0 5 10000 10000 0 -10000 10000

M: 1
O: 10000 10000 0 -10000 10000
S: 0 6 10000 10000 0 -10000 10000

M: 1
O: 10000 10000 0 -10000 10000
S: 0 7 10000 10000 0 -10000 10000

We added also a /etc/config.txt:

set MAV_TYPE 0
param set MAV_TYPE ${MAV_TYPE}

set PWM_OUT 12345678

param set PWM_RATE 50

And a /etc/extras.txt file as follow:

pwm rate -r 400 -c 1234
pwm failsafe -p 1000 -c 1234
pwm disarmed -p 900 -c 1234
pwm min -p 1050 -c 1234
pwm max -p 1950 -c 1234

pwm failsafe -p 1489 -c 5678
pwm disarmed -p 1489 -c 5678
pwm min -p 828 -c 5678
pwm max -p 2150 -c 5678

Any ideas?

Have a nice day,
Mattia.

1 Like

@LorenzMeier do you have any clue?

There is a piece of code that takes the actuator_controls_0 message and passes it to the mixer. Before it passes it, though, it detects if the aircraft is disarmed and writes NAN to the throttle channel if so (this is your 4th motor index). This occurs on PX4IO if you are using an IO mixer (since NANs don’t pass correctly between FMU and IO.

It expects that most mixers will pass on this NAN value to all the motors outputs. pwm_limit.cpp then sets all channels showing NAN to the disarm value.

You have to be careful rewriting actuator_controls_0[3] as anything other than throttle because other modules (land_detector, for example) look at that value for aircraft logic.

In the future I think it might be a good idea to give the simple mixer a parameter to detect arm/disarm states and set outputs to NAN. Maybe create a “Motor Simple Mixer” that ensures safe values during disarm.