47 lines
1.7 KiB
Bash
Executable File
47 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Launch GoWelcome inside the 'welcome' conda env. Any arguments are passed
|
|
# straight through to main.py.
|
|
#
|
|
# ./welcome.sh # mock / webcam (no robot)
|
|
# ./welcome.sh --interface eth0 # real Go2 over eth0 (TEST SUSPENDED FIRST)
|
|
# ./welcome.sh --interface eth0 --dry-run --headless
|
|
set -euo pipefail
|
|
|
|
ENV_NAME="welcome"
|
|
# Resolve this script's own directory (the project root) so it runs from any CWD.
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
# --- locate + activate conda --------------------------------------------
|
|
if ! command -v conda >/dev/null 2>&1; then
|
|
for c in "$HOME/miniconda3" "$HOME/anaconda3" "$HOME/miniforge3" "/opt/conda"; do
|
|
if [ -f "$c/etc/profile.d/conda.sh" ]; then
|
|
# shellcheck disable=SC1091
|
|
source "$c/etc/profile.d/conda.sh"
|
|
break
|
|
fi
|
|
done
|
|
fi
|
|
command -v conda >/dev/null 2>&1 || {
|
|
echo "ERROR: conda not found. Install Miniconda first, then run ./requirement.sh" >&2
|
|
exit 1
|
|
}
|
|
# shellcheck disable=SC1091
|
|
source "$(conda info --base)/etc/profile.d/conda.sh"
|
|
conda activate "$ENV_NAME" 2>/dev/null || {
|
|
echo "ERROR: conda env '$ENV_NAME' not found. Run ./requirement.sh first." >&2
|
|
exit 1
|
|
}
|
|
|
|
# Run from the project root so bundled assets (yolov8n.pt, greeting.wav) resolve.
|
|
cd "$SCRIPT_DIR"
|
|
|
|
# --- default to mock when no args, so a bare ./welcome.sh just runs ------
|
|
if [ "$#" -eq 0 ]; then
|
|
echo "[welcome] no args -> MOCK mode (webcam 0)."
|
|
echo "[welcome] real robot (WebRTC, default): ./welcome.sh --robot-ip <robot-ip> [--aes-key <hex>]"
|
|
echo "[welcome] real robot (DDS/EDU wired): ./welcome.sh --transport dds --interface eth0"
|
|
set -- --mock --source 0
|
|
fi
|
|
|
|
exec python main.py "$@"
|