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. Audio alerts allow easy optimisation. The system is well tested over many months in my Needle 115 and Stribog setups.

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

Snapflap revision

Snapflap is just a fancy name for an elevator to camber mix. Its purpose is to minimise drag at the high lift coefficients required in a typical F3F turn.

Each aerofoil will have a maximum snapflap deflection which should never be exceeded. A reasonable assumption is that this maximum should be reached at or near the apex of the turn. Also, snapflap arising from minor pitch corrections should be suppressed. In order to achieve this, two things are required: (a) a way to adjust upper and lower deadband whilst flying the model and (b) audio alerts to help with the optimisation process.

Adjustments

Most R/C systems allow you to adjust snapflap volume in flight. However other adjustments like expo and deadband normally require reprogramming. With OpenTx we can do better! My goal was to be able to adjust all the key parameters whilst flying the model:
  • 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
These four parameters may be represented as follows:



So how do we make these parameters adjustable in flight?

Volume and expo are easily done through OpenTx. However deadband and saturation limit present a problem: they correspond to intermediate points on the curve. As with other systems, OpenTx doesn't allow these to be altered dynamically. However, unlike most other systems, OpenTx has an integrated Lua interpreter. This allows us to create a custom snapflap mix with all the adjustments we want!

Lua pre-processor and mixing

The script is the source of the snapflap mix. It takes two parameters deadband and saturation limit (values are derived from transmitter controls). With that it builds a virtual 4-point curve ("virtual" because it's constructed internally, independently of OpenTx curves). The script then applies the curve to the elevator value. The result represents the raw snapflap command in the range 0 to +100 corresponding to zero and maximum snapflap.

Next, the expo and weight (volume) are applied using standard OpenTx - no Lua is involved here. Note that expo works best on values in the range 0 to +100 so works well with the output of the Lua script.

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 - supplied as a MAX-based preset value (but it could equally be assigned to a spare control). 

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). These are by way of demonstration only.




In the field

This is the method I use for trimming snapflap:
  1. Volume - start with snapflap travel as recommended by the manufacturer, and adjust later. 
  2. Saturation limit - 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. 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 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.

Links

No comments: