Receive net_ctrl Packet from FlightGear

Receive net_ctrl packet from FlightGear


Animation/Flight Simulator Interfaces


The Receive net_ctrl Packet from FlightGear block receives a network control and environment data packet, net_ctrl, from the simulation of a Simulink® model in the FlightGear simulator, or from a FlightGear session. This data packet is compatible with a particular version of FlightGear flight simulator. All the signals supported by the FlightGear net_ctrl data packet are supported by this block. The signals are arranged into multiple groups. Any group can be turned on or off. Zeros are inserted for packet values that are part of inactive signal groups.

In Rapid Accelerator mode, if you run a model that contains this block , the block produces zeroes (0s). It does not produce deployable code. In Accelerator mode, the block works as expected.

For details on signals and signal groups, see Inputs and Outputs.

Determining the Source IP Address

To determine the source IP address, you can use one of several techniques, such as:

  • Use for the local computer (localhost).

  • Ping another computer from a Windows® cmd.exe (or Linux® shell) prompt:

    C:\> ping andyspc
    Pinging andyspc [] with 32 bytes of data:
    Reply from bytes=32 time=30ms TTL=253
    Reply from bytes=32 time=20ms TTL=253
    Reply from bytes=32 time=20ms TTL=253
    Reply from bytes=32 time=20ms TTL=253
    Ping statistics for
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 20ms, Maximum =  30ms, Average =  22ms
  • On a Windows machine, type ipconfig and use the returned IP address:

    Windows IP Configuration
    Ethernet adapter Local Area Connection:
            Connection-specific DNS Suffix  . :
            IP Address. . . . . . . . . . . . :
            Subnet Mask . . . . . . . . . . . :
            Default Gateway . . . . . . . . . :


FlightGear version

Select your FlightGear software version: v2.0, v2.4, v2.6, v2.8, v2.10, v2.12, v3.0, v3.2, v3.4, v2016.1.

    Note:   If you are using a FlightGear version older than 2.0, the model displays a notification from the Simulink Upgrade Advisor. Consider using the Upgrade Advisor to upgrade your FlightGear version. For more information, see Supported FlightGear Versions.

Origin IP address

Enter a valid IP address as a dot-decimal string. This IP address must be the address of the PC from which FlightGear is run.

For example, You can also use a MATLAB expression that returns a valid IP address as a character vector. If FlightGear is run on the local PC, leave the default value of (localhost).

Origin port

UDP port that the block accepts data from. The sender sends data to the port specified in this parameter. This value must match the Origin port parameter of the Generate Run Script block. It must be a unique port number that no other application on the PC uses. The site,, lists commonly known UDP port numbers. To identify UDP port numbers already in use on your PC, type:

netstat -a -p UDP
Sample time

Specify the sample time (-1 for inherited).

Enable received flag port

Enable a received flag output port. Use this check box to determine if a FlightGear network packet has been received.

Inputs and Outputs

OutputDimension TypeDescription



Contains the controls information from FlightGear in uint8 format.

Windows and Linux

744-by-1 vector (for FlightGear v2016.1, v3.4, v3.2, v3.0, v2.12, v2.10, v2.8, v2.6, v2.4, v2.0)

Mac OS

744-by-1 vector (for FlightGear v2.6*, v2.8*, v2.10*, v2.12*, v3.0*, v3.2*, v3.4*, v2016.1*)

732-by-1 vector (for FlightGear v2.0, v2.4)




  • 0, if no data is received.

  • Size of the packet in bytes (depending on the FlightGear version and architecture).

Windows and Linux

Scalar 0 or:

744 (for FlightGear v2016.1, v3.4, v3.2, v3.0, v2.12, v2.10, v2.8, v2.6, v2.4, v2.0)

Mac OS

Scalar 0 or:

744 (for FlightGear v2.6*, v2.8*, v2.10*, v2.12*, v3.0*, v3.2*, v3.4*, v2016.1*)

732 (for FlightGear v2.0, v2.4)

* On a Macintosh system with FlightGear 2.6, 2.8, 2.10, 2.12, 3.0, 3.2, 3.4, 2016.1 you might see unexpected results (for example, very large or very small data values). For more information, see Macintosh Platform and FlightGear Version 2.6 or Later.


See the asbhl20 example.

Introduced in R2012a

Was this topic helpful?