Expand description
Β§Maviola
A high-level MAVLink communication library written in Rust.
Maviola provides abstractions such as communication nodes, networks, or devices and implements stateful features of MAVLink protocol: sequencing, message signing, automatic heartbeats, and so on.
This library is a part of Mavka toolchain. It is based on Mavio, a low-level MAVLink library, and compatible with MAVSpec MAVLink dialects generator.
Β§π Documentation
If you want to learn how to use Maviola, start from reading Maviola Playbook. This page contains only a brief introduction.
Β§Usage
Maviola provides both synchronous and asynchronous API. The synchronous API is available
in sync
module and can be enabled by sync
feature flag. The asynchronous API is based on
Tokio, it can be found in asnc
module and is enabled by async
feature
flag.
Here is a simple example of a synchronous TCP server:
use maviola::prelude::*;
use maviola::sync::prelude::*;
// Create a synchronous MAVLink node
// with MAVLink protocol version set to `V2`
let server = Node::sync::<V2>()
// Set device system and component IDs
.id(MavLinkId::new(17, 42))
// Define connection settings
.connection(TcpServer::new("127.0.0.1:5600")?)
.build()?;
// Handle node events
for event in server.events() {
match event {
// Handle incoming MAVLink frame
Event::Frame(frame, callback) => {
// Handle heartbeat message
if let Ok(DefaultDialect::Heartbeat(msg)) = frame.decode::<DefaultDialect>() {
// Respond with the same heartbeat message to all clients,
// except the one that sent this message
callback.broadcast(&server.next_frame(&msg)?)?;
}
}
_ => {
/* Handle other node events */
}
}
}
You can learn more about this example in Quickstart section that gets into details.
Also check Overview, Synchronous API, and Asynchronous API documentation sections for details on how to use different types of API.
Β§Features
Maviola is designed to hide most of its functionality under corresponding feature flags. If you need certain features, you have to explicitly opt-in.
Β§API Modes
sync
enables synchronous API (seesync
module and Synchronous API).async
enables asynchronous API (seeasnc
module and Asynchronous API).
These features are not mutually exclusive, you can use both synchronous and asynchronous API in different parts of the project.
Β§Unstable Features
Some parts of the API are still considered to be unstable and available only under the
unstable
feature flag. We mark unstable and experimental entities with β
in
documentation.
Β§Embedded Devices
Maviola is based on Mavio, a low-level library with
no-std
support. If you are looking for a solution for embedded devices, then Mavio would
probably be a better option.
Β§MAVLink Protocol
Protocol entities reside in the protocol
module.
Β§Dialects
Maviola packages standard MAVLink dialects under corresponding dlct-*
feature flags in
protocol::dialects
. It is possible to define your own dialects with XML message definitions
using MAVSpec or even create your ad-hoc dialects using pure
Rust.
Check Dialects documentation section for details.
Β§Microservices
We utilise MAVSpec ability to generate MAVLink
microservices as sub-dialects. Use msrv-*
feature flags to
enable specific microservices.
We also re-export additional microservice utils as protocol::microservices
. You should enable
the corresponding msrv-utils-*
feature flag to access such functionality.
Β§Message Definitions
You may access metadata for MAVLink message definitions by enabling definitions
feature flag.
The metadata is available at protocol::definitions
.
Β§Feature Flags
Β§Generic features
default
β Default features (empty).full
β All stable features (no unsafe features). This should be used instead of βall-features for most of the production environmentsunstable
β Enables unstable API features.unsafe
β Unsafe features.
Β§MAVSpec tools
derive
β Includes derive maros from MAVSpecdefinitions
β Includes MAVLink message definitionsmetadata
β Adds additional metadata to MAVLink entities.
Β§I/O
sync
β Enables synchronous API.async
β Enables asynchromous API via Tokio.
Β§Serialization and reflection
These features enable serde and specta support.
serde
β Enables serde support.specta
β Enables specta support.
Β§Dialects
Bundle standard MAVLink dialects as defined in XML message definitions generated by MAVSpec.
-
dlct-ardupilotmega
β Includeardupilotmega
dialectThe dialect can be found in
protocol::dialects::ardupilotmega
module. -
dlct-asluav
β IncludeASLUAV
dialectThe dialect can be found in
protocol::dialects::asluav
module. -
dlct-avssuas
β IncludeAVSSUAS
dialectThe dialect can be found in
protocol::dialects::avssuas
module. -
dlct-common
β Includecommon
dialectThe dialect can be found in
protocol::dialects::common
module. -
dlct-cs_air_link
β IncludecsAirLink
dialectThe dialect can be found in
protocol::dialects::cs_air_link
module. -
dlct-cubepilot
β Includecubepilot
dialectThe dialect can be found in
protocol::dialects::cubepilot
module. -
dlct-development
β Includedevelopment
dialectThe dialect can be found in
protocol::dialects::development
module. -
dlct-icarous
β Includeicarous
dialectThe dialect can be found in
protocol::dialects::icarous
module. -
dlct-matrixpilot
β Includematrixpilot
dialectThe dialect can be found in
protocol::dialects::matrixpilot
module. -
dlct-minimal
β Includeminimal
dialectThe dialect can be found in
protocol::dialects::minimal
module. -
dlct-paparazzi
β Includepaparazzi
dialectThe dialect can be found in
protocol::dialects::paparazzi
module. -
dlct-standard
β Includestandard
dialectThe dialect can be found in
protocol::dialects::ualberta
module. -
dlct-ualberta
β Includeualberta
dialectThe dialect can be found in
protocol::dialects::ualberta
module. -
dlct-uavionix
β IncludeuAvionix
dialectThe dialect can be found in
protocol::dialects::u_avionix
module. -
dlct-all
β Includeall
meta-dialectThe dialect can be found in
protocol::dialects::all
module.
Β§MAVLink microservices
These features will control generation of MAVLink microservice-specific bindings.
If enabled, microservices can be found in protocol::microservices
module.
-
msrv-all
β Support for all MavLink microservices -
msrv-heartbeat
β Heartbeat protocol supportThis microservice can be found in
protocol::microservices::heartbeat
module. -
msrv-mission
β Mission protocol supportThis microservice can be found in
protocol::microservices::mission
module. -
msrv-parameter
β Parameter protocol supportThis microservice can be found in
protocol::microservices::parameter
module. -
msrv-parameter-ext
β Extended parameter protocol supportThis microservice can be found in
protocol::microservices::parameter_ext
module. -
msrv-command
β Command protocol supportThis microservice can be found in
protocol::microservices::command
module. -
msrv-manual-control
β Manual control protocol supportThis microservice can be found in
protocol::microservices::manual_control
module. -
msrv-camera
β Camera protocol v2 supportThis microservice can be found in
protocol::microservices::camera
module. -
msrv-gimbal-v1
β Gimbal protocol v1 supportThis microservice can be found in
protocol::microservices::gimbal_v1
module. -
msrv-gimbal-v2
β Gimbal protocol v2 supportThis microservice can be found in
protocol::microservices::gimbal_v2
module. -
msrv-arm-auth
β Arm authorization protocol supportThis microservice can be found in
protocol::microservices::arm_auth
module. -
msrv-image-transmission
β Image transmission protocol supportThis microservice can be found in
protocol::microservices::image_transmission
module. -
msrv-ftp
β File transfer protocol supportThis microservice can be found in
protocol::microservices::ftp
module. -
msrv-landing-target
β Landing target protocol supportThis microservice can be found in
protocol::microservices::landing_target
module. -
msrv-ping
β Ping protocol supportThis microservice can be found in
protocol::microservices::ping
module. -
msrv-path-planning
β Path planning protocol supportThis microservice can be found in
protocol::microservices::path_planning
module. -
msrv-battery
β Battery protocol supportThis microservice can be found in
protocol::microservices::battery
module. -
msrv-terrain
β Terrain protocol supportThis microservice can be found in
protocol::microservices::terrain
module. -
msrv-tunnel
β Tunnel protocol supportThis microservice can be found in
protocol::microservices::tunnel
module. -
msrv-open-drone-id
β Open Drone ID protocol supportThis microservice can be found in
protocol::microservices::open_drone_id
module. -
msrv-high-latency
β High latency protocol supportThis microservice can be found in
protocol::microservices::high_latency
module. -
msrv-component-metadata
β Component metadata protocol supportThis microservice can be found in
protocol::microservices::component_metadata
module. -
msrv-payload
β Payload protocol supportThis microservice can be found in
protocol::microservices::payload
module. -
msrv-traffic-management
β Traffic management protocol supportThis microservice can be found in
protocol::microservices::traffic_management
module. -
msrv-events-interface
β Events interface protocol supportThis microservice can be found in
protocol::microservices::events_interface
module. -
msrv-time-sync
β Time synchronization protocol supportThis microservice can be found in
protocol::microservices::time_sync
module.
Β§Additional MAVLink tools
These features will enable additional MAVLink utilities such as *.waypoints
files support, mission planninc, etc.
β οΈ All such features require unstable
feature to be enabled in order to take effect.
-
msrv-utils-all
β All MAVLink microservices utilsβ οΈ Requires
unstable
feature to take effect. -
msrv-utils-mission
β Mission protocol utilsThese additional utils are packaged into
protocol::microservices::mission
microservice and can be alternatively accessed throughprotocol::microservices::utils::mission
.β οΈ Requires
unstable
feature to take effect.
Β§Technical features
These features should not be used directly.
-
msrv
β β Enable MAVLink microservices supportDo not use directly as this feature does not give access to any specific functionality by itself. Instead, use one of
msrv-*
features. -
msrv-utils
β βοΈ Enables MAVLink microservices extra utilsDo not use directly as this feature does not give access to any specific functionality by itself. Instead, use one of
msrv-utils-*
features.
Β§Test utils (β οΈ do not use at production β οΈ)
test_utils
β Add testing utils that allow to run complex tests. Primarily used for documentation but can be utilized by other libraries as well.