OpenTX Pattern Sequence Caller Script

rockyboy

Skill Collector
Mentor
Wha?? :unsure:

Lemme break it down:
  • OpenTX - the software that runs FrSky on and some other radios
  • Pattern - a series of aerobatic maneuvers performed in a specific order for a competition
  • Sequence Caller - an assistant who stands near the pilot and calls out the next maneuver in the sequence
So how does an enterprising young pilot practice when there is nobody around to remind them what comes next? Turn to the power of OpenTX! :D

With this set of LUA and WAV files installed, every time the SH switch is pulled the radio calls out the next move in the pattern! :love:

How did this magic happen you ask? I started with a script I found on the net developed by Nigel Sheffield that did this type of function for an earlier version of OpenTX, but it didn't work when I tried to get it to run, and didn't have sound files to go wit hit. So with a couple days of poking around and trying different things, I finally got it working reliably with OpenTX 2.3. And then I figured out how to get the OpenTX Speaker program running so I could create a set of audio files for the NSRCA AMA Club Class Sequence of 10 maneuvers.

And so you don't have to figure all this out from scratch, I'm posting it up here so everyone can start to become master pattern pilots! :D

Installation Instructions:

0) Download and unzip the Sequence Caller.zip file somewhere handy on your computer.
1) Copy the seqcall.lua file in the transmitter SD card directory SCRIPTS/FUNCTIONS
2) Copy the whole F3club directory to the transmitter SD card to create /SOUNDS/EN/F3club
3) In OpenTX go to the Radio Settings and add a Global Function for SH-down to PlayScript seqcall (see screen capture)
4) In each model go to the Logical Switches and add LS8 and LS9 as Edge functions with V1 SH-down and V2 with 0 and 1.5 instant effect (see other screen capture)
5) Go fly with guidance!

If you use SH-down for something else and want to use a different switch, just use whatever switch you like in the Global and Logical functions. If you already have something in LS8 and LS9, edit the lua script lines 5 & 6 to pick a different logical switch.

If you want to use this for a different sequence, create the audio files and reorganize the list of file names in line 2. Make sure no file names are longer than 6 characters or OpenTX won't play them. Also make sure they are 32khz sampled mono wav files.

If you want to mess with the LUA script to try and eliminate the need for logical switches I did leave some debugging code in there - just open the debugging window in companion to see the variables print out each cycle. When I first got the script it didn't use logical switches, but this was the only way I could figure out how to make it go.

Lemme know how it works for you and what you end up doing with it!
 

Attachments

  • Call Seq Logical Switch.PNG
    Call Seq Logical Switch.PNG
    37 KB · Views: 0
  • Call Seq Global Function.PNG
    Call Seq Global Function.PNG
    27.6 KB · Views: 0
  • Sequence Caller.zip
    1,020.6 KB · Views: 0
Last edited:

bracesport

Legendary member
@rockyboy - downloaded - oh, this does have some appeal - I have never flown a pattern in my life, but this is very intriguing! I suppose it would be similar to playing a voice command with a switch, but advancing to another voice command by a sticky logical switch command?

will try it on the T16
 
Last edited:

rockyboy

Skill Collector
Mentor
@rockyboy - downloaded - oh, this does have some appeal - I have never flown a pattern in my life, but this is very intriguing! I suppose it would be similar to playing a voice command with a switch, but advancing to another voice command by a sticky logical switch command?

will try it on the T16

That's pretty much the theory in a nutshell! (y)

The LUA script keeps a couple running variables that track the current place within the total list of audio files and the logical switches are used so it only triggers once per switch pull (or long switch pull). The processing speed of the LUA script is so darn fast that a single pull of the momentary switch actually executes the script about 6 times!

And ya know what... after getting a good nights sleep and explaining the behavior to you right now, I think I know another configuration of switches & functions that could use fewer processing cycles by switching from global functions to a pair of model based special functions.... would take more effort to activate for each model but less processor use.... need to experiment more tonight! :unsure: If only global functions could interact with per model logical switches better - or if we had global logical switches! :cautious:

Lemme know how it works on the T16 - I don't have one to play with yet but would like to be cross compatible with Jumpers too! :D
 

bracesport

Legendary member
I am so new to the OTX thing, but I really like the 'open' part! I have just shifted all my ships over to OTX and so far the Jumper is talking to all my Rx's with the multi-protocol chipset - I recently met some pro fliers (F3K and DS) and they are using Lua extensively! For now, I just want to get my ships in the air! :D
 

rockyboy

Skill Collector
Mentor
Awesome! Those multi-protocol chips really are the bees knees. :D

I tried my idea to streamline the LUA script more - and it didn't work. *sigh* It's the best and fastest I can make it, unless we get some changes to logical & special functions in a future OpenTX version. It's really pretty lightweight already, I was just hoping for a slightly more elegant solution :D
 

bracesport

Legendary member
I am not a coding guy, but I do like the code when I opened up your script!

I have a T16 thread going with my nube OTX setups - they are getting there and I am looking forward to flying with them soon!
 

sam2b

New member
Hi, @rockyboy . This lua script/function `seqcall` does not appear in the list of when I select "play script" in the Global Functions menu. I've copied it to \scripts\functions folder as instructed. When I try to manually execute this script, I receive the error "script syntax error". Do you have advice, please? Thanks.
OpenTX 2.3.7
Q-X7 transmitter

Problem solved: I had to rename the file to have 6 letters instead of 7. i.e. seqcal.lua with only a single "l" in the file name. :) It works now. Thanks.
 

Attachments

  • seqcall_globalFunction.png
    seqcall_globalFunction.png
    73 KB · Views: 1
Last edited:

Bricks

Master member
Using the momentary switch could you not use a pause so when the switch is flipped it would not play so quick? Like using a 3 position switch and not playing the center position when flipping the switch from position 1-3 ( adding the pause in position 2 ) so not to play the center call out?