Skip to content

Use OrientedBoundingBox for collision checks - #1480

Merged
zhx06 merged 6 commits into
mainfrom
zxiao/feature/obb-collision
Oct 26, 2026
Merged

zhx06 merged 6 commits into
mainfrom
zxiao/feature/obb-collision

Conversation

@zhx06

@zhx06 zhx06 commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Use oriented bounding boxes for placement collision loss and validation. Keep the existing interval calculation for axis-aligned boxes and batch collision checks across candidates. This builds on OrientedBoundingBox from #1477.

Why this change?

Enclosing AABBs can overlap even when rotated objects are separate. Placement previously penalized and rejected those layouts, although the oriented geometry was available.

What changes?

  • Preserve each candidate's rotation and assigned object geometry through solving, filtering, ranking and validation.
  • Loss for rotated boxes: multiply the interval overlaps along each box's face axes, and penalize the harmonic mean of the two volumes.
    • It is zero exactly when a face axis separates the boxes by at least clearance_m, and it equals the intersection volume for axis-aligned pairs.
    • When only one box's projections sit inside the other's, the other box's volume still gives a gradient.
    • CachedOverlapVolumeUpperBound caches the rotation-dependent terms once per solve. Its compute() still returns the smaller volume, a true upper bound.
  • Validate with the separating-axis test.
  • Keep the axis-aligned loss, directed gradients and existing mesh checks. Use matching collision geometry for meshless background obstacles.
  • RelationSolver prepares pair routing for the box and mesh losses once per solve.
  • In the oriented loss, used when any collision box in a solve is rotated, boxes thinner than 2 mm count as 2 mm thick. A flat object that overlaps an obstacle therefore still has an overlap volume to reduce.

collision_bboxes stores oriented geometry once per batch, and each candidate's enclosing AABBs are derived from it. Those AABBs remain available for relation constraints and mesh proxies. For rotated rows they can differ from the previous rotation code by up to about 2e-7 m.

CollisionMode.BBOX uses this automatically. Arbitrary-yaw results can change, including existing clutter examples. Support containment and clutter release initialization remain AABB-based; the existing rotated-support and On(overlap=True) containment issues need a separate correction.

Results

