Table of Contents

Mavlink (developer page)

This page gives you a guide on how to implement the handling of (custom) mavlink messages on the px4 platform and on how to send mavlink messages from your own app via the mavlink app to the groundstation.

Implement handling of a message

The necessary steps are shown here with the example of the COMMAND_LONG mavlink message.

First search the definition of your message here. If you don't find the message you can also check the header files in ~/src/mavlink/include/v1.0/common/

The important parts are the two if-commands. The first checks the type of message, the second makes sure that the message is actually intended for the system on which the code is running. In the above code the values of the message are stored in shared memory and are then made available for other apps. You can read more about this here.

Outgoing mavlink messages

Mavlink proves an easy way to send “mavlink log” messages from your app to the groundstation. The following 3 functions are provided:

Example

Other functions

The mavlink app is also responsible for waypoint management and the updating of parameters.

Waypoint management

Waypoints set in the groundstation are handled by the mavlink app. Furthermore, the mavlink app keeps track of the current vehicle position relative to the current active waypoint and checks whether the waypoint was reached. The current active waypoint is the input for the position controller

Parameters

As described in the parameters the mavlink app is responsible for receiving parameter values from the ground station.