Table of Contents
Mavlink Send
Sends data over a Mavlink connection.
Library
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
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:
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:
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 |
---|---|---|---|
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
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. |
See Also
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.