OpenTX Arming Warning System for iNav

Published by Mr. D on

FrSKY Taranis - 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:

  1. Disarmed and action needed – This is triggered when you try to arm but the checks fail.
  2. Disarmed – the normal disarmed state, activated when the switch is in the disarm position.
  3. 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.

Image showing the Global variable GVAR1 named 'Arm' and 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)
Image showing the logical switches to detect flight.
  • 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.

Image showing the logical switches for a standard test.
  • 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-).

Image showing the logical switches for an in flight test.
  • 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.

Image showing the logical switches to check to see if the system can arm.
  • 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.

Image showing the logical switches for checking and managing the arm state.
  • 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.

Image showing the special functions for the arming system.

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

Select your first available programming slot(s):

  • Logical Switch
  • Special Function

OpenTX Logical Switches

#FunctionV1V2AND SwitchDurationDelay
Detect the throttle is raised and the system is armed
L01a>xThr-98L130.00.0
Detects that the system has been not armed for at least 25 seconds
L02AND!L130.025.0
If this switch is active, it is assumed that we are flying
L03StickyL01L020.00.0
Detect that the throttle is raised
L04a>xThr-980.50.0
Check that we want to arm, but the throttle is raised. The system is not armed
L05ANDL04!L13SF↑0.00.0
Check to see if launch mode is enabled
L06ANDSD-0.00.0
Check if launch mode is enabled and the switch is in the arm position
L07AND!L06SF↑0.00.0
Check the launch mode is enabled, switch in arm, the system is not armed, and we're flying
L08ANDL07!L13L030.00.0
The system is not armed and we are not flying
L09AND!L13!L030.00.0
We are flying, the system is not armed, and launch mode is enabled
L10ANDL03L06!L130.00.0
We are not armed and not flying, an launch mode is not enabled
L11ANDL09!L100.00.0
The check for arming is passed and we are disamed. We can arm
L12ANDL11L14SF↑0.00.0
The system is armed. Note, checking for !L13 checks that the system is not armed, not that it is disarmed
L13a=xGV1:Arm10.00.0
The system is disarmed
L14a=xGV1:Arm00.00.0
If active, the checks have failed
L15ORL08L050.00.0
Keep active while tests are failing. The switch in the disarm position will turn this off
L16StickyL15SF↓0.00.0

OpenTX Special Functions

#SwitchActionParametersEnable
Sets system state to disarmed
SF01SF↓Adjust | GV1:ArmValue | 0
Set system state to NOT armed
SF02L16Adjust | GV1:ArmValue | -1
Set system to armed
SF03L12Adjust | GV1:ArmValue | 1
Armed position
SF04L13Override CH5-100
Disarmed position
SF05!L13Override CH5100
Play warning that launch mode is enabled
SF06L08Play TrackTurnoff autolaunch to arm!x1
Play warning to lower throttle
SF07L05Play TrackLower throttle to arm!x1
SF08L13Play TrackArmed!x1
SF09!L13Play TrackDisarmed!x1
Share:
Categories: OpenTX Tutorials