|
| 1 | +# Environment Profiles: bin-stack SkillGen on the neutral task id |
| 2 | + |
| 3 | +Design record for the `EnvironmentProfile` mechanism |
| 4 | +(`isaac_autodata_interfaces/env/env_profile.py`) and its first user, the Franka bin-stack |
| 5 | +SkillGen variant. |
| 6 | + |
| 7 | +## Problem |
| 8 | + |
| 9 | +Bin-stack differs from plain cube-stack only in the *scene*: a sorting bin, different cube reset |
| 10 | +distributions, and stiffer contact solving. Upstream Isaac Lab expresses this as specialized env |
| 11 | +subclasses and ids (`Isaac-Stack-Cube-Bin-Franka-IK-Rel-Mimic-v0`), coupling scene variants to |
| 12 | +algorithm-named env ids and `isaaclab_mimic`. AutoData already runs MimicGen and SkillGen |
| 13 | +cube-stack on the neutral `Isaac-Stack-Cube-Franka-IK-Rel-v0`; bin-stack should not be the reason |
| 14 | +to reintroduce specialized env classes. |
| 15 | + |
| 16 | +## Mechanism |
| 17 | + |
| 18 | +An environment profile is a YAML overlay applied to the parsed env config between |
| 19 | +`parse_env_cfg` and `gym.make` (hooked into `setup_env_config`, shared by |
| 20 | +`generate_dataset.py` and `annotate_demos.py` via `--env_profile`). It relies on verified |
| 21 | +Isaac Lab behavior: `InteractiveScene._add_entities_from_cfg` and `EventManager._prepare_terms` |
| 22 | +iterate the config instance's `__dict__`, and skip terms set to `None` — so dynamically set |
| 23 | +scene assets and event terms are consumed exactly like class-declared ones, and |
| 24 | +`setattr(events, name, None)` removes a term. |
| 25 | + |
| 26 | +Profile sections: |
| 27 | + |
| 28 | +- `scene.rigid_objects` — assets to add (`RigidObjectCfg` from a USD file). |
| 29 | +- `scene.rigid_body_properties` — physics patches on existing assets' spawn configs. |
| 30 | +- `reset_events.remove / override / add` — event-term changes; added terms reference their |
| 31 | + function as a `"module.path:function"` string resolved via `string_to_callable`, so the |
| 32 | + upstream coupling lives in the YAML, not in AutoData imports. `*_cfg`/`*_cfgs` params name |
| 33 | + scene assets and become `SceneEntityCfg` at apply time. |
| 34 | +- `planner` — name of the cuRobo planner profile tuned for the resulting scene, resolved via |
| 35 | + the explicit registry in `CuroboPlannerCfg.from_profile`. This replaces env-id substring |
| 36 | + matching (`from_task_name`), which on the neutral id would silently pick the cube config |
| 37 | + (wrong `static_objects`, gripper, retreat, and debug/visualization settings). Without a |
| 38 | + profile the substring fallback is preserved, so existing runs are byte-identical. |
| 39 | + |
| 40 | +## Ownership boundaries |
| 41 | + |
| 42 | +| Concern | Owner | |
| 43 | +|---|---| |
| 44 | +| Subtasks, constraints, generation policy | TaskDescriptor YAML (`tasks/*.yaml`) | |
| 45 | +| Robot frames/kinematics (`eef_offset`) | Embodiment YAML (`embodiments/*.yaml`) | |
| 46 | +| Scene additions, reset randomization, planner-profile name | EnvironmentProfile YAML (`environments/*.yaml`) | |
| 47 | +| Planner tuning per named profile | `CuroboPlannerCfg.from_profile` registry | |
| 48 | +| Generation plumbing (terminations/recorders/obs) | `setup_env_config` | |
| 49 | + |
| 50 | +The upstream bin env's `body_offset`/`ee_frame` = 0.0 is the SkillGen frame convention that this |
| 51 | +repo deliberately replaced with the embodiment `eef_offset` (0.1034 back to `panda_hand`); |
| 52 | +profiles must not replicate it. |
| 53 | + |
| 54 | +## Bin-stack specifics |
| 55 | + |
| 56 | +`environments/franka_bin_stack.yaml` reproduces the upstream deltas verbatim |
| 57 | +(`bin_stack_joint_pos_env_cfg.py`): bin fixed at (0.4, 0, 0.0203); cube_1 (stack base) pinned at |
| 58 | +the same spot inside the bin; cube_2/cube_3 randomized at x(0.65–0.70), y(±0.18), |
| 59 | +min_separation 0.1; `solver_position_iteration_count=40` on the cubes. One deliberate deviation: |
| 60 | +upstream's dead third element in the yaw range tuple is dropped. The success term is untouched — |
| 61 | +the bin env inherits `cubes_stacked` unchanged. |
| 62 | + |
| 63 | +**Quaternion convention:** this repo's pinned Isaac Lab defines |
| 64 | +`InitialStateCfg.rot` as **(x, y, z, w)** — identity is `(0, 0, 0, 1)`, not the `(1, 0, 0, 0)` |
| 65 | +of older wxyz-convention Isaac Lab. Profile `rotation` follows the same (x, y, z, w) order. |
| 66 | +Getting this wrong flips the asset 180° about X **on the USD stage only**: reset events reposition |
| 67 | +the physics body (via Fabric) but never write back to USD, so the sim renders correctly while the |
| 68 | +planner — which builds its static collision world from the stage — sees the asset inverted. |
| 69 | +Upstream's odd-looking bin `init_state.rot=(0, 0, 0, 0.1)` is simply xyzw-identity with a typo'd |
| 70 | +w, normalized away. Corollary: a profile asset's spawn position/rotation must match its pinned |
| 71 | +reset event, because the stage keeps the spawn pose forever. |
| 72 | + |
| 73 | +The planner needs no code changes for the bin: the collision world is extracted from the live |
| 74 | +USD stage per env, and `_is_static` lowercase-substring matching makes the scene asset name |
| 75 | +`blue_sorting_bin` match the bin planner profile's `static_objects=["bin", "table"]`. Keep added |
| 76 | +asset names substring-matching the chosen planner profile's `static_objects`. |
| 77 | + |
| 78 | +`tasks/franka_bin_stack_skillgen.yaml` is structurally identical to the cube-stack SkillGen |
| 79 | +descriptor (same four subtasks and signals) with `action_noise: 0.0` (bin walls leave little |
| 80 | +clearance) — the scene difference lives entirely in the profile. It reuses the cube-stack |
| 81 | +annotated SkillGen source dataset; MimicGen's per-object transforms retarget the skill segments |
| 82 | +to the bin scene, and the planner avoids the bin during transits. |
| 83 | + |
| 84 | +## Caveats |
| 85 | + |
| 86 | +- **Dataset provenance**: the generated HDF5 records only the base env id. Replaying or |
| 87 | + annotating a profile-generated dataset without `--env_profile` builds a scene missing the |
| 88 | + added assets, and `reset_to` will hit unknown state entries. The generation-result sidecar |
| 89 | + records `env_profile: {name, path, planner}`; stamping the resolved profile into the HDF5 |
| 90 | + `env_args` via a recorder hook is a follow-up. |
| 91 | +- **Bin-native auto-annotation** is not possible today: the neutral env's `subtask_terms` group |
| 92 | + lacks `stack_2`, and `annotate_demos.py` rejects `--auto` for SkillGen descriptors. Fine for |
| 93 | + the current workflow (bin reuses the cube-stack annotated dataset). A future `observations:` |
| 94 | + profile section would unblock it. |
| 95 | +- **cuRobo v2** is not wired into `generate_dataset.py` (v1 only); when it is, it should adopt |
| 96 | + the same planner-profile names. The v2 mesh-SDF false-positive issue for small/concave |
| 97 | + obstacles (bins) is fixed upstream as of dev34 (see `curobo_v2_mesh_collision_bug.md`). |
0 commit comments