This document describes the steps to set up your linux system with flightgear for running flights with the flightgear-control and thingworx-flightgear-edge projects. The target flightgear version is 2020.3.17.
- Linux x86_64 running with a windowing system.
- Git
- JDK 11
- GPU preferably with more than 1Gb of VRAM.
This guide covers usage of flightgear with an AppImage, which is the preferred method of running the flightgear simulator. Alternatively, flightgear may be available through your package manager.
- Use a web browser to navigate to flightgear's release repository for version 2020.3.17 at https://sourceforge.net/projects/flightgear/files/release-2020.3
- Download the following files and place them in a designated folder.
FlightGear-2020.3.17-x86_64.AppImage
FlightGear-2020.3.17-data.txz
FlightGear-2020.3.17-update-data.txz
- Extract the data archives to the current directory in the following order. Both archives should extract to an
fgdata
directory.- Extract archive
FlightGear-2020.3.17-data.txz
- Extract archive
FlightGear-2020.3.17-update-data.txz
- Extract archive
- Ensure the binary file FlightGear-2020.3.17-x86_64.AppImage is executable.
- Add the directory containing the FlightGear AppImage to the PATH. Set this in the shell config files (e.g. .bashrc) too.
The simulator scripts used by the
flightgear-control
establish and depend on an FG_HOME within the same directory as the AppImage. Simulator assets like aircraft will have to be redownloaded. - Clone the
flightgear-control
project, and check out the latest tagged release. - Run the simulator setup shell script with:
flightgear-control/scripts/fg_launcher.sh
- After the launcher UI is visible, click 'Okay' on the welcome screen if it appears. Enlarge the window if the welcome screen doesn't appear to show an 'Okay' button.
- If inclined, navigate to "Settings" and disable crash and error reporting.
- Navigate to the "Aircraft" section.
- Select the "Browse" tab near the top center of the UI. Add the default hanger if there is an option to do so.
- Search (top right of window) for the following models required by the
flightgear-control
project, and install them if necessary. If a model doesn't appear in the search results, it's possible a minimum ratings requirement is excluding it from results.- Cessna 172P Skyhawk (1982)
- F-15C
- Lockheed Martin F-35B Lightning II
- Alouette-III
- Exit the simulator UI. Manage aircraft models installed in the simulator by re-running the
fg_launcher.sh
shell script.
- Locate the flightgear installation directory on your OS.
- Copy the project protocol xml files under
flightgear-control/protocol
directory into the flightgear installation dataProtocol
directory without preserving the source directory structure. All xml files should end up in this directory without the source directory structure. For example:find flightgear-control/protocol -name *.xml
cp -v flightgear-control/protocol/input/c172p/c172p*.xml flightgear-2020.3.17/fgdata/Protocol/
cp -v flightgear-control/protocol/output/c172p/c172p*.xml flightgear-2020.3.17/fgdata/Protocol/
cp -v flightgear-control/protocol/input/f15c/f15c*.xml flightgear-2020.3.17/fgdata/Protocol/
cp -v flightgear-control/protocol/output/f15c/f15c*.xml flightgear-2020.3.17/fgdata/Protocol/
- ...
- Use the provided shell scripts in
flightgear-control/scripts
to launch a simulator configured for our purposes:flightgear-control/scripts/f15c_flight.sh 5220 103 49.19524 -123.18084 f15c_beta
- Parameters:
- 5220 - lower bounds for the port range. The simulator reserves this port and the next 19 ports for various I/O.
- 103 - initial heading in degrees
- 49.19524 - initial latitude position
- -123.18084 - initial longitude position
- f15c_beta - aircraft nickname
- A table of port ranges mapped to application config files is available here
- The scripts in
flightgear-control/scripts
are organized into [aircraft]_runway.sh and [aircraft]_flight.sh.
- Parameters:
- Launch a simulator instance according to the previous section.
- The shell script specifies a socket protocol defined in f15c_output.xml with this line:
--generic=socket,out,45,$TELEM_HOST,$TELEM_OUTPUT_PORT,udp,f15c_output\
- The shell script specifies a socket protocol defined in f15c_output.xml with this line:
- Use netcat to output the simulator telemetry stream to the shell. The output stream uses the first port in the range reserved by the simulator.
nc -l -u -p 5220 127.0.0.1
- Launch a simulator instance via:
flightgear-control/scripts/f15c_flight.sh 5220 103 49.19524 -123.18084 f15c_beta
- Open URL
http://localhost:5222/screenshot?type=jpg
in a web browser and confirm that the simulator view appears. Some of the packaged shell scripts (typically*_flight.sh
) enable retrieval of the simulator view with line:--httpd=$CAM_VIEW_PORT\
- Switch to the project root of the
flightgear-control
project, and ensure the latest release or development branch is checked out. - Run the build tasks
jar
andsourcesjar
with the gradle wrapper, specifying JDK 11:JAVA_HOME=/path/to/jdk11 ./gradlew jar sourcesjar
- Check that the jars
flightgear-control-[version].jar
andflightgear-control-[version]-src.jar
appear inbuild/lib
. - Use these jars in other projects.
- Switch to the project root of the
flightgear-control
project, and ensure the latest release or development branch is checked out.. - Run the build tasks
appjar
with the gradle wrapper, specifying JDK 11:JAVA_HOME=/path/to/jdk11 ./gradlew appjar
- Check that the application jar
flightgear-control-[version]-app.jar
appears inbuild/lib
- Ensure your IDE has gradle project support.
- Import flightgear-control as a gradle project, and configure it to use the included gradle wrapper.
Documented here.