> For the complete documentation index, see [llms.txt](https://docs.auterion.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.auterion.com/~/changes/TDRfjBXXgHmxK48cWqay/app-development/virtual-skynode.md).

# Virtual Skynode

Usage of Virtual Skynode and its apps. Virtual Skynode simulates a Skynode device that can be used for app development

The Virtual Skynode allows you to fully simulate a Skynode device running AuterionOS. With Virtual Skynode you get all the benefits of a physical Skynode during app development. For example:

* Virtual Skynode offers the same APIs for installing and managing apps as a physical Skynode&#x20;
* The MAVLink communication inside Virtual Skynode is set up identically to a physical Skynode&#x20;
* Apps do not need to be aware that they are being installed in a Virtual Skynode. This significantly simplifies the build workflow of apps&#x20;
* Virtual Skynode's simulated hardware closely resembles a real device when it comes to number of CPU cores, amount of system memory, file system partitioning and size etc.

## Getting started

Virtual Skynode requires two components:

1. virtual-skynode launcher package installed through your operating system's package manager
2. virtual-skynode's AuterionOS image which can be found on [Suite](https://suite.auterion.com)

The installation of both components is explained in the following section.

### Installation

In order to use the Virtual Skynode, the launcher has to be installed on the developer machine first.

{% tabs %}
{% tab title="Linux" %}
The following instructions were tested on Ubuntu 22.04:

Verify that your system supports Kernel-based Virtual Machine (KVM) by running:

```
sudo apt install cpu-checker
sudo kvm-ok
```

If this check does not return positively, CPU virtualization is most likely disabled in the BIOS. Virtual Skynode can be used without KVM, but this comes with a heavy performance penalty as the Virtual Skynode CPU will then be fully emulated in software.

Add the public Auterion debian package repository to apt:

```
curl -1sLf 'https://dl.cloudsmith.io/public/auterion/public/setup.deb.sh'| sudo -E bash
```

Install the Virtual Skynode:

```
sudo apt update
sudo apt install virtual-skynode
```

{% endtab %}

{% tab title="Mac" %}
If you are working on a Mac:

```
brew tap Auterion/auterion
brew install virtual-skynode
```

{% endtab %}
{% endtabs %}

### Downloading the AuterionOS image for Virtual Skynode

In order to run Virtual Skynode, you have to download AuterionOS for Virtual Skynode by visiting <https://suite.auterion.com> and then browsing the **Downloads** > **App Developer Tools** page.

<figure><img src="https://3329189600-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFW1Ge1p1f6WHyiYCb146%2Fuploads%2F2IR2NfPjt64UGWLsMiCr%2Fsuite_download_annotated.png?alt=media&amp;token=9bb385bc-1069-4753-a859-27098a67006b" alt=""><figcaption><p>Download section in Auterion Suite where the AuterionOS image for Virtual Skynode can be found</p></figcaption></figure>

{% hint style="info" %}
You have to be part the Skynode Developer program to obtain AuterionOS for Virtual Skynode
{% endhint %}

### Launching the Virtual Skynode

Ensure that you are currently in the directory that contains the downloaded AuterionOS rootfs and run (replace `<VERSION-NUMBER>`):

```
virtual-skynode run --rootfs virtual-skynode-rootfs-<VERSION-NUMBER>.qcow2 --storage ~/.virtual-skynode --guest-ip 10.41.200.2
```

Running this command will launch the Virtual Skynode using the downloaded version of AuterionOS. It will also (if not already present) create a storage repo in `~/.virtual-skynode` that will be used as persistent storage for all apps and files that will be created/uploaded to the Virtual Skynode.

{% hint style="warning" %}
If you want to run a different AuterionOS rootfs, make sure to use a different storage location or clear your current storage location by [resetting your Virtual Skynode](/~/changes/TDRfjBXXgHmxK48cWqay/app-development/virtual-skynode/resetting-virtual-skynode.md).
{% endhint %}

The IP specified in `--guest-ip` can be used to interface with the running Virtual Skynode. You can choose any IP in the `10.41.200.0/24` subnet. If you are looking for an interactive setup you can also just type `virtual-skynode`.&#x20;

Check that Virtual Skynode is up and running by visiting the IPv4 address specified at launch. By default this is <http://10.41.200.2>:

<figure><img src="https://3329189600-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFW1Ge1p1f6WHyiYCb146%2Fuploads%2FHntmAl5TZXx47QSqqGeZ%2Fvehicle_webapp.png?alt=media&amp;token=2258b5d7-af8c-40db-b3e1-fec66361717d" alt=""><figcaption><p>Virtual Skynode web interface</p></figcaption></figure>

{% hint style="warning" %}
When you run the `virtual-skynode` command for the first time, it initiates an app installation process.\
\
Do not prematurely stop the virtual-skynode process before it successfully completes the installation. If you do so, it may result in a corrupt configuration, which cannot automatically recover and you will have to [reset your Virtual Skynode](/~/changes/TDRfjBXXgHmxK48cWqay/app-development/virtual-skynode/resetting-virtual-skynode.md).\
\
You can ensure the installation is complete with the web interface in Dashboard panel.
{% endhint %}

## Virtual FMU app

The backbone of any Virtual Skynode setup is formed by the Virtual-FMU app. This app runs the PX4 Autopilot code on your Virtual Skynode and allows you to use PX4 as you would on a real Skynode.

{% hint style="info" %}
The Virtual FMU  is automatically installed as a system default app on your Virtual Skynode&#x20;
{% endhint %}

### Usage

1. With Virtual Skynode running visit its web interface at <http://10.41.200.2>
2. Go to the **Apps** page\ <img src="https://3329189600-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFW1Ge1p1f6WHyiYCb146%2Fuploads%2FuhWsXsBUKneMxiMZI6Pi%2Fwebapp_apps_tab.png?alt=media&amp;token=28dbe726-117a-472f-8145-bc654302552c" alt="" data-size="original">
3. Find the **Virtual FMU** app (*com.auterion.virtual-fmu*) and click the **Configure** button next to it. This should open a new browser tab. This is the web interface of the Virtual FMU where the simulation environment can be modified or interacted with\
   ![](https://3329189600-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFW1Ge1p1f6WHyiYCb146%2Fuploads%2Fc9udBpp1abPVYeUn2sVN%2Fimage.png?alt=media\&token=d3811502-e0a0-4e23-939f-7bf9d9a8752f)
4. Virtual FMU starts in self-contained SIH mode by default. This mode doesn't require an external gazebo instance, you can directly connect with Auterion Mission Control and fly.

## Gazebo Simulation

As an alternative to running in self-contained SIH mode, the Virtual FMU app can also run an external Gazebo Sim.

Auterion provides a meta Debian package called **simulation-gazebo** that essentially acts as a wrapper for default Gazebo Sim. It sets several environmental variables that are required to create a network connection between Gazebo and the Virtual FMU app.&#x20;

### Installation

If you have not done so already, setup simulation-gazebo by following the instructions here: [Simulation-Gazebo Reference](/~/changes/TDRfjBXXgHmxK48cWqay/app-development/virtual-skynode/simulation-gazebo-reference.md)

### Switch to Gazebo Simulation Mode

1. Run `simulation-gazebo` to launch gazebo. This should open up a Gazebo Sim window
2. Go to the Virtual FMU configuration browser tab
3. Click the **Simulation mode** dropdown menu and select the desired simulation mode
4. Then click the "Reload Simulation" button

<figure><img src="https://3329189600-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFW1Ge1p1f6WHyiYCb146%2Fuploads%2FH9NqRQ744qvvU2V79lEg%2Fvfmu_sim_mode.png?alt=media&amp;token=a07602d8-2faf-4c63-a98b-da935b1ef33b" alt="" width="563"><figcaption><p>Virtual FMU webpage: switch to Gazebo Sim Mode</p></figcaption></figure>

{% hint style="warning" %}
If you don't have gazebo running on your host, you will see the following warning:\
`WARN [gz_bridge] Service call timed out as Gazebo has not been detected`&#x20;
{% endhint %}

If everything has been installed correctly you should see the vehicle show up in your Gazebo Sim window.

## Build and Install Auterion Apps

Your Auterion apps that you have built for Skynode will fail to install on Virtual Skynode. This is because apps for Skynode target the linux/arm64 architecture, whereas apps for Virtual Skynode running on your machine need to target linux/amd64.

To build your Auterion app for Virtual Skynode, you can follow the [Application Development](/~/changes/TDRfjBXXgHmxK48cWqay/app-development/app-development/application-development-1.md#virtual-skynode) workflow:

```
auterion-cli app build --simulation
```

This will produce a `*-simulation.auterionos` artifact compatible with Virtual Skynode. You can now install your app either via `auterion-cli app install`, or navigating the web interface at <http://10.41.200.2> to Dashboard > Install Software.

## Auterion Mission Control

You can also connect Auterion Mission Control (AMC) to the Virtual FMU. To do so open the AMC settings and select the tab "Settings/Comm Links". There create a new comm link configuration with the following settings:

| Setting                        | Value                                       |
| ------------------------------ | ------------------------------------------- |
| Name                           | Can be an arbitrary string                  |
| Type                           | TCP                                         |
| Automatically Connect on Start | True or False, based on personal preference |
| High Latency                   | False                                       |
| Host Address                   | 10.41.200.2                                 |
| TCP Port                       | 5790                                        |

<figure><img src="https://3329189600-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFW1Ge1p1f6WHyiYCb146%2Fuploads%2FhRUsLM2PYMfTZBrTuCT4%2Fimage.png?alt=media&amp;token=06f8c5b9-cc52-47e5-8fdf-3c00eb4254a2" alt=""><figcaption><p>Example setup of a Comm Link for Virtual Skynode with AMC</p></figcaption></figure>

Click on the created comm link and select "Connect" at the bottom.&#x20;
