PTFS COCKPIT DOCS

Unified Cockpit v3 Live SSE Data A320 FCU GPWS + ILS

Full documentation for the PTFS Unified Cockpit β€” a single-page Airbus A320-style glass cockpit for PTFS (Pilot Training Flight Simulator). Connects to live game data via Server-Sent Events and renders a PFD, ND, and full autopilot FCU panel in real time. No iframes, no frameworks.

CONTENTS

OVERVIEW & ARCHITECTURE

The unified cockpit is a single .html file β€” no iframes, no frameworks. All three instruments share one global state object SH and one SSE connection to the PTFS live data proxy.

Data flow

SSE SOURCEcyklotrasy.info/fushift/proxy24.php?route=acft-data&sse=1 β€” pushes all live PTFS aircraft positions every ~1 second
SHARED STATEwindow.SH β€” single object holding callsign, telemetry (IAS, ALT, HDG, VSI, pitch, roll, position), FCU targets, AP modes, ILS state, GPWS flags
COMPONENTSPFD reads SH, draws on 1000Γ—1000 canvas. ND reads SH, draws on 800Γ—800 canvas. FCU reads/writes SH, runs 10 Hz AP loop.
SERVER SYNCFCU pushes AP state to /pfd/ap-state.php?room=... so the Python client stays in sync

Stack

LayerTechNotes
RenderingHTML5 Canvas 2DPFD 1000Γ—1000 px, ND 800Γ—800 px β€” both CSS-scaled to fill container
Live dataServer-Sent EventsOne persistent SSE connection shared by all components
StatePlain JS objectwindow.SH β€” no framework, no reactive layer needed
AP syncREST pollingPHP file stores room state as JSON, Python client polls at 10 Hz
FontsB612, B612 Mono, Share Tech MonoAviation-standard ESA/Airbus typeface

PAGE LAYOUT

Full viewport, no scroll. Vertical flex column with three rows:

fushift.fun/pfd β€” viewport layout
Row 1 Β· 38px
TOP BAR β€” Room Β· Plane Selector Β· AP Status Pills Β· Clock Β· Docs Β· Download
Row 2 Β· 220px
FCU β€” A/FCU FMGC Autopilot Panel (full width)
Row 3 Left Β· flex:1
PFD β€” Primary Flight Display
1000Γ—1000 canvas Β· CSS scaled to fill
Row 3 Right Β· flex:1
ND β€” Navigation Display
800Γ—800 canvas Β· CSS scaled to fill

All panels resize automatically β€” canvas elements scale via CSS transform: scale() to preserve pixel-perfect rendering.

TOP BAR

38px persistent bar. All session controls in one place.

ControlFunction
Plane SelectorDropdown populated live from SSE. Shows all active aircraft with ALT and SPD. Click SET to apply β€” all instruments switch to that aircraft instantly.
Room + JOINEnter room name, click JOIN or press Enter. Links FCU to server room used by Python AP client. Persists in localStorage and URL.
AP Status PillsLive read-only: A/P on/off, active lateral mode, active vertical mode, current HDG and ALT targets.
ClockUTC time, updated every second.
πŸ“– DOCSOpens this page in a new tab.
⬇ AP.PYDownloads the Python autopilot client.

URL parameters

ParamExampleEffect
cs?cs=OK-NOXPre-selects aircraft on load
room?room=myroomJoins room on load

FCU β€” AUTOPILOT PANEL

Replica of the Airbus A320 A/FCU (Auto Flight Control Unit). Dark anthracite panel with amber 7-segment LED displays and green backlit push buttons. Full-width across the cockpit.

Display windows

WindowRangeButtonsScroll
SPD / MACH80 – 350 ktβˆ’10 / βˆ’1 / +1 / +10βœ“ mouse wheel
HDG / TRK000 – 359Β°βˆ’10 / βˆ’1 / +1 / +10βœ“
ALT0 – 45 000 ftβˆ’1k / βˆ’100 / +100 / +1kβœ“
V/S Β· FPAβˆ’4000 – +4000 fpmβˆ’500 / βˆ’100 / +100 / +500βœ“

