Skip to content

Reorganize Relation Folder - #1534

Merged
zhx06 merged 2 commits into
mainfrom
zxiao/feature/relations-folder-hierarchy
Oct 27, 2026
Merged

zhx06 merged 2 commits into
mainfrom
zxiao/feature/relations-folder-hierarchy

Conversation

@zhx06

@zhx06 zhx06 commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Reorganize isaaclab_arena/relations/ so that its top level holds only what users write and receive, and move the code that solves and applies placements into subpackages by responsibility. Only module paths and imports change.

Why this change?

relations/ kept 30 modules in one flat folder. Only 10 of them are what users write or receive: the relation types, the placers, their settings and results. The other 20 sat beside them: the solver, its losses, collision geometry, build-time checks and reset-time code. Finding the user API, or the code behind a placement behavior, meant scanning the whole folder, and the flat layout said nothing about how the modules depend on each other.

What changes?

One rule decides where each module goes: it stays at the top level only if users construct or receive it. Every other module moves to the subpackage for the stage of placement it serves.

Before:

isaaclab_arena/relations/      30 modules in one flat folder
├── initializers/
└── validation/

After:

isaaclab_arena/relations/      user API: relation types, placers, their settings and results
├── optimization/              build time: seeds candidate layouts and solves them
│   ├── initializers/
│   └── losses/
├── geometry/                  build time, shared: collision objects, obstacles, bounds, Warp meshes
├── validation/                build time: checks candidate layouts
└── runtime/                   run time: applies a layout at each reset

The folders read in the order placement runs. When the environment is built, optimization/ solves candidate layouts against geometry/, and validation/ checks them. At each reset, runtime/ applies one; it imports nothing from optimization/ or validation/, because it only needs finished layouts. This is the same build-time and run-time split Arena uses for variations.

  • No class or function is renamed, and no logic changes.
  • Imports of the top-level modules, including those in the docs, are unchanged.
  • Each subpackage's __init__.py has a one-line docstring saying what it owns.
  • The old paths of moved modules are not kept, so code outside this repository that imports them must update its imports.
Old to new module paths

Replace whole module names only: relation_solver is a prefix of relation_solver_params, which stays at the top level. The initializers line covers that package's modules.

isaaclab_arena.relations.initializers                   ->  isaaclab_arena.relations.optimization.initializers
isaaclab_arena.relations.placement_candidate_batch      ->  isaaclab_arena.relations.optimization.placement_candidate_batch
isaaclab_arena.relations.placement_candidate_generator  ->  isaaclab_arena.relations.optimization.placement_candidate_generator
isaaclab_arena.relations.relation_solver                ->  isaaclab_arena.relations.optimization.relation_solver
isaaclab_arena.relations.relation_solver_state          ->  isaaclab_arena.relations.optimization.relation_solver_state
isaaclab_arena.relations.loss_primitives                ->  isaaclab_arena.relations.optimization.losses.loss_primitives
isaaclab_arena.relations.mesh_pair_cache                ->  isaaclab_arena.relations.optimization.losses.mesh_pair_cache
isaaclab_arena.relations.no_overlap_bbox                ->  isaaclab_arena.relations.optimization.losses.no_overlap_bbox
isaaclab_arena.relations.no_overlap_mesh                ->  isaaclab_arena.relations.optimization.losses.no_overlap_mesh
isaaclab_arena.relations.relation_loss_strategies       ->  isaaclab_arena.relations.optimization.losses.relation_loss_strategies
isaaclab_arena.relations.background_collision_object    ->  isaaclab_arena.relations.geometry.background_collision_object
isaaclab_arena.relations.bounding_box_helpers           ->  isaaclab_arena.relations.geometry.bounding_box_helpers
isaaclab_arena.relations.collision_object               ->  isaaclab_arena.relations.geometry.collision_object
isaaclab_arena.relations.passive_collision_objects      ->  isaaclab_arena.relations.geometry.passive_collision_objects
isaaclab_arena.relations.warp_mesh_manager              ->  isaaclab_arena.relations.geometry.warp_mesh_manager
isaaclab_arena.relations.warp_sdf_kernels               ->  isaaclab_arena.relations.geometry.warp_sdf_kernels
isaaclab_arena.relations.placement_validation_runner    ->  isaaclab_arena.relations.validation.placement_validation_runner
isaaclab_arena.relations.placement_visualizer           ->  isaaclab_arena.relations.validation.placement_visualizer
isaaclab_arena.relations.placement_events               ->  isaaclab_arena.relations.runtime.placement_events
isaaclab_arena.relations.placement_poses                ->  isaaclab_arena.relations.runtime.placement_poses
isaaclab_arena.relations.placement_sampler              ->  isaaclab_arena.relations.runtime.placement_sampler

