Last updated
Last updated
The Tutorial App allows the user to access the vehicles position data from a custom UI and even command position changes. Follow this guide to learn how to write an app that can read and influence the state of the vehicle and make it accessible from a custom UI.
These are the main functions this app provides which will be explained in this guide.
Telemetry reading
Command sending
Custom UI
Along with these functions there will also be general explanations on the structure and functions of AuterionOS apps and how to build, install and use those apps.
The Auterion CLI can easily be installed using PIP (python’s package manager) with the following command:
To get more detailed Information on the Setup go to
For this app mavlink and libmav are used so they need to be added as git submodules.
An AuterionOS app minimally requires an auterion-app.yml needs to be in the root directory, in this case app-tutorial-code. The rest of the structure is optional, but all the referencing in the example code is based on this structure so any changes to the structure need to be changed there as well. The Dockerfile, the submodules that will be added and the source code will be in services/web-navigation. Since this app will be in C++, the CMakeList.txt will be in this directory as well, main.cpp will be in the src folder and the index.html in the website folder.
Like in docker-compose, your app can consist of multiple docker containers. In 'services' you list all the docker containers that make up your app. In most cases, this is just one service. The API configuration for the web interface is also added here.
Create this file in services/web-navigation/src. It contains all the necessary C++ code. First some general setup.
Then a struct for the vehicle coordinate and one for the system state.
To later use for the change in position, functions which change the coordinate a given distance. For this example, this uses a crude distance estimation function, but is sufficient for demo purpose.
To create an interface for the Mavlink connection and connect with Mavlink, add this to the private section of main.cpp. It will be called in run().
Get the Telemetry information from the vehicle and safe the system state. This is a callback that needs to be added to run() in the public section.
Add this to createRouter() to provide the telemetry data for the web interface.
Add this to createRouter() to handle the reposition commands from the web interface
Create and send a Mavlink message to send commands like a reposition to the vehicle. Add this to the private section.
Add this to run() in the public section to start the server.
Create this file in services/web-navigation/website. It contains the scripts for the UI. The Interface can be designed with html and will be accessible in the local updater.
A javascript function using the API is used to get the telemetry data and display it on the web interface.
A second javascript function which uses the Reposition command written in the API is used to command the change in position.
To create the page and call the reposition function html is used.
After installing the App on a Skynode, open 10.41.1.1 and click "Show installed apps" to show all apps installed on the Skynode and click on the "Tutorial Web Navigation" Link to open the web interface.
The CMakeList file contains the information on how to compile.
Add a file named "Dockerfile" to services/web-navigation.Describes how to actually build and run the app. Any docker command can be used in here. Apps shall inherit from the auterion/app-base image. The Dockerfile gets discovered in the build process by the tool looking at the locations indicated in the auterion-app.yml file.
This app will inherit from version 2 of the App Base.
This will copy the code to the specified folder, build it and then run the app.
To install on a Skynode the device must be selected in the Auterion CLI. First discover the devices connected. When no device is selected and the Skynode is connected with USB it will be selected by default so this step can be skipped.
To select a device the serial number is needed. The "*" in the first column shows if the device is already selected and the serial number is in the second column.
Use the serial number to select the device.
If the selection was successful this is the shown output.
First the App needs to be built. Execute this command in the folder the App is in.
The App base version specified in the auterion-app.yml needs to be installed on the device first. The App can be installed either over the local updater on 10.41.1.1 or by using this command.
Auterion CLI can also be used to get the log output from the app.
Clone the to use the example code, take a look at one of the example codes in or build up your own according to the structure outlined in the next section.
Every AuterionOS app should follow the same file structure in order to be built and deployed using the Auterion CLI. There are 3 things that make up an AuterionOS app and these will be explained in the following 3 subsections. More information about this topic can be found in the Section.
After creating the directory the app will be created in, use git to add the necessary submodules. If git isn't already installed you can follow this . To turn your created directory into a git repository use git init.
Then add and as submodules to your repository by going to the directory the submodules should be added to and using git submodule add.
Contains all meta-information about the app, like name, version, author etc. This file needs to be in the project root directory. Each build entry points to the location of a Dockerfile that needs to be built and run. More detailed explanations can be found .
The code from and will be added to the "App" class.
To get flight information or to influence the flight path Mavlink messages can be used. In the Tutorial App a Mavlink connection is established and then used to receive Telemetry data and send commands for a position change to the flight controller. In this App is used.
The tutorial App uses a custom interface explained in the section to change the position of the vehicle. The main.cpp handles these requests and communicates them to the flight controller.
Create a router to handle the http requests from the web interface. This router is created with restinio, to learn more go to . Add this to the private section of the code.
This will install restinio. To learn more about restinio, and how to use it, go to the .
To build an app for , you must also provide the --simulation
flag to the build command. Refer to the page for more context.
Tutorial for creating an AuterionOS App