The placement-success benchmark (#1497) ran every RoboLab and KitchenBench spec on main and on this branch, with 50 layouts × 3 seeds per spec.

Setting Suite Layout success, main → this PR Change (95% interval) Valid candidates, main → this PR Change (95% interval)
Random yaw RoboLab (38) 64.6% → 76.4% +10.9 to +12.3 pts 36.2% → 64.6% +28.0 to +28.7 pts
Random yaw KitchenBench (20) 31.8% → 33.1% −0.1 to +2.6 pts 8.2% → 8.5% −0.1 to +0.7 pts
As authored RoboLab (38) 94.2% → 94.2% −0.8 to +0.8 pts 67.0% → 67.6% +0.2 to +1.0 pts
As authored KitchenBench (20) 84.2% → 84.2% −1.6 to +1.7 pts 27.3% → 27.3% −0.7 to +0.6 pts
  • Random yaw: 24 RoboLab tasks improve significantly after a Holm adjustment, and none get worse. Bin and clutter tasks gain the most:
    • throw_away_snacks: layout success goes from 28% to 100%, and valid candidates from 3% to 68%;
    • marker_in_mug: valid candidates go from 7% to 82%.
  • KitchenBench is unchanged. Random yaw also turns its robot away from the fixture it is placed next to, and that dominates its failures, so its random-yaw row says little about oriented boxes.
  • As authored: no suite gets worse. Two RoboLab tasks improve, food_packing_1_boxes and food_packing_1_cans (valid candidates 75% → 84%).
  • Why it improves: the separating-axis test is exact for boxes, so rotated layouts that enclosing AABBs falsely rejected now pass.
  • Exact quarter turns are unchanged: positions, losses and verdicts match main.

Limitations

  • Tilted boxes: the loss can penalize tilted boxes that the separating-axis test finds separate.
  • Crossed rods: when two long, thin boxes cross in an X, both face-axis volumes are flat and the gradient is zero. In a probe with two 0.5 m rods at random yaw, 73.4% of candidates were valid, against 78.7% with the enclosing-AABB loss under the same validator. A follow-up adds an in-plane enclosing-box term to rotated pairs, which reached 84.5% in the same probe.
  • Near-quarter yaws: robot yaws such as yaw_rad: 1.57 in KitchenBench are not exact quarter turns, so those scenes take the oriented path. Positions matched main in a probe; only the cost differs.

Performance

  • Per solver iteration: cost rises in rotated scenes, because each directed pair stores a rotation per candidate. Caching the rotation-dependent terms makes iterations 6–26% faster on CPU and lowers peak memory by 16–22%, compared with recomputing them. The harmonic mean adds 4–10% per iteration on CPU over the smaller volume.

    Scene (objects × candidates) CPU per iteration Peak GPU memory
    6 × 640 3.2 → 3.5 ms 2.4 → 6.6 MiB
    12 × 1024 7.3 → 9.8 ms 15.2 → 44.4 MiB
    25 × 1024 26.5 → 37.0 ms 65.8 → 194.6 MiB
  • Validation is batched across candidates, which offsets much of the solver cost.

  • Full-suite wall time was noisy on a shared machine. Random-yaw RoboLab went from 979 to 802 s. As authored, the median spec took 16% longer.

These are placement measurements, not physics-acceptance rates.

Validation

  • Benchmark: the runs above compare main at 88f83c967a with this branch's final loss, before rebasing onto the Isaac Lab 3.0 update (Update Arena to Isaac Lab 3.0 release #1481). All 69 specs ran with no failures in both settings.
  • CI: every check passes on 16e712dce3, including both test jobs.
  • Local tests:
    • 392 placement, geometry and collision tests pass, including the relation-solver visualization example;
    • 24 simulator tests pass, covering clutter placement, embodiment collision meshes, placement after build-time variations, and relation placement from YAML;
    • pre-commit passes.
  • Stuck gradient: a test places a yawed bar whose own-axis volume is constant against a cube. It checks that the smaller volume has zero gradient there, while the loss pushes the bar out.
  • Exact quarter turns: candidate positions, losses and verdicts match the AABB baseline exactly. The harmonic mean equals the exact volume for axis-aligned pairs.
  • Zero thickness: a test checks that a zero-thickness panel overlapping a fixed block gets a loss and is pushed clear; it fails without the 2 mm minimum.
  • Loss vs validator: in 1.6M random pairs, yaw-only and tilted, at margins 0 and 0.01, the validator accepted every layout the loss treats as clear. The harmonic mean is zero exactly where the smaller volume is, so this still holds.

@zhx06 zhx06 changed the title use obb for collision checks Use OrientedBoundingBox for collision checks Oct 19, 2026
@zhx06
zhx06 force-pushed the zxiao/feature/obb-geometry branch from aaf7170 to b1bebfc Compare October 20, 2026 17:06
@zhx06
zhx06 force-pushed the zxiao/feature/obb-collision branch from c43326d to 78c30b3 Compare October 21, 2026 06:43
@zhx06
zhx06 force-pushed the zxiao/feature/obb-geometry branch from b1bebfc to 1ff97e5 Compare October 21, 2026 17:52
@zhx06
zhx06 force-pushed the zxiao/feature/obb-collision branch from 78c30b3 to 3e2045c Compare October 22, 2026 15:22
@zhx06
zhx06 force-pushed the zxiao/feature/obb-geometry branch from 1ff97e5 to 69fb952 Compare October 22, 2026 15:52
@zhx06
zhx06 changed the base branch from zxiao/feature/obb-geometry to main October 22, 2026 19:30
@zhx06
zhx06 force-pushed the zxiao/feature/obb-collision branch from 3e2045c to e695eea Compare October 22, 2026 20:39
@zhx06
zhx06 marked this pull request as ready for review October 22, 2026 20:40
@greptile-apps

greptile-apps Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

The PR preserves rotated collision boxes through candidate solving and validation.

  • Placement collision checks use each candidate’s rotated box.

No actionable issues were found.

Author zhx06 explicitly acknowledges that tilted boxes can receive a penalty despite passing SAT, that support containment and clutter initialization remain AABB-based, and that mesh penalties can disagree with validation near contact. These are documented limitations or deferred work, not new findings.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Assigned object geometry and candidate rotations] --> B[Build enclosing and oriented bounds]
    B --> C[Optimize positions with cached box projections]
    C --> D[Apply FaceTo headings and rebuild bounds]
    D --> E[Batched box checks and existing mesh checks]
    E --> F[Rank validated candidates per environment]
