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.
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.
cyklotrasy.info/fushift/proxy24.php?route=acft-data&sse=1 β pushes all live PTFS aircraft positions every ~1 secondwindow.SH β single object holding callsign, telemetry (IAS, ALT, HDG, VSI, pitch, roll, position), FCU targets, AP modes, ILS state, GPWS flagsSH, draws on 1000Γ1000 canvas. ND reads SH, draws on 800Γ800 canvas. FCU reads/writes SH, runs 10 Hz AP loop./pfd/ap-state.php?room=... so the Python client stays in sync| Layer | Tech | Notes |
|---|---|---|
| Rendering | HTML5 Canvas 2D | PFD 1000Γ1000 px, ND 800Γ800 px β both CSS-scaled to fill container |
| Live data | Server-Sent Events | One persistent SSE connection shared by all components |
| State | Plain JS object | window.SH β no framework, no reactive layer needed |
| AP sync | REST polling | PHP file stores room state as JSON, Python client polls at 10 Hz |
| Fonts | B612, B612 Mono, Share Tech Mono | Aviation-standard ESA/Airbus typeface |
Full viewport, no scroll. Vertical flex column with three rows:
All panels resize automatically β canvas elements scale via CSS transform: scale() to preserve pixel-perfect rendering.
38px persistent bar. All session controls in one place.
| Control | Function |
|---|---|
| Plane Selector | Dropdown populated live from SSE. Shows all active aircraft with ALT and SPD. Click SET to apply β all instruments switch to that aircraft instantly. |
| Room + JOIN | Enter room name, click JOIN or press Enter. Links FCU to server room used by Python AP client. Persists in localStorage and URL. |
| AP Status Pills | Live read-only: A/P on/off, active lateral mode, active vertical mode, current HDG and ALT targets. |
| Clock | UTC time, updated every second. |
| π DOCS | Opens this page in a new tab. |
| β¬ AP.PY | Downloads the Python autopilot client. |
| Param | Example | Effect |
|---|---|---|
| cs | ?cs=OK-NOX | Pre-selects aircraft on load |
| room | ?room=myroom | Joins room on load |
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.
| Window | Range | Buttons | Scroll |
|---|---|---|---|
| SPD / MACH | 80 β 350 kt | β10 / β1 / +1 / +10 | β mouse wheel |
| HDG / TRK | 000 β 359Β° | β10 / β1 / +1 / +10 | β |
| ALT | 0 β 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.
| Button | Group | LED | Function |
|---|---|---|---|
| A/P | Master | Blue | Enables autopilot β starts 10 Hz control loop, pushes stick output to room |
| HDG | Lateral | Green | Heading select β AP holds HDG window value |
| NAV | Lateral | Green | LNAV β HDG window goes managed |
| LOC | Lateral | Amber | Localizer capture mode |
| APPR | Lat+Vert | Amber | ILS approach β arms LOC + G/S |
| F/D | FD | Green | Flight Director on/off |
| ALT | Vertical | Green | Altitude hold β captures ALT window value |
| V/S | Vertical | Green | Vertical speed hold β holds VS window value |
| SPD | A/THR | Blue | Autothrottle speed mode |
Lateral modes (HDG/NAV/LOC) are mutually exclusive. Same for vertical modes (ALT/VS/GS/APPR).
LED boxes showing active modes at a glance: MACH Β· LAT mode Β· VERT mode Β· F/D in green, AP Β· A/THR in blue.
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.
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.
| Instrument | Position | Details |
|---|---|---|
| Attitude sphere | Center | Sky/ground horizon, pitch ladder Β±30Β° in 5Β° steps, bank angle, clips to circular mask. Amber AIII reference bars. |
| Speed tape | Left | Scrolling airspeed in knots. Cyan pointer. Ticks every 10kt, labels every 20kt. Β±80kt range. |
| Altitude tape | Right | Scrolling altitude in feet. Ticks every 100ft, labels every 500ft. AIII altitude callout below 2500ft AGL. |
| Heading tape | Bottom | Scrolling magnetic heading, N/E/S/W labels, amber bug, digital readout below tape. |
| VSI | Far right | Vertical Speed Indicator Β±6000 fpm, green triangle pointer. |
| FMA bar | Top | Flight Mode Annunciator β active thrust, lateral and vertical modes. |
| CAS | Left of attitude | Crew Alerting System messages in red/amber. |
| Bottom info | Bottom | Ground speed, wind, QNH 1013, LVR CLB. |
| Control | Function |
|---|---|
| ILS selector | Select runway β activates LOC and G/S deviation display |
| DIAMONDS / BARS | ILS indicator style toggle β floating diamond pointers or full magenta crossbars |
| SND ON/OFF | Enable/disable all GPWS audio callouts |
IAS/ALT/HDG smooth at 8% per frame Β· VSI/pitch/roll at 5% per frame β matches real glass cockpit needle behavior.
800Γ800 canvas. Shows own aircraft, all live PTFS traffic (TCAS), flight plan, ILS cone, compass rose.
| Mode | Center | View |
|---|---|---|
| ARC | Bottom center | Forward 180Β° arc, heading up, compass ring rotates with aircraft. Default. |
| ROSE | Screen center | Full 360Β° compass rose, heading up. |
| PLAN | Fixed north-up | Fixed orientation, PTFS world airports, full flight plan overview. |
β / βΆ cycles: 5 Β· 10 Β· 20 Β· 40 Β· 80 Β· 160 NM. Range rings at 50% and 100%.
All other live aircraft shown as diamonds within 1.5Γ selected range:
Each diamond shows callsign and relative altitude offset (e.g. +12 = 1200ft above).
When ILS active, yellow approach cone from runway threshold extending ~8 NM outbound on the ND β useful for intercepting final approach visually.
Full ILS guidance using pre-configured runway coordinates. Select in PFD ILS dropdown.
| Ident | Runways |
|---|---|
| IBTH | 09, 27 |
| IGRV | 06, 24 |
| IIAB | 09L, 27R |
| ILAR | 06, 24 |
| IMLR | 07, 25 |
| IPAP | 17, 35 |
| IPPH | 11, 29, 33 |
| IRFD | 07C/L/R, 25C/L/R (parallel runways) |
| ISAU | 08, 26 |
| ITKO | 02, 13, 20, 31 |
| IZOL | 10, 28 |
rwy_alt + dist Γ tan(3Β°). Max Β±1.5 dots.Ground Proximity Warning System with full audio. Click ENGAGE SYSTEMS on load to unlock audio. Toggle with SND ON/OFF.
| Altitude | Sound |
|---|---|
| 2500 Β· 1000 Β· 500 Β· 400 Β· 300 Β· 200 Β· 100 Β· 50 Β· 40 Β· 30 Β· 20 Β· 10 ft | wav callout files |
| 200 ft | minimums.mp3 |
| 20β5 ft | retard.mp3 (loops until touchdown) |
Callouts play once per approach β reset above 2600 ft. Sounds loaded from /pfd/sounds/.
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.pypip 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.
/pfd/ap-state.php?room=... every 100ms for FCU state{stickX, stickY, ts, telem} to server. Browser FCU reads next poll cycle.| FCU Mode | Logic | Output |
|---|---|---|
| HDG | Proportional heading error with 360Β° wrap | stickX Β±1.0 |
| ALT Hold | Alt error β clamped target VS β VS error | stickY Β±1.0 |
| V/S | Direct target VS from FCU window vs live VSI | stickY Β±1.0 |