Documentation

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.

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.

  • To report bugs in or request enhancements to the Aerospace Toolbox FlightGear interface, contact MathWorks technical support at http://www.mathworks.com/support/.

  • To report bugs or request enhancements to FlightGear itself, go to www.flightgear.org and use the contact page.

Supported FlightGear Versions

The Aerospace Toolbox product supports the following FlightGear versions:

  • v2.0

  • v2.4

  • v2.6

  • v2.8

  • v2.10

  • v2.12

  • v3.0

  • v3.2

  • v3.4

  • v2016.1

  • v2016.3

  • v2017.1

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 Web site, 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 Web site, 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 Web site.

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 one of these workarounds:

  • In the device manager, disable the NVIDIA driver, enable the Windows system video driver, and start FlightGear. After starting FlightGear, you can reenable the NVIDIA video card.

    Note

    If you do not reenable the NVIDIA card, the Windows driver can affect shading quality, or cause your system to lose support for multiple monitors.

  • Disable the FlightGear shaders:

    • After you use the Generate Run Script block to create a FlightGear run script (runfg.bat), edit the script file to add this line to the end of the file:

      --prop:/sim/rendering/shaders/quality-level=0 

      This command disables FlightGear shaders.

Install and Start FlightGear

The extensive FlightGear documentation guides you through the installation. For complete installation instructions, consult the documentation section of the FlightGear Web site 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 http://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

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.

    Otherwise, copy the HL20 folder from the matlabroot\toolbox\aero\aerodemos\ folder to the FlightGear\data\Aircraft\ folder. This folder contains the preconfigured geometries for the HL-20 simulation and HL20-set.xml. The file matlabroot\toolbox\aero\aerodemos\HL20\models\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/aerodemos/ folder to the $FlightGearBaseDirectory/data/Aircraft/ folder. This folder contains the preconfigured geometries for the HL-20 simulation and HL20-set.xml. The file matlabroot/toolbox/aero/aerodemos/HL20/models/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. In this case, you do not have to do anything, because you can use the existing geometry model. Continue to Running the Example.

    Otherwise, copy the HL20 folder from the

    matlabroot/toolbox/aero/aerodemos/
    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 matlabroot/toolbox/aero/aerodemos/HL20/models/HL20.xml defines the geometry.

Running the Example

  1. Start the MATLAB software.

  2. Enter astfganim in the MATLAB Command Window.

    While running, the example performs several steps by issuing a series of commands.

Was this topic helpful?