Add closed-loop DreamWaQ stair validation

This commit is contained in:
8x54zj-m
2026-07-22 02:36:36 +08:00
parent 9cdf59a99d
commit 660393a9ee
4 changed files with 451 additions and 236 deletions

View File

@@ -7,13 +7,18 @@ RUNS_DIR="${PROJECT_DIR}/runs/go1-dreamwaq-walk/rslrl"
checkpoint=""
output=""
terrain="flat"
terrain="stairs_box"
level="0"
forward_speed="0.5"
timeout="30"
export_only=false
manual=false
headless=false
no_validation=false
usage() {
cat <<'EOF'
Export a DreamWaQ checkpoint to ONNX and run MuJoCo sim2sim.
Export a DreamWaQ checkpoint and run the MuJoCo stair-course validation.
Usage:
scripts/run_dreamwaq_sim2sim.sh [options]
@@ -22,15 +27,21 @@ Options:
-c, --checkpoint PATH Checkpoint to export. Defaults to the newest model_*.pt.
-o, --output PATH ONNX output path. Defaults to policy.onnx beside checkpoint.
-t, --terrain NAME flat, rough, stairs, dreamwaq, stairs_test,
stairs_box, or flat_stairs. Default: flat.
stairs_box, or flat_stairs. Default: stairs_box.
-l, --level N Terrain difficulty level passed to sim2sim. Default: 0.
--speed MPS Autonomous forward command. Default: 0.5.
--timeout SEC Validation timeout in simulation seconds. Default: 30.
--manual Start at zero velocity and use keyboard commands.
--headless Run validation without a viewer or real-time delay.
--no-validation Run until the viewer closes instead of returning PASS/FAIL.
--export-only Export and validate ONNX without starting MuJoCo.
-h, --help Show this help.
Examples:
scripts/run_dreamwaq_sim2sim.sh
scripts/run_dreamwaq_sim2sim.sh -c runs/.../model_1200.pt
scripts/run_dreamwaq_sim2sim.sh -t dreamwaq -l 3
scripts/run_dreamwaq_sim2sim.sh --headless
scripts/run_dreamwaq_sim2sim.sh -c runs/.../model_1200.pt --speed 0.6
EOF
}
@@ -61,6 +72,28 @@ while (($#)); do
level="$2"
shift 2
;;
--speed)
(($# >= 2)) || die "$1 requires a number"
forward_speed="$2"
shift 2
;;
--timeout)
(($# >= 2)) || die "$1 requires a number"
timeout="$2"
shift 2
;;
--manual)
manual=true
shift
;;
--headless)
headless=true
shift
;;
--no-validation)
no_validation=true
shift
;;
--export-only)
export_only=true
shift
@@ -80,6 +113,8 @@ case "$terrain" in
*) die "unsupported terrain: ${terrain}" ;;
esac
[[ "$level" =~ ^[0-9]+$ ]] || die "level must be a non-negative integer: ${level}"
[[ "$forward_speed" =~ ^[0-9]+([.][0-9]+)?$ ]] || die "speed must be a non-negative number: ${forward_speed}"
[[ "$timeout" =~ ^[0-9]+([.][0-9]+)?$ ]] || die "timeout must be a non-negative number: ${timeout}"
command -v uv >/dev/null 2>&1 || die "uv is not available in PATH"
if [[ -z "$checkpoint" ]]; then
@@ -118,7 +153,14 @@ if [[ "$export_only" == true ]]; then
fi
echo "[Pipeline] starting MuJoCo: terrain=${terrain}, level=${level}"
exec uv run scripts/dreamwaq_sim2sim_mujoco.py \
--onnx "$output" \
--terrain "$terrain" \
sim_args=(
--onnx "$output"
--terrain "$terrain"
--level "$level"
--forward-speed "$forward_speed"
--timeout "$timeout"
)
[[ "$manual" == true ]] && sim_args+=(--manual)
[[ "$headless" == true ]] && sim_args+=(--headless)
[[ "$no_validation" == true ]] && sim_args+=(--no-validation)
exec uv run scripts/dreamwaq_sim2sim_mujoco.py "${sim_args[@]}"