Receive net_ctrl Packet from FlightGear

Receive net_ctrl packet from FlightGear

  • Library:
  • Aerospace Blockset / Animation / Flight Simulator Interfaces

Description

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. This block supports all signals supported by the FlightGear net_ctrl data packet. The block arranges the signals into multiple groups. To enable or disable the signal groups, select the FlightGear version. The block inserts zeros for packet values that are part of inactive signal groups.

If you run a model that contains this block in Rapid Accelerator mode, the block produces zeros (0s) and it does not produce deployable code. In Accelerator mode, the block works as expected.

For details on signals and signal groups, see Output.

Ports

Output

expand all

Controls information from FlightGear, specified as a vector. The block returns packets according to platform and FlightGear version.

PlatformFlightGear VersionDimension Type

Windows® and Linux®

v2018.3, v2018.2, v2018.1, v2017.3, v2017.1, v2016.3, v2016.1, v3.4, v3.2, v3.0, v2.12, v2.10, v2.8, v2.6, v2.4, v2.0

744-by-1 vector

macOS

v2018.3*, v2018.2*, v2018.1*, v2017.3*, v2017.1*, 2016.3, v2016.1*, v3.4*, v3.2*, v3.0*, v2.12*, v2.10*, v2.8*, v2.6*

744-by-1 vector

v2.4, v2.0

732-by-1 vector

* On a Mac OS system with FlightGear v2018.3, v2018.2, v2018.1, v2017.3, v2017.1, 2016.3, 2016.1, 3.4, 3.2, 3.0, 2.12, 2.10, 2.8, 2.6, 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.

Data Types: uint8

Received FlightGear packet size, specified as a scalar.

  • 0, if no data is received

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

PlatformFlightGear VersionDimension Type

Windows and Linux

0

v2018.3, v2018.2, v2018.1, v2017.3, v2017.1, v2016.3, v2016.1, v3.4, v3.2, v3.0, v2.12, v2.10, v2.8, v2.6, v2.4, v2.0

744

macOS

0

v2018.3*, v2018.2*, v2018.1*, v2017.3*, v2017.1*, 2016.3, v2016.1*, v3.4*, v3.2*, v3.0*, v2.12*, v2.10*, v2.8*, v2.6*

744

v2.0, v2.4

732

* On a macOS system with FlightGear v2018.3, v2018.2, v2018.1, v2017.3, v2017.1, 2016.3, 2016.1, 3.4, 3.2, 3.0, 2.12, 2.10, 2.8, 2.6, 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.

Data Types: double

Parameters

expand all

Select your FlightGear software version.

Note

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

Programmatic Use

Block Parameter: FlightGearVersion
Type: character vector
Values: scalar
Default: 'v2018.3'

Enter a valid IP address as a dot-decimal string. This IP address must be the address of the computer from which FlightGear is run, for example, 10.10.10.3.

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

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

  • Use 127.0.0.1 for the local computer (localhost).

  • Ping another computer from a Windowscmd.exe (or Linux shell) prompt:

    C:\> ping andyspc
    
    Pinging andyspc [144.213.175.92] with 32 bytes of data:
    
    Reply from 144.213.175.92: bytes=32 time=30ms TTL=253
    Reply from 144.213.175.92: bytes=32 time=20ms TTL=253
    Reply from 144.213.175.92: bytes=32 time=20ms TTL=253
    Reply from 144.213.175.92: bytes=32 time=20ms TTL=253
    
    Ping statistics for 144.213.175.92:
        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:

    H:\>ipconfig
    
    Windows IP Configuration
    
    Ethernet adapter Local Area Connection:
    
            Connection-specific DNS Suffix  . :
            IP Address. . . . . . . . . . . . : 192.168.42.178
            Subnet Mask . . . . . . . . . . . : 255.255.255.0
            Default Gateway . . . . . . . . . : 192.168.42.254
    

Programmatic Use

Block Parameter: ReceiveAddress
Type: character vector
Values: scalar
Default: '127.0.0.1'

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 computer uses. The site, https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers, lists commonly known UDP port numbers. To identify UDP port numbers already in use on your computer, type:

netstat -a -p UDP

Programmatic Use

Block Parameter: ReceivePort
Type: character vector
Values: scalar
Default: '5505'

Specify the sample time (-1 for inherited).

Programmatic Use

Block Parameter: SampleTime
Type: character vector
Values: scalar
Default: '1/30'

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

Programmatic Use

Block Parameter: packetFlag
Type: character vector
Values:'off' | 'on'
Default: 'off'

Introduced in R2012a