Tuesday, 16 April 2013

Porting an F3F setup from the Multiplex 4000 to OpenTx

Most of us are familiar with open-source software, whether it's operating systems, office suites or any of the thousands of other programs. But open-source firmware for R/C transmitters? It may sound a little strange in a world of commercial R/C systems. Well it exists... and it's called 'OpenTx'.

And very soon you're going to hear a lot more about it, as FrSky have adpopted OpenTx as the operating system for their forthcoming Taranis.


OpenTx in action - here's my DLG flying mate Pete Houghton with his FPV kit. Hobby King Bixler, cheapo Skyfly transmitter, FrSky module, FrSky telemetry receiver.

Comparing OpenTx with the Profi 4000

OpenTx is essentially an r/c operating system stripped down to its key elements, and none of the fluff. For example, there are none of the high level menus you get on other sets - everything has to be programmed. The result is a system with many similarities to the Multiplex Profi 4000, though if anything, OpenTx is even more basic.

As an owner and great fan of the Profi 4000, I was interested how OpenTx compares. So I set a little challenge.

A programming challenge

The challenge was simple: I would select the most complicated model definition in my Profi 4000, and attempt to recreate it in OpenTx. There was just one problem - I don't actually possess a transmitter running OpenTx. Fortunately, a clever program called Companion9X allows you create and test your OpenTx model definitions on a PC, without a transmitter. Just what the doctor ordered!

The model I chose was my Sting, an F3F racing glider. The model has a v-tail, separate ailerons and flaps, uses four flight modes.

My Sting F3F racer

Goals for OpenTx setup:
  • Support for 6 servos (4-servo wing + 2-servo V-tail)
  • 3 flight modes: Normal, Thermal, and Landing. Selectable via 3-position switch.
  • A Reflex option for the Normal flight mode, selectable via a 2-position switch
  • Elevator to flap (snapflap) mixing. Volume adjustable via rotary knob 1.
  • Elevator to flap (snapflap) expo adjustment on side lever
  • Aileron differential. Adjustable via rotary knob 2.
  • Aileron differential suppression
  • Camber control via side lever (in Thermal mode only) 
  • Spoiler compensation with multi-point curve
  • Coupled ailerons and rudder in Normal mode
  • Full travel possible on the flap servos.
  • Mixers linked to flight modes - no separate mixer switches required

Companion9x

Companion9x (C9X) provides a way to create and test your model setups on a PC. It supports all the native features of the transmitter, but with a more convenient user interface, for example you can copy mixers from one model to another using 'drag and drop'. C9X also enables you to transfer model definitions between your PC and your transmitter, using a USB cable.

Companion 9X
Companion9x main window with model definitions created for FrSky Taranis

C9X also incorporates a firmware simulator. This provides a good way to familiarise with the interface before purchasing a transmitter. Note that while it will read your default model definition, it won't save any changes - for that, you need to use the editor.

Companion 9X Simulator
Companion9x's UI Simulator. Runs the actual firmware in a virtual machine.

C9X is being developed in parallel with OpenTx, and there are versions for Windows, Mac and Linux. C9X can emulate a variety of transmitter boards. At the time of writing, support for the Taranis was incomplete, however version 1.27 is usable (ignore any warning messages).

Translating the Sting setup to OpenTx

Down to work! The first task was to download C9X and install it on my Windows 7 PC. No problem - the whole process took about three minutes from start to finish, with no nagging or crapware. If only all installs were so simple.

Next, I turned to the Profi 4000. The task here just to document the key settings in preparation for the translation to OpenTx. Nothing complicated, just a sketch of the mixing scheme, and a list of switches, flight modes, and rough shape of the curves.

Original mixer scheme on Multiplex Profi 4000

The next step was to translate the settings from the 4000 to the equivalent in OpenTx. This took longer, and I used a spreadsheet. The aim was to get a working list of all the key elements which would need to be inputted into C9X. These include mixer, flight mode and switch definitions.

Screen capture from working spreadsheet. Click to enlarge.

Next, I created a new model in C9X, and typed in the data from my working spreadsheet. The task was made easier by C9X's support for drag-and-drop, for copying mixers.

Companion 9X Mixers
Corresponding mixing scheme in OpenTx  CH1,2 = ail, CH3,4=Flap, CH5,6=Vtail. CH7-12 =intermediate mixer outputs. Version shown is work in progress.