HDG window turns purple when NAV or LOC is active (managed mode). ALT window turns purple when ALT or VS is active.

Mode buttons

ButtonGroupLEDFunction
A/PMasterBlueEnables autopilot β€” starts 10 Hz control loop, pushes stick output to room
HDGLateralGreenHeading select β€” AP holds HDG window value
NAVLateralGreenLNAV β€” HDG window goes managed
LOCLateralAmberLocalizer capture mode
APPRLat+VertAmberILS approach β€” arms LOC + G/S
F/DFDGreenFlight Director on/off
ALTVerticalGreenAltitude hold β€” captures ALT window value
V/SVerticalGreenVertical speed hold β€” holds VS window value
SPDA/THRBlueAutothrottle speed mode

Lateral modes (HDG/NAV/LOC) are mutually exclusive. Same for vertical modes (ALT/VS/GS/APPR).

Annunciators (top row)

LED boxes showing active modes at a glance: MACH Β· LAT mode Β· VERT mode Β· F/D in green, AP Β· A/THR in blue.

Status bar (bottom)

Live IAS / HDG / ALT / VSI readout. Heading and altitude errors when AP is active. Python heartbeat: βœ“ PY when client connected within 3s. Stick output dot visualizer.

PFD β€” PRIMARY FLIGHT DISPLAY

Airbus A320-style PFD on a 1000Γ—1000 canvas. Animates at 60 fps with lerp smoothing. Click ENGAGE SYSTEMS on first load to unlock browser audio.

Instruments

InstrumentPositionDetails
Attitude sphereCenterSky/ground horizon, pitch ladder Β±30Β° in 5Β° steps, bank angle, clips to circular mask. Amber AIII reference bars.
Speed tapeLeftScrolling airspeed in knots. Cyan pointer. Ticks every 10kt, labels every 20kt. Β±80kt range.
Altitude tapeRightScrolling altitude in feet. Ticks every 100ft, labels every 500ft. AIII altitude callout below 2500ft AGL.
Heading tapeBottomScrolling magnetic heading, N/E/S/W labels, amber bug, digital readout below tape.
VSIFar rightVertical Speed Indicator Β±6000 fpm, green triangle pointer.
FMA barTopFlight Mode Annunciator β€” active thrust, lateral and vertical modes.
CASLeft of attitudeCrew Alerting System messages in red/amber.
Bottom infoBottomGround speed, wind, QNH 1013, LVR CLB.

PFD controls

ControlFunction
ILS selectorSelect runway β€” activates LOC and G/S deviation display
DIAMONDS / BARSILS indicator style toggle β€” floating diamond pointers or full magenta crossbars
SND ON/OFFEnable/disable all GPWS audio callouts

Lerp smoothing

IAS/ALT/HDG smooth at 8% per frame Β· VSI/pitch/roll at 5% per frame β€” matches real glass cockpit needle behavior.

ND β€” NAVIGATION DISPLAY

800Γ—800 canvas. Shows own aircraft, all live PTFS traffic (TCAS), flight plan, ILS cone, compass rose.

Display modes

ModeCenterView
ARCBottom centerForward 180Β° arc, heading up, compass ring rotates with aircraft. Default.
ROSEScreen centerFull 360Β° compass rose, heading up.
PLANFixed north-upFixed orientation, PTFS world airports, full flight plan overview.

Range

β—€ / β–Ά cycles: 5 Β· 10 Β· 20 Β· 40 Β· 80 Β· 160 NM. Range rings at 50% and 100%.

TCAS traffic

All other live aircraft shown as diamonds within 1.5Γ— selected range:

WHITE<500ft altitude separation
AMBER500–1000ft separation
RED>1000ft separation

Each diamond shows callsign and relative altitude offset (e.g. +12 = 1200ft above).

ILS cone

When ILS active, yellow approach cone from runway threshold extending ~8 NM outbound on the ND β€” useful for intercepting final approach visually.

ILS β€” INSTRUMENT LANDING SYSTEM

