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 (requires std)
  • 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-minimal
  • dialect-paparazzi
  • dialect-python_array_test
  • dialect-standard
  • dialect-stemstudios
  • dialect-storm32
  • dialect-test
  • dialect-ualberta
  • dialect-uavionix

Modules§

consts
MAVLink frame constants.
dialects
MAVLink dialect Rust bindings generated by mavlink-bindgen.
error
types
utils
Utilities for processing MAVLink messages

Structs§

AsyncMavlinkReadertokio, or embedded and non-std
Incrementally reads complete MAVLink frames from an asynchronous byte stream.
Connectionstd
Concrete MAVLink connection returned by connect.
FileConfigstd
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
MavlinkReader
Incrementally reads complete MAVLink frames from a blocking byte stream.
SerialConfigtransport-direct-serial
MAVLink address for a serial connection
SigningConfigmav2-message-signing
Configuration used for MAVLink 2 messages signing as defined in https://mavlink.io/en/guide/message_signing.html.
SigningDatamav2-message-signing
MAVLink 2 message signing data
TcpConfigtransport-tcp
MAVLink connection address for a TCP server or client
UdpConfigtransport-udp
MAVLink address for a UDP server client or broadcast connection

Enums§

ConnectionAddressstd or tokio
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
TcpModetransport-tcp
Type of TCP connection
UdpModetransport-udp
Type of UDP connection

Constants§

MAV_STX
Message framing marker for MAVLink 1
MAV_STX_V2
Message framing marker for MAVLink 2

Traits§

AsyncConnectabletokio
A MAVLink connection address that can be connected to, establishing an AsyncMavConnection
AsyncMavConnectiontokio
An async MAVLink connection
Connectablestd
A MAVLink connection address that can be connected to, establishing a MavConnection
MavConnectionstd
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.
connectstd
Connect to a MAVLink node by address string.
connect_asynctokio
Connect asynchronously to a MAVLink node by address string.
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_signedmav2-message-signing and tokio
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.