# Isaac runbook (URDF → USD) — DIY VR Goggles

**Simulation-tested · Not built.** Isaac is used here only to produce `robot/robot.usd` and to check that it loads. There is no learned controller, so there is no Isaac training task (RL-ISAAC, RL-SIM2SIM and POLICY-PLAYABLE are N/A, see `docs/PLAN.md`).

Environment used on 2026-10-11: Isaac Lab 3.0.0, Isaac Sim 6.1.0-rc.26 (`C:\isaac-sim\IsaacLab\_isaac_sim`), URDF importer 3.0 ("URDF USD Converter v0.3.2"), PhysX schema 110.3, Newton 1.5.2, USD 0.25.5, RTX 5060 Ti (16 GB). Isaac runs in its own Python; only files cross over. GPU queue only.

## One command

```
uv run tasks.py usd                 # convert + flatten + dump + load probes (PhysX, Newton) + model_checks (about 30 s)
uv run tasks.py usd --skip-convert  # reuse runs/usd_import
uv run tasks.py usd --no-probe      # flatten + dump only
uv run tasks.py describe            # (CPU) rewrites model_consistency.json; it reads usd_dump.json + usd_load_probe.json
```

## What it runs (exact commands)

`tools/tasks/_common.py: isaac()` calls `C:\isaac-sim\IsaacLab\isaaclab.bat -p <script> ...` with `VIRTUAL_ENV`, `UV_PROJECT_ENVIRONMENT`, `PYTHONHOME` and `PYTHONPATH` removed and the project `.venv` stripped from `PATH`, working directory `C:\isaac-sim\IsaacLab`. `<P>` is `C:\Users\matth\Desktop\Robots for ZMass\VR Goggles`.