Full ILS guidance using pre-configured runway coordinates. Select in PFD ILS dropdown.

Available runways

IdentRunways
IBTH09, 27
IGRV06, 24
IIAB09L, 27R
ILAR06, 24
IMLR07, 25
IPAP17, 35
IPPH11, 29, 33
IRFD07C/L/R, 25C/L/R (parallel runways)
ISAU08, 26
ITKO02, 13, 20, 31
IZOL10, 28

Deviations

LOCALIZERLateral deviation from centerline Β±1.5 dots. Computed from aircraft position vs runway heading.
GLIDESLOPEVertical deviation from 3Β° glide path. Aircraft altitude vs rwy_alt + dist Γ— tan(3Β°). Max Β±1.5 dots.

GPWS & AUDIO CALLOUTS

Ground Proximity Warning System with full audio. Click ENGAGE SYSTEMS on load to unlock audio. Toggle with SND ON/OFF.

Altitude callouts (descending)

AltitudeSound
2500 Β· 1000 Β· 500 Β· 400 Β· 300 Β· 200 Β· 100 Β· 50 Β· 40 Β· 30 Β· 20 Β· 10 ftwav callout files
200 ftminimums.mp3
20–5 ftretard.mp3 (loops until touchdown)

GPWS warnings

PULL UPVSI < βˆ’4000 fpm below 1000 ft AGL
SINK RATEVSI < βˆ’2500 fpm below 2500 ft AGL
OVERSPEEDIAS > 450 kt

CAS Messages

OVERSPEEDIAS > 450 kt
SINK RATEVSI < βˆ’3000 fpm below 2000 ft
TAXI SPEEDOn ground, speed > 30 kt
LOC DEVILS active, localizer deviation > 0.8 dots

Callouts play once per approach β€” reset above 2600 ft. Sounds loaded from /pfd/sounds/.

🐍 PYTHON AUTOPILOT CLIENT

External Python script acting as an autopilot computer. Reads FCU targets, fetches PTFS telemetry, computes stick outputs, pushes back at 10 Hz. FCU stick visualizer shows output live.

⬇ Download ap_client.py

Requirements & Usage

pip install requests
python ap_client.py --room myroom --nick YourRobloxName

--room must match the room name entered in Top Bar. --nick is your Roblox username β€” callsign is looked up automatically.

How it works

1. CONNECTPolls /pfd/ap-state.php?room=... every 100ms for FCU state
2. TELEMETRYFetches PTFS aircraft data every 1s (IAS, ALT, HDG, VSI, position)
3. COMPUTEHDG: heading error Γ— 0.04 β†’ stickX. ALT: alt error β†’ target VSI β†’ VSI error Γ— 0.0003 β†’ stickY. VS: VS error β†’ stickY.
4. PUSHPosts {stickX, stickY, ts, telem} to server. Browser FCU reads next poll cycle.

Supported modes

FCU ModeLogicOutput
HDGProportional heading error with 360Β° wrapstickX Β±1.0
ALT HoldAlt error β†’ clamped target VS β†’ VS errorstickY Β±1.0
V/SDirect target VS from FCU window vs live VSIstickY Β±1.0

Console output

[NOX AP] Room: myroom | Aircraft: OK-NOX
[NOX AP] Polling at 10 Hz β€” Ctrl+C to stop

[AP] IAS=245kt ALT=8500ft HDG=270Β° OUT=(+0.120,-0.034) HE=+3.0Β° AE=-120ft

ALL TOOLS

πŸŒ‘
Cockpit Unified

PFD + ND + FCU all-in-one. Main page.

β†’ fushift.fun/pfd
πŸ–₯️
PFD Standalone

Legacy standalone PFD.

β†’ Open PFD
πŸ—ΊοΈ
ND Standalone

Navigation Display only.

β†’ Open ND
✈️
FCU Standalone

Autopilot panel only.

β†’ Open FCU
🐍
Python AP Client

External autopilot script.

⬇ ap_client.py
πŸ“–
Docs

You are here.

β†’ fushift.fun/pfd/docs