Friday, 8 September 2017

Advanced snapflap mixing with OpenTx and Lua

In this post, I'll describe an advanced snapflap mix using Lua. It offers full control over the snapflap curve, via dedicated controls.


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

Adjustments

Most R/C systems allow you to adjust the snapflap volume (the amount of snapflap) in flight. However other adjustments like expo and deadband normally require reprogramming. 

With OpenTx and EdgeTX we can do better! My goal was to be able to adjust four key parameters whilst flying the model:

  • Volume - max snapflap deflection
  • Lower deadband - elevator stick deflection at which snapflap starts.
  • Upper deadband - elevator stick deflection at which max snapflap is reached. 
  • Expo - snapflap exponential

These four parameters may be represented as follows:

Volume and expo are easily done using native o/s features. However upper and lower deadband correspond to points on a curve and OpenTx doesn't allow these to be altered dynamically. Fortunately we can overcome this limitation by means of a Lua script.

The complete snapflap system can be represented as follows:

Lua pre-processor and mixing

The job of the Lua script is to build a 4-point virtual curve. The end points are fixed at (-100,-100) and (100,100). The intermediate points define the end of the lower deadband and the start of the upper deadband zones. The x-values are derived from transmitter controls. 

The script reads the elevator value and applies the curve. The result is a raw snapflap value in the range -100% to 100%. Expo and volume adjustment can be applied using regular o/s features. The final output is fed to a flap mix, to provide the snapflap function.

User interface

With four parameters to adjust, careful consideration must be given to the user interface, after all we don't want to be playing the accordion while flying the model! 

I've found the following works well on my Taranis X9D:

  • Upper deadband - adjusted via a rotary knob.
  • Lower deadband - supplied as a MAX-based preset value (but it could equally be assigned to a spare control). 
  • Volume - adjusted via the throttle trim. 
  • Expo - adjusted via a slider.

Audio alerts

On my setups, I've configured audio alerts when the snapflap exceeds 5% and 95%. These are implemented using 2 logical switches and 2 special functions.

Sample snapflap curves

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





In the field

Method for trimming snapflap:

  1. Volume - start with snapflap travel as recommended by the manufacturer. 
  2. Upper deadband - adjust to match elevator deflection at apex of turn. Practical tests have shown that the optimal value varies according to the wind conditions. Use audio alert as a tuning aid. 
  3. Lower deadband - set deadband to suppress snapflap during minor pitch corrections. Use audio alert as a tuning aid. 
  4. Expo - set this to linear (zero) for first flights and tune.

Author's Needle 115 with Taranis X9D

Finally

The enhanced snapflap system has proved very useful on my F3F models. Not only has it speeded up the trimming process, it has also provided an insight into the effects of these adjustments.

Links

No comments: