Skip to main content
The FlightGear protocol sends head tracking data directly to the FlightGear flight simulator via UDP packets. It’s specifically designed for FlightGear and provides native integration with the simulator’s view system.

How It Works

The protocol sends a UDP datagram containing 6DOF tracking data to FlightGear’s property system:
  1. Packages position (X, Y, Z in meters) and rotation (heading, pitch, roll in degrees) into a binary structure
  2. Sends the data via UDP to a configurable IP address and port
  3. FlightGear reads the data and updates the view camera accordingly

Data Structure

struct flightgear_datagram {
    double x;       // Position X (meters)
    double y;       // Position Y (meters)  
    double z;       // Position Z (meters)
    double h;       // Heading (degrees)
    double p;       // Pitch (degrees)
    double r;       // Roll (degrees)
    int status;     // Status flag (1 = active)
};

Compatible Simulators

FlightGear

Open-source flight simulator - all versions that support UDP property input
This protocol is specifically designed for FlightGear. For other flight simulators:
  • FSX/Prepar3D: Use SimConnect
  • X-Plane: Use FreeTrack with X-Camera plugin
  • MSFS 2020: Use FreeTrack

Setup Instructions

1

Select FlightGear protocol

In OpenTrack, go to the Output dropdown and select “FlightGear”.
2

Configure network settings

Click the settings button next to the Output dropdown.Network configuration:
  • IP Address: Where FlightGear is running
    • Default: 127.0.0.1 (same computer)
    • For networked setup: Enter FlightGear PC’s IP address
  • Port: UDP port number
    • Default: 5542
    • Must match FlightGear’s configured port
3

Configure FlightGear

Start FlightGear with UDP input enabled. Add this to your FlightGear command line or launcher settings:
--generic=socket,in,25,127.0.0.1,5542,udp,opentrack
Or in the FlightGear launcher:
  • Go to Settings → Additional Settings
  • Add: --generic=socket,in,25,127.0.0.1,5542,udp,opentrack
4

Create FlightGear protocol file

FlightGear needs a protocol definition file to parse OpenTrack data.Create a file named opentrack.xml in FlightGear’s Protocol directory:Location:
  • Windows: <FG Install>\data\Protocol\opentrack.xml
  • Linux: ~/.fgfs/Protocol/opentrack.xml or /usr/share/games/flightgear/Protocol/opentrack.xml
  • macOS: /Applications/FlightGear.app/data/Protocol/opentrack.xml
5

Protocol file contents

Add this XML content to opentrack.xml:
<?xml version="1.0"?>
<PropertyList>
  <generic>
    <input>
      <binary_mode>true</binary_mode>
      <byte_order>host</byte_order>
      
      <chunk>
        <name>x-position</name>
        <type>double</type>
        <node>/sim/current-view/x-offset-m</node>
      </chunk>
      
      <chunk>
        <name>y-position</name>
        <type>double</type>
        <node>/sim/current-view/y-offset-m</node>
      </chunk>
      
      <chunk>
        <name>z-position</name>
        <type>double</type>
        <node>/sim/current-view/z-offset-m</node>
      </chunk>
      
      <chunk>
        <name>heading</name>
        <type>double</type>
        <node>/sim/current-view/heading-offset-deg</node>
      </chunk>
      
      <chunk>
        <name>pitch</name>
        <type>double</type>
        <node>/sim/current-view/pitch-offset-deg</node>
      </chunk>
      
      <chunk>
        <name>roll</name>
        <type>double</type>
        <node>/sim/current-view/roll-offset-deg</node>
      </chunk>
      
      <chunk>
        <name>status</name>
        <type>int</type>
      </chunk>
    </input>
  </generic>
</PropertyList>
6

Start tracking

  1. Start OpenTrack and click Start
  2. Launch FlightGear with the generic protocol configuration
  3. Your head movements will control the view in FlightGear

Configuration

Default Settings

IP Address: 127.0.0.1
Port: 5542

Network Configuration

For running OpenTrack and FlightGear on different computers:
1

Find FlightGear PC IP

On the computer running FlightGear, find its local IP address:
  • Windows: ipconfig in command prompt
  • Linux/Mac: ifconfig or ip addr
