Exploring through the mixer code on the px4io firmware I’ve noticed that we are protecting against motors spinning during disarm by doing the following:
If so, is this the best method to handle ensuring safe values are passed through the mixer during disarm? I believe this could be documented a little better for people making custom mixers- they should expect a NaN value for thrust control during disarm and need to be able to handle that case.
Hi @dlwalter ,
Yes, this is correct. I also find that we should maybe force disarmed values withou relaying on the propagation on NANs. I discovered that when one day I decided to make a mixer to output that output 1 or zero depending on the thrust. I realized that I was unable to disarm the drone because the result of a NAN thrust was 1.
I think that the reason is that we want to output PWM values to the servos even when disarmed (as long as the vehicle is prearmed - safety switch pressed) but not the motors. Since the motors signals are directly computed using - at least - thrust, setting a NAN to thrust should output a NAN and the FMU/IO/… driver is then able to identify when it should set disarmed values.
Yeah, the passthrough of NAN can be pretty obscured for anyone unfamiliar with the system. Maybe it should just be better documented in mixer.h or somewhere.
It would have definitely saved me some development time if the NaN logic was explicit in the mixer - especially since the whole PWM architecture is completely different in SITL and the NaNs never show up.