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

yalexx/gomavlib

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gomavlib

Build Status Go Report Card GoDoc

gomavlib is a library that implements the Mavlink protocol (2.0 and 1.0) in the Go programming language. It can power UGVs, UAVs, ground stations, monitoring systems or routers acting in a Mavlink network.

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

  • Decodes and encodes 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.
  • Provides a high-level API (Node) with:
    • ability to communicate with multiple endpoints in parallel:
      • serial
      • UDP (server, client or broadcast mode)
      • TCP (server or client mode)
      • custom reader/writer
    • automatic heartbeat emission
    • automatic stream requests to Ardupilot devices (disabled by default)
  • Provides a low-level API (Parser) with ability to decode/encode frames from/to a generic reader/writer
  • UDP connections are tracked and removed when inactive
  • Supports both domain names and IPs
  • Examples provided for every feature, comprehensive test suite, continuous integration

Installation

Go ≥ 1.12 is required, and modules must be enabled (there must be a go.mod file in your project folder, that can be created with the command go mod init main). To install the library, it is enough to write its name in the import section of the source files that will use it. Go will take care of downloading the needed files:

import (
    "github.com/aler9/gomavlib"
)

Examples

Dialect generation

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

go get github.com/aler9/gomavlib/commands/dialgen
dialgen my_dialect.xml > dialect.go

Documentation

https://pkg.go.dev/github.com/aler9/gomavlib

Testing

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

make test

Links

Protocol documentation

Other Go libraries

Other non-Go libraries

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%