Repository navigation
Conversation
|
/review |
| count = len(changes) | ||
| baseline = sum(change.baseline for change in changes) / count | ||
| candidate = sum(change.candidate for change in changes) / count | ||
| centre = sum((change.low + change.high) / 2 for change in changes) / count |
There was a problem hiding this comment.
🟡 Suite interval shifts when run sizes differ
Each Agresti–Caffo centre is pulled toward 50% by about 1/(n+2). When the two runs have different trial counts, that shift is the same in every environment, so averaging doesn't cancel it while the suite half-width keeps shrinking. With 37 environments at 100% in both runs, seeds 0 1 2 against seed 0 prints 100.0% → 100.0% | [-1.9, -0.6] pts (p ≈ 1e-4). A change to max_placement_attempts causes a smaller shift in the valid-candidates column, with no settings warning.
Could the suite interval be centred on the observed change, keeping the current half-width? The rst sentence saying intervals "need not be centered on the observed change" would then apply only to per-environment intervals.
| centre = sum((change.low + change.high) / 2 for change in changes) / count | |
| centre = candidate - baseline |
| try: | ||
| arena_env = ArenaEnvGraphSpec.from_yaml(spec_path).to_arena_env() | ||
| inputs = ArenaEnvBuilder(arena_env, ArenaEnvBuilderCfg()).prepare_live_placement_inputs() | ||
| placed_objects = [asset for asset in inputs.assets if not asset.is_anchor and asset is not arena_env.embodiment] |
There was a problem hiding this comment.
🔵 Why skip robot-only specs?
A real build still places the robot in these specs (11 of the 31 KitchenBench specs, such as kitchen_bench_lightwheel_open_fridge), and the robot's relations already count in the other 20. Skipping them drops the most direct robot-placement signal. Is there a reason not to score them? Skipping only when every asset is an anchor (all(asset.is_anchor for asset in inputs.assets)) would match the case where a build has nothing to place.
| if best.success: | ||
| record.layout_successes += 1 | ||
| else: | ||
| for check in validation.get_failed_validation_check_names: |
There was a problem hiding this comment.
🔵 failed_checks counts checks that never ran
PlacementValidationRunner._run_expensive_checks() records ik_reachable as False for every candidate that failed a cheaper required check, without running IK (placement_validation_runner.py:130). So in the cuRobo image, failed_checks["ik_reachable"] always equals the number of failed layouts and points at IK even when IK never ran.
Could this leave out checks whose validator has run_after_inexpensive_checks when a required cheaper check already failed? Or, at least, could the EnvironmentRecord.failed_checks docstring say so? Also, test_seed_results_count_each_layout_by_its_best_candidate passes ik_reachable=True for candidates that fail no_overlap, which the runner never produces.
| environments: list[EnvironmentComparison] | ||
| """One entry per environment scored in both runs with the same checks.""" | ||
|
|
||
| unpaired: list[tuple[str, str, str, str]] |
There was a problem hiding this comment.
🔵 Positional tuples in RunComparison
format_comparison() unpacks unpaired, settings_differences and check_differences by position. _status_name() also turns EnvironmentStatus into strings, plus a "missing" value, before formatting. The rest of the result already uses dataclasses (RateChange, SuiteComparison, EnvironmentComparison). Could these be small dataclasses too, for example UnpairedEnvironment(suite, environment, baseline_status: EnvironmentStatus | None, candidate_status: EnvironmentStatus | None), CheckDifference and SettingDifference, with "missing" printed only in format_comparison()?
| A suite has no rate metrics when any of its environments failed, and the | ||
| script exits with an error after writing the file. | ||
|
|
||
| The file also records whether the checkout had uncommitted changes. Only the |
There was a problem hiding this comment.
🔵 The examples mark the next run as dirty
The commands on this page write results into the checkout root. In a single checkout, the second run, or a full run after the quick check, then records dirty: true. *outputs/ is already gitignored, so mkdir -p outputs and --output outputs/placement_main.json avoid that.
Also, dirty isn't printed anywhere: format_run() shows only the commit and branch, and format_comparison() shows neither run's commit. Could the comparison print each run's commit and dirty flag?
| assert "| robolab | 1 | 90.0% → 100.0% |" in completed.stdout | ||
|
|
||
|
|
||
| def test_cli_rejects_repeated_seeds_without_simulator(): |
There was a problem hiding this comment.
🔵 This check can run in-process
The assert fails before SimulationAppContext with an AssertionError, not SystemExit, so it doesn't need a child interpreter. As written, if the assert regressed, the child would start Isaac Sim on all 69 specs and only fail at the 300 s timeout. test_environment_runner.py already calls main() in-process this way (this needs import sys):
def test_cli_rejects_repeated_seeds_without_simulator(monkeypatch):
"""A repeated seed would count the same candidates twice, so the CLI rejects it before starting the simulator."""
from isaaclab_arena.scripts import placement_success_benchmark
# A filter that matches no spec stops a regression before the simulator starts.
argv = ["placement_success_benchmark.py", "--placement_seeds", "0", "0", "--env", "no_such_spec"]
monkeypatch.setattr(sys, "argv", argv)
with pytest.raises(AssertionError, match="--placement_seeds must be distinct"):
placement_success_benchmark.main()
🤖 Isaac Lab-Arena Review BotSummaryThis PR adds three things:
Since the last review, the settings live in Findings🟡 Warning: 🔵 Improvement: 🔵 Improvement: The PR description has no Validation section. Please add a line on what you ran, for example a full run's time and the baseline rates. That would help reviewers judge the defaults (50 layouts, seeds 0 1 2). Test Coverage and CI Cost
Pre-commit passed on this head. The image builds were still queued and the test jobs had been skipped, so the new tests have not run in CI yet. I didn't run the tests or the benchmark. I checked the statistics with a separate re-implementation, and it matched the test values. VerdictMinor fixes needed |
9b7481f to
9644d3c
Compare
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 (#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. --------- Signed-off-by: zhx06 <zihaox@nvidia.com>
9644d3c to
01381e9
Compare
[Medium impact] The PR appears safe to merge; no actionable issues were established. SummaryAdds a placement-success benchmark for RoboLab and KitchenBench, plus saved results and run comparisons.
No actionable issues were established. Review checks were static; tests were not run. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
Specs[YAML specs] --> Inputs[Shared live placement inputs]
Inputs --> Candidates[Seeded candidates]
Candidates --> Checks[Pre-physics checks and ranking]
Checks --> Counts[Layout and candidate counts]
Counts --> Results[Saved results]
Results --> Compare[Suite and environment comparisons]
Reviews (1) · Last reviewed commit: "Add PlacementBenchmarkSettings, drop KPI..." · Reviewed by Greptile |
| required_after = after.checks.get(check, False) | ||
| if required_before != required_after: | ||
| record_requiring_check = before if required_before else after | ||
| if record_requiring_check.candidate_failures_per_check.get(check, 0) > 0: |
There was a problem hiding this comment.
🟡 The exception rarely applies to IK
This follows up on the earlier note about skipped IK counts. add_seed_results() counts ik_reachable as failing on every candidate that failed a cheaper required check. So this condition is true whenever any candidate failed no_overlap or on_relation, even if IK passed every candidate it actually ran on. Comparing a run from the cuRobo image with one from the base image leaves out every environment that has the IK check and any cheap failure.
PlacementValidationRunner.validate_candidates() already builds evaluated_layout_indices_by_check and then discards it. Could it record which checks a candidate skipped, so add_seed_results() counts only the candidates a check ran on? Counting only the candidates whose single failure is that check won't work. A skipped IK check always fails alongside the cheap check that caused the skip.
| for excluded in comparison.check_differences: | ||
| lines.append( | ||
| f"- {excluded.suite}/{excluded.environment}: before {_format_checks(excluded.before.checks)};" | ||
| f" after {_format_checks(excluded.after.checks)}" |
There was a problem hiding this comment.
🔵 Show rates for environments left out?
Suppose the change under test adds a required check. This list then holds exactly the environments that check affects, but --compare prints only their check names. Could each line also show the layout-success and valid-candidate rates before and after, without an interval or significance flag? Then the size of the effect is visible without opening the JSON files.
| inputs.assets, inputs.scene_assets, params.solver_params.collision_mode | ||
| ) | ||
| self._num_layouts = settings.num_layouts | ||
| self._first_seed = seed_block_index * _SEEDS_PER_ENVIRONMENT |
There was a problem hiding this comment.
🔵 Object-set members depend on seed order
ObjectPlacer._place_ranked() calls assign_variants_for_envs(), which does nothing once a RigidObjectSet has members assigned for the same num_envs. A set with random_choice=True therefore keeps the members chosen by the first seed. Seed 1 gets different members with --placement_seeds 0 1 than with --placement_seeds 1. No spec uses an object set yet. Could __init__ choose the members once from this environment's seed block? This also needs from isaaclab_arena.relations.bounding_box_helpers import assign_variants_for_envs next to the other imports.
| self._first_seed = seed_block_index * _SEEDS_PER_ENVIRONMENT | |
| self._first_seed = seed_block_index * _SEEDS_PER_ENVIRONMENT | |
| # An object set keeps its first member assignment, so draw it from this environment's seed block. | |
| assign_variants_for_envs(self._assets, self._num_layouts, placement_seed=self._first_seed) |
00b91f8 to
ed92e28
Compare
| ``isaaclab_arena/scripts/placement_success_benchmark.py`` measures how often | ||
| relation placement succeeds across the RoboLab and KitchenBench environment | ||
| specs. Run it before and after a change to the placement pipeline, then compare | ||
| the two runs to check for regressions. |
There was a problem hiding this comment.
Can we add as an automated unit test that fails if there's regression? Then we won't have to run and compare manually
If the runtime is too long for a unit tests we could add a limited experiment
There was a problem hiding this comment.
Addressed. The new commit contains a unit test for the regression.
ed92e28 to
f7a76f7
Compare
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>
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>
3c5288b to
df180f9
Compare
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """Placement-success benchmark results: settings, results files, suite summaries and run comparisons. |
There was a problem hiding this comment.
AI-drafted (Claude Code), reviewed by me.
Suggestion (non-blocking): split this PR into four stacked PRs
At df180f9 the PR adds about 2,000 lines across 15 files. Changes to core placement code sit next to a benchmark runner, the comparison statistics and a regression baseline, which makes it hard to review each part properly. The parts depend on each other in order, so they stack:
- Placement diagnostics (~250 lines)
relations/placement_diagnostics.py.- The changes to
ObjectPlacer,PooledObjectPlacerandPlacementValidationRunner.validate_candidates. - The
ArenaEnvBuilder.placement_diagnosticsfield. - Tests:
test_placement_diagnostics.py,test_a_failed_rebuild_clears_the_placement_diagnostics, and the updates to the clutter, face-to and heterogeneous-placement tests.
- Benchmark runner and results file (~800 lines)
scripts/placement_success_benchmark.py, without--compare.- From this file:
PlacementBenchmarkSettings,EnvironmentRecord,PlacementBenchmarkResults,summarize_suitesandformat_results. - The seed, provenance, spec-discovery and round-trip tests.
- The docs, except the comparison section.
- Run comparison (~550 lines)
compare_resultsandformat_comparison.- The
RateChangeand*Comparisontypes. - The interval, Holm and p-value helpers.
--compare, the comparison tests and the comparison section of the docs.
- Baseline regression test (~150 lines)
test_placement_success_matches_the_baselineandtest_data/placement_success_baseline.json.
Why split it this way:
- PR 1 is the only part that changes core placement code, so it needs the most careful review. It is also useful by itself: pool
RuntimeErrors then report per-check rejection counts. - PR 3 is plain Python that runs without the simulator, so the statistics can be reviewed without the runner around them.
- PR 4 should go last, with the baseline generated from the merged code. The current baseline records commit
f7a76f7withdirty: true, and that commit isn't in the branch history.
The commits don't follow this split (db2c569 touches parts 1–3), so rebuilding the branches from the final tree is probably easier than cherry-picking.
|
|
||
|
|
||
| @dataclass | ||
| class ValidatedBatch: |
There was a problem hiding this comment.
AI-drafted (Claude Code), reviewed by me.
Suggestion (non-blocking): rename ValidatedBatch and CheckCounts
ValidatedBatch reads like the batch of candidates after validation, but it holds only counts. As a result, ObjectPlacer.validated_batches (object_placer.py:64) looks like it keeps candidate batches alive. CheckCounts is vague on its own, because "check" could mean anything.
Suggest these names, so the three types form one diagnostics family:
PlacementDiagnostics one per pool fill
└─ batches: list[BatchValidationDiagnostics] one per validated batch
└─ checks: dict[str, ValidationCheckDiagnostics] one per check
ValidatedBatch→BatchValidationDiagnosticsCheckCounts→ValidationCheckDiagnosticsObjectPlacer.validated_batches→batch_validation_diagnostics
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """Placement-success benchmark results: settings, results files, suite summaries and run comparisons. |
There was a problem hiding this comment.
AI-drafted (Claude Code), reviewed by me.
Design: move the benchmark into a new isaaclab_arena_benchmarking package
Right now the benchmark code is split between two places that don't fit it:
offline_placement/placement_success.py:offline_placement/holds the offline settled-placement code (settling, recording, pool validation). The benchmark now measures the live build path instead. Also, this file is results-file I/O plus comparison statistics, not placement code.scripts/placement_success_benchmark.py: this holds library code beside the CLI (measure_environment,get_placement_seed,add_build_results,discover_specs,get_git_provenance). The tests import those functions fromisaaclab_arena.scripts.
I'd move all the benchmarking code into a new top-level package with an object_placement subfolder:
isaaclab_arena_benchmarking/
object_placement/
measurement.py # measure_environment, seeds, spec discovery, provenance
results.py # settings, EnvironmentRecord, results file, summaries
comparison.py # compare_results, intervals, Holm, format_comparison
run_placement_success_benchmark.py # CLI only: argument parsing and main()
tests/
test_object_placement_benchmark.py
test_data/placement_success_baseline.json
These stay in core, because the build uses them:
relations/placement_diagnostics.pyArenaEnvBuilder.placement_diagnosticstest_placement_diagnostics.pyandtest_a_failed_rebuild_clears_the_placement_diagnostics
Why do it this way:
- It keeps the code that measures the library apart from the library itself.
- It matches the other first-party packages (
isaaclab_arena_gr00t,isaaclab_arena_curobo, ...), each of which has its owntests/. - It gives other benchmarks a home too.
Splitting placement_success.py into results.py and comparison.py also lines up with the suggested PR split.
Two things to do along with the move:
- CI:
.github/workflows/ci.ymllists test directories explicitly. Addisaaclab_arena_benchmarking/tests/there, or the baseline regression test stops running. That's a workflow change, so please flag it in the PR description. - Packaging: add the package to
[tool.setuptools.packages.find]inpyproject.toml, and declare the baseline JSON as package data.
Add a placement-success benchmark script that measures how often relation placement succeeds across the RoboLab and KitchenBench specs, writes a results file and compares two runs. Add
ArenaEnvBuilder.prepare_live_placement_inputs()so the script places exactly what an environment build places, without building the environment.Why this change?
Placement changes, such as oriented bounding boxes for collision checks (#1480), need a number to compare before and after. Until now, success rates were measured with one-off scripts, so results from different PRs were hard to compare and their noise was unknown.
What changes?
isaaclab_arena/scripts/placement_success_benchmark.pybuilds each spec's placement inputs, places--num_layoutslayouts for each seed in--placement_seeds, and validates them without stepping physics. It reports two rates per environment and per suite:max_placement_attemptscandidates passes every required pre-physics check, asObjectPlacer.place()does.CandidatePlacergives each environment its own block of candidate seeds, and each seed its own range within it.--envsolves the same candidates for its specs as a full run.The robot is placed and checked whenever a spec places it by relations, as in a real build. This includes the 11 KitchenBench specs that place only the robot. Specs that place nothing other than anchors are skipped. Specs that fail are recorded with their error, and the script exits non-zero after writing the results file.
--compare BEFORE AFTERcompares two results files without starting the simulator. It reports:isaaclab_arena/offline_placement/placement_success.pyowns the data and statistics, with no simulator dependency:PlacementBenchmarkSettings: the measurement settings, with their defaults and validation;PlacementBenchmarkResults: provenance, settings and oneEnvironmentRecordper environment, saved to and loaded from JSON;summarize_suites()andcompare_results(), withformat_results()andformat_comparison()for the printed tables.ArenaEnvBuilder.prepare_live_placement_inputs()applies build-time variations and reachability constraints and returns aLivePlacementInputs. It asserts that no Hydra overrides or recorded replay are set, since it does not apply them._prepare_relation_placement()now uses the same code. The moved lines are unchanged; they were written by Xinjie Yao, Clemens Volk and qianlin.A new docs page,
object_placement/placement_success_benchmark, explains how to run the benchmark, compare runs, read the results file and add a suite.The PR is about 1,490 lines: about 320 are tests and 175 are docs. I kept the comparison in the same PR, because a benchmark is only useful once two runs can be compared.
Follow-ups this leaves room for
PlacementBenchmarkResults.load()and exportsummarize_suites()orcompare_results()without changing the benchmark. A field added later with a default still loads older files.--envand--output. The commit is not recorded in an image without.git, so that MR would need to pass it in.SUITE_SPEC_GLOBS; the other specs keep their candidates.Usage example