diff --git a/strands_robots/device_connect/GUIDE.md b/strands_robots/device_connect/GUIDE.md index 3f37df2..143f8f7 100644 --- a/strands_robots/device_connect/GUIDE.md +++ b/strands_robots/device_connect/GUIDE.md @@ -71,33 +71,29 @@ No Docker needed. No env vars. Devices discover each other directly on the LAN v #### Setup -Clone the repo and create a virtual environment: +##### 1. Install + +> `setup.sh` installs `uv`, Python 3.12, creates a venv, and installs all dependencies. ```bash git clone --branch feat/device-connect-integration-draft https://github.com/atsyplikhin/robots.git cd robots - -python3.12 --version # verify Python 3.12 is installed -# If not installed, see https://www.python.org/downloads/ or use your package manager: -# macOS: brew install python@3.12 -# Ubuntu: sudo apt install python3.12 python3.12-venv - -python3.12 -m venv .venv # Python 3.12 recommended (MuJoCo has no 3.14 wheels) +./strands_robots/device_connect/setup.sh source .venv/bin/activate - -pip install -e ".[sim]" # install from source; sim = MuJoCo, Device Connect SDK is a core dep - -export PYTHONPATH="$PWD:$PYTHONPATH" # only needed when running from source checkout ``` -**Start a robot (keep running in a separate terminal):** +##### 2. Start a robot -```python +```bash +screen -S robot # start a persistent session python -c " from strands_robots import Robot r = Robot('so100') r.run() " +# once online, Ctrl+a then d to detach +# screen -ls to list sessions +# screen -r robot to reattach ``` Expected output: diff --git a/strands_robots/device_connect/setup.sh b/strands_robots/device_connect/setup.sh new file mode 100755 index 0000000..4f73565 --- /dev/null +++ b/strands_robots/device_connect/setup.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +# setup.sh — one-command environment setup for Strands Robots + Device Connect +# +# Usage: +# ./strands_robots/device_connect/setup.sh +# +set -euo pipefail + +PYTHON_VERSION="3.12" +VENV_DIR=".venv" +REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)" + +echo "============================================================" +echo " Strands Robots — Environment Setup" +echo "============================================================" +echo "" + +# ── 0. Install uv (if needed) ──────────────────────────────────────────────── +if ! command -v uv &>/dev/null; then + echo "[0/2] uv not found — installing..." + curl -LsSf https://astral.sh/uv/install.sh | sh + export PATH="$HOME/.local/bin:$PATH" +else + echo "[0/2] uv $(uv --version) ✓" +fi + +# ── 1. Install Python (if needed) ──────────────────────────────────────────── +if ! uv python find "$PYTHON_VERSION" &>/dev/null; then + echo "[1/2] Python $PYTHON_VERSION not found — installing via uv..." + uv python install "$PYTHON_VERSION" +else + echo "[1/2] Python $PYTHON_VERSION ✓" +fi + +# ── 2. Create virtual environment and install ──────────────────────────────── +if [ ! -d "$REPO_ROOT/$VENV_DIR" ]; then + echo "[2/2] Creating virtual environment and installing packages..." + uv venv --python "$PYTHON_VERSION" "$REPO_ROOT/$VENV_DIR" +else + echo "[2/2] Virtual environment exists, installing packages..." +fi + +# shellcheck disable=SC1091 +source "$REPO_ROOT/$VENV_DIR/bin/activate" +uv pip install -e "$REPO_ROOT[sim]" + +echo "" +echo "============================================================" +echo " Setup complete" +echo "============================================================" +echo "" +echo "Activate the environment:" +echo " source $REPO_ROOT/$VENV_DIR/bin/activate"