Welcome to the tutorial page for the mavlink package for hardio. In these pages, you will learn about the mavlink protocol, its various components, and the specificities of the implementation that the hardio framework uses.
Quick access list
- MavlinkProtocol’s Dispatcher
- Using microservices
- Full usage example
- Creating a MicroServiceImpl
- TelemetryImpl service
What is the mavlink protocol?
MavlinkProtocol is a lightweight messaging protocol primarily used to communicate with drones and between onboard components.
This protocol is based on a dialect, that uses the XML format to define all message types.
Messages
MavlinkProtocol provides a base set of messages that are meant to be used by any robot. This set is already quite large and covers most use cases. The documentation for this common set of message can be found on the mavlink documentation.
Other messages can be defined by the user. The official documentation on the XML schema covers this topic.
Microservices
MavlinkProtocol defines what is called microservices which can be qualified as sub-protocols using the mavlink protocol. The mavlink implementation for the hardio framework supports some of these microservices. For more information about mavlink’s microservices, you can go to this page.
MavlinkProtocol for hardio
The mavlink implementation for the hardio framework uses the common dialect. It is split into 2 main parts:
- mavlink_core: The mavlink library and low level message dispatcher.
- mavlink: High level API that defines all microservices.
There is no real separation between these two part, they are both accessible
from the hardio namespace, with only the include directoy being different. The
only real difference is that the mavlink part uses the mavlink_core
part to send, receive and read messages.
The mavlink package also provides some of the microservices defined in the common dialect. Here is the list of all microservices that are available in the current implementation:
- CommandImpl
- HeartBeatImpl
- MissionImpl
- Parameter
- PingImpl
Other messages have been managed in a similar way as the other microservice for consistency, thus adding the following “microservices”:
- Manual input: Service used to receive input from the ground station.
- StatusImpl: Service that is used to make sending SYS_STATUS messages easier.
- TelemetryImpl: A set of helper functions and services that make sending telemetry more simple.
Minimal set of services
In order to have the connection process work, the following services must be correctly setup and active on the robot:
- HeartBeatImpl
- CommandImpl
- MissionImpl
Other microservices are optionnal for the robot to connect to the ground station.
How to use mavlink for hardio
In this part of the tutorial you will find instructions on how to use mavlink in your hardio projects.
At the very basics of the mavlink protocol for hardio, you will find the “core” API, which is the main dispatcher of the implementation and the base mavlink library.
-
The main dispatcher is quite important and you will have to use it at least to set things up in your code. The dispatcher tutorial covers the use of the dispatcher.
-
Microservices are the main objects you will use with the mavlink protocol. Knowing how to use microservices is therefore essential. The using microservices covers this topic.
-
Because the ground station requires multiple microservices to be properly setup and running, the full usage example will help you in that task.
Expanding mavlink for hardio
The current implementation of mavlink provides a lot of functionnality. However, it does not implement all possible microservices and does not handle all message types.
Because of that, you might want to add new microservices or handle new types of messages. The following tutorials will teach you how to do such a thing.
-
The main way to expand the mavlink protocol is by adding new microservices. The creating a microservice tutorial covers this topic.
-
The telemetry microservice provides the user with useful functions that simplify sending telemetry to the ground station. the telemetry service tutorial covers how you can expand this microservice.