#!/usr/bin/env bash # Train the Go2 SRU navigation policy FROM SCRATCH (no checkpoint). # # Defaults: headless, 24 envs, 1000 iter, Dev task, seed=42. # Use this when you intentionally want a cold start (e.g. after sweeping # reward / action / terrain shaping where the previous policy mean has # collapsed into a degenerate solution and resuming would just re-learn it). # # Usage: # ./scripts/train_go2_scratch.sh # 1000 iter, 24 envs, headless # NUM_ENVS=16 MAX_ITER=500 ./scripts/train_go2_scratch.sh # GUI=1 NUM_ENVS=4 MAX_ITER=200 ./scripts/train_go2_scratch.sh # TASK=Isaac-Nav-PPO-Go2-v0 RUN_NAME=scratch_full ./scripts/train_go2_scratch.sh # # Notes: # * No --checkpoint flag is passed, so the agent + critic are re-initialised. # * RTX 5070 (12 GB VRAM): 24 envs headless is the safe default. GUI + 32 # envs OOMs (G0.0 lesson). # * Output goes to outputs/logs/rsl_rl//_/. set -e REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" NUM_ENVS="${NUM_ENVS:-24}" MAX_ITER="${MAX_ITER:-1000}" TASK="${TASK:-Isaac-Nav-PPO-Go2-Dev-v0}" GUI="${GUI:-0}" SEED="${SEED:-42}" RUN_NAME="${RUN_NAME:-scratch_reward_fix_v1}" # GPU selection. Set GPU=0 / GPU=1 / GPU=0,1 to pin specific cards. # Empty (default) = all visible GPUs (--gpus all). The container sees the selected # GPU(s) as cuda:0,cuda:1,... so the training process always uses cuda:0 inside. GPU="${GPU:-}" GPU_FLAG="--gpus all" if [[ -n "$GPU" ]]; then GPU_FLAG="--gpus device=${GPU}" fi HEADLESS_FLAG="--headless" EXTRA_DOCKER_ARGS=() if [[ "$GUI" == "1" ]]; then HEADLESS_FLAG="" xhost +local:root >/dev/null 2>&1 || xhost +local:docker >/dev/null 2>&1 || true EXTRA_DOCKER_ARGS+=(-e "DISPLAY=${DISPLAY:-:1}" -v /tmp/.X11-unix:/tmp/.X11-unix:rw -v "$HOME/.Xauthority:/root/.Xauthority:ro") fi cat <