Airplance Surfaces

Summary

The airplane surfaces controller can be used to add generic airplane surface control easily. It supports ailerons, elevators, rudders, flaps and slats. All of these can be independently trimmed

File Info

Filename airplaneSurfaces.lua
Path /lua/vehicle/controller/airplaneSurfaces.lua
Type Auxiliary
Multiple Usage Not supported

Jbeam Properties

Name Default Unit Description
flapStart 0 number Starting value of the flaps
slatStart 0 number Starting value of the slats
rudderTrimmingStart 0 number Starting value of the rudder trimming
aileronTrimmingStart 0 number Starting value of the aileron trimming
elevatorTrimmingStart 0 number Starting value of the elevator trimming
trimSpeed 0.05 number/s Speed with which the trimming changes
flapSpeed 0.1 number/s Speed with which the flaps change
slatSpeed 0.1 number/s Speed with which the slats change

Public Functions

Function name Parameters Description
toggleTrimMode()   Toggle between elevator, aileron and rudder trimming
setTrimValue(input, value) string, number Directly set “elevator”, “aileron” or “rudder” trim value

Example Usage

Controller setup

"controller": [
  ["fileName"],
  ["airplaneSurfaces"]
],
"airplaneSurfaces": {
  "flapStart":0.5,
  "elevatorTrimmingStart":0.1,
  "trimSpeed":0.1,
  "slatSpeed": 0.05,
}

Input actions setup

{
  //Elevator axis and key inputs
  "elevators":            {"order":  1, "onChange":"input.event('elevator', VALUE, FILTERTYPE)", "isCentered":true, "title": "Elevators", "desc": "Control the aircraft's elevators" },
  "elevators_up":         {"order":  2, "onChange":"input.event('elevator', VALUE, FILTERTYPE)", "title": "Elevators Up", "desc": "Pitch up the aircraft" },
  "elevators_down":       {"order":  3, "onChange":"input.event('elevator', -VALUE, FILTERTYPE)", "title": "Elevators Down", "desc": "Pitch down the aircraft" },

  //Ailerons axis and key inputs
  "ailerons":             {"order":  11, "onChange":"input.event('aileron', VALUE, FILTERTYPE)", "isCentered":true, "title": "Ailerons", "desc": "Control the aircraft's ailerons" },
  "ailerons_left":        {"order":  12, "onChange":"input.event('aileron', -VALUE, FILTERTYPE)", "title": "Ailerons Left", "desc": "Bank left" },
  "ailerons_right":       {"order":  13, "onChange":"input.event('aileron', VALUE, FILTERTYPE)", "title": "Ailerons Right", "desc": "Bank right" },

  //Rudder axis and key inputs
  "rudder":               {"order":  21, "onChange":"input.event('rudder', VALUE, FILTERTYPE)", "isCentered":true, "title": "Rudder", "desc": "Control the aircraft's rudder" },
  "rudder_left":          {"order":  22, "onChange":"input.event('rudder', -VALUE, FILTERTYPE)", "title": "Rudder Left", "desc": "Yaw left" },
  "rudder_right":         {"order":  23, "onChange":"input.event('rudder', VALUE, FILTERTYPE)", "title": "Rudder Right", "desc": "Yaw right" },

  //Flap axis and key inputs
  "flap":                 {"order":  31, "onChange":"input.event('flap', VALUE, FILTERTYPE)", "title": "Flaps", "desc": "" },
  "flap_up":              {"order":  32, "onChange":"input.event('flapChange', -VALUE, FILTERTYPE)", "title": "Flaps Up", "desc": "" },
  "flap_down":            {"order":  33, "onChange":"input.event('flapChange', VALUE, FILTERTYPE)", "title": "Flaps Down", "desc": "" },

  //Trim axis inputs
  "trim_evelator":        {"order":  41, "onChange":"input.event('trimElevator', VALUE, FILTERTYPE)", "isCentered":true, "title": "Trim Elevator", "desc": "Trim the elevator" },
  "trim_aileron":         {"order":  42, "onChange":"input.event('trimAileron', VALUE, FILTERTYPE)", "isCentered":true, "title": "Trim Aileron", "desc": "Trim the aileron" },
  "trim_rudder":          {"order":  43, "onChange":"input.event('trimRudder', VALUE, FILTERTYPE)", "isCentered":true, "title": "Trim Rudder", "desc": "Trim the rudder" },

  //Trim key inputs
  "trim_up":              {"order":  51, "onChange":"input.event('trimChange', VALUE, FILTERTYPE)", "title": "Trim Up", "desc": "Change the current trimming value up" },
  "trim_down":            {"order":  52, "onChange":"input.event('trimChange', -VALUE, FILTERTYPE)", "title": "Trim Down", "desc": "Change the current trimming value down" },
  "trim_toggle_mode":     {"order":  53, "onUp":"controller.getController('airplaneSurfaces').toggleTrimMode()", "title": "Toggle trim mode", "desc": "Switch between trimming modes" },
}