LVNL Variables - ilabs-kdc/bluesky GitHub Wiki

The file traffic/lvnlvariables.py contains a class (LVNLVariables) which contains LVNL specific variables. This class is initialized in the traffic/traffic.py file as lvnlvars. Therefore in the code, these variables can be accessed with bs.traf.lvnlvars.variable_name.

Adding Variables

If you would like to add an LVNL specific variable, you can just add it in the initialize method within the class (the length of the array/list is automatically changed when an aircraft is created/deleted):

def __init__(self):

    ...

    with self.settrafarrays():

        ...

        self.variable_name = ...

        ...

If you would give the variable a default value for new aircraft, you can add this in the create method within the class:

def create(self, n=1):

    ...

    self.variable_name[-n:] = ...

    ...

If you would like to be able to change the variable with a command, you can create a method within the class and use the stack.command() decorator:

@stack.command(name='COMMAND_NAME')
def setvariable_name(self, idx: 'acid', ...)
    self.variable_name[idx] = ...

When a variables needs to be updated over a specific interval, you can add this to the udpate method. In this example the method is called every 0.1 seconds, but this can be changed (dt=...).

@timed_function(name='lvnlvars', dt=0.1)
def update(self)

    ...

    self.variable_name = ...

    ...

Commands

Command Arguments Description File
ARR CALLSIGN ARRIVAL/STACK (ADDWPTS) Set the arrival/stack traffic/lvnlvariables.py
FLIGHTTYPE CALLSIGN TYPE Set the flight type traffic/lvnlvariables.py
FIRSTWP CALLSIGN WAYPOINT SET FIRST WAYPOINT IN FMS traffic/lvnlvariables.py
POSLABEL CALLSIGN POSLABEL Set the position of the track label traffic/lvnlvariables.py
MICROLABEL CALLSIGN Show/Hide the micro label traffic/lvnlvariables.py
REL CALLSIGN Release command traffic/lvnlvariables.py
RWY CALLSIGN RUNWAY Set the runway traffic/lvnlvariables.py
INTERCEPT CALLSIGN (RUNWAY,DEST,HDG) Intercept runway with current Autopilot Heading traffic/lvnlvariables.py
SID CALLSIGN SID (ADDWPTS) Set the SID traffic/lvnlvariables.py
SSR CALLSIGN SSR Set the SSR code traffic/lvnlvariables.py
SSRLABEL CALLSIGN Show/Hide mode in SSR label traffic/lvnlvariables.py
TRACKLABEL CALLSIGN Show/Hide the track label traffic/lvnlvariables.py
SETCLR GROUP COLOR/(R,G,B) Set the color of a group traffic/lvnlvariables.py
SETTRAILCOLOR CALLSIGN COLOR/(R,G,B) Set the color of an aircraft (by making its own distinct group) traffic/lvnlvariables.py
UCO CALLSIGN Under control command traffic/lvnlvariables.py
WTC CALLSIGN WTC Set the wake turbulence category traffic/lvnlvariables.py
SYMBOL CALLSIGN SYMBOL Set the responsible flight officer traffic/lvnlvariables.py