docs(setup): README + linux/windows setup + calibration/troubleshooting + packaging (wave 11; todo 18 done)
This commit is contained in:
1 parent
9b5a0255e2
commit
39876fa97b
9 files changed
+809
-42
No files matched your search
@@ -293,7 +293,7 @@ Your next move: run the default-on high-accuracy review (in progress), then exec
|
||||
Commit: Y | feat(robust): graceful degradation + fault recovery
|
||||
Recommended task executor category: unspecified-low - contained hardening with fault tests.
|
||||
|
||||
- [ ] 18. Packaging + setup documentation
|
||||
- [x] 18. Packaging + setup documentation
|
||||
What to do / Must NOT do: `docs/` + packaging: a Linux setup guide (deps, usbip attach, run) and a Windows setup guide (test-signing + driver install, attach, run, DEA config per P3dro200), a calibration how-to, and a troubleshooting section (mirror bit, player-lost, depth out-of-range). The Windows signing docs MUST cover enabling test-signing (`bcdedit /set testsigning on`), disabling Secure Boot, the test-mode desktop watermark, and potential interaction with spice2x anti-tamper. LINK to Microsoft's official Kinect 1.8 runtime/SDK download. Package the tracker + core + attach shims into a runnable bundle per OS. Must NOT: redistribute/bundle the MS Kinect 1.8 runtime, NiTE2, or any DEA game asset (link to official sources only); document steps not actually verified in todos 10/13.
|
||||
Closes: GAP-7 (docs), proves IS-5,6
|
||||
Parallelization: Wave 11 | Blocked by: 10,13 | Blocks: none
|
||||
|
||||
@@ -1,50 +1,98 @@
|
||||
# Webcam-driven virtual Kinect v1
|
||||
|
||||
Make an ordinary RGB webcam present itself as a genuine **Microsoft Kinect v1** sensor so
|
||||
unmodified Kinect apps — primary proof target **DanceEvolution Arcade (DEA)** on Windows —
|
||||
run with no recompile. We emulate the **device** (the thing on USB), not the game's API, so
|
||||
the approach is OS-agnostic and the real host Kinect stack (MS NUI on Windows, OpenNI2/NiTE
|
||||
on Linux) computes the skeleton from webcam-derived synthetic depth.
|
||||
Make an ordinary RGB webcam present itself as a genuine **Microsoft Kinect v1** sensor, so
|
||||
unmodified Kinect apps run with no recompile. The primary proof target is **DanceEvolution
|
||||
Arcade (DEA)** on Windows. We emulate the **device** (the thing on USB), not the game's API, so
|
||||
the approach is OS-agnostic and the real host Kinect stack (MS NUI on Windows, OpenNI2/NiTE on
|
||||
Linux) computes the skeleton from webcam-derived synthetic depth.
|
||||
|
||||
## Quickstart
|
||||
|
||||
- **Linux (verified path):** build the core, run the tracker, see moving synthetic depth through a
|
||||
real OpenNI2 consumer. Follow **[docs/setup-linux.md](docs/setup-linux.md)**.
|
||||
- **Windows (DEA):** attach the virtual device or drop in the `Kinect10.dll` shim, then play.
|
||||
Follow **[docs/setup-windows.md](docs/setup-windows.md)**.
|
||||
- **Calibrate once:** **[docs/calibration.md](docs/calibration.md)**.
|
||||
- **Something broken:** **[docs/troubleshooting.md](docs/troubleshooting.md)**.
|
||||
- **Build details / toolchain:** **[docs/build.md](docs/build.md)**.
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
webcam ─► tracker (Python, MediaPipe pose + segmentation)
|
||||
│ publishes to the frozen shared-memory IPC contract
|
||||
▼
|
||||
core/ (OS-agnostic engine, libnui_core)
|
||||
contract · mapping · synth · protocol · calibration
|
||||
│
|
||||
┌────────────┴─────────────────────────────┐
|
||||
▼ ▼
|
||||
attach/ (per-OS USB attach) fallback/ (per-OS library surface)
|
||||
linux: usbip/vhci device linux: OpenNI2 "SynthKinect" driver
|
||||
windows: usbip-win VHCI windows: clean-room Kinect10.dll shim
|
||||
│
|
||||
▼
|
||||
real host Kinect stack skeletonizes the synthetic depth
|
||||
(MS NUI on Windows, OpenNI2 + NiTE on Linux) ─► the game
|
||||
```
|
||||
|
||||
The shared engine is the OS-agnostic `core/`, built into `libnui_core` and unit-tested on Linux.
|
||||
Only the thin `attach/` and `fallback/` layers are per-OS. One tracker feeds one contract; every
|
||||
surface is a consumer of that one producer, so skeleton and depth stay identical across paths.
|
||||
|
||||
## Status: what is verified vs blocked
|
||||
|
||||
Mirrors the plan's `[x]`/`[~]` state. "Verified" means executed and observed in the Linux/WSL2
|
||||
build environment. `[~]` means the code is complete but the runtime proof is gated on hardware or an
|
||||
OS this environment lacks (no Windows, no WDK, no `usbip` userspace, no loaded `vhci-hcd`).
|
||||
|
||||
| Capability | Surface | Status |
|
||||
| --- | --- | --- |
|
||||
| OS-agnostic core (contract, mapping, synth, protocol, calibration) builds + unit-tests | `core/` | **verified** (CTest green) |
|
||||
| Webcam -> MediaPipe pose/segmentation -> frozen IPC contract | `tracker/` | **verified** against a recorded video; live `--source 0` needs a real camera |
|
||||
| Articulated synthetic depth through a real OpenNI2 stack (moving, in-band, spread > 100 mm) | `fallback/linux-openni2/` + e2e harness | **verified** (depth + enumeration; `VERDICT: PASS`) |
|
||||
| Robustness: player-lost, low-light, mask noise, tracker-crash without host crash | `tracker/` + `core/` | **verified** (fault-injection) |
|
||||
| Linux USB device-attach (OS enumerates a Kinect) | `attach/linux/` | `[~]` blocked: no `usbip` userspace / loaded `vhci-hcd` here. Compiles + unit-tests; needs a native-Linux host |
|
||||
| Linux skeleton tracking (NiTE2) | OpenNI2 + NiTE2 | out of scope: NiTE2 is non-redistributable; supply it yourself |
|
||||
| Windows device-attach (IS-1 enumerate, IS-2 MS NUI skeletonizes synthetic depth) | `attach/windows/` | `[~]` blocked: no Windows/WDK. Scripts + topology + signing fully specified |
|
||||
| Windows `Kinect10.dll` NUI shim (IS-3/IS-4 playability only) | `fallback/windows-nui/` | **built + export-audited** (real PE32/PE32+, 21 exports, 0 missing); runtime load `[~]` unverified |
|
||||
| DEA in-game playability proof | Windows | `[~]` blocked: human-assisted on the user's Windows box (plan F5) |
|
||||
|
||||
The authoritative skeleton/fidelity proof is DEA on Windows; the Linux OpenNI2 path proves the
|
||||
depth/synthesis fidelity. The `Kinect10.dll` shim proves playability only and does **not** satisfy
|
||||
IS-1 (OS enumeration) or IS-2 (real-runtime skeletonization).
|
||||
|
||||
## Clean-room notice
|
||||
|
||||
All synthesis, mapping, protocol, and shim code in this repository is **written fresh**.
|
||||
The public Kinect `NuiApi.h` headers and the libfreenect USB protocol are treated as
|
||||
interface facts only. **No GPLv3 source (KinectFaker, NiVirtualCam, NiTE2, etc.) is read or
|
||||
vendored.** The MS Kinect 1.8 runtime, NiTE2, and any game assets are never bundled — the
|
||||
docs link to their official sources.
|
||||
All synthesis, mapping, protocol, and shim code here is **written fresh**. The public Kinect
|
||||
`NuiApi.h` headers and the libfreenect USB protocol are treated as interface facts only. **No GPLv3
|
||||
source (KinectFaker, NiVirtualCam, NiTE2, etc.) is read or vendored.** The MS Kinect 1.8 runtime,
|
||||
NiTE2, and any game assets are never bundled; the docs link to their official sources.
|
||||
|
||||
## Module map
|
||||
|
||||
| Path | Role |
|
||||
| --- | --- |
|
||||
| `core/contract/` | Frozen, versioned IPC frame + control schema (todo 2) |
|
||||
| `core/mapping/` | NUI intrinsics, MediaPipe-33 -> Kinect-20 map, Holt smoothing (todo 6) |
|
||||
| `core/synth/` | Packed depth + player-index + color rasterizer (todo 7) |
|
||||
| `core/protocol/` | Kinect v1 virtual USB device emitter (todo 8) |
|
||||
| `tracker/` | Python webcam -> MediaPipe pose/segmentation -> IPC (todo 5) |
|
||||
| `attach/linux/` | Linux USB attach via usbip/vhci (todo 9) |
|
||||
| `attach/windows/` | Windows virtual USB bus attach + signing docs (todo 12) |
|
||||
| `fallback/linux-openni2/` | OpenNI2 virtual device fallback / general emulator (todo 15) |
|
||||
| `fallback/windows-nui/` | Clean-room `Kinect10.dll` NUI shim (todo 14) |
|
||||
| `tools/logging-shim/` | Pass-through logging shim for the Windows spike (todo 4) |
|
||||
| `tools/record-replay/` | Deterministic record/replay harness (todo 16) |
|
||||
| `tools/mock-nui-host/` | Mock NUI host driving the shim (todo 16) |
|
||||
| `tests/` | Cross-cutting C++ (CTest) + Python (pytest) smoke tests |
|
||||
| `docs/` | Build, setup, calibration, troubleshooting, spike reports |
|
||||
| `core/contract/` | Frozen, versioned IPC frame + control schema |
|
||||
| `core/mapping/` | NUI intrinsics, MediaPipe-33 -> Kinect-20 map, Holt smoothing |
|
||||
| `core/synth/` | Packed depth + player-index + color rasterizer |
|
||||
| `core/protocol/` | Kinect v1 virtual USB device emitter |
|
||||
| `core/calibration/` | One-time T-pose + mirror calibration |
|
||||
| `tracker/` | Python webcam -> MediaPipe pose/segmentation -> IPC |
|
||||
| `attach/linux/` | Linux USB attach via usbip/vhci |
|
||||
| `attach/windows/` | Windows virtual USB bus attach + signing scripts |
|
||||
| `fallback/linux-openni2/` | OpenNI2 virtual device / Linux general emulator |
|
||||
| `fallback/windows-nui/` | Clean-room `Kinect10.dll` NUI shim |
|
||||
| `tools/e2e_linux_validation/` | Recorded-video -> tracker -> OpenNI2 depth e2e harness |
|
||||
| `tools/record-replay/`, `tools/mock-nui-host/` | Deterministic record/replay + mock NUI host |
|
||||
| `packaging/` | Per-OS runnable-bundle assembly script |
|
||||
| `tests/` | Cross-cutting C++ (CTest) + Python (pytest) tests |
|
||||
| `docs/` | Setup, calibration, troubleshooting, build, spike reports |
|
||||
|
||||
The shared engine is the OS-agnostic `core/` (built into `libnui_core`, unit-tested on
|
||||
Linux); only the thin `attach/` and `fallback/` layers are per-OS.
|
||||
## Packaging
|
||||
|
||||
## Build
|
||||
`packaging/build_bundle.sh` assembles a per-OS runnable bundle from the built artifacts. See
|
||||
[packaging/README.md](packaging/README.md).
|
||||
|
||||
See **[docs/build.md](docs/build.md)**. Quick start (Linux):
|
||||
|
||||
```sh
|
||||
cmake -S . -B build/linux && cmake --build build/linux
|
||||
ctest --test-dir build/linux --output-on-failure
|
||||
.venv/bin/pytest -q
|
||||
```
|
||||
|
||||
The full plan lives in `.omo/plans/webcam-kinect-emulator.md`; the architecture and NUI
|
||||
contract notes in `.omo/design/`.
|
||||
The full plan lives in `.omo/plans/webcam-kinect-emulator.md`; the architecture and NUI contract
|
||||
notes in `.omo/design/`.
|
||||
+9
-4
@@ -1,5 +1,10 @@
|
||||
# docs/ — setup, build, spike reports
|
||||
# docs/ - setup, build, spike reports
|
||||
|
||||
- `build.md` — toolchain + build instructions (cmake, venv, cross-compile status).
|
||||
- `spike-linux.md`, `spike-windows.md` — spike reports (todos 3, 4).
|
||||
- Setup/calibration/troubleshooting guides land in todo 18.
|
||||
- `setup-linux.md` - reproducible Linux pipeline (core build, tracker, OpenNI2 driver, e2e).
|
||||
- `setup-windows.md` - Windows device-attach + Kinect10.dll shim paths and DEA config.
|
||||
- `calibration.md` - one-time T-pose + mirror calibration how-to.
|
||||
- `troubleshooting.md` - mirror bit, player-lost, flat/out-of-range depth, driver discovery.
|
||||
- `build.md` - toolchain + build instructions (cmake, venv, cross-compile status).
|
||||
- `spike-linux.md`, `spike-windows.md` - spike reports (todos 3, 4).
|
||||
|
||||
Packaging (per-OS runnable bundles): see `../packaging/README.md`.
|
||||
@@ -0,0 +1,70 @@
|
||||
# Calibration guide
|
||||
|
||||
The virtual Kinect needs a one-time calibration so the player-space scale, the depth placement,
|
||||
and the mirror orientation match your room and camera mount. The logic lives in
|
||||
`core/calibration/` (`calibration.h` / `calibration.cpp`) and is reused by every surface (the
|
||||
OpenNI2 driver, the USB emitter, and the Windows shim), so you calibrate once and all paths agree.
|
||||
|
||||
Calibration is two short poses: a **mirror-confirm** (raise one arm) and a **T-pose** (arms out).
|
||||
Both are read from the live tracker's pose output; no extra tool is needed beyond the running
|
||||
tracker.
|
||||
|
||||
## Why calibrate
|
||||
|
||||
- **Scale.** A single webcam has no absolute size. The T-pose shoulder span fixes the player-space
|
||||
scale so your body maps to roughly Kinect-sized skeleton coordinates. The target shoulder width
|
||||
is 0.40 m (`kTargetShoulderWidthMeters`).
|
||||
- **Depth placement (Z0).** Your standing distance from the camera becomes the depth origin, so the
|
||||
synthetic depth sits in the Kinect's valid band instead of pegging at a floor value. Z0 is clamped
|
||||
to the Kinect's usable range, 0.8 m to 4.0 m.
|
||||
- **Mirror.** A raw camera image is left/right flipped relative to how a Kinect presents the scene.
|
||||
The mirror flag makes your anatomical right arm land where the host tracker and the game expect
|
||||
it. Getting this wrong is the most common "my moves are inverted" bug (see troubleshooting).
|
||||
|
||||
## Step 1: mirror confirm (raise your right arm)
|
||||
|
||||
Stand facing the camera and raise **only your anatomical right arm**, left arm down.
|
||||
|
||||
`confirm_mirror_raise_right_arm()` checks that exactly the right arm is up (right wrist above the
|
||||
right shoulder, left wrist at or below its shoulder). It then sets the global `mirror` flag from
|
||||
where that raised arm appears horizontally in the image: if the raised arm shows up on image-left,
|
||||
the feed is mirrored and the flag is set so downstream consumers flip it back.
|
||||
|
||||
If the check fails it returns an error ("mirror confirmation requires only the right arm raised");
|
||||
lower your left arm fully and raise only the right, then retry.
|
||||
|
||||
## Step 2: T-pose (arms straight out)
|
||||
|
||||
Stand at your normal playing distance and hold a **T-pose**: both arms straight out to the sides,
|
||||
level with your shoulders, facing the camera, whole body in frame.
|
||||
|
||||
`calibrate_tpose()` reads one `TposeObservation`:
|
||||
|
||||
- `person_detected` must be true (one clean detection),
|
||||
- `root_depth_meters` becomes the clamped Z0 depth origin,
|
||||
- `normalized_shoulder_width` sets `player_scale` so your shoulders map to 0.40 m,
|
||||
- `floor_plane` carries the floor estimate through unchanged,
|
||||
- `mirror` comes from step 1.
|
||||
|
||||
It produces a `CalibrationConfig` (mapping intrinsics, smoothing parameters, player scale, floor
|
||||
plane). Invalid or non-finite inputs (no person, zero shoulder width) fail with a clear error
|
||||
rather than writing a bad config.
|
||||
|
||||
## Step 3: save and reuse
|
||||
|
||||
`save_config()` writes the calibration to a plain-text key/value file; `load_config()` reads it
|
||||
back. Save it once and every surface loads the same file:
|
||||
|
||||
- the OpenNI2 SynthKinect driver (Linux),
|
||||
- the USB emitter (`core/protocol`, both OSes),
|
||||
- the `Kinect10.dll` shim (Windows).
|
||||
|
||||
Recalibrate when you move the camera, change your playing distance, or switch rooms. The mirror
|
||||
step is worth repeating any time left/right feels wrong in a game.
|
||||
|
||||
## Tips
|
||||
|
||||
- Calibrate in the lighting you will play in; poor light degrades the pose estimate the calibration
|
||||
is built from.
|
||||
- Keep your whole body in frame for the T-pose; a cropped arm skews the shoulder-span scale.
|
||||
- If moves still invert after a clean T-pose, redo step 1. Mirror is the usual culprit, not scale.
|
||||
@@ -0,0 +1,213 @@
|
||||
# Linux setup guide
|
||||
|
||||
This is the exact, reproducible Linux pipeline: build the OS-agnostic core, stand up
|
||||
the Python tracker, provision a user-space OpenNI2 runtime, build the OpenNI2 "SynthKinect"
|
||||
driver, and watch moving synthetic depth flow through a real, independent OpenNI2 consumer.
|
||||
|
||||
Following this from a clean checkout reaches the plan's todo-10 result: **a sequence of
|
||||
moving, in-band, articulated depth frames read out of a real OpenNI2 stack driven by the
|
||||
live webcam/MediaPipe tracker.** That is the verified Linux surface (plan IS-6, IS-7 depth
|
||||
half).
|
||||
|
||||
## What is verified vs blocked on Linux
|
||||
|
||||
| Path | Status |
|
||||
| --- | --- |
|
||||
| Core build + unit tests (`libnui_core`, CTest) | verified |
|
||||
| Python tracker: MediaPipe pose + mask through the frozen IPC contract | verified (against a recorded video; live `--source 0` needs a real camera) |
|
||||
| OpenNI2 "SynthKinect" driver + independent OpenNI2 depth consumer | verified: moving articulated depth read through a real OpenNI2 stack |
|
||||
| usbip/vhci device-attach (the `attach/linux` lane) | `[~]` blocked here: no `usbip` userspace, no loaded `vhci-hcd` controller on this WSL2 kernel. Code compiles and unit-tests; live USB attach needs a native-Linux host or a kernel with a matching `linux-tools`/`usbip` package. See `attach/linux/README.md`. |
|
||||
| Skeleton tracking on Linux (NiTE2) | out of scope: NiTE2 is non-redistributable. Supply it yourself to get a skeleton; depth/enumeration work without it. |
|
||||
|
||||
The verified route below is the **OpenNI2 driver (fallback) path**, which proves depth and
|
||||
enumeration end to end without the USB-attach blocker. It is the Linux surface the e2e
|
||||
harness exercises.
|
||||
|
||||
## 0. Prerequisites
|
||||
|
||||
A Linux (or WSL2) box with `g++`, `python3`, `curl`, and `git`. No root is required for the
|
||||
verified path; every dependency below installs into your home directory.
|
||||
|
||||
`cmake` is not assumed present. Install it into the per-user site (PEP-668 externally-managed
|
||||
systems need the `--break-system-packages` flag, which only touches your user site):
|
||||
|
||||
```sh
|
||||
pip install --user --break-system-packages cmake
|
||||
export PATH="$HOME/.local/bin:$PATH" # put this in your shell rc
|
||||
cmake --version # expect 4.x
|
||||
```
|
||||
|
||||
## 1. Build the OS-agnostic core and run its tests
|
||||
|
||||
```sh
|
||||
cd /path/to/kinect
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
cmake -S . -B build/linux
|
||||
cmake --build build/linux
|
||||
ctest --test-dir build/linux --output-on-failure
|
||||
```
|
||||
|
||||
GoogleTest is fetched once via CMake `FetchContent` at configure time (network needed once;
|
||||
then cached under `build/linux/_deps`). This builds `libnui_core` (contract, mapping, synth,
|
||||
protocol, calibration) and runs the C++ unit suite plus the Python/C contract interop check.
|
||||
|
||||
## 2. Stand up the Python tracker environment
|
||||
|
||||
System Python here is 3.14, which has no MediaPipe wheel and a broken `ensurepip`. The working
|
||||
route is user-space [`uv`](https://github.com/astral-sh/uv) with a pinned Python 3.12:
|
||||
|
||||
```sh
|
||||
pip install --user --break-system-packages uv
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
uv python install 3.12
|
||||
uv venv --python 3.12 tracker/.venv
|
||||
uv pip install --python tracker/.venv numpy pytest opencv-python-headless mediapipe
|
||||
```
|
||||
|
||||
Known-good versions installed this way: Python 3.12.16, numpy 2.5.5,
|
||||
opencv-python-headless 5.1.0, mediapipe 1.2.3.
|
||||
|
||||
### 2a. MediaPipe model bundles
|
||||
|
||||
MediaPipe 1.x ships only the Tasks API and loads a `.task` bundle. Fetch the tiers into
|
||||
`tracker/models/` (git-ignored):
|
||||
|
||||
```sh
|
||||
base="https://storage.googleapis.com/mediapipe-models/pose_landmarker"
|
||||
for t in lite full heavy; do
|
||||
curl -fsSL -o tracker/models/pose_landmarker_$t.task \
|
||||
"$base/pose_landmarker_$t/float16/latest/pose_landmarker_$t.task"
|
||||
done
|
||||
```
|
||||
|
||||
`full` is the selected tier (>=25 fps on CPU at the test resolution; `heavy` drops below).
|
||||
|
||||
### 2b. User-space libGLESv2 workaround
|
||||
|
||||
MediaPipe 1.2.3's native bindings need `libGLESv2.so.2`. If it is absent and you cannot
|
||||
`apt install libgles2` (no sudo), stage it into your home directory from the package payload:
|
||||
|
||||
```sh
|
||||
cd /tmp && apt-get download libgles2 && dpkg-deb -x libgles2_*.deb ext
|
||||
mkdir -p ~/.cache/kinect/gllibs && cp -a ext/usr/lib/*/libGLESv2.so.2* ~/.cache/kinect/gllibs/
|
||||
```
|
||||
|
||||
Then prepend it to the loader path whenever you run the tracker:
|
||||
|
||||
```sh
|
||||
export LD_LIBRARY_PATH="$HOME/.cache/kinect/gllibs:$LD_LIBRARY_PATH"
|
||||
```
|
||||
|
||||
### 2c. Tracker self-check
|
||||
|
||||
```sh
|
||||
tracker/.venv/bin/python -m pytest tests/test_tracker.py -v # data-path suite, 9/9 green
|
||||
```
|
||||
|
||||
## 3. Provision a user-space OpenNI2 runtime
|
||||
|
||||
The verified Linux consumer links against a real `libOpenNI2.so`. If OpenNI2 is not installed
|
||||
system-wide and you have no sudo, stage it into `~/.local/openni2-root` from the Debian/Ubuntu
|
||||
packages using the same `apt-get download` + `dpkg-deb -x` pattern as the GL workaround:
|
||||
|
||||
```sh
|
||||
mkdir -p ~/.local/openni2-root
|
||||
cd /tmp
|
||||
apt-get download libopenni2-0 libopenni2-dev
|
||||
for d in libopenni2-0_*.deb libopenni2-dev_*.deb; do
|
||||
dpkg-deb -x "$d" ~/.local/openni2-root
|
||||
done
|
||||
```
|
||||
|
||||
After this you should have, under `~/.local/openni2-root/usr`:
|
||||
|
||||
- `include/openni2/OpenNI.h` (plus the `OniDriverAPI.h` custom-driver headers needed by the
|
||||
SynthKinect driver, which this repo vendors under `fallback/linux-openni2/vendor/openni2/`),
|
||||
- `lib/x86_64-linux-gnu/libOpenNI2.so` and `libOpenNI2.so.0`,
|
||||
- `lib/x86_64-linux-gnu/OpenNI2/Drivers/` holding the stock drivers (`libPS1080.so.0`,
|
||||
`libOniFile.so.0`, `libDummyDevice.so.0`, `libPSLink.so.0`).
|
||||
|
||||
This particular `libOpenNI2.so` scans only `<libdir>/OpenNI2/Drivers` for `*.so.0` files
|
||||
(no `OPENNI2_DRIVERS_PATH` env var is honored), which is why the build step in step 4 copies
|
||||
the SynthKinect driver into that exact directory.
|
||||
|
||||
## 4. Build the OpenNI2 SynthKinect driver
|
||||
|
||||
```sh
|
||||
cmake -S fallback/linux-openni2 -B fallback/linux-openni2/build
|
||||
cmake --build fallback/linux-openni2/build
|
||||
```
|
||||
|
||||
This is an isolated CMake project (it does not touch the root build). It compiles the driver
|
||||
`libSynthKinect.so.0` from `core/synth` + `core/mapping` (reused directly, never duplicated)
|
||||
and the independent `openni2_depth_consumer` binary, then deploys `libSynthKinect.so.0` into
|
||||
`~/.local/openni2-root/usr/lib/x86_64-linux-gnu/OpenNI2/Drivers/` so the OpenNI2 loader finds it.
|
||||
|
||||
`OPENNI2_ROOT` defaults to `$HOME/.local/openni2-root`; override the cache var if yours lives
|
||||
elsewhere.
|
||||
|
||||
### 4a. About the frame source
|
||||
|
||||
The deployed driver (`libSynthKinect.so.0`) reads **live** frames from the shared-memory contract
|
||||
region `virtual_kinect_frames` (`ShmFrameSource`), the same region the tracker publishes to. So a
|
||||
publisher must be running for the driver to emit a body: run `openni2_depth_consumer` with no
|
||||
tracker publishing and it reads all-zero frames (`non_zero=0`), by design, not a failure of the
|
||||
driver. The verified moving-depth result comes from the full end-to-end run in step 5, which starts
|
||||
the tracker first.
|
||||
|
||||
```sh
|
||||
LD_LIBRARY_PATH=$HOME/.local/openni2-root/usr/lib/x86_64-linux-gnu \
|
||||
fallback/linux-openni2/build/openni2_depth_consumer 12
|
||||
```
|
||||
|
||||
## 5. Run the full end-to-end validation
|
||||
|
||||
This is the reproduction target: recorded video -> live MediaPipe tracker -> shared-memory IPC
|
||||
contract -> SynthKinect OpenNI2 driver -> an independent OpenNI2 consumer observing moving,
|
||||
articulated depth.
|
||||
|
||||
```sh
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
export LD_LIBRARY_PATH="$HOME/.cache/kinect/gllibs:$LD_LIBRARY_PATH"
|
||||
tracker/.venv/bin/python tools/e2e_linux_validation/run_e2e.py
|
||||
```
|
||||
|
||||
The harness, with no pytest and no mocks (every step is the real binary/process):
|
||||
|
||||
1. generates a deterministic recorded video of a real photographed human panning across frames
|
||||
(never a live webcam, so the run is reproducible),
|
||||
2. builds the SynthKinect driver and the `depth_stats_consumer`,
|
||||
3. runs the real tracker (`python -m tracker.tracker`) against that video at 320x240, publishing
|
||||
real MediaPipe pose + mask frames into the frozen IPC contract,
|
||||
4. runs `openni2_depth_consumer`, which reads moving depth frames through OpenNI2,
|
||||
5. runs `depth_stats_consumer`, a second independent OpenNI2 consumer asserting a per-frame
|
||||
depth spread of at least 100 mm (an articulated body surface, not a flat 800 mm floor).
|
||||
|
||||
**Expected result:** `VERDICT: PASS`. An observed run on the build host read 12 in-band depth
|
||||
frames with a moving silhouette (max centroid displacement ~75 px) and `ARTICULATED DEPTH
|
||||
CONFIRMED: max per-frame spread 191mm across 12 frames`, with body depth in the ~2300-2530 mm band.
|
||||
A non-zero exit means the consumer saw fewer than 10 in-band moving frames, or the depth never
|
||||
spread past the 100 mm articulation threshold.
|
||||
|
||||
If you supply NiTE2 (non-redistributable, not shipped here), point a NiTE2 skeleton sample at
|
||||
the same OpenNI2 device to additionally get a tracked skeleton. Without NiTE2 you still get the
|
||||
verified depth + enumeration result above.
|
||||
|
||||
## 6. The USB device-attach path (optional, `[~]` not verified here)
|
||||
|
||||
Instead of the OpenNI2 driver, you can present the emitter as a real USB device so any Kinect v1
|
||||
OpenNI/libfreenect app binds to it. This needs the `usbip` userspace and a loaded `vhci-hcd`
|
||||
controller, neither of which is available on the WSL2 kernel this repo was built on. On a
|
||||
native-Linux host where `usbip` is packaged:
|
||||
|
||||
```sh
|
||||
cmake -S attach/linux -B attach/linux/build && cmake --build attach/linux/build
|
||||
./attach/linux/build/kinect_attach serve --port 3240 # exports 1-1 camera, 1-2 audio, 1-3 motor
|
||||
sudo modprobe vhci-hcd
|
||||
./attach/linux/build/kinect_attach attach --host 127.0.0.1 --port 3240 --busid 1-1
|
||||
lsusb | grep 045e # expect 045e:02ae
|
||||
```
|
||||
|
||||
Repeat `attach` for `--busid 1-2` and `1-3`. See `attach/linux/README.md` for the full runbook
|
||||
and the WSL2 caveats. This path proves IS-1 (the OS enumerates a Kinect); the OpenNI2 driver
|
||||
path in steps 1-5 proves the depth/synthesis fidelity.
|
||||
@@ -0,0 +1,189 @@
|
||||
# Windows setup guide
|
||||
|
||||
This covers the two Windows surfaces for the webcam-driven virtual Kinect v1 and how to run
|
||||
DanceEvolution Arcade (DEA) against them.
|
||||
|
||||
> **Honesty note.** This project was built on a Linux/WSL2 host with no Windows and no Windows
|
||||
> Driver Kit. Every runtime step in this guide is marked `[~]` where it was **not executed in the
|
||||
> build environment**. The cross-compiled artifacts (`fallback/windows-nui/build/Kinect10-x86.dll`
|
||||
> and `-x64.dll`) are real PE images with an audited export table, but no step below that loads a
|
||||
> DLL into the MS NUI runtime, binds a driver, or launches DEA has been verified here. These are
|
||||
> the acceptance surface for plan todos 12/13 and the F5 playability proof on your Windows box.
|
||||
|
||||
## What you must supply (never bundled here)
|
||||
|
||||
This repository links only. It never redistributes Microsoft or game assets. You install:
|
||||
|
||||
- **Kinect for Windows Runtime + SDK v1.8** (provides the real `Kinect10.dll`, the Kinect USB
|
||||
driver `kinectsensor.inf`, and the SDK headers). Official download:
|
||||
<https://www.microsoft.com/en-us/download/details.aspx?id=40278>
|
||||
- **Kinect for Windows Developer Toolkit v1.8** (ships the `SkeletonBasics-D2D` and
|
||||
`KinectExplorer-D2D` samples used to confirm enumeration):
|
||||
<https://www.microsoft.com/en-us/download/details.aspx?id=40276>
|
||||
- **DanceEvolution Arcade** (`gamekdm.dll` + data) and **spice2x** with its Kinect-bypass option,
|
||||
per your P3dro200 install. These are not provided here.
|
||||
|
||||
## Two Windows paths
|
||||
|
||||
| Path | What it proves | Status |
|
||||
| --- | --- | --- |
|
||||
| **Device-level** (usbip-win VHCI + MS Kinect driver) | IS-1 (OS enumerates a Kinect) + IS-2 (real MS NUI skeletonizes synthetic depth) | `[~]` unverified: needs Windows + a USB/IP client. This is the authoritative path. |
|
||||
| **Kinect10.dll NUI shim** (`fallback/windows-nui/`) | IS-3 / IS-4 (the game shows the player and scores) only. It does **not** satisfy IS-1 or IS-2. | DLLs built + export-audited on Linux; runtime load `[~]` unverified. |
|
||||
|
||||
The device path is primary. The shim is the independent escape hatch if the device path cannot be
|
||||
made to bind. Do not report IS-1/IS-2 as proven from the shim.
|
||||
|
||||
---
|
||||
|
||||
## Path A: device-level (usbip-win) `[~]`
|
||||
|
||||
### A1. Run the emitter (on any Linux/WSL2 box reachable over TCP)
|
||||
|
||||
The USB/IP server is OS-agnostic and already built + socket-verified on Linux. The Windows side
|
||||
adds no device logic; it just attaches a VHCI client across TCP (loopback if co-located).
|
||||
|
||||
```sh
|
||||
cmake -S attach/linux -B attach/linux/build && cmake --build attach/linux/build
|
||||
./attach/linux/build/kinect_attach serve --port 3240 # exports 1-1 camera, 1-2 audio, 1-3 motor
|
||||
```
|
||||
|
||||
For a real session the emitter is fed by the tracker/synth pipeline (see `docs/setup-linux.md`);
|
||||
standalone `serve` uses a placeholder frame source, which is enough to prove binding/enumeration.
|
||||
|
||||
### A2. Install a USB/IP VHCI client on Windows
|
||||
|
||||
Two prebuilt clients work. Scripts for both live in `attach/windows/scripts/` (run from an
|
||||
elevated PowerShell).
|
||||
|
||||
- **usbip-win2 (vadimgrn), recommended.** Attestation/WHLK-signed UDE driver, usually needs no
|
||||
test-signing and no Secure Boot change. MSI from
|
||||
<https://github.com/vadimgrn/usbip-win2/releases>. Requires Windows 10 1903+.
|
||||
|
||||
```powershell
|
||||
cd attach\windows\scripts
|
||||
.\Install-UsbIpWin.ps1 -Client usbip-win2 -InstallerPath C:\path\to\USBip-<ver>.x64.msi
|
||||
.\Attach-Kinect.ps1 # attaches busids 1-1, 1-2, 1-3
|
||||
.\Verify-KinectDevice.ps1 # confirms the three PIDs bound to the MS Kinect driver
|
||||
```
|
||||
|
||||
- **usbip-win (cezanne), legacy fallback.** Test-signed driver. Requires the test-signing posture
|
||||
below. Release zip from <https://github.com/cezanne/usbip-win/releases>.
|
||||
|
||||
### A3. Test-signing posture (legacy client, or any unsigned driver) `[~]`
|
||||
|
||||
Windows x64 enforces driver signing. A self-built or test-signed VHCI driver loads only when the
|
||||
box is in test-signing mode, trusts the test certificate, and has Secure Boot off. This is a
|
||||
**personal-use development posture, not production.**
|
||||
|
||||
```powershell
|
||||
cd attach\windows\scripts
|
||||
|
||||
# 1. Turn Secure Boot OFF in UEFI firmware first. Then:
|
||||
.\Enable-TestSigning.ps1 -PfxPath C:\path\to\usbip-win-<ver>\usbip_test.pfx
|
||||
# runs: bcdedit /set testsigning on
|
||||
# warns if Secure Boot is still on; imports usbip_test.pfx (password: usbip)
|
||||
# into LocalMachine Root AND TrustedPublisher. REBOOT after this.
|
||||
|
||||
# 2. Install the test-signed VHCI driver, then attach + verify.
|
||||
.\Install-UsbIpWin.ps1 -Client usbip-win -PackageDir C:\path\to\usbip-win-<ver>
|
||||
.\Attach-Kinect.ps1
|
||||
.\Verify-KinectDevice.ps1
|
||||
```
|
||||
|
||||
Facts to expect:
|
||||
|
||||
- **`bcdedit /set testsigning on`** is the command that relaxes signature enforcement.
|
||||
- **Secure Boot must be OFF**, or firmware re-enforces the same policy and the driver will not load.
|
||||
- **A "Test Mode Windows <build>" desktop watermark** appears in the lower-right after a reboot.
|
||||
It is expected and harmless; it does not affect gameplay.
|
||||
- **spice2x anti-tamper interaction:** test-signing and injected DLLs can trip DEA/spice2x
|
||||
integrity checks. Use spice2x's Kinect-bypass option (it clears the boot-time Kinect presence
|
||||
check only; it provides no gameplay data), and if the game refuses to boot under test mode,
|
||||
confirm spice2x is configured to tolerate the virtual device before assuming the driver failed.
|
||||
|
||||
### A4. Pass criteria for the device path
|
||||
|
||||
1. Device Manager shows the three Kinect devices (`VID_045E&PID_02AE` camera, `PID_02AD` audio,
|
||||
`PID_02B0` motor) bound to the **Microsoft Kinect driver** (`kinect*.inf`), no yellow-bang. If
|
||||
`Verify-KinectDevice.ps1` reports the service/INF as `usbip*`, the VHCI stub attached but the MS
|
||||
driver did not match the descriptors; confirm the 1.8 runtime is installed.
|
||||
2. The NUI runtime enumerates it: `KinectExplorer-D2D` lists the sensor, or `SkeletonBasics-D2D`
|
||||
opens it; equivalently `NuiGetSensorCount() >= 1`.
|
||||
|
||||
Capture a Device Manager screenshot + the KinectExplorer window to
|
||||
`.omo/evidence/task-12-webcam-kinect-emulator.*`.
|
||||
|
||||
### A5. Teardown
|
||||
|
||||
```powershell
|
||||
.\Detach-Kinect.ps1 -All
|
||||
.\Disable-TestSigning.ps1 # legacy client only; reboot; re-enable Secure Boot
|
||||
```
|
||||
|
||||
The one open risk on this path is isochronous camera framing: the shared server models the ISO IN
|
||||
endpoints as single packets without the USB/IP `iso_packet_descriptor` array. Whether the Windows
|
||||
VHCI + MS Kinect driver accept that simplification is the question todo 13 resolves. If rejected,
|
||||
the fix extends the shared `core/` + `attach/linux` ISO path (reused by Windows for free), not a
|
||||
Windows-only change. See `attach/windows/docs/approach.md` for the full analysis.
|
||||
|
||||
---
|
||||
|
||||
## Path B: Kinect10.dll NUI shim `[~]`
|
||||
|
||||
The clean-room shim is a drop-in `Kinect10.dll` that feeds skeleton/depth to the game directly from
|
||||
the shared core engine. It proves playability (IS-3/IS-4), not enumeration.
|
||||
|
||||
### B1. Pick the right architecture
|
||||
|
||||
DEA/`gamekdm.dll` is likely x86 (32-bit). Confirm from a Developer Command Prompt:
|
||||
|
||||
```
|
||||
dumpbin /headers gamekdm.dll # FILE HEADER machine: 14C = x86, 8664 = x64
|
||||
```
|
||||
|
||||
A 64-bit DLL will not load into a 32-bit game. Use the matching artifact:
|
||||
`fallback/windows-nui/build/Kinect10-x86.dll` or `Kinect10-x64.dll`.
|
||||
|
||||
### B2. Install the shim
|
||||
|
||||
1. Back up (do not overwrite) the system `Kinect10.dll`.
|
||||
2. Copy the matching built DLL into the DEA directory **beside `gamekdm.dll`**, renamed to
|
||||
`Kinect10.dll`.
|
||||
3. Start the tracker so it publishes frames into the named shared-memory region the shim reads.
|
||||
The shim opens the region named by `KINECT_SHIM_SHM` (default `kinect_virtual_frames`); the
|
||||
tracker must publish under the same name. When the region is absent the shim still ticks at
|
||||
30 Hz and reports a no-player frame, so the game never hangs.
|
||||
4. Boot DEA through spice2x with the Kinect bypass and enter a dance.
|
||||
|
||||
The exported surface is a 21-function superset of the minimum DEA imports. Confirm against DEA's
|
||||
real import list with `dumpbin /imports gamekdm.dll`; if the spike reveals an extra symbol, add it
|
||||
to `fallback/windows-nui/Kinect10.def` and a stub in `src/exports.cpp` and rebuild. See
|
||||
`fallback/windows-nui/README.md`.
|
||||
|
||||
### B3. Building the shim from source
|
||||
|
||||
The repo ships prebuilt `Kinect10-x86.dll` / `-x64.dll`. To rebuild (MSVC is authoritative; MinGW
|
||||
cross is a smoke signal):
|
||||
|
||||
```sh
|
||||
cd fallback/windows-nui && bash build.sh # cross-build both arches on Linux
|
||||
# or, on Windows with MSVC:
|
||||
cmake -S . -B build-x86 -DCMAKE_TOOLCHAIN_FILE=toolchain-mingw-x86.cmake && cmake --build build-x86
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## DEA configuration (per P3dro200)
|
||||
|
||||
1. Install Kinect for Windows Runtime + SDK v1.8 and the Developer Toolkit v1.8.
|
||||
2. Install DEA and spice2x per the P3dro200 layout; enable spice2x's **Kinect bypass** so the game
|
||||
clears its boot-time Kinect presence check.
|
||||
3. Choose one path: attach the device (Path A) so the MS NUI runtime enumerates a real Kinect, or
|
||||
drop the matching `Kinect10.dll` shim beside `gamekdm.dll` (Path B).
|
||||
4. Start the tracker (webcam + MediaPipe) so synthetic frames are flowing before launching DEA.
|
||||
5. Launch DEA through spice2x, calibrate once (see `docs/calibration.md`), and confirm the player
|
||||
silhouette appears and moves track. Record the gameplay proof to
|
||||
`.omo/evidence/task-13-webcam-kinect-emulator.*`.
|
||||
|
||||
If the player silhouette is mirrored, moves invert, or the player drops out, see
|
||||
`docs/troubleshooting.md`.
|
||||
@@ -0,0 +1,95 @@
|
||||
# Troubleshooting
|
||||
|
||||
Common failures and what to check. Grouped by symptom.
|
||||
|
||||
## The player is mirrored, or moves invert (left/right swapped)
|
||||
|
||||
The mirror bit is wrong. A raw camera image is left/right flipped relative to how a Kinect presents
|
||||
the scene, and the `mirror` flag corrects it.
|
||||
|
||||
- Redo the mirror-confirm calibration step (`docs/calibration.md`, step 1): raise only your
|
||||
anatomical right arm and let the tracker set the flag.
|
||||
- The mirror toggles map to the Kinect depth/video hflip registers (`0x17` depth, `0x47` video). If
|
||||
you set them by hand, confirm you flipped the depth stream, not just color.
|
||||
- If scoring is directionally inverted in DEA but the silhouette looks correct, it is still the
|
||||
mirror: the skeleton's left/right joints are swapped. Recalibrate mirror, do not touch scale.
|
||||
|
||||
## The player drops out / "player lost" mid-session
|
||||
|
||||
The tracker lost the subject (left frame, occluded, or poor light). The pipeline is built to hold
|
||||
the last good frame briefly and recover on its own, event/heartbeat driven, without crashing the
|
||||
host app (plan todo 17, IS-8).
|
||||
|
||||
- Step back into full frame; tracking should re-acquire within a second or two.
|
||||
- Improve lighting; a low-visibility pose publishes joints marked inferred and holds, rather than
|
||||
emitting garbage.
|
||||
- If the tracker process actually died, the emitter keeps serving a safe no-player frame (tracking
|
||||
id 0), so the game sees "no skeleton" instead of hanging. Restart the tracker; no host restart
|
||||
needed.
|
||||
- Persistent dropouts with the subject clearly in frame usually mean the capture resolution or fps
|
||||
is too low for the model tier. Re-measure fps at your real capture resolution and prefer the
|
||||
`full` tier.
|
||||
|
||||
## Depth is out of range or flat (no articulation)
|
||||
|
||||
The host tracker needs articulated depth inside the Kinect band (roughly 800 to 4000 mm), not a
|
||||
flat wall.
|
||||
|
||||
- Run the Linux e2e harness (`tools/e2e_linux_validation/run_e2e.py`). It fails loudly with
|
||||
"depth is not articulated" if the per-frame spread is under 100 mm, which means depth pegged flat.
|
||||
- Flat depth at ~800 mm is the old placeholder behavior. Live depth is routed through the
|
||||
`core/mapping` Z0 + depthGain placement (plan todo 21) so it varies per joint across the body. If
|
||||
you see flat depth, confirm the tracker is publishing through mapping, not the raw pass-through.
|
||||
- Out-of-band depth (everything 0, or clipped) usually means Z0 is wrong: recalibrate the T-pose so
|
||||
your standing distance sets the depth origin inside the 0.8 to 4.0 m clamp.
|
||||
- The depth packing is 11-bit at 640x480 by default (register `0x12 = 0x03`); a consumer expecting a
|
||||
different mode reads garbage. Match the consumer's requested mode.
|
||||
|
||||
## The OpenNI2 driver is not discovered (Linux)
|
||||
|
||||
`libOpenNI2.so` finds drivers only in `<libdir>/OpenNI2/Drivers`, by scanning for `*.so.0` files.
|
||||
There is no `OPENNI2_DRIVERS_PATH` env var honored by this build.
|
||||
|
||||
- Confirm `libSynthKinect.so.0` is in
|
||||
`~/.local/openni2-root/usr/lib/x86_64-linux-gnu/OpenNI2/Drivers/`. The
|
||||
`cmake --build fallback/linux-openni2/build` step copies it there automatically; re-run the build
|
||||
if it is missing.
|
||||
- Set `LD_LIBRARY_PATH` to the OpenNI2 lib dir when running a consumer:
|
||||
`LD_LIBRARY_PATH=$HOME/.local/openni2-root/usr/lib/x86_64-linux-gnu`.
|
||||
- If `OPENNI2_ROOT` is not the default `$HOME/.local/openni2-root`, override the CMake cache var so
|
||||
the driver deploys into your actual install's `OpenNI2/Drivers`.
|
||||
|
||||
## MediaPipe fails to load (Linux)
|
||||
|
||||
- `libGLESv2.so.2` missing: stage it user-space (see `docs/setup-linux.md`, step 2b) and prepend
|
||||
`~/.cache/kinect/gllibs` to `LD_LIBRARY_PATH`.
|
||||
- No model bundle: fetch the `.task` tiers into `tracker/models/` (step 2a).
|
||||
- Wrong Python: MediaPipe 1.x has no wheel for system Python 3.14 here; use the `uv`-created
|
||||
Python 3.12 venv at `tracker/.venv`.
|
||||
|
||||
## The Windows device never binds / Device Manager shows usbip, not Kinect
|
||||
|
||||
- `Verify-KinectDevice.ps1` reporting the service as `usbip*` means the VHCI stub attached but the
|
||||
MS Kinect driver did not match the descriptors. Confirm the Kinect for Windows Runtime + SDK v1.8
|
||||
is actually installed (it provides `kinect*.inf`), and that all three busids (1-1, 1-2, 1-3) are
|
||||
attached, not just the camera. An incomplete sensor can make `NuiCreateSensorByIndex` reject it.
|
||||
- If a self-built/test-signed driver will not load: you omitted a signing step. Confirm
|
||||
`bcdedit /set testsigning on` ran, Secure Boot is OFF in firmware, and the test certificate is
|
||||
imported into both LocalMachine Root and TrustedPublisher. The "Test Mode" watermark confirms
|
||||
test-signing is active; its absence after reboot means it did not take. This is exactly the
|
||||
failure the Windows guide's signing section exists to prevent.
|
||||
- Prefer the signed usbip-win2 client first; it usually needs no test-signing at all.
|
||||
|
||||
## DEA will not boot under test mode / spice2x blocks it
|
||||
|
||||
- Enable spice2x's Kinect-bypass option so the game clears its boot-time Kinect presence check.
|
||||
- Test-signing plus an injected `Kinect10.dll` shim can trip anti-tamper. Confirm spice2x tolerates
|
||||
the virtual device before concluding the driver or shim failed.
|
||||
|
||||
## Isochronous framing rejected on Windows
|
||||
|
||||
The shared USB/IP server models the camera ISO IN endpoints as single packets without the
|
||||
`iso_packet_descriptor` array. If the Windows VHCI + MS Kinect driver reject that, the fix is in the
|
||||
shared `core/` + `attach/linux` ISO path (reused by Windows), not a Windows-only change. See
|
||||
`attach/windows/docs/approach.md` section 5. If USB/IP cannot carry the ISO streams at all, drop to
|
||||
the `Kinect10.dll` NUI shim for playability (it does not prove enumeration).
|
||||
@@ -0,0 +1,33 @@
|
||||
# packaging/ - per-OS runnable bundles
|
||||
|
||||
`build_bundle.sh` assembles a runnable bundle of first-party build outputs plus the docs, one per
|
||||
OS. It copies already-built artifacts; it does not compile. Build first (see
|
||||
[docs/setup-linux.md](../docs/setup-linux.md) / [docs/setup-windows.md](../docs/setup-windows.md)),
|
||||
so every bundle reflects a real, tested output.
|
||||
|
||||
```sh
|
||||
packaging/build_bundle.sh linux [OUTDIR] # default: dist/kinect-linux
|
||||
packaging/build_bundle.sh windows [OUTDIR] # default: dist/kinect-windows
|
||||
```
|
||||
|
||||
The script fails loudly (naming the missing artifact and the build to run) if an expected output is
|
||||
absent, rather than shipping an incomplete bundle.
|
||||
|
||||
## What a bundle contains
|
||||
|
||||
| OS | Contents |
|
||||
| --- | --- |
|
||||
| **linux** | `lib/libnui_core.a`; `openni2/Drivers/libSynthKinect.so.0` (the OpenNI2 SynthKinect driver); `bin/openni2_depth_consumer`, `bin/depth_stats_consumer`, and optionally `bin/kinect_attach`; the `tracker/` Python source + `pyproject.toml`; the e2e harness (`run_e2e.py`, `generate_dance_video.py`); docs; `RUN.txt`. |
|
||||
| **windows** | `shim/x86/Kinect10.dll` and `shim/x64/Kinect10.dll` (the clean-room NUI shim, both arches); the usbip-win attach/verify PowerShell scripts + `kinect-usbip.json`; the `tracker/` Python source; docs; `RUN.txt`. |
|
||||
|
||||
## What a bundle never contains
|
||||
|
||||
Per the plan's hard guardrail, a bundle links to but never redistributes:
|
||||
|
||||
- the Microsoft Kinect for Windows 1.8 Runtime/SDK (`Kinect10.dll` real runtime, `kinect*.inf`),
|
||||
- NiTE2,
|
||||
- any DanceEvolution Arcade asset,
|
||||
- the tracker's `.venv` and MediaPipe `.task` model bundles (environment-specific; the setup guide
|
||||
reproduces them, and `tracker/models/README.txt` in the bundle carries the download commands).
|
||||
|
||||
Those are supplied by the user from their official sources.
|
||||
@@ -0,0 +1,114 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# build_bundle.sh - assemble a per-OS runnable bundle of the webcam virtual Kinect v1
|
||||
# from already-built artifacts. It copies, it does not build (run the builds first, per
|
||||
# docs/setup-linux.md and docs/setup-windows.md), so a bundle always reflects real,
|
||||
# verified outputs rather than a fresh untested compile.
|
||||
#
|
||||
# Usage:
|
||||
# packaging/build_bundle.sh linux [OUTDIR] # default OUTDIR: dist/kinect-linux
|
||||
# packaging/build_bundle.sh windows [OUTDIR] # default OUTDIR: dist/kinect-windows
|
||||
#
|
||||
# What it MUST NOT do (and does not): bundle the MS Kinect 1.8 runtime, NiTE2, or any DEA
|
||||
# asset. Those are linked from the docs and supplied by the user. This script only packages
|
||||
# first-party build outputs plus the docs.
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
OS="${1:-}"
|
||||
case "$OS" in
|
||||
linux|windows) ;;
|
||||
*) echo "usage: $0 <linux|windows> [outdir]" >&2; exit 2 ;;
|
||||
esac
|
||||
OUTDIR="${2:-$ROOT/dist/kinect-$OS}"
|
||||
|
||||
say() { printf '[bundle] %s\n' "$*"; }
|
||||
die() { printf '[bundle] ERROR: %s\n' "$*" >&2; exit 1; }
|
||||
need() { [ -e "$1" ] || die "missing artifact: $1 (build it first, see docs/setup-$OS.md)"; }
|
||||
copy() { mkdir -p "$(dirname "$2")"; cp -a "$1" "$2"; say "+ ${2#$OUTDIR/}"; }
|
||||
|
||||
rm -rf "$OUTDIR"
|
||||
mkdir -p "$OUTDIR"
|
||||
|
||||
# --- docs shared by every bundle ---
|
||||
copy "$ROOT/README.md" "$OUTDIR/README.md"
|
||||
copy "$ROOT/LICENSE" "$OUTDIR/LICENSE"
|
||||
copy "$ROOT/docs/setup-$OS.md" "$OUTDIR/docs/setup-$OS.md"
|
||||
copy "$ROOT/docs/calibration.md" "$OUTDIR/docs/calibration.md"
|
||||
copy "$ROOT/docs/troubleshooting.md" "$OUTDIR/docs/troubleshooting.md"
|
||||
|
||||
# --- the tracker (Python source; the user creates tracker/.venv per the setup guide) ---
|
||||
# The .venv and model bundles are environment-specific and are NOT bundled; the setup guide
|
||||
# reproduces them. We ship the source, pyproject, and a models/ placeholder with instructions.
|
||||
mkdir -p "$OUTDIR/tracker"
|
||||
for f in __init__.py contract.py control.py fake_pose.py joint_mapping.py pose.py \
|
||||
publisher.py tracker.py pyproject.toml README.md; do
|
||||
copy "$ROOT/tracker/$f" "$OUTDIR/tracker/$f"
|
||||
done
|
||||
mkdir -p "$OUTDIR/tracker/models"
|
||||
cat > "$OUTDIR/tracker/models/README.txt" <<'EOF'
|
||||
Download the MediaPipe pose_landmarker .task bundles here (lite/full/heavy).
|
||||
See docs/setup-linux.md step 2a for the exact curl commands.
|
||||
EOF
|
||||
|
||||
if [ "$OS" = linux ]; then
|
||||
# --- OS-agnostic core library + the verified Linux OpenNI2 surface + e2e harness ---
|
||||
core_lib=""
|
||||
for cand in "$ROOT/build/linux/core/libnui_core.a" \
|
||||
"$ROOT/attach/linux/build/core/libnui_core.a"; do
|
||||
[ -e "$cand" ] && { core_lib="$cand"; break; }
|
||||
done
|
||||
[ -n "$core_lib" ] || die "missing libnui_core.a (build the core, see docs/setup-linux.md)"
|
||||
copy "$core_lib" "$OUTDIR/lib/libnui_core.a"
|
||||
|
||||
need "$ROOT/fallback/linux-openni2/build/OpenNI2/Drivers/libSynthKinect.so.0"
|
||||
copy "$ROOT/fallback/linux-openni2/build/OpenNI2/Drivers/libSynthKinect.so.0" \
|
||||
"$OUTDIR/openni2/Drivers/libSynthKinect.so.0"
|
||||
copy "$ROOT/fallback/linux-openni2/build/openni2_depth_consumer" \
|
||||
"$OUTDIR/bin/openni2_depth_consumer"
|
||||
[ -e "$ROOT/tools/e2e_linux_validation/build/depth_stats_consumer" ] && \
|
||||
copy "$ROOT/tools/e2e_linux_validation/build/depth_stats_consumer" \
|
||||
"$OUTDIR/bin/depth_stats_consumer"
|
||||
|
||||
[ -e "$ROOT/attach/linux/build/kinect_attach" ] && \
|
||||
copy "$ROOT/attach/linux/build/kinect_attach" "$OUTDIR/bin/kinect_attach"
|
||||
|
||||
# the e2e harness + its deps, so a bundle can self-validate
|
||||
copy "$ROOT/tools/e2e_linux_validation/run_e2e.py" \
|
||||
"$OUTDIR/tools/e2e_linux_validation/run_e2e.py"
|
||||
copy "$ROOT/tools/e2e_linux_validation/generate_dance_video.py" \
|
||||
"$OUTDIR/tools/e2e_linux_validation/generate_dance_video.py"
|
||||
|
||||
cat > "$OUTDIR/RUN.txt" <<'EOF'
|
||||
Linux bundle. Deploy openni2/Drivers/libSynthKinect.so.0 into your OpenNI2 install's
|
||||
<libdir>/OpenNI2/Drivers, start the tracker (docs/setup-linux.md), then run
|
||||
bin/openni2_depth_consumer. See docs/setup-linux.md for the full reproduction.
|
||||
EOF
|
||||
|
||||
elif [ "$OS" = windows ]; then
|
||||
# --- the clean-room Kinect10.dll shim (both arches) + the attach scripts ---
|
||||
need "$ROOT/fallback/windows-nui/build/Kinect10-x86.dll"
|
||||
need "$ROOT/fallback/windows-nui/build/Kinect10-x64.dll"
|
||||
copy "$ROOT/fallback/windows-nui/build/Kinect10-x86.dll" "$OUTDIR/shim/x86/Kinect10.dll"
|
||||
copy "$ROOT/fallback/windows-nui/build/Kinect10-x64.dll" "$OUTDIR/shim/x64/Kinect10.dll"
|
||||
|
||||
# the usbip-win attach/verify PowerShell scripts + config
|
||||
for s in Attach-Kinect.ps1 Detach-Kinect.ps1 Enable-TestSigning.ps1 \
|
||||
Disable-TestSigning.ps1 Install-UsbIpWin.ps1 Verify-KinectDevice.ps1; do
|
||||
copy "$ROOT/attach/windows/scripts/$s" "$OUTDIR/attach/scripts/$s"
|
||||
done
|
||||
copy "$ROOT/attach/windows/config/kinect-usbip.json" "$OUTDIR/attach/config/kinect-usbip.json"
|
||||
copy "$ROOT/attach/windows/README.md" "$OUTDIR/attach/README.md"
|
||||
copy "$ROOT/attach/windows/docs/approach.md" "$OUTDIR/attach/approach.md"
|
||||
|
||||
cat > "$OUTDIR/RUN.txt" <<'EOF'
|
||||
Windows bundle. Pick ONE path (see docs/setup-windows.md):
|
||||
Device path: run the attach/scripts against a running USB/IP emitter.
|
||||
Shim path: copy shim/<arch>/Kinect10.dll beside gamekdm.dll (match DEA's bitness).
|
||||
You must install the MS Kinect 1.8 Runtime+SDK yourself; it is never bundled here.
|
||||
EOF
|
||||
fi
|
||||
|
||||
say "bundle assembled at: $OUTDIR"
|
||||
say "done."
|
||||
Reference in new issue
Block a user