Development Guide

Offboard Control

The idea behind off-board control is to be able to control the px4 flight stack using software running outside of the autopilot. This is done through the Mavlink protocol, specifically the SET_POSITION_TARGET_LOCAL_NED and the SET_ATTITUDE_TARGET messages.

Offboard Control Firmware Setup

There are two things you want to setup on the firmware side before starting offboard development.

1. Map an RC switch to offboard mode activation

To do this, load up the parameters in qGroundcontrol and look for the RC_MAP_OFFB_SW parameter to which you can assign the RC channel you want to use to activate offboard mode. It can be useful to map things in such a way that when you fall out of offboard mode you go into position control.

Although this step isn't mandatory since you can activate offboard mode using a MAVLink message. We consider this method much safer.

2. Enable the companion computer interface

Look for the SYS_COMPANION parameter and set it to either 921600 (Recommended) or 57600. This parameter will activate a MAVLink stream on the Telem2 port with data streams specific to onboard mode with the appropriate baud rate (921600 8N1 or 57600 8N1).

For more information on these data streams, look for "MAVLINK_MODE_ONBOARD" in the source code.

Hardware setup

Usually, there are three ways of setting up offboard communication.

1. Serial radios

  1. One connected to a UART port of the autopilot
  2. One connected to a ground station computer

Example radios include

graph TD; gnd[Ground Station] --MAVLink--> rad1[Ground Radio]; rad1 --RadioProtocol--> rad2[Vehicle Radio]; rad2 --MAVLink--> a[Autopilot];

2. On-board processor

A small computer mounted onto the vehicle connected to the autopilot through a UART to USB adapter. There are many possibilities here and it will depend on what kind of additional on-board processing you want to do in addition to sending commands to the autopilot.

Small low power examples:

Larger high power examples

graph TD; comp[Companion Computer] --MAVLink--> uart[UART Adapter]; uart --MAVLink--> Autopilot;

A small computer mounted onto the vehicle connected to the autopilot through a UART to USB adapter while also having a WiFi link to a ground station running ROS. This can be any of the computers from the above section coupled with a WiFi adapter. For example, the Intel NUC D34010WYB has a PCI Express Half-Mini connector which can accomodate an Intel Wifi Link 5000 adapter.

graph TD subgraph Ground Station gnd[ROS Enabled Computer] --- qgc[qGroundControl] end gnd --MAVLink/UDP--> w[WiFi]; qgc --MAVLink--> w; subgraph Vehicle comp[Companion Computer] --MAVLink--> uart[UART Adapter] uart --- Autopilot end w --- comp