OpenTX Arming Warning System for iNav
This tutorial will show you how to add checks for iNav arming in to your Taranis. iNav will not let the flight controller arm under certain conditions, such as the throttle is raised or launch mode is enabled in flight. With this system, the Taranis will help you discover what’s wrong if you attempt to arm. This can be really useful in an accidental disarm.
How this is set up
This system works by taking the control of arming away from a simple switch. Instead it uses a global variable to store the arm state (armed – disarmed – disarmed requiring action), logical switches to decide what’s happening, and special functions to set the state of arm.
For this tutorial, I have a arm switch on SF (towards you is disarmed), launch mode on SD (centre position), and auto tune on SG (towards you is enabled). I will use channel 5 to send the arm state to the flight controller. I have also separated blocks in the logical switches and special functions to make it easier to understand. These blocks can be put together so long as you adjust the logical switch numbers appropriately.
The arm state variable
We will get started nice and simply with the arm state variable. This keeps track of whether the system is armed or not. There are 3 options for the arm state:
- Disarmed and action needed – This is triggered when you try to arm but the checks fail.
- Disarmed – the normal disarmed state, activated when the switch is in the disarm position.
- Armed – all checks have been passed, so really arm the model.
To set this variable, go to the Flight Modes tab and for the default flight mode set GVAR1‘s name to Arm and make sure the value is set to 0.
The next step is to create the logic for the tests. I’ve broken this down in to smaller sections to make it easier and so that you can add your own logic to the tests.
Are we flying?
Some of the tests that we perform, we only want to check when we’re flying. Depending the setup, this could be done via telemetry, but I’ve chosen to use a pure Taranis method to estimate as to whether the model is flying or not. The checks I’m using are:
- Is the system armed?
- Is the throttle raised? (only needed to initiate the test, so gliding doesn’t interfere)
- Has the system been disarmed for less than 25 seconds? (If over 25 seconds, we can safely assume the model has landed in one way or another)
- L01 – Detects that the throttle is raised and the system is armed.
- L02 – Detects if the system has been disarmed for at least 25 seconds.
- L03 – If this switch is active, we are assuming the model is flying.
This is a test which will be performed every time the arm switch is thrown. I’ll show checking the throttle is high, but it could be used on any switch that you want off every time you arm.
- L10 – Checks to see if the throttle is high. (this could be replaced with any switch you want tested)
- L11 – Checks that L10 is true (throttle is high), the system is not armed (!L29), and the arm switch is in the arm position. If this logical switch is active, a warning to lower the throttle should be sounded and the system should not arm.
Tests for in flight re-arms only
This test is only performed when it’s thought the model is flying. I’ll show this check using an auto launch switch (SD-).
- L05 – Checks to see if the launch mode is enabled.
- L06 – Checks to see if L05 is true (launch mode enabled) and the arm switch is in the arm position.
- L07 – Checks to see if L06 is true (launch mode enabled and arm switch in the arm position), the system is not armed (!L29) and that the model is thought to be flying (L03). If this logical switch is active, a warning to disable launch mode should be sounded and the system should not arm.
Set the system to armed
The next block checks the tests to see if the system can be armed.
- L20 – Make sure the throttle is low (!L10) and that the system is not armed (!L29). If you create more standard tests, you will need to add these checks for each of them.
- L21 – Check to see if we are assumed flying (L03), launch mode is active (L05), and the system is not armed (!L29). If you create more in flight tests, you will need to add these checks for each of them.
- L22 – Check to see if L20 is true and L21 is false. Again, you will need multiples of these for additional logical switches. Standard type tests should always be true and in flight tests should be false.
- L23 – Check that L22 is true, the system is in the disarmed state, and that the arm switch is in the arm position. This this is true, we can arm the system.
Managing the system arm state
This system uses an arming state to monitor and decide how to work. This last section of logical switches check the arm state and also has the logic to set it to disarmed and action needed. The only thing the switch (SF) does is inform the system that you want to arm, and disarm.
- L29 – If this logical switch is active, the system is armed.
- L30 – If this logical switch is active, the system is disarmed.
The following checks set the state to disarmed and action needed. Which means there is a switch in the wrong place, stopping the system from arming.
- L31 – Check to see if L7 (launch mode test) is active or L11 is active (throttle test). If you add additional tests, you will need to add addition checks here too.
- L32 – If L31 is active (at least 1 arming test has failed), keep this switch on until the arming switch is in the disarm position.
The final thing we need to do, is tie the system together with some special functions. These set the arm state and give feedback if any tests fail.
The first section sets the arm state for the system.
- SF1 – The arm switch in the disarm position always sets the system to disarmed (0).
- SF2 – If L32 is active, set the arm state to disarmed and action needed (-1).
- SF3 – If L23 is active, all tests are passed, so set the system to armed (1).
The next section actually sends the armed/disarmed state to the flight controller. I’m using channel 5, but feel free to put it on whatever channel you like. Combining it with flight modes, like in my flight modes and arming on a single channel tutorial, is also fine.
- SF5 – If L29 is active, send the position for armed to the radio channel.
- SF6 – if L29 is not active, send the position for disarmed to the radio channel.
The final section is for the alerts. You would need custom sound files to give the correct instructions, such as “Lower throttle to arm” or “Disable launch mode to arm”.
- SF12 – If L29 is active, say that the system is armed.
- SF13 – If L29 is not active, say that the system is disarmed.
- SF10 – If L07 is active, play a message to state that launch mode needs to be disabled to arm.
- SF11 – If L11 is active, play a message to state that the throttle needs to be lowered to arm.
This should give you a working system that performs tests before arming the model, and alerts you to what is stopping arming from taking place.
Full OpenTX Code
|L01||a > x||Thr||98||L13||---||---|
|L04||a > x||Thr||-98||---||0.5||N/A|
|L06||a = x||SD||0||---||---||---|
|L13||a = x||GV1:Arm||1||---||---||---|
|L14||a = x||GV1:Arm||0||---||---||---|
|SF01||SF↓||Adjust GV1:Arm||Value 0||✔ ON|
|SF02||L16||Adjust GV1:Arm||Value -1||✔ ON|
|SF03||L12||Adjust GV1:Arm||Value 1||✔ ON|
|SF04||L13||Override CH5||100||✔ ON|
|SF05||!L13||Override CH5||-100||✔ ON|
This article has helped 202 people. For more useful things, please check out my YouTube Channel.