We are integrating a parachute which should be fired on flight termination, and would like to have a manual way of triggering flight termination (i.e., in addition to the automatic flight termination triggers like
FD_FAIL - which we have had separate issues with, but that’s another issue.)
Is there a way to trigger flight termination via the RC?
I am from the same team as Michael, and we solved our issue now by changing the code for the kill switch. Instead of activating the manual_lockdown, we set the force_failsafe.
Since we did not use the kill-switch for whatever it was supposed to, it is not a restriction for us. Now, the kill switch terminates, i.e. stops the rotors and activates the parachute. Switching off the kill-switch has no effect in our environment.
Hi @AlexKuenz ,
I think this is a feature that other people might like and we should support mapping a switch/button to flight termination. Could you add that functionality, make a PR and tag me for review please?
We are happy to create a PR containing the change from kill switch (manual_lockdown) to flight termination (force_failsafe). Unfortunately we know too little about the PX4 codebase to create a new switch/button mapping functionality.
Our change can be seen here:
Could you point out the steps to make this into a fully featured change from which we can create a PR?
Sure, the easiest way to add a new switch is to take as a baseline an other switch; for example, the kill switch.
Almost everything you need to change is in the
rc_update module (this is a new module, you need to pull the latest master to find it, previously everything was in the sensor module).
Take for example this line: https://github.com/PX4/Firmware/blob/4a28c8180b3f0249efc706f712b9ed41ca4f7dec/src/modules/rc_update/rc_update.cpp#L446-L447
Duplicate it, change
rc_killswitch_inv as well.
Then you need to search where the previous variables should be declared and associated to a parameter (note that
RC_CHANNELS_FUNCTION_TERMINATION has to be added in the message definition: https://github.com/PX4/Firmware/blob/07d656e971a72d1202651dfd3b4642736fb078d7/msg/rc_channels.msg).
After this is done, you can simply go to commander and make the change you made previously, but using the newly created termination switch.
There shouldn’t be anything too complicated, just search, copy/paste, replace, compile, fix the missing declarations and repeat.
I hope it’s clear enough, don’t hesitate to ask if there is an issue you can’t solve.