Skip to content

Unify placement sampling and replay - #1427

Merged
qianl-nv merged 11 commits into
mainfrom
qianl/feature/placement-sampler-replay
Oct 13, 2026
Merged

qianl-nv merged 11 commits into
mainfrom
qianl/feature/placement-sampler-replay

Conversation

@qianl-nv

@qianl-nv qianl-nv commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Unify solved, recorded, and replayed relation layouts around one PlacementSample representation. Route live placement and replay through the variation scheduler and shared scene-root pose application.

Why this change?

Placement and variation record/replay uses separate param and scheduler on main, allowing the two to diverge when assigned to episodes. Route placement record/replay through PlacementSampler to reuse the variation recorder and replay scheduler.

What changes?

  • Make PlacementSample the canonical representation for one layout, with a layout ID and asset poses. Replace PlacementLayouts.
  • Apply both relation-solver output and recorded replay samples through scene-root pose writes.
  • Record placement samples with the variation recorder and restore them with the replay scheduler.
  • Update offline placement recording, pool validation, clutter configurations, and documentation.
  • Add replay experiment definitions for bowl and tool clutter scenes.

This removes the PlacementLayouts container. Callers now pass list[PlacementSample] and use the helpers in placement_sampler.py.

Warning

This changes breaks IL interop for any scene with relation. IL is broken already for variation recorder, but this change adds a recorder for relations. A follow up PR will fix this breakage.

Validation

Passed:

  • pre-commit run --all-files
  • 29 placement sample and recorded-variation unit tests
  • 40 placement event and relation-solver tests
  • 2 settled-placement JSONL tests
  • The placement replay integration test

@qianl-nv
qianl-nv marked this pull request as ready for review October 9, 2026 18:29
@arena-review-bot

arena-review-bot Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Isaac Lab-Arena Review Bot

Summary

This PR replaces PlacementLayouts and the separate cached-replay event with one PlacementSample type and a PlacementSampler. Live, fixed, and recorded placement now all go through the single placement_reset event. Placement is recorded through the variation recorder and replayed through VariationReplayScheduler. Having one write path and one record format is a good simplification. The main issue is a behavior that was quietly dropped during the move, and validation coverage that went away with the deleted test file.

Findings

🟡 Warning: relation_solver_interface.py:125: Recorded replay no longer clears replayed assets' own pose-reset events. The recorded pose wins only because of the event order in compose_manager_cfg.
🟡 Warning: placement_sampler.py:251: No remaining tests cover the failure branches of validate_root_reset_for_placement_replay or validate_placement_sample_assets.
🔵 Improvement: recorded_variation_samples.py:76: The old scene.relation_placement format is still read without a note, and the example JSONL the docs point to still uses it.
🔵 Improvement: placement_events.py:115: write_layout_to_sim's base_rotations values are unused, and the rotation-marker lookup is duplicated.
🔵 Improvement: placement_events.py:143: PlacementPoolHandle / placement_pool now hold a sampler, and the docstring is stale.
🔵 Improvement: relation_solver_interface.py:72: get_scene_root_owners is called only for its asserts.

Not tied to a changed line:

  • Breaking CLI change: --placement_layouts is removed, and recorded_variation_samples_path is not exposed on the environment_runner CLI. Replay is now available only through Experiment Definitions or ArenaEnvBuilderCfg. The PR description mentions removing PlacementLayouts but not this flag, so it is worth calling out for downstream users.
  • Default recording change: every episode record now gets a placement block for envs with relation placement. Replaying any such file with recorded_variation_samples_path also pins placement, with no way to replay only the variations. If that is intended, a sentence in the docs would help.

Verdict

Minor fixes needed

@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 3/5

[High impact] Refactors placement sampling and replay across core modules.

Fix the non-finishing clutter examples and repeated-layout codec failure before merging.

Findings

  1. P1 Clutter replay never finishes ▶
  2. P1 Repeated layouts fail to load ▶
  3. P2 Old placement records accumulate ▶

Summary

