60 lines
2.3 KiB
Bash
Executable File
60 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Create/refresh the 'welcome' conda env and install GoWelcome's Python deps.
|
|
#
|
|
# ./requirement.sh
|
|
#
|
|
# Installs the off-robot / mock dependencies (numpy, opencv, ultralytics,
|
|
# simpleaudio). The real Go2 additionally needs the Unitree SDK (hardware only)
|
|
# -- see the note printed at the end.
|
|
set -euo pipefail
|
|
|
|
ENV_NAME="welcome"
|
|
PY_VERSION="3.10"
|
|
# Resolve this script's own directory so it works from any CWD.
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
# --- locate 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/Anaconda first." >&2
|
|
exit 1
|
|
}
|
|
# shellcheck disable=SC1091
|
|
source "$(conda info --base)/etc/profile.d/conda.sh"
|
|
|
|
# --- create env if missing ----------------------------------------------
|
|
if conda env list | awk '{print $1}' | grep -qx "$ENV_NAME"; then
|
|
echo "[requirement] conda env '$ENV_NAME' already exists -- reusing it."
|
|
else
|
|
echo "[requirement] creating conda env '$ENV_NAME' (python $PY_VERSION)..."
|
|
conda create -y -n "$ENV_NAME" "python=$PY_VERSION"
|
|
fi
|
|
|
|
conda activate "$ENV_NAME"
|
|
echo "[requirement] using $(python --version) @ $(command -v python)"
|
|
|
|
# --- install python deps -------------------------------------------------
|
|
python -m pip install --upgrade pip
|
|
python -m pip install -r "$SCRIPT_DIR/requirements.txt"
|
|
|
|
echo
|
|
echo "[requirement] done. Off-robot/mock deps installed in conda env '$ENV_NAME'."
|
|
echo "[requirement] For a REAL Go2, also install the Unitree SDK (hardware only):"
|
|
echo " git clone https://github.com/unitreerobotics/unitree_sdk2_python"
|
|
echo " cd unitree_sdk2_python && pip install -e . # pulls in cyclonedds"
|
|
echo
|
|
echo "[requirement] Verify the install (real YOLO, no robot needed):"
|
|
echo " python \"$SCRIPT_DIR/scripts/smoke_test.py\""
|
|
echo
|
|
echo "[requirement] Start GoWelcome with:"
|
|
echo " ./welcome.sh # mock / webcam (no robot)"
|
|
echo " ./welcome.sh --interface eth0 # real Go2 over eth0"
|