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.
Logical switches
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.
Standard Test
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.
Special Functions
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.
RC Programming
OpenTX Logical Switches
# | Function | V1 | V2 | AND Switch | Duration | Delay |
---|---|---|---|---|---|---|
Detect the throttle is raised and the system is armed | ||||||
L01 | a>x | Thr | -98 | L13 | 0.0 | 0.0 |
Detects that the system has been not armed for at least 25 seconds | ||||||
L02 | AND | !L13 | 0.0 | 25.0 | ||
If this switch is active, it is assumed that we are flying | ||||||
L03 | Sticky | L01 | L02 | 0.0 | 0.0 | |
Detect that the throttle is raised | ||||||
L04 | a>x | Thr | -98 | 0.5 | 0.0 | |
Check that we want to arm, but the throttle is raised. The system is not armed | ||||||
L05 | AND | L04 | !L13 | SF↑ | 0.0 | 0.0 |
Check to see if launch mode is enabled | ||||||
L06 | AND | SD- | 0.0 | 0.0 | ||
Check if launch mode is enabled and the switch is in the arm position | ||||||
L07 | AND | !L06 | SF↑ | 0.0 | 0.0 | |
Check the launch mode is enabled, switch in arm, the system is not armed, and we're flying | ||||||
L08 | AND | L07 | !L13 | L03 | 0.0 | 0.0 |
The system is not armed and we are not flying | ||||||
L09 | AND | !L13 | !L03 | 0.0 | 0.0 | |
We are flying, the system is not armed, and launch mode is enabled | ||||||
L10 | AND | L03 | L06 | !L13 | 0.0 | 0.0 |
We are not armed and not flying, an launch mode is not enabled | ||||||
L11 | AND | L09 | !L10 | 0.0 | 0.0 | |
The check for arming is passed and we are disamed. We can arm | ||||||
L12 | AND | L11 | L14 | SF↑ | 0.0 | 0.0 |
The system is armed. Note, checking for !L13 checks that the system is not armed, not that it is disarmed | ||||||
L13 | a=x | GV1:Arm | 1 | 0.0 | 0.0 | |
The system is disarmed | ||||||
L14 | a=x | GV1:Arm | 0 | 0.0 | 0.0 | |
If active, the checks have failed | ||||||
L15 | OR | L08 | L05 | 0.0 | 0.0 | |
Keep active while tests are failing. The switch in the disarm position will turn this off | ||||||
L16 | Sticky | L15 | SF↓ | 0.0 | 0.0 |
OpenTX Special Functions
# | Switch | Action | Parameters | Enable |
---|---|---|---|---|
Sets system state to disarmed | ||||
SF01 | SF↓ | Adjust | GV1:Arm | Value | 0 | ☑ |
Set system state to NOT armed | ||||
SF02 | L16 | Adjust | GV1:Arm | Value | -1 | ☑ |
Set system to armed | ||||
SF03 | L12 | Adjust | GV1:Arm | Value | 1 | ☑ |
Armed position | ||||
SF04 | L13 | Override CH5 | -100 | ☑ |
Disarmed position | ||||
SF05 | !L13 | Override CH5 | 100 | ☑ |
Play warning that launch mode is enabled | ||||
SF06 | L08 | Play Track | Turnoff autolaunch to arm | !x1 |
Play warning to lower throttle | ||||
SF07 | L05 | Play Track | Lower throttle to arm | !x1 |
SF08 | L13 | Play Track | Armed | !x1 |
SF09 | !L13 | Play Track | Disarmed | !x1 |