2

Update OpenTrack settings

In OpenTrack FlightGear settings, enter the FlightGear PC’s IP address.
3

Configure FlightGear

Update FlightGear command line to listen on all interfaces:
--generic=socket,in,25,0.0.0.0,5542,udp,opentrack
4

Check firewall

Ensure UDP port 5542 is allowed through the firewall on the FlightGear PC.

Coordinate Transformations

OpenTrack coordinates are converted for FlightGear:
// Position (cm to meters)
FlightData.x = -headpose[TX] * 0.01;  // Negated
FlightData.y =  headpose[TY] * 0.01;
FlightData.z =  headpose[TZ] * 0.01;

// Rotation (degrees)
FlightData.h = -headpose[Yaw];    // Heading (negated)
FlightData.p =  headpose[Pitch];  // Pitch
FlightData.r = -headpose[Roll];   // Roll (negated)

// Status
FlightData.status = 1;  // Always active when tracking

Troubleshooting

”Can’t bind to [IP:Port]” Error

Cause: OpenTrack cannot bind to the UDP socket. Solution:
  1. Check if another application is using the port
  2. Verify IP address format is correct (e.g., 192.168.1.100)
  3. Try changing the port number
  4. Run OpenTrack as administrator

FlightGear Doesn’t Respond to Tracking

Symptoms: OpenTrack is running but view doesn’t move in FlightGear. Solution:
  1. Verify protocol file exists: Check opentrack.xml is in Protocol folder
  2. Check command line: Ensure --generic=socket,in,25,127.0.0.1,5542,udp,opentrack is in FlightGear launch options
  3. Match IP and port: Settings must match between OpenTrack and FlightGear
  4. Firewall: Add exception for UDP port 5542
  5. Test connectivity: Use Wireshark or tcpdump to verify UDP packets are being sent

View Jumps or Jitters

Cause: Network latency or packet loss. Solution:
  • If networked: Use wired connection instead of WiFi
  • Reduce OpenTrack filter smoothing
  • Check for network congestion
  • Ensure FlightGear frame rate is stable

Wrong Axis Movement

Cause: Coordinate system mismatch. Solution:
  • Verify opentrack.xml maps chunks to correct view properties
  • Check OpenTrack mapping settings
  • May need to invert specific axes in OpenTrack mapping

FlightGear View Configuration

View System Properties

The protocol controls these FlightGear properties:
  • /sim/current-view/x-offset-m - X position offset
  • /sim/current-view/y-offset-m - Y position offset
  • /sim/current-view/z-offset-m - Z position offset
  • /sim/current-view/heading-offset-deg - Heading offset
  • /sim/current-view/pitch-offset-deg - Pitch offset
  • /sim/current-view/roll-offset-deg - Roll offset

Compatible View Types

Head tracking works best with these FlightGear views:
  • Cockpit View (default)
  • Helicopter View
  • Chase View
External views may have limited head tracking functionality.

Advanced Usage

Custom Update Rate

FlightGear’s command line specifies update rate (25 Hz in example):
--generic=socket,in,25,127.0.0.1,5542,udp,opentrack
                    ^^-- Update rate in Hz
Adjust this to match your tracking input device framerate:
  • 25 Hz - Standard
  • 30 Hz - Smoother
  • 60 Hz - Very smooth (requires fast tracking source)

Multiple Tracking Sources

To use multiple UDP inputs in FlightGear, use different ports:
--generic=socket,in,25,127.0.0.1,5542,udp,opentrack \
--generic=socket,in,30,127.0.0.1,5543,udp,joystick
The FlightGear protocol is designed for dedicated FlightGear users who want native integration. For casual use or multiple simulators, consider using FreeTrack protocol with appropriate plugins.

Technical Details

Binary Protocol

The protocol sends binary data in host byte order:
  • 6 doubles (8 bytes each) = 48 bytes
  • 1 integer (4 bytes) = 4 bytes
  • Total packet size: 52 bytes per update

Network Performance

At 25 Hz update rate:
  • Bandwidth: ~10 Kbps
  • Packets per second: 25
  • Latency: Typically <1ms on local network
Very low overhead, suitable for network play.