NANs not passing to mixer on PX4IO on actuator_controls_0

I am attempting a pass-through control mixer running on FMU with Simple Mixers on the PX4IO to map to the correct output pins. I am using actuator_controls_1 to pass these messages.

The problem is PX4 expects NANs on motor channels to send the correct “disarm PWM”. I cannot write NANs to the controls channels on the FMU side - they are coming out as “0.0f” on the PX4IO side - which results in a PWM of 1500us.

writing to actuator_controls_0 channels - with PWM ranges from 1000-2000us.

To follow up - a value of NAN comes out as 0.0f on the PX4IO side, corresponding to 1500.

A value of INFINITY comes out to 1.0f on the PX4IO side corresponding to 2000.

A value of -INFINITY comes out to -1.0f on the PX4IO side corresponding to 1000us.

Ok, as Daniel Agar pointed out, this section of code ensure the values are finite before being cast to int, since NAN can’t be cast to int?.

1 Like

The behavior between the FMU mixer and the IO mixers do not match in this case - NANs are passed to the FMU mixer unaffected and send disarm values correctly.

I proposed that we encode a NAN as INT16_MAX, since the controls values are constraint to -1.0 to +1.0 and scaled by 10000 before getting cast to ints.

This way NANs still get passed on control channels and the FMU/PX4IO mixers behave the same.