Repository navigation
Derive Object geometry from its spawn configuration - #1430
Conversation
Split compute_local_bounding_box_from_usd into a stage-based helper so callers that compose their own stage (for example with selected USD variants) get the same bounds. A None scale keeps the authored root scale, matching UsdFileCfg(scale=None) at spawn time. Signed-off-by: Clemens Volk <[email protected]>
ObjectGeometry computes bounds and the contact-body suffix from a single native spawn config: USD assets on an in-memory referencing stage with their variants selected, and Isaac Lab primitive shapes analytically. USD results keep the frame, root-scale rule and shallowest rigid body that Object uses today. get_geometry_key identifies the settings that change geometry, so callers can cache results per configuration. Signed-off-by: Clemens Volk <[email protected]>
Object bounds, corners and the contact-sensor body now come from object_cfg.spawn through cached ObjectGeometry, so edits to the spawn config, or replacing it, are reflected. Declared constructor inputs keep their values. bounding_box is now only an explicit override, and get_contact_sensor_prim_path no longer takes a usd_path argument. Objects spawned from Isaac Lab primitives get bounds and contact paths. Signed-off-by: Clemens Volk <[email protected]>
WarpMeshAndSphereCache now extracts meshes and builds cache keys from object_cfg.spawn, so an object whose spawn config is replaced no longer reuses the declared asset's mesh. Objects without a single USD spawn, including RigidObjectSet's MultiUsdFileCfg, fall back to their bounds. Signed-off-by: Clemens Volk <[email protected]>
Signed-off-by: Clemens Volk <[email protected]>
The comment in open_usd_stage said pxr is not loaded at module scope, but object_geometry already imports pxr through isaaclab_arena.utils.usd.helpers. Import Sdf and Usd at module level and drop the comment and the TYPE_CHECKING block. The ObjectGeometry docstring described the bounds rule as what Object.get_bounding_box() has always used. It now states the rule: the default prim's origin is the frame, its authored rotation is kept, and a tuple spawn scale replaces the authored root scale. The compute_local_bounding_box_from_usd docstring described the call chain. It now states the scale rule that matches UsdFileCfg.scale. Signed-off-by: Clemens Volk <[email protected]>
The nested-body test asset only scaled its default prim. Give /Asset a translation and a rotation as well, so the tests compare the geometry referenced from the spawn config with bounds read directly from the file for a default prim that is translated, rotated and scaled. Rename test_usd_bounds_and_contact_body_match_main_helpers to ..._match_file_helpers, since it compares against the file-based helpers and not against main. Remove the unused tmp_path parameter from test_warp_mesh_cache_follows_spawn_cfg. Signed-off-by: Clemens Volk <[email protected]>
🤖 Isaac Lab-Arena Review BotSummaryThis PR moves Findings🔵 Improvement: Question (unchanged code, VerdictShip it |
|
The class computes geometry from a spawn configuration before anything is spawned. ArenaWorld reports the live geometry of the spawned scene, so the old name left it unclear which of the two a caller gets. Rename the module, the class and Object's cache helper, and say in the docstring how the two relate. Also write RigidObjectSet's member contact-path lookup as a plain loop with named values; the longer helper name made the comprehension hard to read. Signed-off-by: Clemens Volk <[email protected]>
Nothing read the attribute; Object already caches each geometry under its key. The constructor still rejects multi-asset spawners, now through a helper shared with get_geometry_key(). Signed-off-by: Clemens Volk <[email protected]>
Mesh extraction multiplies a tuple spawn scale onto the authored root scale, while Isaac Lab replaces it. This predates this change; record the cause and the planned fix next to the scale handling. Signed-off-by: Clemens Volk <[email protected]>
Key primitive shapes by the half extents their bounds come from, so each shape's dimensions are read in one place. Make the variant helper private and return an empty dict when no variants are set, which removes the None checks in its callers. Signed-off-by: Clemens Volk <[email protected]>
The assets page never described where bounds come from, and an object with a custom spawner gets an assertion that says to set bounding_box. Signed-off-by: Clemens Volk <[email protected]>
"Variant" also names spawn entries in Isaac Lab's cloner and object-set members in Arena. Use "USD variant selections" in the helper name and docstrings, and explain what a selection does. Signed-off-by: Clemens Volk <[email protected]>
The bounds divide out the authored root scale and apply the spawn scale along world axes. That equals Isaac Lab's spawn only for a uniform authored scale or an unrotated root, so the docstrings now say so. Signed-off-by: Clemens Volk <[email protected]>
Signed-off-by: Clemens Volk <[email protected]>
qianl-nv
left a comment
There was a problem hiding this comment.
Overall clean change. Approved with small nits
The SpawnCfgGeometry class docstring no longer names its callers, and its bounds rules move to get_bounding_box. The note on when the per-axis rescaling matches Isaac Lab's spawn moves from the compute_local_bounding_box_from_stage docstring to a comment where the scales are combined. Signed-off-by: Clemens Volk <[email protected]>
Say what the cache is keyed by and which edits to object_cfg.spawn give new geometry. Signed-off-by: Clemens Volk <[email protected]>
The per-object cache moves to one cache shared across objects in a follow-up PR, as agreed in the review. Signed-off-by: Clemens Volk <[email protected]>
The class docstring said it was a pick-up object for pick-and-place, but Object also builds articulated and static (BASE) assets, chosen by object_type. Raised in the review of #1430. Signed-off-by: Clemens Volk <[email protected]>
Add a docstring rule to `AGENTS.md`: describe what the code is and does, not who calls it or which features use it. ## Why this change? A docstring that names its callers, for example "Placement and contact-sensor setup use it", goes stale when the callers change, and a search finds the callers anyway. This came up in the review of #1430. ## What changes? - One bullet under "Docstrings style" in `AGENTS.md`. --------- Signed-off-by: Clemens Volk <[email protected]> Co-authored-by: arena-review-bot[bot] <290456231+arena-review-bot[bot]@users.noreply.github.com>
discover_passive_assets() skipped every object without a USD path, because bounds used to come from the USD file. Since #1430 they come from object_cfg.spawn, so a rigid object without a USD path, such as a primitive shape or an object set, has bounds too. Skip only non-rigid objects without a USD path, such as lights and the ground plane, and drop the object-set special case. A relation-free rigid primitive with a fixed pose now blocks placement, like ProceduralTable and ProceduralCube, which pass usd_path="". Signed-off-by: Clemens Volk <[email protected]>
Spawn each `RigidObjectSet` member from its own spawn configuration through Isaac Lab's `MultiAssetSpawnerCfg`, so members keep their scale and the physics settings, USD variant selections and materials set in their spawn configurations. This is the second step toward choosing an object's asset through a variation, after #1430. ## Why this change? We plan to let experiments choose which registered asset a scene object spawns with, the way they already vary lighting, camera pose or mass. This will be a build-time variation, `AssetSelectionVariation`: for an object such as `pickup` it picks one of several registered assets, for example a cracker box or a sugar box, for each environment. Each chosen asset must spawn exactly as registered, with its own scale and physics settings. Isaac Lab supports this natively: `MultiAssetSpawnerCfg` spawns every entry from its own spawn configuration. `RigidObjectSet` does not use it yet. It spawns a `MultiUsdFileCfg`, which gives all members one configuration, so members lose the physics settings, USD variant selections and visual materials set in their spawn configurations, and Arena writes rescaled copies of member USD files to keep their scale. Materials authored in the USD files were already kept. This PR switches `RigidObjectSet` to `MultiAssetSpawnerCfg`. It keeps one step that Isaac Lab does not cover: Isaac Lab finds a rigid object's body through one path for all environments, so members whose bodies sit at different paths get a cached copy with the body moved to a common path. `AssetSelectionVariation` will use both: `MultiAssetSpawnerCfg` to spawn the assets chosen for the environments, and `align_rigid_body_paths` to give them a common body path. ## What changes? - `align_rigid_body_paths(spawn_cfgs)` (`utils/usd/rigid_body_path_alignment.py`) returns copies of the spawn configurations with their rigid bodies at one path. If the paths already agree, the copies are unchanged and nothing is written. Otherwise every member must be a USD asset, and each gets a cached `rigid_<sha256>.usd` copy with its body at `/rigid_body`, its materials kept and its USD variant selections baked in. Settings that name prims inside the asset, such as `prim_physics` or `visual_material_bindings`, are rejected in that case. - `RigidObjectSet` spawns the aligned copies: one member as a plain config, more members as a `MultiAssetSpawnerCfg`. Members may be primitive shapes when their body paths agree. - Per-environment assignment is unchanged: `assign_variants()` still expands the spawn entries to one per environment. This expansion is transitional. The next PR pins assignments through Isaac Lab's clone strategy. - `object_set_utils.py`, the old rescale-and-rename cache, and its tests are deleted. - The file-based `find_shallowest_rigid_body` is deleted, because its last production caller was the old set code. Its tests use `find_shallowest_rigid_body_from_stage` instead. Effect on existing code: - The physics settings, USD variant selections and visual materials set in members' spawn configurations now reach the spawned set. The YCB members share a body path and spawn their own files. `sweet_potato` and `jug` keep their rigid body at different paths, so they spawn copies with the body moved to `/rigid_body`, with their scales kept on the spawn config instead of baked into the file. - `member_usd_paths` and `object_usd_paths` are removed. A set with several members exposes its spawn entries as `object_cfg.spawn.assets_cfg`: one per member, or one per environment after `assign_variants()`. A one-member set spawns the member's own config at `object_cfg.spawn`. Callers in the repo are updated. - Configure members before building the set. Per-environment assignment rebuilds the entries in `object_cfg.spawn.assets_cfg` from the members, so edits to single entries do not survive it. Set-wide settings on `object_cfg.spawn` do. - A set-level `scale` or `spawn_cfg_addon` is rejected, and a set-level `asset_cfg_addon` now applies, as for `Object`. No caller passes any of them. - A copy with the body moved drops an authored root translation and rotation, as Isaac Lab's spawn does. For `computer_mouse_hot3d_robolab`, this swaps two bounds axes compared with #1430's bounds, which keep the rotation (follow-up: #1430's bounds will drop the authored root rotation too). ## Usage example Before (the set kept only each member's USD path and scale): ```python sugar_box.object_cfg.spawn.mass_props = sim_utils.MassPropertiesCfg(mass=0.3) pickup_object = RigidObjectSet(name="pickup", objects=[cracker_box, sugar_box]) pickup_object.object_cfg.spawn.mass_props # None: one MultiUsdFileCfg for both members, the mass is dropped ``` After: ```python sugar_box.object_cfg.spawn.mass_props = sim_utils.MassPropertiesCfg(mass=0.3) pickup_object = RigidObjectSet(name="pickup", objects=[cracker_box, sugar_box]) pickup_object.object_cfg.spawn.assets_cfg[1].mass_props.mass # 0.3 ``` ## Validation - `pre-commit run --all-files` passes. - Test phases in the Arena container: Phase 1 1488 passed and 3 failed, Phase 2 27 passed, Phase 3 64 passed and 2 failed. The 5 failures are the same as on main and #1430: four need the optional tetrahedralization dependency (`pytetwild`), and the multi-env mimic test hits its 900 s timeout. The review GUI tests give 45 passed and 1 failed (`test_run_sim_preview_via_simapp_subprocess`), which fails the same way on #1430's head. - Library check over all 173 registered rigid assets: contact paths are unchanged, and the YCB members already share a body path, so their set spawns the original files and writes no copies. Moving the rigid body of every registered rigid USD asset into a copy: 169 keep their bounds, 1 changes (the rotated mouse above), none are rejected. - The full phases ran on cde46e2. The commits after it were checked with the affected test files. - At 5e01c88, which included main with #1427 and #1426 and the final #1430, before the branch was rebased onto main after #1430 merged (the rebased head aa9b074 has identical files): the object-set, body-path alignment, geometry, environment-graph and clutter tests pass (80 passed), the heterogeneous placement and rigid-body tests pass (35), the camera test passes, and the review GUI tests pass apart from the known `test_run_sim_preview_via_simapp_subprocess` (45 passed). #1427's placement tests passed after the main merge (16 and 51). The library check gives the same result as above. - After the rename of the module to `rigid_body_path_alignment.py` (7941495), its tests and the object-set tests pass (45 passed). - A relation-free set with a fixed pose still blocks placement, as on main (eafbb63). Set, collision and placement tests pass (50 and 46). - New tests were checked to fail when the behaviour they guard is removed: clearing the root translation and rotation before the body is moved, de-instancing before body discovery, and keeping path-keyed settings when the body paths already match. --------- Signed-off-by: Clemens Volk <[email protected]>
PickAndPlaceTask, ObjectInTask and SortMultiObjectTask built their contact sensors in their constructors, so each sensor kept the rigid-body path of the spawn configuration its object had then. Object geometry follows object_cfg.spawn since #1430, but a spawn configuration replaced after the task was built left the sensor and its filter on the old body. Build the sensors in get_scene_cfg() instead, which ArenaEnvBuilder.compose_manager_cfg() calls after the build-time variations. The three tasks no longer have a scene_config attribute, and SortMultiObjectTask no longer has pick_up_object_contact_sensor_list. Nothing in the repository read them. Signed-off-by: Clemens Volk <[email protected]>
PickAndPlaceTask, ObjectInTask and SortMultiObjectTask built their contact sensors in their constructors, so each sensor kept the rigid-body path of the spawn configuration its object had then. Object geometry follows object_cfg.spawn since #1430, but a spawn configuration replaced after the task was built left the sensor and its filter on the old body. Build the sensors in get_scene_cfg() instead, which ArenaEnvBuilder.compose_manager_cfg() calls after the build-time variations. The three tasks no longer have a scene_config attribute, and SortMultiObjectTask no longer has pick_up_object_contact_sensor_list. Nothing in the repository read them. Signed-off-by: Clemens Volk <[email protected]>
PickAndPlaceTask, ObjectInTask and SortMultiObjectTask built their contact sensors in their constructors, so each sensor kept the rigid-body path of the spawn configuration its object had then. Object geometry follows object_cfg.spawn since #1430, but a spawn configuration replaced after the task was built left the sensor and its filter on the old body. Build the sensors in get_scene_cfg() instead, which ArenaEnvBuilder.compose_manager_cfg() calls after the build-time variations. The three tasks no longer have a scene_config attribute, and SortMultiObjectTask no longer has pick_up_object_contact_sensor_list. Nothing in the repository read them. Signed-off-by: Clemens Volk <[email protected]>
PickAndPlaceTask, ObjectInTask and SortMultiObjectTask built their contact sensors in their constructors, so each sensor kept the rigid-body path of the spawn configuration its object had then. Object geometry follows object_cfg.spawn since #1430, but a spawn configuration replaced after the task was built left the sensor and its filter on the old body. Build the sensors in get_scene_cfg() instead, which ArenaEnvBuilder.compose_manager_cfg() calls after the build-time variations. The three tasks no longer have a scene_config attribute, and SortMultiObjectTask no longer has pick_up_object_contact_sensor_list. Nothing in the repository read them. Signed-off-by: Clemens Volk <[email protected]>
PickAndPlaceTask, ObjectInTask and SortMultiObjectTask built their contact sensors in their constructors, so each sensor kept the rigid-body path of the spawn configuration its object had then. Object geometry follows object_cfg.spawn since #1430, but a spawn configuration replaced after the task was built left the sensor and its filter on the old body. Build the sensors in get_scene_cfg() instead, which ArenaEnvBuilder.compose_manager_cfg() calls after the build-time variations. The three tasks no longer have a scene_config attribute, and SortMultiObjectTask no longer has pick_up_object_contact_sensor_list. Nothing in the repository read them. Signed-off-by: Clemens Volk <[email protected]>
PickAndPlaceTask, ObjectInTask and SortMultiObjectTask built their contact sensors in their constructors, so each sensor kept the rigid-body path of the spawn configuration its object had then. Object geometry follows object_cfg.spawn since #1430, but a spawn configuration replaced after the task was built left the sensor and its filter on the old body. Build the sensors in get_scene_cfg() instead, which ArenaEnvBuilder.compose_manager_cfg() calls after the build-time variations. The three tasks no longer have a scene_config attribute, and SortMultiObjectTask no longer has pick_up_object_contact_sensor_list. Nothing in the repository read them. Signed-off-by: Clemens Volk <[email protected]>
0.2.0 fails at import on Arena main (dc77564): its resolve_layout names build_checks_for_placer_params, which Arena removed. 0.4.0 is the composer ported to Arena main from isaac-sim/IsaacLab-Arena#1430 on.
Derive
Objectbounds, corners, contact-sensor body and MESH-mode collision mesh fromobject_cfg.spawnthrough a newSpawnCfgGeometryclass, instead of from the constructor inputs. This is the first step toward asset selection as a variation, which installs the chosen asset by replacingobject_cfg.spawn.Why this change?
We want experiments to choose which registered asset a scene object spawns with, the way they already vary lighting, camera pose or mass. One environment can then be evaluated on many objects without editing it, and every episode result names its asset. The planned
AssetSelectionVariationmakes this choice at build time, before objects are placed.Each
Objectstores an Isaac Lab spawn configuration inobject_cfg.spawn. It tells Isaac Lab what to spawn: for a USD asset the file, scale and physics settings, for a primitive the shape and size. Asset selection keeps the scene object, for examplepickup, and swaps its asset by replacingobject_cfg.spawnwith the chosen asset's spawn configuration.Before the scene is spawned, Arena also needs the object's geometry. Placement relations such as
Onuse its bounding box, collision checks in MESH mode use its mesh, and contact sensors attach to its rigid body. Onmain, Arena computes this geometry from the arguments the object was built with (usd_path,scaleandspawn_cfg_addon["variants"]), not fromobject_cfg.spawn. After a swap, the geometry would still describe the old asset. For example, ifpickupis built as a cracker box and selection installs a sugar box, placement uses the cracker box's height and the contact sensor looks for the cracker box's rigid body.This PR computes the geometry from
object_cfg.spawn, so placement, collision checks and contact sensors always see the asset that is actually spawned. Replacingobject_cfg.spawnis then all selection has to do.Objects built directly from a spawn configuration, such as primitive shapes or
spawner_cfg=UsdFileCfg(...), have nousd_path. Onmainthey therefore get no bounding box and no contact-sensor body. With this PR they get both.What changes?
SpawnCfgGeometrycomputes bounds and the contact-body path from one spawn config, before anything is spawned.ArenaWorldstill reports the live geometry of the spawned scene.UsdFileCfg: references the USD into an in-memory stage and applies the USD variant selections inUsdFileCfg.variants. Bounds use the same frame and scale rule ascompute_local_bounding_box_from_usd(). The contact body is the shallowest rigid body.CuboidCfg,SphereCfg, ...): analytic bounds. The contact body is the root whenrigid_propsis set.Object.bounding_box.Objectcaches oneSpawnCfgGeometryper geometry key (USD path, scale, USD variant selections, shape size,rigid_props). A geometric edit toobject_cfg.spawnrecomputes it, a physics or rendering edit does not.WarpMeshAndSphereCachetakes the MESH-mode USD path and scale fromobject_cfg.spawn. It ignores USD variant selections, as before.RigidObjectSetbuilds aUsdFileCfgper member to find its contact body. The next PR spawns members from their own spawn configs and removes this.Effect on existing code: all 294 registered library objects keep their bounds and contact paths, and no environment behaves differently. Only direct callers of these methods and unusual USD files see a difference:
get_contact_sensor_prim_path()no longer takes ausd_pathargument. No caller in the repo passes one.get_bounding_box()no longer writes its result intobounding_box. Settingbounding_boxstill overrides the bounds, and no code read the written value.tabletop_place_upright_environmentscales its background after construction. The background's bounds and mesh now include that 0.6 z-scale, matching what spawns. Nothing in that environment reads them.Left for follow-ups:
ArenaWorld.get_aabb_in_local_frame()measures from the rigid body. They differ for assets whose rigid body is offset below the default prim.warp_mesh_manager.pydescribes the fix.SpawnCfgGeometry. Spawn object-set members from their own spawn configurations #1434 deletesfind_shallowest_rigid_body. Follow-ups moveDeformableObjectbounds, the BASE contact filter inObject.get_contact_sensor_cfg()and MESH-mode mesh extraction ontoSpawnCfgGeometry.compute_local_bounding_box_from_usdcan go after that, andread_asset_rigid_body_pathswill share the in-memory stage setup instead of repeating it.Validation
pre-commit run --all-filespasses.kitchen_benchandmaple_table_topspawn with a USD variant selection ({"Physics": "physics"}) match as well.RigidObjectSetis not covered.run-testsphases in the Arena container: 1470 passed and 3 failed, 27 passed, 64 passed and 2 failed. The full phases ran on c59d2de and 378c665. After the review rounds, the affected test files pass on bbeddef (54 passed), and the geometry and object-set tests on 554a60a (24 passed).All 5 failures also fail on main in the same container:
test_all_assets_in_registry,test_experiment_runner_all_environmentsand twotest_deformable_object.pytests need Isaac Lab's optional tetrahedralization dependency, which is not installed. So the registry-wide scene build and the all-environments run are not verified here.