Skip to content

Mavlink library (2.0 and 1.0) for the Go programming language

License

Notifications You must be signed in to change notification settings

bluenviron/gomavlib

Folders and files

NameName
Last commit message
Last commit date
Oct 27, 2024
Aug 5, 2024
Oct 27, 2024
Jan 30, 2025
Jan 10, 2025
Dec 28, 2019
Aug 5, 2024
Feb 13, 2021
Aug 4, 2024
Oct 9, 2019
Oct 27, 2024
Dec 8, 2024
Apr 13, 2024
Jan 3, 2024
Sep 21, 2023
Mar 12, 2023
Apr 28, 2024
Apr 13, 2024
Apr 28, 2024
May 28, 2023
Apr 13, 2024
Dec 15, 2024
Apr 13, 2024
Apr 28, 2024
Apr 13, 2024
Apr 13, 2024
Jan 30, 2025
Jan 30, 2025
Apr 13, 2024
Apr 13, 2024
Aug 7, 2023
Apr 13, 2024
Apr 13, 2024
Apr 13, 2024
Sep 30, 2020

Repository files navigation

gomavlib

Test Lint Dialects Go Report Card CodeCov PkgGoDev

gomavlib is a library that implements the Mavlink protocol (2.0 and 1.0) in the Go programming language. It can interact with Mavlink-capable devices through a serial port, UDP, TCP or a custom transport, and it can be used to power UGVs, UAVs, ground stations, monitoring systems or routers.

Mavlink is a lightweight and transport-independent protocol that is mostly used to communicate with unmanned ground vehicles (UGV) and unmanned aerial vehicles (UAV, drones, quadcopters, multirotors). It is supported by the most popular open-source flight controllers (Ardupilot and PX4).

This library powers the mavp2p router.

Features:

  • Decode and encode Mavlink v2.0 and v1.0. Supports checksums, empty-byte truncation (v2.0), signatures (v2.0), message extensions (v2.0).
  • Dialects are optional, the library can work with standard dialects (ready-to-use standard dialects are provided in directory dialects/), custom dialects or no dialects at all. In case of custom dialects, a dialect generator is available in order to convert XML definitions into their Go representation.
  • Create nodes able to communicate with multiple endpoints in parallel and with multiple transports:
    • serial
    • UDP (server, client or broadcast mode)
    • TCP (server or client mode)
    • custom reader/writer
  • Emit heartbeats automatically
  • Send automatic stream requests to Ardupilot devices (disabled by default)
  • Support both domain names and IPs
  • Examples provided for every feature, comprehensive test suite, continuous integration

Table of contents

Installation

  1. Install Go ≥ 1.21.

  2. Create an empty folder, open a terminal in it and initialize the Go modules system:

    go mod init main
    
  3. Download one of the example files and place it in the folder:

  1. Compile and run

    go run name-of-the-go-file.go
    

API Documentation

Click to open the API Documentation

Dialect generation

Standard dialects are provided in the pkg/dialects/ folder, but it's also possible to use custom dialects, that can be converted into Go files by running:

go install github.com/bluenviron/gomavlib/v3/cmd/dialect-import@latest
dialect-import my_dialect.xml

Testing

If you want to hack the library and test the results, unit tests can be launched with:

make test

Specifications

name area
main website protocol
packet format protocol
common dialect dialects
Golang project layout project layout

Links

Related projects

Other Go libraries

Other non-Go libraries