Skip to content

Add placement diagnostics - #1556

Merged
zhx06 merged 3 commits into
mainfrom
zxiao/feature/placement-diagnostics
Oct 29, 2026
Merged

zhx06 merged 3 commits into
mainfrom
zxiao/feature/placement-diagnostics

Conversation

@zhx06

@zhx06 zhx06 commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Return per-check validation counts from relation placement and keep them for each pool fill. A pool that can't fill now says which check rejected its candidates, and ArenaEnvBuilder.placement_diagnostics holds the counts after a build.

Why this change?

When the placement pool can't fill, the error only lists how many layouts each env has. The validation runner prints per-check pass counts to the log but doesn't return them, so code can't read them and you have to search the log to find the failing check.

What changes?

  • PlacementValidationRunner.validate_candidates() returns a BatchValidationDiagnostics: the number of candidates, how many passed every required check, and a ValidationCheckDiagnostics per check with how many candidates it ran on and how many passed. ObjectPlacer.last_batch_validation_diagnostics keeps the latest one. The log line is unchanged.

  • PooledObjectPlacer.last_fill_diagnostics holds every batch of the most recent fill and the envs that fell back to best-loss layouts.

  • ArenaEnvBuilder.placement_diagnostics holds the fill made during the latest build_env_cfg(), or None if that build solved no relations or failed.

  • Fill-failure errors end with one line per batch:

    Placement pool could not fill 1 layouts per env after 2 solve batches. Available per env: [0, 0].
    batch 0: 0/4 valid; passed per check: on_relation=0/4, clutter_on_relation=4/4, ..., no_overlap=4/4
    batch 1: 0/4 valid; passed per check: on_relation=0/4, clutter_on_relation=4/4, ..., no_overlap=4/4
    
  • The pooled placement docs get a "Diagnosing Placement" section.

A follow-up PR adds a placement benchmark that reports these counts across scenes.

Validation

  • The new test_placement_diagnostics.py covers the first batch's counts, refills, fallbacks, the failure message, and clearing the field when a rebuild fails.
  • test_clutter_on.py checks the counts of checks that run on only some candidates.
  • 90 placement tests pass locally. ik_reachable isn't tested, because the dev container has no cuRobo.

@zhx06
zhx06 marked this pull request as ready for review October 29, 2026 17:39
@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; no actionable issues were found.

Summary

Adds placement diagnostics from individual checks through pool fills to the environment builder.

  • Placement checks now return counts for every candidate batch.
  • Pool fills keep diagnostics and explain when layouts run out.

No actionable issues were found. Tests were inspected but not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  V["PlacementValidationRunner"] -->|"BatchValidationDiagnostics"| O["ObjectPlacer"]
  O -->|"Each solved batch"| P["PooledObjectPlacer"]
  P -->|"Latest fill record"| B["ArenaEnvBuilder.placement_diagnostics"]
  P -->|"Batch summaries"| E["Pool-fill error"]
Loading

Reviews (1) · Last reviewed commit: "rename variables/functions" · Reviewed by Greptile

@arena-review-bot

Copy link
Copy Markdown
Contributor

🤖 Isaac Lab-Arena Review Bot

Summary

The validation runner now returns per-check pass counts. The pool keeps those counts for each fill and adds them to the fill-failure error, so a failed placement names the check that rejected its candidates. This is a small, useful change. My main question is whether ArenaEnvBuilder needs its own copy of the counts in this PR. The other points are small test and naming fixes.

Design, Boundaries & Scope

🔵 ArenaEnvBuilder.placement_diagnostics keeps a reference to state that the pool already owns. get_placement_pool(env).last_fill_diagnostics (relations/runtime/placement_events.py:68) already reaches it from a built env. Unlike the builder copy, it also shows fills made during resets. Keeping the copy adds a rule that resets it to None on a failed build, plus a simulation test that builds twice. No production code reads it yet. If the follow-up benchmark needs it after build_env_cfg(), before any env exists, could the attribute land with that PR?

Separately, the "Diagnosing Placement" docs say that fills during resets record counts too, but they don't say how to read them. Pointing readers to get_placement_pool(env).last_fill_diagnostics would close that gap.

Findings

