Skip to main content

Crate mavlink

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.
  • transport-direct-serial: Enable serial MAVLink connections, enabled by default.
  • transport-udp: Enables UDP based MAVLink connections, enabled by default.
  • transport-tcp: Enables TCP based MAVLink connections, enabled by default.
  • mav2-message-signing: Enable support for MAVLink 2 message signing
  • embedded: Enables embedded support using the embedded-io crate, incompatible with tokio.
  • tokio: 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, requires rustfmt to be installed, enabled by default.
  • mav2-message-extensions: Generated MAVLink message set code will include MAVLink 2 message extensions.
  • arbitrary: Enable support for the arbitrary crate.
  • ts-rs: Enable TypeScript code generation via ts-rs.

Either std or embedded must be enabled.

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

  • dialect-all
  • dialect-ardupilotmega, enabled by default
  • dialect-common, enabled by default
  • dialect-asluav
  • dialect-avssuas
  • dialect-cubepilot
  • dialect-csairlink
  • dialect-development
  • dialect-icarous
  • dialect-loweheiser
  • dialect-marsh
  • dialect-matrixpilot
  • dialect-minimal
  • dialect-paparazzi
  • dialect-python_array_test
  • dialect-standard
  • dialect-stemstudios
  • dialect-storm32
  • dialect-test
  • dialect-ualberta
  • dialect-uavionix

Modules§

async_peek_readertokio
This module implements a buffered/peekable reader using async I/O.
dialects
MAVLink dialect Rust bindings generated by mavlink-bindgen.
error
peek_reader
This module implements a buffered/peekable reader.
types
utils
Utilities for processing MAVLink messages

Structs§

Connection
Concrete MAVLink connection returned by connect.
FileConfig
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
SerialConfig
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
TcpConfig
MAVLink connection address for a TCP server or client
UdpConfig
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
TcpMode
Type of TCP connection
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_asynctokio
Asynchronously read and parse a MAVLink 1 or 2 message from a AsyncPeekReader.
read_any_msg_async_signedtokio and mav2-message-signing
Asynchronously read and parse a MAVLink 1 or 2 message from a AsyncPeekReader with signing support.
read_any_msg_signedmav2-message-signing
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_asynctokio
Asynchronously read a raw MAVLink 1 or 2 message from a AsyncPeekReader.
read_any_raw_message_async_signedtokio and mav2-message-signing
Asynchronously read a raw MAVLink 1 or 2 message from a AsyncPeekReader with signing support.
read_any_raw_message_signedmav2-message-signing
Read a raw MAVLink 1 or 2 message from a PeekReader with signing support.
read_raw_versioned_msgDeprecated
read_raw_versioned_msg_asyncDeprecatedtokio
read_raw_versioned_msg_async_signedDeprecatedtokio and mav2-message-signing
read_raw_versioned_msg_signedDeprecatedmav2-message-signing
read_v1_msg
Read and parse a MAVLink 1 message from a PeekReader.
read_v1_msg_asynctokio
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_asynctokio
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_asynctokio
Asynchronously read and parse a MAVLink 2 message from a AsyncPeekReader.
read_v2_msg_async_signedtokio and mav2-message-signing
Asynchronously read and parse a MAVLink 2 message with signing support from a AsyncPeekReader.
read_v2_msg_signedmav2-message-signing
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_asynctokio
Asynchronously read a raw MAVLink 2 message from a AsyncPeekReader.
read_v2_raw_message_async_signedtokio and mav2-message-signing
Asynchronously read a raw MAVLink 2 message with signing support from a AsyncPeekReader
read_v2_raw_message_signedmav2-message-signing
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_asynctokio
Asynchronously read and parse a MAVLink message of the specified version from a AsyncPeekReader.
read_versioned_msg_async_signedtokio and mav2-message-signing
Asynchronously read and parse a MAVLink message of the specified version from a AsyncPeekReader with signing support.
read_versioned_msg_signedmav2-message-signing
Read and parse a MAVLink message of the specified version from a PeekReader with signing support.
read_versioned_raw_message
Read and parse a MAVLink message of the specified version from a PeekReader.
read_versioned_raw_message_asynctokio
Asynchronously read and parse a MAVLinkMessageRaw of the specified version from a AsyncPeekReader.
read_versioned_raw_message_async_signedtokio and mav2-message-signing
Asynchronously read and parse a MAVLinkMessageRaw of the specified version from a AsyncPeekReader with signing support.
read_versioned_raw_message_signedmav2-message-signing
Read and parse a MAVLinkMessageRaw of the specified version from a PeekReader with signing support.
write_v1_msg
Write a MAVLink 1 message to a Writer.
write_v1_msg_asynctokio
Asynchronously write a MAVLink 1 message to a [AsyncWrite]r.
write_v2_msg
Write a MAVLink 2 message to a Writer.
write_v2_msg_asynctokio
Asynchronously write a MAVLink 2 message to a [AsyncWrite]r.
write_v2_msg_async_signedmav2-message-signing and tokio
Write a MAVLink 2 message to a [AsyncWrite]r with signing support.
write_v2_msg_signedmav2-message-signing
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_asynctokio
Asynchronously write a MAVLink message using the given MAVLink version to a [AsyncWrite]r.
write_versioned_msg_async_signedtokio and mav2-message-signing
Asynchronously write a MAVLink message using the given MAVLink version to a [AsyncWrite]r with signing support.
write_versioned_msg_signedmav2-message-signing
Write a MAVLink message using the given mavlink version to a Writer with signing support.