kassam 2a78f1b609 Record/replay studio, manual recorder kit, and new-robot install tooling
Dashboard (web/hand_web.py)
- Record/replay panel driving g1_record_replay.py as a pty child: take library
  (replay/download/duplicate/rename/delete/upload/delete-all), pause & resume,
  and in-take key buttons that grey out in the --fingers modes the recorder
  ignores (measured: in touch mode the keys change nothing at all).
- /api/restart is container-aware: it kills inspire_g1 and lets the supervisor
  relaunch it. It used to run manage.sh, which started a SECOND inspire_g1
  beside the supervised one - two writers on one RS-485 bus - and never
  returned.
- Shape/combo libraries take a .bak on every write, with an undo button. Both
  files are rewritten in full, so deleting the last entry was unrecoverable.

recorder/
- The recorder lives in this project now: one source of truth for the CLI and
  the dashboard, with pause/resume added to replay.
- record.sh picks a runtime by itself (a python with the SDK, the vendored SDK,
  or the inspire-hand container). bundle.sh packs a ~340KB portable kit.

tools/
- preflight.sh: read-only readiness report for a new robot (hardware, docker,
  build prerequisites, per-robot settings) ending in an install-path verdict.
- fetch_deps.sh: stage build dependencies, verifying the libs are aarch64.
- export_ui.py: regenerate an embedding app's vendored copy of the UI.

docker/
- build_image.sh resolves its dependencies from several layouts: deps/ inside
  the project, /usr/local, a source install prefix, or a ROS2 colcon workspace
  (where the idl headers live when /usr/local has none).
- web/ is copied in the last layer, so dashboard edits skip the C++ rebuild.
- restart=always, and start.sh always builds so an edit cannot silently run a
  stale image.

deps/unitree_sdk2 is vendored so a robot that has never seen the SDK can build.
Docs: README quickstart + embedding notes, SETUP_G1 corrected (that udev rule
stopped creating /dev/inspire_* symlinks a while ago), ROBOT_README describing
a live install.
2026-08-28 20:27:28 +04:00

64 lines
2.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# =============================================================================
# bundle.sh — pack the manual recorder into one file you can copy anywhere.
#
# ./bundle.sh -> manual_recorder_<date>.tar.gz (~2 MB)
# ./bundle.sh --with-takes -> also include DataG1/*.jsonl
# ./bundle.sh --out /tmp/x.tar.gz
#
# What goes in: the recorder itself, its launcher, the home pose, the vendored
# Unitree python SDK, and a README. That is everything the CLI path needs except
# the compiled DDS bindings, which cannot travel in a tarball — the README says
# how to get them.
#
# This is the fallback for when Docker, the dashboard, or the network are not
# available: unpack on any machine that can reach the robot's DDS interface and
# record from a terminal.
# =============================================================================
set -euo pipefail
HERE="$(cd "$(dirname "$0")" && pwd)"
REPO="$(cd "$HERE/.." && pwd)"
WITH_TAKES=0
OUT="$PWD/manual_recorder_$(date +%Y%m%d).tar.gz"
while [ $# -gt 0 ]; do
case "$1" in
--with-takes) WITH_TAKES=1 ;;
--out) shift; OUT="$1" ;;
-h|--help) sed -n '3,15p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
*) echo "unknown option: $1" >&2; exit 1 ;;
esac
shift
done
STAGE="$(mktemp -d)"
trap 'rm -rf "$STAGE"' EXIT
K="$STAGE/manual_recorder"
mkdir -p "$K/recorder" "$K/vendor"
cp "$HERE/g1_record_replay.py" "$HERE/record.sh" "$K/recorder/"
[ -f "$HERE/README.md" ] && cp "$HERE/README.md" "$K/recorder/"
[ -f "$HERE/arm_home.jsonl" ] && cp "$HERE/arm_home.jsonl" "$K/recorder/"
chmod +x "$K/recorder/record.sh"
# The SDK is pure python and travels fine; the compiled cyclonedds bindings do
# not, which is why the README leads with the two runtimes that already have them.
if [ -d "$REPO/vendor/unitree_sdk2_python" ]; then
cp -r "$REPO/vendor/unitree_sdk2_python" "$K/vendor/"
rm -rf "$K/vendor/unitree_sdk2_python/.git" 2>/dev/null || true
else
echo ">> note: no vendored SDK at $REPO/vendor — bundling without it"
fi
if [ "$WITH_TAKES" = 1 ] && [ -d "$HERE/DataG1" ]; then
mkdir -p "$K/recorder/DataG1"
cp "$HERE"/DataG1/*.jsonl "$K/recorder/DataG1/" 2>/dev/null || true
echo ">> takes included: $(ls "$K/recorder/DataG1" | wc -l) file(s)"
fi
tar -czf "$OUT" -C "$STAGE" manual_recorder
echo ">> wrote $OUT ($(du -h "$OUT" | cut -f1))"
echo " unpack: tar -xzf $(basename "$OUT") && cd manual_recorder/recorder"
echo " check: ./record.sh doctor"