1. Convert (Isaac Lab's script; Isaac Lab 3.0 has no `--headless` flag, it is headless unless `--viz` is given):
   ```
   isaaclab.bat -p scripts\tools\convert_urdf.py "<P>\package\robot\robot.urdf" "<P>\runs\usd_import" --joint_stiffness 0 --joint_damping 0
   ```
   Output: `runs/usd_import/robot/robot.usda` + `payloads/` (variant set `Physics` = physics | physx | mujoco | none; default `physics`). Gains are 0 because the importer applies one value to every joint, which would put a spring on the passive strap pivots; the servo gains live in `spec.yaml` / `robot/robot.xml`.
2. Flatten and dump (plain `pxr`):
   ```
   isaaclab.bat -p "<P>\package\simulation\isaac\tools\usd_flatten_dump.py" "<P>\runs\usd_import\robot\robot.usda" "<P>\package\robot\robot.usd" "<P>\package\docs\sim-tests\usd_dump.json" "<P>\package\robot\robot.urdf"
   ```
   Writes one self-contained layer (ASCII encoding inside `robot.usd`, about 2 MB, Git LFS):
   - de-instances first (session layer only), because `Flatten()` numbers instance prototypes in a run-dependent order;
   - authors the rack couplings' `newton:mimicCoef1` per degree for Isaac Sim PhysX (see Findings, DESIGN_LOG D16).
   Two runs, including a fresh conversion, give byte-identical `robot.usd` and `usd_dump.json`.
3. Load probe, once per backend:
   ```
   isaaclab.bat -p "<P>\package\simulation\isaac\tools\usd_load_probe.py" "<P>\package\robot\robot.usd" "<P>\package\docs\sim-tests\usd_load_probe.json" "<P>\package\robot\robot.xml" "<P>\package\robot\robot.urdf" --physics isaacsim_physx
   isaaclab.bat -p ... same ... --physics newton_mjwarp
   ```
   It loads `robot.usd` as an Isaac Lab `Articulation` with the root link fixed and gravity on (dt 1 ms from `robot.xml`). Servo kp/kv come from `robot.xml`; coupling references come from `robot.urdf` `<mimic>`. It runs three 1 s phases: hold 0, then +half range, then −half range. Recorded: finite state, limits, servo error at the end of each phase, and each mimic follower's worst coupling error over all steps.
4. `package/src/model_checks.py` (project Python, via `tasks.py usd` or `tasks.py describe`) → `docs/sim-tests/model_consistency.json`.

## Results (2026-10-11, `docs/sim-tests/`)

| Item | Result | Evidence |
|---|---|---|
| Importer output | 11 rigid bodies, 10 joints (4 servo revolutes, 4 prismatic slides, 2 strap revolutes), 5 `NewtonMimicAPI` followers, 0 fixed joints, one articulation root on `headset_shell` (floating; the URDF has no world link) | `usd_dump.json` |
| Flattened `robot.usd` | self-contained (1 layer, 0 asset references), 35 visual meshes, 96 collision prims, metres/kg, Z up | `usd_dump.json` |
| MODEL-LOAD (USD, Isaac Sim PhysX) | **PASS**: loaded, 10 joints / 11 bodies, finite, within limits | `usd_load_probe.json`, `model_consistency.json` |
| MODEL-CONSIST (USD vs CAD/spec) | **PASS**: worst static relative difference 6e-8 (mass, principal inertia, COM, axes, origins, limits, maxForce, Newton velocity/damping/friction, couplings) | `model_consistency.json` |
| PhysX coupling, rack slides | worst 0.0104 mm over the probe = 0.24 % of the slide range (threshold `consistency_frac` 1 %); MuJoCo gives 0.027 mm | `usd_load_probe.json` |
| PhysX coupling, strap loop | worst 1.7e-6 deg | `usd_load_probe.json` |
| Newton (MuJoCo-Warp, kitless) | **NOT RUN**: the process crashes (access violation) | see Findings |

## Findings

1. **Cross-type mimic joints.** The importer copies each URDF `<mimic multiplier="0.006">` (prismatic slide following a revolute pinion, m/rad) into `newton:mimicCoef1` unchanged. The `NewtonMimicAPI` schema (newton_usd_schemas 0.5.0) says leader and follower "must be the same joint type", and that cross-type coefficients have "no well defined units and [are] not supported".
   - Isaac Sim PhysX reads them anyway, but per **degree** of the leader. With 0.006 the slides reached their stops at 1.3° of servo (coupling error 6.9 mm). With 0.006 × π/180 the error was 0.010 mm. With the mimic disabled the slides stayed put (3.5 mm).
   - `robot.usd` therefore carries 1.0472e-4 m/deg, with the SI value in `diyvr:mimicMultiplierSI` (DESIGN_LOG D16).
   - The strap loop is revolute → revolute and needs no change.
2. **Newton backend.** `UsdPhysics.LoadUsdPhysicsFromRange` in `newton/_src/utils/import_usd.py:587` crashed with an access violation (0xC0000005) on the flattened `robot.usd`, in both binary and ASCII encodings and with the slide mimics disabled.
   - The importer's layered `runs/usd_import/robot/robot.usda` loaded in Newton. There, the rack slides did not follow (3.5 mm error, the cross-type mimic is ignored as the schema says), and the strap follower was 1.3° off.
   - Newton is therefore not a supported target for this file. Its result is NOT RUN, and only PhysX gates MODEL-LOAD (USD).
   - To retry: `uv run tasks.py usd`; the crash is recorded under `backends.newton_mjwarp` in `usd_load_probe.json`.
3. `isaaclab.bat` exits 0 even when its Python dies natively. `tools/tasks/usd.py` therefore checks that each probe wrote its record, and writes a crash record if it did not.
4. The rack coupling convention was measured only on Isaac Sim 6.1.0-rc.26 / PhysX 110.3. Re-run `tasks.py usd` after any Isaac update: the probe's coupling error shows immediately whether the convention changed.

## Not done here (optional)

- GPU timing of the schedule simulation's job classes (eye render, reprojection, hand inference) on the RTX 5060 Ti, to replace ESTIMATED durations (ASSUMPTIONS A29): **NOT RUN**. It needs a GPU-queue slot and a SteamVR/OpenXR-free render benchmark.
