Friday, 8 September 2017

Advanced snapflap mixing with Lua

In this post, I'll describe an enhanced mixer system designed for quick trimming of elevator-to-flap mix, aka. 'snapflap'. Parameters which can be adjusted are volume, deadband, expo and saturation limit. In addition, an alert may be sounded when snapflap exceeds a certain threshold.

The system has been refined in my competition F3F models over the last two years and has proved very useful.

Where it's won or lost!

Background

The use of snapflap is the subject of constant debate in F3X circles, with questions like: "how much snapflap travel should I use", "should I use expo", and "what are the benefits of deadband". If you want a deeper insight then I highly recommend this thread in RC Groups with some great contributions by Mark Drela and Joe Wurts.

Theory aside, the snapflap curve can be described using four parameters: volume, expo, deadband, and saturation limit (I'll describe these in more detail later). The challenge is make each parameter adjustable without having to land just to alter the programming or alter the points on a curve. So for my new Needle 115, I decided to devise a system where each parameter could be continuously and independently adjustable, using the transmitter controls.

Such a system is beyond the capabilities of conventional RC operating systems. Fortunately, OpenTx can call on a useful little sidekick, in the form an embedded Lua interpreter. Armed with the relevant documentation, I wrote a simple mixer script to help out with the trickier stuff.

Implementation

A conventional snapflap mix consists of an (a) elevator input, (b) a mixer, and (c) an output to the flap servo. The only difference with the new system is that the elevator input is pre-processed using a Lua script.
Processing overview (click to enlarge)

The Lua script applies a simple 4-point 'S' curve to the elevator input. The curve is defined by two parameters:
  • Deadband - elevator stick deflection at which snapflap starts.
  • Saturation limit - elevator stick deflection at which max snapflap is reached. 
Two further adjustments are applied using regular mixing functions:
  • Expo - snapflap exponential
  • Volume - max snapflap deflection
All four adjustments can be associated with a transmitter control if desired. Because of they way my setups are structured (with servo calibration and cascading mixers), each adjustment propagates to all four control surfaces, with precise tracking guaranteed, irrespective of mechanical differences.

User interface

A good user interface is important - making adjustments should be easy when needed, but it shouldn't interfere when racing. I've found the following works well on my Taranis X9D:
  • Volume - adjusted via the throttle trim. 
  • Saturation limit - adjusted via a rotary knob.
  • Expo - adjusted via the right slider
  • Deadband - preset in the Script menu (it does not require frequent adjustment). 
It's a good idea to use OpenTx's 'pot checks', this generates an alert if the knobs or sliders have moved since the last shutdown, and prompts you to move them back.

Audio feedback

I've started experimenting with audio alerts in the form of short beeps when (a) snapflap kicks in and (b) when max snapflap is achieved. Apart from providing a reassuring beep when rounding the bases, the alerts radically reduce the guesswork when adjusting deadband and saturation limit. Once adjustment is complete, the beeps can be disabled by a switch. 


Sample snapflap curves

Below are sample curves which can be generated by the system (the data was recorded using a second script). These are by way of demonstration only.




In the field

Suggested settings for the snapflap parameters as follows:
  • deadband - just enough to suppress unwanted snapflap deflections due to minor pitch corrections on the straights. Audio feedback can help with this adjustment
  • volume - snapflap travel as recommended by the manufacturer, adjust as necessary.
  • saturation limit - set to match typical elevator stick value when rounding the bases. Audio  feedback can help with this adjustment.
  • expo - set this to linear for first flights and tune as necessary. Aim for a smooth turn without losing speed or shimmying.

Author's Needle 115 with Taranis X9D

Finally

The enhanced snapflap system is doing sterling service in my Needle 115. Not only has it speeded up the trimming process, it has also provided a deeper insight into the adjustments, and what to alter according to the conditions.

Jeti also offers an embedded Lua interpreter. It may be possible to duplicate this system on those transmitters, howeveer I have insufficient knowledge of Jeti to comment in detail.

Links

No comments: