Crab UAV
Open Source

MAVLink Communication, Built for Rust

Async MAVLink library built on Tokio. Multi-autopilot support, lock-free telemetry reads, mission and parameter protocols, and fleet management — with 786 tests and 75% MAVSDK coverage.

786

Tests

14

Autopilot Backends

75%

MAVSDK Coverage

3

Feature Flags

Features

A complete MAVLink SDK for Rust — from vehicle connection to mission management.

Vehicle Abstraction

High-level async API for vehicle communication. 14 autopilot backend implementations covering ArduPilot copter, plane, rover, sub, and PX4 multirotor, fixed-wing, VTOL, and rover.

Lock-Free Telemetry

Sync reads via watch channels — no .await needed for real-time data. Position, attitude, battery, GPS status, and actuator output are always available without locking.

Mission Protocol

Upload and download waypoints with full MAVLink mission protocol support. QGC .plan file import, geofence, and rally point management.

Parameter Management

Read, write, and cache vehicle parameters with bulk transfer and progress tracking. Type-safe parameter access with automatic refresh.

Multi-Autopilot

ArduPilot, PX4, and CrabPilot support with fleet management and vehicle discovery. Connect to multiple vehicles simultaneously over serial, TCP, or UDP.

Simulation & Testing

SITL and HIL injection for testing. Tlog recording, MAVLink FTP, log download protocol, and MAVLink shell. 786 tests covering every protocol and subsystem.

Architecture

Subsystems

  • CoreState

    Heartbeat, connection state, vehicle info, command tracking

  • ParameterState

    Parameter cache with bulk read/write

  • MissionState

    Mission protocol and waypoint storage

  • ProtocolState

    FTP, MAVLink shell, log download

  • PeripheralState

    Camera, gimbal, and fence info

  • ControllerState

    Guided, offboard, and follow-me controllers

  • TlogState

    Telemetry log recording

Design Principles

  • Lock-free reads

    Telemetry via watch channels — no locks for real-time data

  • Fine-grained locking

    7 independent locks instead of one monolithic state

  • Strict lock ordering

    Defined ordering prevents deadlocks across subsystems

  • Async-first

    Built on Tokio with structured concurrency throughout

  • Feature flags

    Optional qgc-plan, sitl, and fleet features

Simple API

Clean, async Rust API that makes MAVLink communication straightforward.

Connect & Fly

let vehicle = Vehicle::connect_auto("udp:127.0.0.1:14550").await?;

vehicle.arm().await?;
vehicle.takeoff(10.0).await?;

Read Telemetry

// Sync reads — no .await needed
let pos = vehicle.position();
let att = vehicle.attitude();
let bat = vehicle.battery();
let gps = vehicle.gps_status();

Subscribe to Events

let mut events = vehicle.subscribe_events();

while let Ok(event) = events.recv().await {
    match event {
        VehicleEvent::ModeChanged(mode) => { /* ... */ }
        VehicleEvent::Armed(armed) => { /* ... */ }
        VehicleEvent::Connected(conn) => { /* ... */ }
        _ => {}
    }
}

Part of the Crab UAV Stack

CrabStation

Cross-platform ground control station for ArduPilot, PX4, and CrabPilot.

CrabPilot

Rust-based autopilot firmware for STM32H7 flight controllers.

Start Building

CrabLink is open source and ready to use. Add it to your Rust project and start communicating with MAVLink vehicles.