One nice feature is that mixer inputs can be switched on or off according to flight mode, as well as via physical and logical switches.

Companion 9X Mixer
C9X menu for defining a mixer line. In this example, line is active only in flight modes 0, 2 and 3.

Testing

The Sting was now coded up in OpenTx, but not tested. Fortunately, C9X's has a splendid 'simulate' mode, which makes testing straightforward. Click the Simulate button, and C9X displays a set of virtual sticks and switches which can be operated with the mouse. Channel outputs are displayed beneath. You can disable centring on the sticks, and you can lock one or both axes. All the switches operate, too, so you can simulate different flight modes etc.

Companion 9X Simulator
C9X in test mode showing F3F setup in 'reflex' mode. CH1,2 = ail, CH3,4=Flap, CH5,6=Vtail. CH7-12 show mixer outputs.

How easy was the migration?

The translation from 4000 to OpenTx was reasonably straightforward. Anyone who has an in-depth understanding of the 4000's multimix should have no problem, though there will be some familiarisation required.

The only thing which I missed was an equivalent to the Controls layer on the 4000. This means that adjustment of control travel, trim method, etc. is somewhat more long winded in OpenTx. In particular there is no equivalent to the FIX_VAL for simulating a fixed stick position. As with everything, though, there are workarounds.

Other difficulties arose from incomplete documentation. For example, mixer inputs are specified in terms of offset, curve and weight, and the order of processing is important but not currently documented. I had to do some experiments in C9X to suss it out.

There were a couple of things (diff and snapflap expo) which I was unable to implement using C9X v1.26 as support for the Taranis was incomplete. However, I have no doubt that the tx firmware will be able to replicate the functionality in my Sting setup.

Resource usage

Resource usage and latency are considerations if you're creating a complex setup, and this is one area where the 4000 with its antiquated processor and limited memory is beginning to struggle.

The OpenTx version users four more mixer lines than the 4000, however I still have around 35 inputs left to play with. So lots of room for expansion. I can already think of a one or two extra features, like a switch to disable all mixing and trim, for calibrating the servos.

With a faster processor, latency should be less of an issue.

Summary

As a committed 4000 user, my thoughts about OpenTx changed from mild scepticism to pleasant surprise. A transmitter with OpenTx installed should certainly be capable of controlling the Sting.

Programming with OpenTx is not as coherent, elegant or concise as on the 4000, in particular OpenTx lacks an equivalent to the masterful Controls layer on the 4000. Nevertheless, OpenTx is more flexible. OpenTx also has a couple of trump cards: it can react to telemetry data, and it supports voice output. And thanks to C9X, debugging of complex setups is easier.


Thoughts on the Taranis

A few comments on the forthcoming FrSky Taranis, which will be the first transmitter to come with OpenTx pre-installed. The shell is a classic JR moulding, with rotary knobs and side levers. There are rumours of a version with a new case, hopefully it'll also have a more 'euro' control layout and some slider controls.

FrSky Taranis - uses classic JR-style case. No sliders :-(

It's on order!

Well I've taken the plunge and put my name on the pre-order list for a Taranis, from T9 Hobbysport. It won't be replacing my 4000 for F3F, partly because of the paucity of controls, and partly because it'll be a new and untried system. However it should be a good platform for further experimentation with OpenTx. Needless to say, I'm looking forward to receiving it. Expect a post to the blog soon after I receive it, so stay tuned.

Links
Happy flying!

5 comments:

Anonymous said...

Taranis = GOD! (in this age), (for the lowest cost ever for a killer radio), Thanks You FrSky for your excellent quality and price!, Oz

Anonymous said...

Have you uploaded your openTx template onto the forums?
Cheers Jeff

RC Soar said...

Fully working now on Companion 9X v1.31, but I want to test it on the actual Taranis hardware before publishing. My tx should be arriving in the next week or so. I am also intending to publish the working spreadsheet as documentation.

Anonymous said...

Mike

How do you make the servos move more down than up for the flaps? equivalent to "offset" in multiplex talk.

Cheers
Tom

RC Soar said...

Tom, I take it you want full servo travel for the flap servo even though control surface movement may be grossly asymmetric. Typical example is large flap deflections when spoiler is deployed. The basic idea withe the Taranis and 4000 is to reserve the required ranges of travel for spoiler and aileron in their respective mixer inputs to the flap servo - leave servo subtrim and centre alone. All will be documented once I test it on the real hardware.