Mavlink Receive End of trail navigation bar

Table of Contents

Mavlink Send

Sends 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 Send

The Mavlink Send block sends 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 Send block is able to send packets to more than one drone at the same time. To do so, specify more than one system identifier in the System identifier(s) parameter.

This block does support two threads calling Mavlink Send at the same time.

Input Ports

en

A scalar enable signal indicating whether the packet should be sent.

..

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

Output Ports

err

An int32 value indicating whether the data was written to 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 sent 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.

Data Type Support

The Mavlink Send 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 Send block are divided into two categories: Main and Inputs.

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

The Inputs tab provides more detailed information on each of the inputs 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 Send Main tab

Connection name

The name of the connection to which Mavlink packets will be sent. 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 to which to send 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 to which to send 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 send. 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 inputs of the block to match the fields of the selected Mavlink message.

Inputs Pane

The Inputs pane of the dialog appears as follows:

Mavlink Send Inputs tab

Select input for details

Choosing an input from the list updates the data type and description areas with information about the selected input. 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 Send 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