Known couplings, left for follow-ups because fixing them moves functions rather than files:

  • RelationSolverParams maps each relation type to its loss strategy, so the top-level settings import optimization/losses/.
  • PlaceableAsset imports runtime/placement_poses.py for its method that writes poses to the simulation.
  • ObjectPlacerParams takes InitializerType, a user choice, from optimization/initializers/.
  • validation/pre_physics.py imports the NextTo and NotNextTo checks from optimization/losses/relation_loss_strategies.py.
  • physics_settle_params.py is used only by offline_placement/; moving it there would reach outside relations/.

Validation

  • Same results: a seeded ObjectPlacer run gives identical positions, yaws, losses and verdicts on main and on this branch. It covers both initializers, with and without random yaw, over 3 environments, plus a PooledObjectPlacer.
  • Phase-1 suite in the dev container, split as CI splits it:
    • PhysX: 1684 passed, 6 skipped (they need a live inference endpoint), 1 expected failure.
    • Newton: 18 passed.
  • Relations tests, one file at a time: 465 pure-Python and 122 simulator tests pass.
  • Imports: every isaaclab_arena.relations import and patch target resolves (958 names in 119 files), and no old module path remains.
  • pre-commit passes.
  • Not run: the cuRobo validator tests, because the dev container has no curobo. Their imports resolve.

@zhx06 zhx06 changed the title Separate Relations API from Placement Solving Reorganize Relation Placement Oct 27, 2026
zhx06 added 2 commits October 27, 2026 09:40
Signed-off-by: zhx06 <zihaox@nvidia.com>
Signed-off-by: zhx06 <zihaox@nvidia.com>
@zhx06
zhx06 force-pushed the zxiao/feature/relations-folder-hierarchy branch from 75f4aaa to a47929b Compare October 27, 2026 17:03
@zhx06
zhx06 marked this pull request as ready for review October 27, 2026 17:08
@greptile-apps

greptile-apps Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

Reorganizes placement code into geometry/, optimization/, validation/, and runtime/. User-facing modules stay at the top level.

  • Build-time layout solving and its starting layouts now live together.
  • Collision shapes and mesh helpers now live together under geometry/.
  • Candidate layout checks and their visualizer now live under validation/.
  • Reset-time sampling and pose writing now live under runtime/.

Acknowledged by zhx06: removing the old import paths is intentional. Existing dependencies involving RelationSolverParams, PlaceableAsset, ObjectPlacerParams, pre_physics.py, and physics_settle_params.py are explicitly deferred.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  API["User-facing relations and placers"] --> OPT["optimization: seed and solve layouts"]
  OPT --> GEO["geometry: collision shapes and bounds"]
  API --> VAL["validation: check layouts"]
  VAL --> GEO
  API --> LAYOUT["Finished layouts"]
  LAYOUT --> RUN["runtime: choose layouts and write poses"]
Loading

Reviews (1) · Last reviewed commit: "describe relations subpackages" · Reviewed by Greptile

@arena-review-bot

Copy link
Copy Markdown
Contributor

🤖 Isaac Lab-Arena Review Bot

Summary

This PR moves 21 modules out of the flat isaaclab_arena/relations/ folder into optimization/, geometry/, validation/ and runtime/, and updates every import. I compared the moved and edited files against the base. Only imports and docstrings change. No references to the old module paths remain anywhere in the repo: code, string patch targets, docs, skills and config are all clean. The PR description already says the old paths are removed without re-exports, so out-of-repo users get an ImportError. The old-to-new table in the description is what the next release's "API migration" notes will need.

Design, Boundaries & Scope

  • PlacementCandidateBatch placement (inline): this is the type every validator receives, but it now lives in optimization/. That creates the only two-way links between the new subpackages, and the known-couplings list doesn't mention them. Keeping the module at the top level, next to placement_result.py, would remove both links.
  • Description wording: "At each reset, runtime/ applies one … because it only needs finished layouts" doesn't hold for the default path. With resolve_on_reset=True, the reset event solve_and_place_objects calls PlacementSampler.sample and then PooledObjectPlacer.sample_for_envs. When an env's queue is empty, that runs the solver and the pre-physics validators during the reset (pooled_object_placer.py:258-259, then _solve_and_store). runtime/ avoids importing optimization/ and validation/ only because the pool object is passed in. The code itself is unchanged here, but the sentence is worth rewording so readers don't assume a reset never solves.

Findings

🔵 Improvement: isaaclab_arena/relations/validation/pre_physics.py:22: PlacementCandidateBatch sits in optimization/. As a result, validation/ imports from optimization/ while optimization/placement_candidate_batch.py imports validation.types, and geometry/ and optimization/ import each other the same way. Both back-links are TYPE_CHECKING-only. Details are in the inline comment.

Test Coverage and CI Cost

I couldn't confirm CI results for this head: the test jobs show as skipped and pre-commit as queued. The description reports local Phase 1 runs (PhysX and Newton) and the relations tests. It also says the cuRobo validator tests were not run. The PR doesn't add or change test logic, so I have no coverage concern beyond that.

Verdict

Ship it

@zhx06 zhx06 changed the title Reorganize Relation Placement Reorganize Relation Folder Oct 27, 2026
@zhx06
zhx06 merged commit f7a6107 into main Oct 27, 2026
36 of 37 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