A Python script to convert IGC flight logs to X-Plane compatible FDR files for glider flights.
This tool allows glider pilots to replay their real-world or simulated flights in X-Plane. It converts IGC files (the standard flight recording format for gliders) to FDR files (X-Plane's flight data recorder format).
Based on 42fdr by MadReasonable, which handles ForeFlight CSV and KML files.
- Processes IGC files from any source (flight recorders, Condor, XCSoar, SeeYou, etc.)
- Estimates attitude (pitch and roll) based on flight trajectory and physics
- Configurable aircraft selection based on tail number
- Customizable DREFs for X-Plane instrument panel support
- Timezone adjustment for correct replay timing
- Smoothing for realistic flight dynamics
- Detailed flight summary with metadata
- Time gap interpolation for smooth playback
- Heading discontinuity fixes for accurate replay
# 1. Convert an IGC file
python igc2fdr.py -c igc2fdr.conf my_flight.igc
# 2. Copy the generated FDR file to X-Plane
cp my_flight.fdr /path/to/X-Plane/Output/FDR/
# 3. In X-Plane: File → Replay a Flight → my_flight.fdrExample output:
2025-11-19 19:06:21 - INFO - Processing JUGA-2025-05-09.igc
2025-11-19 19:06:21 - INFO - Created ./JUGA-2025-05-09.fdr
2025-11-19 19:06:21 - INFO - Processed 1 files: 1 succeeded, 0 failed
- Clone or download this repository
- Ensure you have Python 3.6 or newer installed
- No additional dependencies required - uses only standard library modules
If you plan to contribute or run tests:
# Clone the repository
git clone https://github.com/jlgabriel/IGC2FDR.git
cd IGC2FDR
# Install development dependencies
pip install -r requirements-dev.txt
# Run tests
pytestpython igc2fdr.py [-c config] [-a aircraft] [-t timezone] [-o outputFolder] file.igc [file2.igc ...]Examples:
python igc2fdr.py -c igc2fdr.conf JUGA-2025-05-09.igc
python igc2fdr.py -c igc2fdr.conf JUGA-2025-05-11.igc
| Option | Description |
|---|---|
-c |
Specify a config file (defaults to igc2fdr.conf in the current directory) |
-a |
Choose an X-Plane aircraft (overrides the one in the config file) |
-t |
Adjust timezone (IGC files are typically in UTC) |
-o |
Set output folder for the generated FDR files |
The config file allows you to:
- Set default aircraft and timezone settings
- Define DREFs for X-Plane instrument panel support
- Map tail numbers to specific X-Plane aircraft
- Apply calibration to heading, pitch, and roll
- Adjust smoothing factors for more realistic flight dynamics
Example config file structure:
[Defaults]
Aircraft = Aircraft/Laminar Research/Schleicher ASK 21/ASK21.acf
Timezone = 0
OutPath = .
RollFactor = 0.6
PitchFactor = 0.8
DREF sim/cockpit2/gauges/indicators/airspeed_kts_pilot = round({Speed}, 4), 1.0, IAS
# More DREFs...
[Aircraft/Laminar Research/Schleicher ASK 21/ASK21.acf]
Tails = D-XXXX, EC-XXX, N1234, CC-JUGA
StripPrefixes = GLIDERID:, PILOT:, GLIDERTYPE:
# Aircraft-specific DREFs...
[CC-JUGA]
headingTrim = 0.5
pitchTrim = -0.2
rollTrim = 0.0IGC files contain GPS position and altitude data but lack attitude information (pitch, roll). This tool:
- Parses the IGC file to extract the flight track and metadata
- Calculates heading from position changes
- Estimates pitch from altitude changes and ground speed
- Estimates roll from heading change rate (turn rate)
- Applies smoothing for more realistic flight dynamics
- Applies any configured calibration values
- Generates an FDR file with properly formatted header and track data
- Generate the FDR file using this tool
- Copy the .fdr file to your X-Plane's
Output/FDRfolder - In X-Plane, select "Replay a Flight" from the File menu
- Choose your FDR file from the list
The project includes a diagnostic tool to analyze FDR files and detect potential issues:
python tools/fdr_analyzer.py my_flight.fdr
# Optional: Export issues to CSV
python tools/fdr_analyzer.py my_flight.fdr --export-csv issues.csv
# Adjust detection thresholds
python tools/fdr_analyzer.py my_flight.fdr --heading-threshold 60 --speed-threshold 40This tool detects:
- Heading discontinuities and abrupt changes
- Time gaps in the data
- Speed anomalies (unrealistic or sudden changes)
- Extreme attitude values (pitch/roll)
- Position jumps
- Attitude estimation is approximate and based on trajectory, not actual measurements
- Very small or rapid changes in heading may not be accurately captured
- Very slow ground speeds can result in exaggerated attitude estimates
- X-Plane may adjust flight times to fit its internal scheduling
igc2fdr.py- Main script and entry pointigc_model.py- Data model definitions (FdrFlight, FdrTrackPoint, etc.)igc_config.py- Configuration file parsing and managementigc_parser.py- IGC file parsing with attitude estimationigc_summary.py- Flight summary generationigc_utils.py- Utility functions (distance, heading, timezone conversion)igc_writer.py- FDR file generation and formattingigc_constants.py- Constants and configuration defaults
igc2fdr.conf- Example configuration filetools/fdr_analyzer.py- FDR file analysis tool for detecting discontinuities
tests/- Comprehensive test suite with 168 teststest_igc_utils.py- Utility function teststest_igc_model.py- Data model teststest_igc_config.py- Configuration teststest_igc_parser.py- IGC parsing teststest_igc_writer.py- FDR writing teststest_igc_summary.py- Summary generation teststest_igc2fdr.py- End-to-end integration tests
pytest.ini- Test configurationrequirements-dev.txt- Development dependencies
- Based on 42fdr by MadReasonable
- IGC file format specifications from the FAI/IGC
- FDR format based on X-Plane documentation and examples
- Code assistance provided by Anthropic Claude 3.7 Sonnet
This project has comprehensive test coverage (93.72%) to ensure code quality and reliability.
# Install development dependencies
pip install -r requirements-dev.txt
# Run all tests
pytest
# Run tests with coverage report
pytest --cov=. --cov-report=html
# View coverage report
open htmlcov/index.html- ✅
igc_constants.py- 100% - ✅
igc_model.py- 100% - ✅
igc_summary.py- 100% - ✅
igc_writer.py- 100% - ✅
igc_config.py- 87% - ✅
igc2fdr.py- 84% - ✅
igc_parser.py- 83% ⚠️ igc_utils.py- 72%
Contributions are welcome! Please follow these guidelines:
- Fork the repository and create a feature branch
- Write tests for any new functionality
- Ensure all tests pass with
pytest - Maintain code coverage above 80%
- Update documentation as needed
- Submit a pull request with a clear description
- Enhanced attitude estimation algorithms
- Support for additional glider-specific instruments
- Improved handling of edge cases in IGC files
- GUI for easier configuration and file selection
- Additional output formats (KML, GPX, etc.)
Problem: "No module named 'igc_config'"
- Solution: Make sure you're running the script from the project directory, or add the project directory to your Python path.
Problem: Generated FDR file has discontinuities or jumps
- Solution: Use the FDR analyzer tool to identify issues:
python tools/fdr_analyzer.py your_flight.fdr
- Tip: Adjust
RollFactorandPitchFactorin the config file to smooth attitude changes.
Problem: X-Plane doesn't show the FDR file
- Solution: Ensure the file is in
X-Plane/Output/FDR/folder - Check: File has
.fdrextension (lowercase) - Verify: File is not corrupted (should start with
A\n4\n)
Problem: Heading shows sudden jumps
- Solution: This was fixed in recent updates. Make sure you're using the latest version with heading interpolation fixes.
Problem: Flight plays back at wrong time in X-Plane
- Solution: Use the
-toption to adjust timezone:python igc2fdr.py -t "+2" my_flight.igc # Add 2 hours
- Check the Issues page for known problems
- Review test examples in
tests/for usage patterns - Run tests to verify your installation:
pytest
This project is licensed under the MIT License - see the LICENSE file for details.