MAVLink Deserializer
Convert serialized uint8
MAVLink data stream to Simulink
nonvirtual bus
Since R2020b
Libraries:
UAV Toolbox /
MAVLink
Description
The MAVLink Deserializer block receives a uint8
buffer
and decodes the buffer for MAVLink messages. Once 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 MAVLink messages that are received after decoding. 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 ensures that the block can 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). This behavior can be changed by selecting Queue 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 the conversion of the received serialized data, it is recommended that you 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), mention the data read size as 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