Loading

Reviews (1) · Last reviewed commit: "fix docs and tests" · Reviewed by Greptile

@arena-review-bot

Copy link
Copy Markdown
Contributor

🤖 Isaac Lab-Arena Review Bot

Summary

This PR switches CollisionMode.BBOX from enclosing AABBs to oriented boxes. The solver now penalizes a face-axis overlap-volume bound, and the no-overlap validator runs a batched SAT check across candidates. The approach is sound and well covered by tests. The main concern is that the new loss can stop giving any gradient while two boxes still overlap. The other comments suggest ways to keep the new box state and caching smaller.

Design, Boundaries & Scope

  • Default results change for many users. BBOX is the default mode, so seeded layouts will change for anyone who uses random_yaw_init, ClutterOn (its random_yaw defaults to True), FaceTo, or a non-quarter-turn RotateAroundSolution. Keeping it on by default seems reasonable: validation now only accepts extra layouts whose boxes really don't overlap. Still, downstream users should hear about it in a release note.
  • Box state is spread across several places. RelationSolverState gains three box maps, a geometry cache and a keyed pair cache. PlacementCandidateBatch.collision_bboxes holds the same geometry as each candidate.bboxes, in a second form that update_candidate_bounds has to keep in sync. The inline comments suggest three changes:
    • Prepare the pair cache in RelationSolver.solve, next to _mesh_cache.
    • Drop the duplicate maps.
    • Derive the enclosing boxes from the collision boxes.

Findings

🟡 Warning: isaaclab_arena/relations/no_overlap_bbox.py:235: The loss takes torch.minimum of the two face-axis volumes. When the smaller volume is saturated on every axis, the loss stays positive but the subject gets exactly zero gradient, even when the other box's frame would still push it out. The validator still rejects these layouts, so the cost is fewer valid candidates, not bad layouts.

🔵 Improvement: isaaclab_arena/relations/relation_solver_state.py:155: The pair cache's key can't change during a solve. The cache could be prepared once in RelationSolver.solve the same way _mesh_cache is. That removes the key, two fields and the circular import of no_overlap_bbox.

🔵 Improvement: isaaclab_arena/relations/relation_solver_state.py:124: _enclosing_collision_bboxes repeats get_bbox and _fixed_obstacle_world_bboxes. _collision_bboxes copies the fixed world boxes again, next to boxes stored relative to each movable object's origin.

🔵 Improvement: isaaclab_arena/relations/bounding_box_helpers.py:138: update_candidate_bounds rotates every object's bounds twice. The enclosing boxes could be derived from the collision boxes with to_aabb().

🔵 Improvement: isaaclab_arena/relations/object_placer_params.py:27-29 (not in the diff): The random_yaw_init docstring still says collisions use "the conservative box enclosing the rotated object". That is no longer true in BBOX mode.

Test Coverage and CI Cost

  • The new tests use plain torch and don't start a SimulationApp, so they add little CI time.
  • test_validator_oriented_boxes_clear_fixed_obstacles_and_support_enclosing_bounds repeats cases that other tests in this PR already check (see the inline comment).
  • When this review ran, "Run tests" and "Run tests with subprocess" were still in progress, so I couldn't confirm that the test suite passes. Pre-commit and the docs build had passed.

Verdict

Minor fixes needed

@alexmillane alexmillane left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

The only functional issue is the one that the bot commented on about the loss being zero even when there's overlap in some cases.

My additional small comments are about breaking up some functions, moving some code to different places.

Comment thread isaaclab_arena/utils/bounding_box.py Resolved
Comment thread isaaclab_arena/utils/bounding_box.py Resolved
zhx06 added 5 commits October 23, 2026 14:05
Signed-off-by: zhx06 <zihaox@nvidia.com>
Signed-off-by: zhx06 <zihaox@nvidia.com>
Signed-off-by: zhx06 <zihaox@nvidia.com>
Signed-off-by: zhx06 <zihaox@nvidia.com>
Signed-off-by: zhx06 <zihaox@nvidia.com>
@zhx06
zhx06 force-pushed the zxiao/feature/obb-collision branch from e695eea to f2249a6 Compare October 23, 2026 21:06
Signed-off-by: zhx06 <zihaox@nvidia.com>
@zhx06
zhx06 merged commit e07dfaa into main Oct 26, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants