Profile
Back to NewsBack
GitHub Trending 2 min
Reader Mode
bluenviron/gomavlib: Mavlink library (2.0 and 1.0) for the Go programming language

bluenviron/gomavlib: Mavlink library (2.0 and 1.0) for the Go programming language

12 hours ago

gomavlib

Test</a> Lint</a> CodeCov</a> PkgGoDev</a>

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:

  • Create Mavlink nodes able to communicate with other nodes.
- Supported transports: serial, UDP (server, client or broadcast mode), TCP (server or client mode), custom reader/writer. - Support both domain names and IPs. - Emit heartbeats automatically. - Send automatic stream requests to Ardupilot devices (disabled by default).
  • Decode and encode Mavlink v2.0 and v1.0.
- Compute and validate checksums. - Support all v2 features: empty-byte truncation, signatures, message extensions.
  • Use dialects in multiple ways.
- Ready-to-use standard dialects are available in directory dialects/. - Custom dialects can be defined. Aa dialect generator is available in order to convert XML definitions into their Go representation. - Use no dialect at all. Messages can be routed without having their content decoded.
  • Read and write telemetry logs (tlog)

Table of contents

Installation

  1. Install Go ≥ 1.26.
  1. Create an empty folder, open a terminal in it and initialize the Go modules system:
go mod init main
  1. Download one of the example files and place it in the folder.
  1. Compile and run:
go run name-of-the-go-file.go

Examples

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/v4/cmd/dialect-import@latest
dialect-import my_dialect.xml

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
Chat with me