The PR unifies live placement, offline recording, and replay around PlacementSample.

  • Live and recorded layouts now share one placement sample and reset path.
  • Replay keeps each placement matched to its recorded episode.
  • Settled layouts now use the shared placement JSONL format.

The public API removal was explicitly described as intentional by qianl-nv; it is not reported as a finding.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Live[Live relation solver] --> Sampler[PlacementSampler]
  File[Recorded episode JSONL] --> Scheduler[VariationReplayScheduler]
  Scheduler --> Sampler
  Scheduler --> Variations[Recorded variation samples]
  Sampler --> Sample[PlacementSample]
  Sample --> Writer[Shared scene-root pose writer]
  Sample --> Recorder[VariationRecorder]
  Recorder --> Output[Episode JSONL placement field]
Loading

Reviews (1) · Last reviewed commit: "Unify placement sampling and replay" · Reviewed by Greptile

@qianl-nv qianl-nv left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

self review 1

@qianl-nv

Copy link
Copy Markdown
Collaborator Author

/review

@qianl-nv

Copy link
Copy Markdown
Collaborator Author

/review

@cvolkcvolk cvolkcvolk 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.

Thanks Qian. Nice cleanup!
Feel free to have a stab at the "Ai-drafted" design suggestions, skip or to mark them as follow ups

Use one placement sample representation for solved, recorded, and
replayed layouts. Apply live and replayed samples through the variation
scheduler so placement metadata and scene poses stay synchronized.

Signed-off-by: Qian Lin <[email protected]>
Infer placement replay from JSONL contents and let recorded samples define
per-episode reset behavior. Skip unreplayable object-set placements, allow
repeated source layout IDs, and release run-time samples after recording each
episode.

Signed-off-by: Qian Lin <[email protected]>

@zhx06 zhx06 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! Left some non-blocking comments here

@qianl-nv
qianl-nv merged commit dfd746d into main Oct 13, 2026
12 checks passed
@qianl-nv
qianl-nv deleted the qianl/feature/placement-sampler-replay branch October 13, 2026 03:29
qianl-nv added a commit that referenced this pull request Oct 13, 2026
Add run-level multi-file variation replay and split the
recorded-variations workflow into separate recording and replay
Experiments. Reuse one builder-level placement recording across live
rebuilds, then assign each recorded episode JSONL to its corresponding
replay rebuild.

## Why this change?

[PR #1427](#1427) adds
recorded placement and variation replay for one environment build.
Experiments also need to record variations across multiple rebuilds and
replay each resulting JSONL without manually creating one Run per file.

The sample workflow first holds settled placement layouts fixed across
two live rebuilds while sampling ordinary variations. It then replays
the two 500-episode recordings with a different number of parallel
environments.

## What changes?

- Add `ArenaRunCfg.recorded_variation_samples_paths` as an ordered,
run-level replay list.
- Infer `num_rebuilds` from the list and assign one JSONL to each
rebuild.
- Replay every row by default, or split an explicit total
`rollout_limit.num_episodes` across the rebuilds.
- Allow one `environment_builder.recorded_variation_samples_path` to be
reused across multiple rebuilds.
- Keep the existing single-file placement replay examples unchanged.
- Add separate 1,000-episode recording and two-file replay Experiment
Definitions.
- Document the three-step placement recording, variation recording, and
replay workflow.

## Usage example

Record live variations over two rebuilds while reusing one placement
file:

```yaml
environment_builder:
  recorded_variation_samples_path: outputs/recording/placements.jsonl
num_rebuilds: 2
rollout_limit:
  num_episodes: 1000
```

Replay the resulting files:

```yaml
recorded_variation_samples_paths:
  - outputs/recording/episode_results_rebuild0.jsonl
  - outputs/recording/episode_results_rebuild1.jsonl
rollout_limit:
  num_episodes: 1000
```

The replay list creates two rebuilds and assigns 500 episodes to each
file.

## Validation

Passing checks:

- Targeted pre-commit hooks passed for all changed Python, YAML, and RST
files.
- 59 focused run-configuration, Hydra, and execution tests passed.
- Fresh settled placement recording accepted 8/8 layouts.
- Compared 64 existing partial source/replay rows: all placement and
variation payloads matched exactly, and replay source indices were
consecutive.

---------

Signed-off-by: Qian Lin <[email protected]>
cvolkcvolk added a commit that referenced this pull request Oct 15, 2026
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]>
zhx06 added a commit that referenced this pull request Oct 16, 2026
Fix variation overrides and recorder binding when using Isaac Lab’s
`record_demos.py` with Arena environments.

