Crate mavlink

Source
Expand description

Rust implementation of the MAVLink UAV messaging protocol, with bindings for all dialects. This crate provides message set code generation, packet building, parsing and connection handling for blocking and asynchronous I/O.

§Feature flags

The mavlink crate uses a number of feature flags to reduce the amount of compiled code by making certain functions and MAVLink message sets (dialects) optional. These feature flags are available to control the provided functionalities:

  • std: Enables the usage of std in mavlink, enabled by default, this can be disabled for embedded applications.
  • direct-serial: Enable serial MAVLink connections, enabled by default.
  • udp: Enables UDP based MAVLink connections, enabled by default.
  • tcp: Enables TCP based MAVLink connections, enabled by default.
  • signing: Enable support for MAVLink 2 message signing
  • embedded: Enables embedded support using the embedded-io crate, incompatible with embedded-hal-02 and tokio-1.
  • embedded-hal-02: Enables embedded support using version 0.2 of the embedded-hal crate, incompatible with embedded.
  • tokio-1: Enable support for asynchronous I/O using tokio, incompatible with embedded.
  • serde: Enables serde support in generated message sets, enabled by default.
  • format-generated-code: Generated MAVLink message set code will be formatted.
  • emit-description: Generated MAVLink message set code will include documentation.
  • emit-extensions: Generated MAVLink message set code will include MAVLink 2 message extensions.
  • arbitrary: Enable support for the arbitrary crate.

Either std, embedded or embedded-hal-02 must be enabled.

Each MAVlink message set (dialect) can be enabled using its feature flag. The following message set feature flags are available:

  • ardupilotmega, enabled by default
  • common, enabled by default
  • all, this includes all other sets in the same message set
  • asluav
  • avssuas
  • cubepilot
  • csairlink
  • development
  • icarous
  • loweheiser
  • matrixpilot
  • minimal
  • paparazzi
  • python_array_test
  • slugs
  • standard
  • storm32
  • test
  • ualberta
  • uavionix

The all-dialects feature enables all message sets except all.

Modules§

ardupilotmegaardupilotmega
MAVLink ardupilotmega dialect.
asluavasluav
MAVLink ASLUAV dialect.
async_peek_reader
This module implements a buffered/peekable reader using async I/O.
avssuasavssuas
MAVLink AVSSUAS dialect.
bytes
bytes_mut
commoncommon
MAVLink common dialect.
csairlinkcsairlink
MAVLink csAirLink dialect.
cubepilotcubepilot
MAVLink cubepilot dialect.
developmentdevelopment
MAVLink development dialect.
error
icarousicarous
MAVLink icarous dialect.
loweheiserloweheiser
MAVLink loweheiser dialect.
matrixpilotmatrixpilot
MAVLink matrixpilot dialect.
minimalminimal
MAVLink minimal dialect.
paparazzipaparazzi
MAVLink paparazzi dialect.
peek_reader
This module implements a buffered/peekable reader.
python_array_testpython_array_test
MAVLink python_array_test dialect.
standardstandard
MAVLink standard dialect.
storm32storm32
MAVLink storm32 dialect.
testtest
MAVLink test dialect.
ualbertaualberta
MAVLink ualberta dialect.
uavionixuavionix
MAVLink uAvionix dialect.
utils
Utilities for processing MAVLink messages

Structs§

FileConnectable
MAVLink connection address for a file input
MAVLinkV1MessageRaw
Byte buffer containing the raw representation of a MAVLink 1 message beginning with the STX marker.
MAVLinkV2MessageRaw
Byte buffer containing the raw representation of a MAVLink 2 message beginning with the STX marker.
MavFrame
Encapsulation of the MAVLink message and the header, important to preserve information about the sender system and component id.
MavHeader
Metadata from a MAVLink packet header
SerialConnectable
MAVLink address for a serial connection
SigningConfig
Configuration used for MAVLink 2 messages signing as defined in https://mavlink.io/en/guide/message_signing.html.
SigningData
MAVLink 2 message signing data
TcpConnectable
MAVLink connection address for a TCP server or client
UdpConnectable
MAVLink address for a UDP server client or broadcast connection

Enums§

ConnectionAddress
A parsed MAVLink connection address
MAVLinkMessageRaw
Raw byte representation of a MAVLink message of either version
MavlinkVersion
Versions of the MAVLink protocol that we support
ReadVersion
MAVLink Version selection when attempting to read
UdpMode
Type of UDP connection

