Main Content

Aero.FlightGearAnimation Objects

The Aerospace Toolbox interface to the FlightGear flight simulator enables you to visualize flight data in a three-dimensional environment. The third-party FlightGear simulator is an open source software package available through a GNU® General Public License (GPL). This section describes how to obtain and install the third-party FlightGear flight simulator. It also describes how to play back 3-D flight data by using a FlightGear example, provided with your Aerospace Toolbox software. For an example of the Aerospace Toolbox interface to the FlightGear flight simulator, see Create a Flight Animation from Trajectory Data.

About the FlightGear Interface

The FlightGear flight simulator interface included with the Aerospace Toolbox product is a unidirectional transmission link from the MATLAB® software to FlightGear. It uses FlightGear's published net_fdm binary data exchange protocol. Data is transmitted via UDP network packets to a running instance of FlightGear. The toolbox supports multiple standard binary distributions of FlightGear. For interface details, see Flight Simulator Interface Example following.

FlightGear is a separate software entity that is not created, owned, or maintained by MathWorks®.

Supported FlightGear Versions

The Aerospace Toolbox product supports FlightGear versions starting from v2.6.

Obtaining FlightGear Software

You can obtain FlightGear software from www.flightgear.org in the download area or by ordering CDs from FlightGear. The download area contains extensive documentation for installation and configuration. Because FlightGear is an open source project, source downloads are also available for customization and porting to custom environments.

Configuring Your Computer for FlightGear

You must have a high-performance graphics card with stable drivers to use FlightGear. For more information, see the FlightGear CD distribution or the hardware requirements and documentation areas of the FlightGear website, www.flightgear.org.

Setup on Linux, Mac OS X, and Other Platforms

FlightGear distributions are available for Linux®, Mac OS X, and other UNIX® platforms from the FlightGear website, www.flightgear.org. Installation on these platforms, like Windows®, requires careful configuration of graphics cards and drivers. Consult the documentation and hardware requirements sections at the FlightGear website.

FlightGear and Video Cards in Windows Systems

Your computer built-in video card, such as NVIDIA® cards, can have issues working with FlightGear shaders. Consider this workaround:

  • Disable the FlightGear shaders by specifying the DisableShaders property of the Aero.FlightGearAnimation object to the GenerateRunScript method.

Install and Start FlightGear

The extensive FlightGear documentation guides you through the installation. For complete installation instructions, consult the documentation section of the FlightGear website www.flightgear.org.

Note:

  • Generous central processor speed, system and video RAM, and virtual memory are essential for good flight simulator performance.

    For more information, see https://wiki.flightgear.org/Hardware_recommendations.

  • Have sufficient disk space for the FlightGear download and installation.

  • Before you install FlightGear, configure your computer graphics card. See the preceding section, Configuring Your Computer for FlightGear.

  • Before installing FlightGear, shut down all running applications (including the MATLAB software).

  • Install FlightGear in a folder path name composed of ASCII characters.

  • The operational stability of FlightGear is especially sensitive during startup. It is best to not move, resize, mouse over, overlap, or cover up the FlightGear window until the initial simulation scene appears after the startup splash screen fades out.

  • The current releases of FlightGear are optimized for flight visualization at altitudes below 100,000 feet. FlightGear does not work well or at all with very high altitude and orbital views.

The Aerospace Toolbox product supports FlightGear on a number of platforms (System Requirements). The following table lists the properties to be aware of before you start using FlightGear.

FlightGear PropertyFolder DescriptionPlatformsTypical Location

FlightGearBaseDirectory

FlightGear installation folder.

Windows

C:\Program Files\FlightGear
(default)

Linux

Directory into which you installed FlightGear

Mac

/Applications
(folder into which you dragged the FlightGear icon)

GeometryModelName

Model geometry folder

Windows

C:\Program Files\FlightGear\data\Aircraft\HL20
(default)

Linux

$FlightGearBaseDirectory/data/Aircraft/HL20

Mac

$FlightGearBaseDirectory/FlightGear.app/Contents/Resources/data/Aircraft/HL20

Installing Additional FlightGear Scenery

When you install the FlightGear software, the installation provides a basic level of scenery files. The FlightGear documentation guides you through installing scenery as part the general FlightGear installation.

If you need to install more FlightGear scenery files, see the instructions at http://www.flightgear.org. Those instructions describe how to install the additional scenery in a default location.