## Why this change?

Arena variation overrides were not forwarded to the builder. Isaac Lab
also constructed the environment without Arena’s recorder kwargs,
causing reset-time recording to fail. Relation placement introduced in
#1427 encounters the same binding failure.

Recreating an environment from the same registration also retained stale
recording samples and replay assignments.

## What changes?

- Extract variation-override routing into `split_variation_overrides`,
preserving Isaac Lab’s remaining arguments.
- Forward the original recorder and replay scheduler through the
registered constructor.
- Bind the recorder to the environment through a weak reference.
- Clear runtime samples and restart replay assignments for each new
environment, preserving build-time samples.
- Verify recorded placement poses against actual simulator poses
immediately after reset.

`recorded_variation_samples_path` Hydra support through IL interop
remains deferred, with a TODO as agreed. Isaac Lab’s separate
`annotate_demos.py` routing issue is outside this recording fix. No
Isaac Lab changes are included.

## Validation

- 51 focused tests passed, covering routing, recorder lifetime,
environment recreation, replay and partial resets.
- Both environment-recreation regressions failed before the fix and
passed afterward.
- Two native recording tests passed, including relation placement,
enabled mass variation and HDF5 export.
- Applicable pre-commit hooks, strict Sphinx build and `git diff
--check` passed.

---------

Signed-off-by: zhx06 <[email protected]>
cvolkcvolk added a commit that referenced this pull request Oct 20, 2026
Add a `draft-pr-review` skill to turn review findings into a pending
GitHub review, with comments attached to the relevant lines. The
reviewer approves the text before it is added to GitHub and submits the
review themselves.

## Why this change?

Findings from a review done in chat together with an agent have to be
copied into GitHub by hand. This can lose Markdown formatting, and line
numbers can become outdated when the author pushes changes.

The review is still guided by a human. The skill makes it easier to
transfer the findings and their context from the review session to
GitHub, where the author and their agent can use them to address the
feedback.

## What changes?

The skill covers creating a pending review, adding comments to one
already started, and editing its comments. It requires showing the exact
summary and comments locally for approval before writing to GitHub.

Every summary and comment starts with `_AI-drafted (<agent name>),
reviewed by me._` so readers can see how it was drafted. The reviewer
reads and edits the text before submitting it.

A Python script checks that comments refer to the current PR version and
valid lines in the diff, include the attribution, and do not request
immediate publication. The skill also explains how to preserve edits
made in GitHub and avoid duplicating comments when retrying a failed
request.

## How to use it

Review the PR as you normally would, using your agent to investigate
questions and discuss possible issues. Once you’ve decided which
findings are worth raising, say: “Turn these findings into a pending
review on PR #1234.” You can also invoke `$draft-pr-review` explicitly.

The agent shows you the proposed comments for approval, then adds them
to GitHub as a pending review. Open the PR, make any final edits, and
submit the review yourself. The skill transfers findings you’ve already
discussed; it doesn’t perform the code review for you.

## Validation

- All ten tests pass. They cover comment locations, deleted lines,
filenames with special characters, invalid review data, attribution, and
changes to the PR during validation.
- Pre-commit checks and the skill metadata check pass.
- The script was checked against PR #1428 without posting a review.
- Earlier manual checks on #1427 confirmed that reviews stay pending
when created, extended, and edited. Submitting a review remains a manual
step.

---------

Signed-off-by: Clemens Volk <[email protected]>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
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.

3 participants