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. The system was developed for my Needle 115, and has been refined over two years.

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

Snapflap basics

'Snapflap' is of course just a fancy name for an elevator-to-flap mix. The relationship between elevator input and flap movement can be described via an 'S' curve, and we can define the precise shape using four parameters:
  • Volume - max snapflap deflection
  • Deadband - elevator stick deflection at which snapflap starts.
  • Saturation limit - elevator stick deflection at which max snapflap is reached. 
  • Expo - snapflap exponential

My goal was for each parameter to be adjustable via a transmitter control. Volume and expo are easy enough to handle, however deadband and expo present a problem: they represent two points on a curve, and - like other RC systems - OpenTx doesn't allow you to control a curve-point dynamically. However, OpenTx can call on a helping hand, in the form of an integrated Lua interpreter.

Lua pre-processor and mixing

With the advanced snapflap system, a standard mixer is used, except that the source is a Lua script instead of the more usual elevator stick. The script parameters are deadband and saturation limit, and these may be supplied by transmitter controls. The Lua script uses these parameters to build a virtual 4-point curve. The script then applies the curve to the elevator stick value. The result becomes the input to the mixer. Expo and volume are also linked to controls, and applied using regular mixer functions.

Processing overview

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 (it does not require frequent adjustment, but could be assigned to a transmitter control if required). 

Audio alerts

I've set up an audio alert which is triggered when snapflap kicks in or reaches the maximum. It's a great help when adjusting deadband and saturation limit, and 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 unwanted snapflap deflections, i.e those  due to minor pitch corrections between the turn bases. Audio alerts help with this adjustment
  • Volume - initialise to the flap travel recommended by the manufacturer, adjust as necessary during flight tests.
  • Saturation limit - set this to match typical elevator stick values when rounding the bases. An audio alert when full snapflap is reached is useful.
  • 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 has proved very useful when 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: