Skip to content

karakayahuseyin/mavlink2grpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mavlink2grpc

A high-performance, native bridge and code generator that exposes the entire MAVLink protocol as type-safe gRPC services using modern C++17.

Designed as a robust, type-safe alternative to mavlink2rest for professional UAV systems.

Features

  • Schema-First: Auto-generates Protobuf definitions (.proto) directly from MAVLink XMLs.
  • High Performance: C++17 runtime bridge designed for low latency and efficient resource usage.
  • Polyglot: Consume MAVLink telemetry in Python, Go, Rust, or Web clients via gRPC.
  • Real-time Streaming: Bidirectional MAVLink message streaming with gRPC server-side streaming.
  • Web Inspector: Built-in QGroundControl-style MAVLink inspector with live charts and frequency tracking.

Project Structure

generator/

Python-based code generator that converts MAVLink XML definitions to Protocol Buffer files and C++ conversion code. Uses Jinja2 templates to generate .proto files, gRPC service definitions, and C++ MAVLink↔Protobuf converters from XML message definitions.

bridge/

C++17 MAVLink-to-gRPC bridge that connects to MAVLink devices (UDP/Serial) and exposes real-time bidirectional message streaming via gRPC. Implements connection management, message routing, and gRPC service (StreamMessages, SendMessage). Supports MAVSDK-style connection URLs like udp://:14550 or serial:///dev/ttyUSB0:57600.

inspector/

QGroundControl-style web-based MAVLink inspector. Node.js backend (Express + Socket.IO) acts as gRPC client to the bridge and WebSocket server for the browser. Vanilla JavaScript frontend provides real-time message monitoring, frequency tracking, and multi-field chart visualization with Chart.js.

Installation

Requirements

  • C++: C++17 compatible compiler, CMake 3.10+, gRPC, Protocol Buffers
  • Python: 3.8+
  • Node.js: 20+

Setup

# Clone repository
git clone https://github.com/karakayahuseyin/mavlink2grpc.git
cd mavlink2grpc

# Run setup script (clones mavlink submodule, installs dependencies)
./setup.sh

# Generate proto files and C++ converters
cd generator
python3 main.py
# Select dialect: common.xml

# Build bridge
cd ../bridge/
cmake -B build
cmake --build build -j$(nproc)

# Install inspector dependencies
cd ../inspector
npm install

Usage

Start px4 or any MAVLink-compatible autopilot simulator (e.g., px4_sitl).

Start Bridge

cd bridge/build
./mav2grpc_bridge -c udp://:14550 -g 0.0.0.0:50051
# Change connection string (-c) as needed

Start Inspector Demo

cd inspector
npm install
node server.js -g localhost:50051 -p 8000

Open browser: http://localhost:8000