Repository navigation
Optimize heterogeneous bin-packing view - #7333
Conversation
Keep the existing scene configuration, clone combinations, and layout flow while changing grocery slots to spawn-only assets. Manage all spawned groceries through one flat PhysX rigid-body view.
Greptile SummaryThe PR replaces per-slot rigid-object views in the heterogeneous bin-packing demo with spawn-only assets managed through one flat PhysX rigid-body view.
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness, security, or quality issues identified. The flat view preserves the existing pose and velocity conventions while batching reset, mass, and out-of-bounds operations over the matched grocery bodies. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
Config[Spawn-only grocery configurations] --> Scene[Cloned heterogeneous scene]
Scene --> View[Flat PhysX RigidBodyView]
View --> Metadata[Environment and slot metadata]
Metadata --> Reset[Batched pose, velocity, and mass reset]
View --> Bounds[Read transforms and detect out-of-bounds groceries]
Bounds --> Correction[Restore spawn pose and zero velocity]
Correction --> View
Reviews (1): Last reviewed commit: "Optimize heterogeneous bin-packing view" | Re-trigger Greptile |
There was a problem hiding this comment.
Isaac Lab Review Bot
The demo’s single flat PhysX rigid-body view is a reasonable local optimization, but its direct transform writes bypass the quaternion-layout conversion previously handled by RigidObject.
- Design and architecture: Replacing per-slot
RigidObjectviews with spawn-only assets and one path-indexedRigidBodyViewpreserves the heterogeneous layout design while moving raw PhysX tensor-boundary responsibilities into the demo. That boundary must explicitly handle transform representation conventions. - API: No public Isaac Lab API is changed. The modified
grocery_cfgreturn type and new flat-view helper are local to the demo, and no source package or public documentation surface is affected. - Implementation: The reset path supplies Isaac Lab
wxyzquaternions directly to the PhysX tensor API, which expectsxyzw; the stray-object correction similarly insertsspawn_pose_wrows into PhysX transform buffers without conversion. Convert quaternions at both the write and read boundaries to preserve the orientations produced by the previousRigidObjectpath.
Minor fixes needed. Posted 1 actionable finding inline.
Automated review; human maintainers own approval decisions.
| pose = groceries.spawn_pose_w.clone() | ||
| noise_quat = math_utils.quat_from_euler_xyz(noise[..., 0], noise[..., 1], noise[..., 2]) | ||
| pose[..., 3:7] = math_utils.quat_mul(pose[..., 3:7], noise_quat) | ||
| groceries.root_view.set_transforms(wp.from_torch(pose.contiguous()), groceries.all_indices) |
There was a problem hiding this comment.
🟡 Warning · Implementation — Quaternion layout not converted at PhysX boundary
grocery_spawn_poses, quat_from_euler_xyz, and quat_mul produce (w, x, y, z), while omni.physics.tensors transforms use (x, y, z, w). The replaced write_root_pose_to_sim_index performed this conversion; writing pose directly here, and assigning spawn_pose_w into the get_transforms buffer at line 404, mixes conventions and yields wrong reset orientations. Convert to xyzw before set_transforms and back after get_transforms.
Description
This PR reduces the number of physics views created by
scripts/demos/bin_packing.py. It keeps the existing scene configuration, clone combinations, and randomized layout flow, but changes each grocery slot to a spawn-onlyAssetBaseCfgand manages all spawned groceries through one flat PhysXRigidBodyView.This is a demo-only performance optimization and adds no dependencies.
Type of change
Testing
uv run isaaclab -fuv run python -m py_compile scripts/demos/bin_packing.pyuv run isaaclab -p scripts/demos/bin_packing.py --num_envs 2 --visualizer noneThe 2-environment PhysX smoke test completed scene setup, created one flat grocery view, and ran without errors.
Screenshots
Not applicable; the rendered scene and randomized layouts are unchanged.
Checklist
uv run isaaclab -f.CONTRIBUTORS.md.