If you install additional scenery in a non-standard location, you may need to update the FG_SCENERY environment variable in the script output from the GenerateRunScript function to include the new path. For a description of the FG_SCENERY variable, see the documentation at http://www.flightgear.org.

If you do not download scenery in advance, you can direct FlightGear to download it automatically during simulation using the InstallScenery property of the Aero.FlightGearAnimation object for the GenerateRunScript method.

For Windows systems, you may encounter an error message while launching FlightGear with the InstallScenery option enabled:

Error creating directory: No such file or directory

This error likely indicates that your default FlightGear download folder is not writeable, the path cannot be resolved, or the path contains UNC path names. To work around the issue, edit the runfg.bat file to specify a new folder path to store the scenery data:

  1. Edit runfg.bat.

  2. To the list of command options, append --download-dir= and specify a folder to which to download the scenery data. For example:

    --download-dir=C:\Users\user1\Documents\FlightGear

    All data downloaded during this FlightGear session is saved to the specified directory. To avoid downloading duplicate scenery data, use the same directory in succeeding FlightGear sessions

  3. To open FlightGear, run runfg.bat.

Note

Each time that you run the GenerateRunScript function, it creates a new script. It overwrites any edits that you have added.

Flight Simulator Interface Example

The Aerospace Toolbox product provides an example named Displaying Flight Trajectory Data. This example shows you how you can visualize flight trajectories with FlightGear Animation object. The example is intended to be modified depending on the particulars of your FlightGear installation. Use this example to play back your own 3-D flight data with FlightGear.

Before attempting to simulate this model, you must have FlightGear installed and configured. See About the FlightGear Interface.

To run the example:

  • Import the aircraft geometry into FlightGear.

  • Run the example. The example performs the following steps:

    • Loads recorded trajectory data.

    • Creates a time series object from trajectory data.

    • Creates a FlightGearAnimation object.

  • Modify the animation object properties, if needed.

  • Create a run script for launching the FlightGear flight simulator.

  • Start the FlightGear flight simulator.

  • Play back the flight trajectory.

Import the Aircraft Geometry into FlightGear

Before running the example, copy the aircraft geometry model into FlightGear. From the following procedures, choose the one appropriate for your platform. This section assumes that you have read Install and Start FlightGear.

If your platform is Windows:

  1. Go to your installed FlightGear folder. Open the data folder, and then the Aircraft folder: FlightGear\data\Aircraft\.

  2. If you have previously run the Aerospace Blockset™ NASA HL-20 with FlightGear Interface example, you might already have an HL20 subfolder there. If that is the case, you do not have to do anything, because you can use the existing geometry model.

    Otherwise, copy the HL20 folder from the matlabroot\toolbox\aero\animation folder to the FlightGear\data\Aircraft folder. This folder contains the preconfigured geometries for the HL-20 simulation and HL20-set.xml. The file HL20.xml defines the geometry.

If your platform is Linux:

  1. Go to your installed FlightGear folder. Open the data folder, then the Aircraft folder: $FlightGearBaseDirectory/data/Aircraft/.

  2. If you have previously run the Aerospace Blockset NASA HL-20 with FlightGear Interface example, you might already have an HL20 subfolder there. If that is the case, you do not have to do anything, because you can use the existing geometry model.

    Otherwise, copy the HL20 folder from the matlabroot/toolbox/aero/animation folder to the $FlightGearBaseDirectory/data/Aircraft/ folder. This folder contains the preconfigured geometries for the HL-20 simulation and HL20-set.xml. The file HL20.xml defines the geometry.

If your platform is Mac:

  1. Open a terminal.

  2. List the contents of the Aircraft folder. For example, type:

    ls $FlightGearBaseDirectory/data/Aircraft/
  3. If you have previously run the Aerospace Blockset NASA HL-20 with FlightGear Interface example, you might already have an HL20 subfolder there. If that is the case, you do not have to do anything, because you can use the existing geometry model.

    Otherwise, copy the HL20 folder from the matlabroot/toolbox/aero/animation folder to the $FlightGearBaseDirectory/FlightGear.app/Contents/Resources/data/Aircraft/ folder. This folder contains the preconfigured geometries for the HL-20 simulation and HL20-set.xml. The file HL20.xml defines the geometry.

See Also

Related Topics