GoWelcome/scripts/run_robot.sh

30 lines
1001 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
#
# run_robot.sh -- run GoWelcome against a REAL Unitree Go2.
#
# !!! SAFETY: ALWAYS test the robot SUSPENDED (hung off the ground) first, with
# !!! a hand on Ctrl-C. Ctrl-C is the e-stop: it stops motion and shuts down.
#
# Usage:
# ./scripts/run_robot.sh [INTERFACE] [extra main.py args...]
#
# The first positional argument is the host network interface to the Go2
# (default: eth0). Anything after it is forwarded straight to main.py, e.g.:
#
# ./scripts/run_robot.sh eth0 --no-avoidance --headless
# ./scripts/run_robot.sh wlan0 --device cuda
#
# Resolve the repo root from this script's location so it runs from anywhere.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
cd "${PROJECT_ROOT}"
INTERFACE="${1:-eth0}"
# Drop the interface from $@ if it was supplied, so the rest are passthrough.
if [[ "$#" -gt 0 ]]; then
shift
fi
exec python3 main.py --interface "${INTERFACE}" "$@"