🔵 Improvement: isaaclab_arena/environments/arena_env_builder.py:131: the builder stores a second copy of the pool's diagnostics (see above).
🔵 Improvement: isaaclab_arena/tests/test_placement_diagnostics.py:54: the docstring credits the batch size to min_unique_layouts_per_env, which PooledObjectPlacer doesn't read. Setting it in _placer_params() (line 111) has no effect on these tests.
🔵 Improvement: isaaclab_arena/relations/placement_diagnostics.py:55: PoolFillDiagnostics would say what the class records.

Test Coverage and CI Cost

test_a_failed_rebuild_clears_the_placement_diagnostics builds the maple-table graph twice with default placer params. Each build fills a 10-layout pool before the assertions run: 100 candidates per batch and up to 600 solver iterations. Setting small placer_params on arena_env keeps both checks with much less solver work; there is an inline suggestion. The CI test jobs were skipped for this head commit, so I couldn't confirm that the new tests pass in CI or measure their runtime.

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.

Looking pretty good. A couple of comments:

  • Our agents are requesting per-object/asset information. For example if a placement fails because two objects are in collision, that is the kind of information that the agents want.
  • We need some way of getting the diagnostics out. I'm wondering if we can output to the output folder when running the experiment runner, in a placer-specific, run-specific log.

These can be addressed in follow up MRs.

zhx06 added 3 commits October 29, 2026 14:06
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/placement-diagnostics branch from e586a18 to 068c9f4 Compare October 29, 2026 21:06
@zhx06
zhx06 merged commit b374df5 into main Oct 29, 2026
13 checks passed
zhx06 added a commit that referenced this pull request Nov 4, 2026
Write each Run's placement diagnostics to its output directory, and add
RoboLab and KitchenBench Experiments that measure placement success with
the normal experiment runner. This replaces the standalone benchmark
runner from the first revision of this PR.

## Why this change?

A placement change can help one scene and hurt another, and a few
hand-picked scenes don't show that. #1556 made each environment build
record per-check validation counts, but the experiment runner dropped
them after the build. This PR keeps them, so placement success can be
measured across all the maintained specs.

## What changes?

- `_build_environment_from_cfg()` in `run_execution.py` writes
`placement_diagnostics_rebuild<i>.json` to the Run directory for every
rebuild that solves relation placement. This applies to every
Experiment, including policy evaluations.
- `PlacementDiagnostics` gets `num_envs` and `save()` / `load()`.
- `robolab_placement_experiment.yaml` and
`kitchen_bench_placement_experiment.yaml` in
`isaaclab_arena_benchmarking/experiment_configs/` have one Run per spec,
each with 30 environments, a zero-action policy and one step.
- Each Run has its own placement seed, 100000 apart, so tasks that share
a scene solve different candidates.
- Tests check that each experiment lists every spec in its folder and
that no two Runs share candidate seeds.
- `placement_success.py` reads an Experiment output directory into one
`RunPlacementRecord` per Run and a `PlacementSuccessSummary`. It
reports:
- `valid_candidate_rate_first_batch`: the share of the first batch that
passes every required check.
- `valid_env_rate_after_retries`: the share of environments that need no
best-loss fallback.
  - `batches_per_build`.
- The docs page explains what is measured and how to run it.
- `ci.yml` runs
`isaaclab_arena_benchmarking/tests/test_placement_success.py`.

Each Run builds its spec once. On `main`, the rebuilds of a Run get the
same placement seed, so more rebuilds would repeat the same candidates.
Once rebuilds get their own seeds (after #1523), the Experiments can use
more rebuilds.

The experiments are not in `tracked_benchmarks.yaml` yet. They can be
added together with placement KPI fields, which David plans to wire up.

## Validation

- The new tests, `test_placement_diagnostics.py`,
`test_run_execution.py`, `test_experiment_runner.py` and
`test_arena_experiment_result.py` pass locally, with the camera test run
in its own process as in CI. That includes one test that runs a one-Run
placement Experiment and reads its diagnostics back.
- Three real Runs (`banana_on_plate` and two KitchenBench specs, 30
environments) took 81 s through `experiment_runner.py` on one GPU, from
app start to the result file. The KitchenBench pick spec took the
longest, about 50 s.
- My local image has no cuRobo v2, so these ran on the core from before
#1550 with this PR's changes applied. CI covers the current image.
- The full 80-spec Experiments have not been run yet.

---------

Signed-off-by: zhx06 <zihaox@nvidia.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.

2 participants