ardupilot/libraries/AP_Scripting/examples/Aerobatics/Via_Switch
..
5_knifedges.lua
10_loops-and-immelman.lua
README
lua_trick_selector.lua

README

Aerobatics via an RC switch
===========================

this requires the lua_trick_selector.lua script
additional individual trick scripts can then be selectively executed via a switch

RCx_OPTION switch 300 is the activations switch to execute a trick
RCx_OPTION switch 301 selects a trick from up to 10 trick scripts to execute

included as templates are two tricks: any angle knife-edge and a loop/return

activation switch when high will start the trick, which may self terminate (loop/return example), or continue indefinitely (knige-edge) until switch is low, when switched from low to mid and held for 0.5 second, the trick number selected by the selection channel is announced

trick is aborted if:
- activation switch is returned low
- flight mode changes
- script hangs, ie does not call the set_target_throttle_rpy(..) function every 50ms
- trick selection is moved to 0 (low)

Only modes defined in the nav_scripting_enable(mode) function call can enable scripting control and current flight mode must match the "mode" argument

Note: for tricks like knifedges which normally are indefinite(could modify this trick for a fixed duration, instead, though) until activation switch is set back low or mode is changed, the exit is totally dependent upon the mode being re-entered....for example, returning to FBWA can result in a change of heading as FBWA re-establishes level depending on knife-edge angle (90 deg has worst heading shift upon FBWA recovery), ACRO shows no change of attitude,CRUISE will re-establish track to last CRUISE target update, etc.