Mavlink Enumeration Mavlink Send navigation bar

Table of Contents

Mavlink Receive

Receives data over a Mavlink connection.

Library

QUARC Targets/Communications/Mavlink

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

qc_open_library('quarc_library/Communications/Mavlink')

Description

Mavlink Receive

The Mavlink Receive block receives packets over a Mavlink connection. The Mavlink connection is established using a Mavlink Initialize block. The Mavlink connection is referenced by name via the Connection name parameter.

When the Mavlink connection is configured as a UDP server then the Mavlink Receive block is able to receive packets from more than one drone at the same time. To do so, specify more than one system identifier in the System identifier(s) parameter.

Input Ports

This block has no input ports.

Output Ports

new

A vector indicating whether the data for each system is new. There is one element for each system.

err

An int32 value indicating whether the data was read from the stream buffer successfully. If an error occurs then this value is a negative error code. The reception of a packet is non-blocking, so if a packet is not received for any system then -QERR_WOULD_BLOCK is output. See Error Codes for the different error codes and their values. Use the Compare to Error block rather than the error code itself to check for specific error codes. To check for errors in general use the Compare to Zero block to check whether err output is less than zero.

..

There will be an additional output for each field of the Mavlink message being received. The data type and dimension of the output depends on the data type and length of the field. Most fields are scalars, so the output will be a vector with one element for each system. If the message field is an array then the output will be a matrix with one column for each system. If only one system is specified then scalar fields are output as a scalar and array fields are output as a vector.

Data Type Support

The Mavlink Receive block supports signals of any of the standard Mavlink data types at its outputs. Array fields are supported.

Parameters and Dialog Box

Individual Panes

The parameters of the Mavlink Receive block are divided into two categories: Main and Outputs.

The Main tab contains the parameters that affect the block functionality.

The Outputs tab provides more detailed information on each of the outputs of the block that are specific to the selected message.

Use the links below to jump to the documentation for each tab:

Main Pane

The Main pane of the dialog appears as follows:

Mavlink Receive Main tab

Connection name

The name of the connection from which Mavlink packets will be received. Connections are configured using the Mavlink Initialize block. Place a Mavlink Initialize block in your diagram to add a connection name to the list.

System identifier(s)

The identifiers of the systems from which to receive packets. Only a single system identifier may be specified unless the block is configured as a UDP server. The system identifier of each drone must be unique. QGroundControl may be used to set the system identifier of a drone. Drones typically default to a system identifer of 1.

Component identifier(s)

The identifiers of the component on each system from which to receive packets. Systems may contain multiple components so the component identifier must also be specified. Only a single component identifier may be specified unless the block is configured as a UDP server. Components within a drone must be unique, but need not be unique across systems. Drones typically only have one component whose default identifer is 1.

Message

The Mavlink message to receive. The list of messages is determined by the message definition file referenced by the Mavlink Initialize block which defines the connection. Changing this parameter will redefine the outputs of the block to match the fields of the selected Mavlink message.

Outputs Pane

The Outputs pane of the dialog appears as follows:

Mavlink Receive Outputs tab

Select output for details

Choosing an output from the list updates the data type and description areas with information about the selected output. This parameter does not affect the functionality of the block and is only provided for documentation purposes.

Targets

Target Name

Compatible*

Model Referencing

Comments

QUARC Win32 Target

Yes

Yes

QUARC Win64 Target

Yes

Yes

QUARC Linux Nvidia Target

Yes

Yes

QUARC Linux QBot Platform Target

Yes

Yes

QUARC Linux QCar 2 Target

Yes

Yes

QUARC Linux QDrone 2 Target

Yes

Yes

QUARC Linux Raspberry Pi 3 Target

Yes

Yes

QUARC Linux Raspberry Pi 4 Target

Yes

Yes

QUARC Linux RT ARMv7 Target

Yes

Yes

QUARC Linux x64 Target

Yes

Yes

QUARC Linux DuoVero Target

Yes

Yes

QUARC Linux DuoVero 2016 Target

Yes

Yes

QUARC Linux Verdex Target

Yes

Yes

QUARC QNX x86 Target

Yes

Yes

Last fully supported in QUARC 2018.

Rapid Simulation (RSIM) Target

Yes

Yes

S-Function Target

No

N/A

Old technology. Use model referencing instead.

Normal simulation

Yes

Yes

If the Mavlink Initialize block which created the connection is not active during normal simulation, then the Mavlink Receive block does nothing. Otherwise it receives packets from the connection.

* Compatible means that the block can be compiled for the target.

See Also

 

navigation bar