Files
MultiRoombaRover/docs/pi-deployment.md
T
2025-11-09 21:15:13 -05:00

2.9 KiB

Pi Deployment Guide

Tooling

Fedora 43:

sudo dnf install golang libgpiod

Cross-compiling roverd for Pi Zero 2 W (ARMv7):

cd pi/roverd
mkdir -p ../../dist
make pi-build

The binary is placed in dist/roverd (relative to the repo root).

Installing roverd

  1. Copy the binary and config:

    sudo useradd -r -s /usr/sbin/nologin roverd || true
    sudo install -o roverd -g roverd -m 0755 dist/roverd /usr/local/bin/roverd
    sudo install -o roverd -g roverd -m 0640 pi/roverd/roverd.sample.yaml /etc/roverd.yaml
    

    Adjust /etc/roverd.yaml for each rover: name, serverUrl (e.g. ws://control-server:8080/rover), serial port path, battery thresholds, GPIO pin for BRC, and the media WHEP URL that points at the central distribution server.

  2. Install the systemd unit:

    sudo install -m 0644 pi/systemd/roverd.service /etc/systemd/system/roverd.service
    sudo systemctl daemon-reload
    sudo systemctl enable --now roverd.service
    

roverd requires access to /dev/ttyAMA0 and /sys/class/gpio; keeping it under its own user ensures the rest of the system stays isolated.
If you set media.manage: true in /etc/roverd.yaml, make sure the roverd service account can invoke systemctl <action> <media.service> (either run the unit as root or grant sudo privileges for that command).

Configuring mediaMTX

  1. Download the latest mediaMTX release for ARMv7 and place the binary at /usr/local/bin/mediamtx.
  2. Copy the provided config:
    sudo useradd -r -s /usr/sbin/nologin mediamtx || true
    sudo install -d -o mediamtx -g mediamtx /etc/mediamtx
    sudo install -o mediamtx -g mediamtx -m 0644 pi/mediamtx/mediamtx.yml /etc/mediamtx/mediamtx.yml
    sudo install -m 0644 pi/systemd/mediamtx.service /etc/systemd/system/mediamtx.service
    sudo systemctl daemon-reload
    sudo systemctl enable --now mediamtx.service
    

The sample config uses the Raspberry Pi camera module as the source and exposes a WHEP endpoint at http://<pi-host>:8889/whep/rovercam. Point media.whepUrl in roverd.yaml at this URL so the central server can list it.
Expose the mediaMTX HTTP API locally (default http://127.0.0.1:9997) and set media.healthUrl so roverd can monitor the pipeline; media.service should match the systemd unit name (default mediamtx.service).

Server + UI

From the repo root:

cd server
npm install
npm run start

This launches the HTTP server (serving the barebones UI) and the rover WebSocket endpoint at ws://<server>:8080/rover. The UI expects roverd instances to send hello frames so it can populate the rover list. Use the mode buttons to emit Start/Safe/Full/Passive/Dock commands (they send the raw OI opcode bytes), tap the sensor toggle to request Group 100 streaming, and use WASD for drive testing; the UI emits Drive Direct commands ~8 times per second, so the rover sees them immediately.