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.
49 lines
2.7 KiB
Bash
Executable File
49 lines
2.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Run the containerized hand stack (service + bridge + dashboard).
|
|
# Stops any host-native inspire_g1/bridge first — two services would collide on
|
|
# the RS-485 bus. Needs --network host (DDS) + --privileged -v /dev:/dev (serial).
|
|
set -e
|
|
IMG="${IMG:-inspire-hand:latest}"
|
|
IFACE="${IFACE:-eth0}"
|
|
|
|
echo ">> removing old container, then killing host-native services (avoid double inspire_g1)"
|
|
docker rm -f inspire-hand 2>/dev/null || true # kill container's procs first
|
|
pkill -x inspire_g1 2>/dev/null || true # now only host natives remain
|
|
pkill -x hand_bridge 2>/dev/null || true
|
|
pkill -f hand_web.py 2>/dev/null || true
|
|
sleep 1; pkill -9 -x inspire_g1 2>/dev/null || true
|
|
|
|
# INSPIRE_RIGHT_PATH pins which physical USB socket is the RIGHT hand. Both hands answer on
|
|
# RS-485 id 1, so without this the side is inferred from USB path ORDER — correct today, but
|
|
# it would flip undetected if the two dongles were swapped between sockets.
|
|
# Operator-verified at the robot 2026-08-03: usb 1-2.2.1.1 is the physical RIGHT hand.
|
|
# (An earlier wiggle test concluded the opposite; the operator watching the robot corrected
|
|
# it. Flip this one value if the sides ever read swapped again — nothing else needs changing.)
|
|
RIGHT_PATH="${INSPIRE_RIGHT_PATH:-1-2.2.1.1}"
|
|
# Saved shapes/combos on the HOST, so rebuilding the image no longer wipes the library.
|
|
DATA_DIR="${HAND_DATA_DIR:-$HOME/hand_data}"
|
|
# Recordings live on the HOST for the same reason the shape library does: a `docker rm -f`
|
|
# in this script would otherwise destroy every take ever made.
|
|
mkdir -p "$DATA_DIR" "$DATA_DIR/DataG1"
|
|
|
|
# always: the hands must be there whenever the robot is, and the Sanad "Hands" tab proxies to
|
|
# this stack — a robot that boots without it shows an OFFLINE banner until someone SSHes in.
|
|
# `always` rather than `unless-stopped` so it also comes back after a manual `docker stop`,
|
|
# not just after a reboot. Note the trade-off: this stack takes the RS-485 bus and
|
|
# rt/inspire/cmd as soon as it starts. `./start.sh stop` still removes it (rm -f), and it
|
|
# stays gone until the next ./start.sh.
|
|
docker run -d --name inspire-hand --restart always \
|
|
--network host --privileged -v /dev:/dev \
|
|
-v "$DATA_DIR":/opt/hand/data \
|
|
-v "$DATA_DIR/DataG1":/opt/recorder/DataG1 \
|
|
-e HAND_DATA=/opt/hand/data \
|
|
-e INSPIRE_RIGHT_PATH="$RIGHT_PATH" \
|
|
-e IFACE="$IFACE" "$IMG"
|
|
echo ">> right hand pinned to usb $RIGHT_PATH · data dir $DATA_DIR · takes $DATA_DIR/DataG1"
|
|
|
|
sleep 4
|
|
docker logs --tail 24 inspire-hand || true
|
|
echo ">> inspire_g1 instances (want 1, the container's): $(pgrep -xc inspire_g1)"
|
|
ip=$(hostname -I | awk '{print $1}')
|
|
echo ">> dashboard: http://$ip:8088"
|