> 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/app-development/simulation/hardware-in-the-loop.md).

# Hardware in the Loop

## Hardware in the Loop

Hardware in the Loop (HITL) allows you to run the simulation against a physical Skynode device instead of a virtual one.

### Prerequisites

A compatible HITL image must be installed on the device.

You can find them in `auterionos-oem-core/hitl/[skynode-n, skynode-s]`.

Alternatively, use a prebuilt image.

### Running the simulation with Hardware in the Loop

1. Start the simulator with the `-d` flag. This changes the IP address for Gazebo:

```bash
./Tools/StartEditor.sh -d ...
```

2. Start Gazebo with the `--ditl` flag. The `-d` flag is reserved by Docker. This also changes the IP address:

```bash
sudo simulation-gazebo --ditl ...
```

### Image compression

By default, images are compressed as JPEG at 80% quality.

For the Raider configuration:

```json
{
  "FrameRate": 50,
  "ResolutionWidth": 1920,
  "ResolutionHeight": 1440
}
```

This results in around 16 MB/s, or 128 Mbit/s. At lower quality, such as 20%, bandwidth drops to around 8 MB/s, or 64 Mbit/s.

Control this with the `-c {0-100}` flag in Unreal.

### Sending uncompressed video

To disable video compression, do not use `--hitl`, as it enables compression automatically. Instead:

1. Start the simulator with:

```bash
GZ_IP=10.41.1.2 Tools/StartEditor.sh ...
```

2. Keep Gazebo unchanged.
3. `video2ros` on the device automatically switches between compressed and uncompressed inputs.

Note the following limitations:

The `skynode-n` requires a 5 GbE connection. Its USB ports handle only around 3.5 Gbit/s. Otherwise, it is capped at about 14 FPS unless you reduce the resolution. This is untested. Attempts to connect 5 GbE have caused stability issues, which may indicate hardware incompatibility.

Exceeding the connection limit can increase latency by up to 20 seconds and drop frames. No special handling is available. Confirm your connection speed before proceeding.

The `skynode-s` is capped at 100 Mbit/s. This is unusable without compression.