Constants§

MAV_STX
Message framing marker for MAVLink 1
MAV_STX_V2
Message framing marker for MAVLink 2
MAX_FRAME_SIZE
Maximum size of any MAVLink frame in bytes.

Traits§

AsyncConnectable
A MAVLink connection address that can be connected to, establishing an AsyncMavConnection
AsyncMavConnection
An async MAVLink connection
Connectable
A MAVLink connection address that can be connected to, establishing a MavConnection
MavConnection
A MAVLink connection
Message
A MAVLink message payload
MessageData

Functions§

calculate_crc
Calculates the CRC checksum of a messages header, payload and the CRC_EXTRA byte.
connect
Connect to a MAVLink node by address string.
connect_async
Connect asynchronously to a MAVLink node by address string.
read_any_msg
Read and parse a MAVLink 1 or 2 message from a PeekReader.
read_any_msg_async
Asynchronously read and parse a MAVLink 1 or 2 message from a AsyncPeekReader.
read_any_msg_async_signed
Asynchronously read and parse a MAVLink 1 or 2 message from a AsyncPeekReader with signing support.
read_any_msg_signed
Read and parse a MAVLink 1 or 2 message from a PeekReader with signing support.
read_any_raw_message
Read a raw MAVLink 1 or 2 message from a PeekReader.
read_any_raw_message_async
Asynchronously read a raw MAVLink 1 or 2 message from a AsyncPeekReader.
read_any_raw_message_async_signed
Asynchronously read a raw MAVLink 1 or 2 message from a AsyncPeekReader with signing support.
read_any_raw_message_signed
Read a raw MAVLink 1 or 2 message from a PeekReader with signing support.
read_v1_msg
Read and parse a MAVLink 1 message from a PeekReader.
read_v1_msg_async
Asynchronously read and parse a MAVLink 1 message from a AsyncPeekReader.
read_v1_raw_message
Read a raw MAVLink 1 message from a PeekReader.
read_v1_raw_message_async
Asynchronously read a raw MAVLink 1 message from a AsyncPeekReader.
read_v2_msg
Read and parse a MAVLink 2 message from a PeekReader.
read_v2_msg_async
Asynchronously read and parse a MAVLink 2 message from a AsyncPeekReader.
read_v2_msg_async_signed
Asynchronously read and parse a MAVLink 2 message from a AsyncPeekReader.
read_v2_msg_signed
Read and parse a MAVLink 2 message from a PeekReader.
read_v2_raw_message
Read a raw MAVLink 2 message from a PeekReader.
read_v2_raw_message_async
Asynchronously read a raw MAVLink 2 message from a AsyncPeekReader.
read_v2_raw_message_async_signed
Asynchronously read a raw MAVLink 2 message with signing support from a AsyncPeekReader.
read_v2_raw_message_signed
Read a raw MAVLink 2 message with signing support from a PeekReader.
read_versioned_msg
Read and parse a MAVLink message of the specified version from a PeekReader.
read_versioned_msg_async
Asynchronously read and parse a MAVLink message of the specified version from a AsyncPeekReader.
read_versioned_msg_async_signed
Asynchronously read and parse a MAVLink message of the specified version from a AsyncPeekReader with signing support.
read_versioned_msg_signed
Read and parse a MAVLink message of the specified version from a PeekReader with signing support.
write_v1_msg
Write a MAVLink 1 message to a Writer.
write_v1_msg_async
Asynchronously write a MAVLink 1 message to a AsyncWriter.
write_v2_msg
Write a MAVLink 2 message to a Writer.
write_v2_msg_async
Asynchronously write a MAVLink 2 message to a AsyncWriter.
write_v2_msg_async_signed
Write a MAVLink 2 message to a AsyncWriter with signing support.
write_v2_msg_signed
Write a MAVLink 2 message to a Writer with signing support.
write_versioned_msg
Write a MAVLink message using the given mavlink version to a Writer.
write_versioned_msg_async
Asynchronously write a MAVLink message using the given MAVLink version to a AsyncWriter.
write_versioned_msg_async_signed
Asynchronously write a MAVLink message using the given MAVLink version to a AsyncWriter with signing support.
write_versioned_msg_signed
Write a MAVLink message using the given mavlink version to a Writer with signing support.