feat(export): X-Plane FDR flight-data-recorder export#702
Draft
msupino wants to merge 15 commits into
Draft
Conversation
Adds '🎬 Export FDR' to the Export dropdown. Samples the route at 1 second intervals, computing for each point: - lat/lng via linear interpolation along each leg - altitude blended smoothly over 20 s at each waypoint transition - heading blended through the turn angle - roll from bank-angle formula: arctan(turn_rate × KTAS / 1092) - pitch from climb/descent rate - VVI in ft/min from Δalt between samples - temperature from ISA lapse rate Output is a plain-text .fdr file X-Plane opens via the FDR replay dialog. Default aircraft Cessna 172SP (editable). EN + HE strings. Closes #701 Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
🚀 Preview deployed
Commit: |
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…es X-Plane 12 spec Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…usable) X-Plane FDR DATA rows are fixed-position, not header-labelled. The export emitted time,lon,lat,alt,hdg,pitch,roll,IAS,VVI — which shifted every value into the wrong column (heading landed in h_msl, altitude in latitude, etc.), so X-Plane couldn't replay the route. Add fdrDataRow() that writes each value to its required column per the spec (1 time, 2 temp, 3 lon, 4 lat, 5 h_msl, 6 radio_alt, 7-9 controls, 10 pitch, 11 roll, 12 hdg true, 13 KIAS, 14 VVI, 15 slip, 16 turn). Replace the custom DREF columns with the standard fixed KIAS/VVI slots; add PRES/TEMP/WIND header lines. tests/export-fdr.spec.js asserts the column positions + altitude ramp.
X-Plane reported "Out of range FDR-file heading … 2000" — it was reading our altitude (col 5) as the heading. The 'A'/'3' version line forced X-Plane's compact parser (heading = 5th value); the documented keyword format has no version line and uses the 80-column DATA order with heading in its fixed far column. Remove the 'A'/'3' lines; keep the 80-col rows. Also: describe each export type in the dropdown labels (JSON/GPX/PLN/FDR), en + he.
X-Plane 12 rejected the header-less/legacy 80-col layout ("Old,
non-supported FDR format") and, with an A/3 header but 80-col rows, read
the altitude as the heading ("Out of range … 2000"). V3 wants the COMPACT
positional order: time, lon, lat, alt_ft, heading_true, pitch, roll — with
heading as the 5th value (confirmed by X-Plane's own error). Restore the
A/3 version header and emit compact rows. Reference: lavirott/tofdr.
Replaced the per-leg straight-line sampler (which kinked instantly at each waypoint) with a curved path: each interior waypoint is rounded with a banked-turn arc of radius R = V²/(g·tan φ) at φ=18°, computed in a local metres projection and clamped so adjacent turns don't overlap. The path is resampled at 1 s and heading is taken from the path tangent, roll from the heading rate (tan φ = ω·V/g, signed by turn direction), and pitch from the climb rate — so X-Plane replays natural, banked turns instead of snapping direction at the corners. Altitude is smoothed (±20 s) for gradual climbs.
…to feat/fdr-export
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds 🎬 Export FDR to the Export dropdown so pilots can pre-fly their CVFR route in X-Plane as a replay.
How it works
References
Closes #701
Made with Cursor