Friday, 8 September 2017

Advanced snapflap mixing with OpenTx and Lua

In this post, I'll describe a snapflap mix with the emphasis on 'trimmability'. It offers full control over the snapflap curve, with all adjustments via dedicated controls. In addition, alerts are sounded when snapflap exceeds user-defined thresholds. I developed it for my Needle 115, and have been using and refining it over the last couple of years.

F3F turn: Phil Taylor's T-Master rounds base A. Shot at ~6fps.

Enhanced functions

'Snapflap' is of course just a fancy - and not exactly descriptive - term for an elevator-to-flap mix. Its purpose is to minimise the drag of the airfoil during apex of the turn, when the wing is generating maximum lift.

With any decent R/C system it should be possible to adjust the snapflap volume in flight. However for anything more sophisticated, it may be a question of reprogramming the mix (e.g. selecting a different preset curve), and this may involve a landing and re-launch by which time the conditions may have changed.

With OpenTx we can do better! My goal was to be able to expore the nuances of the snapflap curve without having to land just to program the transmitter. In particular I wanted to be able to adjust the following parameters dynamically, and independently, whilst flying the model:
  • Snapflap travel
  • Deadband around neutral (to suppress unwanted snapflap due to minor pitch corrections). 
  • Deadband at the top end (to avoid excessive snapflap travel when over-pulling the elevator).
  • Expo  (to tune snapflap 'aggression').

The Curve in detail

The enhanced curve can be described parametrically as follows:

  • Deadband - elevator stick deflection at which snapflap starts.
  • Saturation limit - elevator stick deflection at which max snapflap is reached. 
  • Volume - max snapflap deflection
  • Expo - snapflap exponential
As regards making these dynamically adjustable: volume and expo are easy using the stock OpenTx features. However deadband and saturation limit present a problem: they are represented by the middle curve points  and - like other systems - OpenTx doesn't allow these to be altered dynamically. However, unlike most other systems, OpenTx can call on a helping hand, in the form of an integrated Lua interpreter. This allows us to create and apply a curve on the fly.

Lua pre-processor and mixing

The first stage of the pipeline is the Lua script. The script takes two parameters deadband and saturation limit which it uses to build a 4-point virtual curve. The actual arguments may be provided by transmitter controls though on my current setup, deadband is preset in the script menu. Having built the curve, the script applies it to the elevator stick value. The result is fed to a standard mixer (in practice, the script is the source of the snapflap mix)

Expo and volume applied using regular mixer features. Expo works best when applied to an input range of 0 - 100, so the volume adjustment must come last. Fortunately OpenTx applies expo before weight (volume) when both are specified in the same mix.

Snapflap mix operation

User interface

With four parameters to adjust, careful consideration must be given to the user interface. 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 as I didn't feel it would require much adjustment. In retrospect I feel it should be adjustable and the script could easily be modified to assign it to a control (it's on the to-do list!).

Audio alerts

Audio alerts are triggered when snapflap starts and reaches the maximum. Easily done two logical switches and two special functions. These are a help when adjusting deadband and saturation limit. The alerts can be switched off when not needed.

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

This is the method I use for trimming snapflap:
  • Deadband - set deadband to help suppress snapflap when making minor pitch corrections on the straight. Audio alerts help with this adjustment. 
  • Volume - start with snapflap travel as recommended by the manufacturer, adjust as necessary during flight tests.
  • Saturation limit - set this to match typical elevator stick values when rounding the bases. Audio alerts help again here.
  • Expo - set this to linear (zero) for first flights and tune for a smooth turn with minimal speed loss.

Author's Needle 115 with Taranis X9D


The enhanced snapflap system was easy to incorporate in my existing setups and has proved particularly useful for trimming out snapflap in my Needle 115. Not only has it speeded up the whole process, it has also provided a deeper insight into the adjustments.


No comments: