MAVLink Deserializer
R2026bConvert serialized uint8 MAVLink data stream to Simulink
nonvirtual bus
Libraries:
UAV Toolbox /
MAVLink
Description
The MAVLink Deserializer block receives a uint8 buffer
and decodes the buffer for MAVLink messages. When the block receives the MAVLink message for
the selected MAVLink message type, the block outputs a Simulink® nonvirtual bus representing a MAVLink packet containing the Message ID, System
ID, Component ID, Sequence, and Payload information corresponding to the selected MAVLink
message type.
At each simulation step, the block decodes the input uint8 buffer and
retrieves the decoded MAVLink messages. If a new message for the
selected MAVLink message type has been received, the block retrieves that message from the
list of received messages and converts it to a Simulink nonvirtual bus signal.
The MAVLink decoding logic in the block takes care of scenarios where a MAVLink packet has been received partially from a communication channel. The MAVLink Deserializer block internally stores the current state of parsing and resumes decoding from the previous step when the new buffer has been received over the communication channel. If the complete MAVLink packet has been received and the received checksum matches the computed checksum for the received bytes, then this indicates that a MAVLink message has been received. Storing the state of parsing enables the block to decode the MAVLink packets received in multiple parts.
By default, the block outputs the latest received MAVLink message for the selected MAVLink message type (if received). To change this behavior, select the Queue MAVLink messages in output parameter. In this case, all the received MAVLink messages for the desired type are queued and at each simulation step, the block outputs the oldest message.
Ports
Input
Output
Parameters
Tips
To speed up conversion of received serialized data, apply the following settings in the communication channel receive block:
Read the data at the highest rate possible to ensure that no packets are dropped. Use the IsNew output of MAVLink Deserializer along with the logic to use MAVLink messages to know if the output of the block is a new message or not.
If the receive block outputs any number of bytes that are received irrespective of the data size requested (partial receive), set the data read size to a large number and use the length of actual number of bytes received as an input to MAVLink Deserializer block (use the Length input port).
Extended Capabilities
Version History
Introduced in R2020b
