# Cubex Demo Guide

## Virtual Machine

The demo is demonstrated in a VM. In the tarball can be found 2 images that can run in VirtualBox (OVA) and Virt-Manager (QCOW2).

#### Credentials
* **username**: cubex
* **password**: 2025

## Demo steps
This guide shows 2 ways of running the Cubex demo:

#### 1. Simulated environment:
This cubex demo version runs natively in a linux environment.

The main difference with the real environment is the lack of the hardware. This means that the deployment runs locally, the **IMU** Component data aqcuasition is simulated using a distribution function and the RGB LED lights can be translated into additional telemetry. Due to the lack of the IMU sensor, there is no need to initialize the I2C bus to establish communication.

This demo has a ready deployment. To run the example,  the user has to follow the commands below:

```bash
cd Desktop/cubex
. fprime-venv/bin/activate
```

Now, the user can either run the ready deployment or build the project from the beginning.

```bash
fprime-gds
# or
fprime-util purge # yes in all
fprime-util generate
fprime-util build
fprime-gds
```

This will open `fprime-gds` in the browser in the **Commands** tab. The **Channels** tab has the emmited telemetry. In the bottom of the list, the user can find the IMU abd Payload components' telemetry.

Back in the **Commands** tab, in the mnemonic dropdown there is the `paylaod.TOGGLE_PAYLOAD` command. By selecting it and then switching the argument to turn Payload `ON` and clicking `Send Command`, an event will be generated in the **Events** tab. This will subsequently trigger the Payload component to emit the assigned telemetry for the dominant axis. Back in the telemetry tab, the user will observe new telemetry. 

#### 2. With hardware:

The same demonstration can be done using the real hardware with the following commands:

```bash
fprime-util purge rpipico # yes in all
fprime-util generate rpipico
fprime-util build rpipico
# put RPI Pico into boot mode
cp ./build-artifacts/rpipico/Cubex/bin/Cubex.uf2 /media/aggelosmots/RPI-RP2/
# USB redirect the serial port
fprime-gds -n --dictionary ./build-artifacts/rpipico/Cubex/dict/CubexTopologyAppDictionary.xml --comm-adapter uart --uart-device /dev/ttyACM0 --uart-baud 115200 
```
