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
syncenables synchronous API (seesyncmodule and Synchronous API).asyncenables asynchronous API (seeasncmodule 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β IncludeardupilotmegadialectThe dialect can be found in
protocol::dialects::ardupilotmegamodule. -
dlct-asluavβ IncludeASLUAVdialectThe dialect can be found in
protocol::dialects::asluavmodule. -
dlct-avssuasβ IncludeAVSSUASdialectThe dialect can be found in
protocol::dialects::avssuasmodule. -
dlct-commonβ IncludecommondialectThe dialect can be found in
protocol::dialects::commonmodule. -
dlct-cs_air_linkβ IncludecsAirLinkdialectThe dialect can be found in
protocol::dialects::cs_air_linkmodule. -
dlct-cubepilotβ IncludecubepilotdialectThe dialect can be found in
protocol::dialects::cubepilotmodule. -
dlct-developmentβ IncludedevelopmentdialectThe dialect can be found in
protocol::dialects::developmentmodule. -
dlct-icarousβ IncludeicarousdialectThe dialect can be found in
protocol::dialects::icarousmodule. -
dlct-matrixpilotβ IncludematrixpilotdialectThe dialect can be found in
protocol::dialects::matrixpilotmodule. -
dlct-minimalβ IncludeminimaldialectThe dialect can be found in
protocol::dialects::minimalmodule. -
dlct-paparazziβ IncludepaparazzidialectThe dialect can be found in
protocol::dialects::paparazzimodule. -
dlct-standardβ IncludestandarddialectThe dialect can be found in
protocol::dialects::ualbertamodule. -
dlct-ualbertaβ IncludeualbertadialectThe dialect can be found in
protocol::dialects::ualbertamodule. -
dlct-uavionixβ IncludeuAvionixdialectThe dialect can be found in
protocol::dialects::u_avionixmodule. -
dlct-allβ Includeallmeta-dialectThe dialect can be found in
protocol::dialects::allmodule.
Β§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::heartbeatmodule. -
msrv-missionβ Mission protocol supportThis microservice can be found in
protocol::microservices::missionmodule. -
msrv-parameterβ Parameter protocol supportThis microservice can be found in
protocol::microservices::parametermodule. -
msrv-parameter-extβ Extended parameter protocol supportThis microservice can be found in
protocol::microservices::parameter_extmodule. -
msrv-commandβ Command protocol supportThis microservice can be found in
protocol::microservices::commandmodule. -
msrv-manual-controlβ Manual control protocol supportThis microservice can be found in
protocol::microservices::manual_controlmodule. -
msrv-cameraβ Camera protocol v2 supportThis microservice can be found in
protocol::microservices::cameramodule. -
msrv-gimbal-v1β Gimbal protocol v1 supportThis microservice can be found in
protocol::microservices::gimbal_v1module. -
msrv-gimbal-v2β Gimbal protocol v2 supportThis microservice can be found in
protocol::microservices::gimbal_v2module. -
msrv-arm-authβ Arm authorization protocol supportThis microservice can be found in
protocol::microservices::arm_authmodule. -
msrv-image-transmissionβ Image transmission protocol supportThis microservice can be found in
protocol::microservices::image_transmissionmodule. -
msrv-ftpβ File transfer protocol supportThis microservice can be found in
protocol::microservices::ftpmodule. -
msrv-landing-targetβ Landing target protocol supportThis microservice can be found in
protocol::microservices::landing_targetmodule. -
msrv-pingβ Ping protocol supportThis microservice can be found in
protocol::microservices::pingmodule. -
msrv-path-planningβ Path planning protocol supportThis microservice can be found in
protocol::microservices::path_planningmodule. -
msrv-batteryβ Battery protocol supportThis microservice can be found in
protocol::microservices::batterymodule. -
msrv-terrainβ Terrain protocol supportThis microservice can be found in
protocol::microservices::terrainmodule. -
msrv-tunnelβ Tunnel protocol supportThis microservice can be found in
protocol::microservices::tunnelmodule. -
msrv-open-drone-idβ Open Drone ID protocol supportThis microservice can be found in
protocol::microservices::open_drone_idmodule. -
msrv-high-latencyβ High latency protocol supportThis microservice can be found in
protocol::microservices::high_latencymodule. -
msrv-component-metadataβ Component metadata protocol supportThis microservice can be found in
protocol::microservices::component_metadatamodule. -
msrv-payloadβ Payload protocol supportThis microservice can be found in
protocol::microservices::payloadmodule. -
msrv-traffic-managementβ Traffic management protocol supportThis microservice can be found in
protocol::microservices::traffic_managementmodule. -
msrv-events-interfaceβ Events interface protocol supportThis microservice can be found in
protocol::microservices::events_interfacemodule. -
msrv-time-syncβ Time synchronization protocol supportThis microservice can be found in
protocol::microservices::time_syncmodule.
Β§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
unstablefeature to take effect. -
msrv-utils-missionβ Mission protocol utilsThese additional utils are packaged into
protocol::microservices::missionmicroservice and can be alternatively accessed throughprotocol::microservices::utils::mission.β οΈ Requires
unstablefeature 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.