Skip to content

Allows looser check on asset spawning - #4823

Merged
ooctipus merged 2 commits into
isaac-sim:developfrom
ooctipus:fix/develop/allow_looser_check_on_asset_spawning
Mar 4, 2026
Merged

ooctipus merged 2 commits into
isaac-sim:developfrom
ooctipus:fix/develop/allow_looser_check_on_asset_spawning

Conversation

@ooctipus

@ooctipus ooctipus commented Mar 4, 2026

Copy link
Copy Markdown
Collaborator

Description

Allows looser check on asset spawning, if spawn path is None, we just assume user will handle the spawning them selfs.

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (existing functionality will not work without user modification)
  • Documentation update

Screenshots

Please attach before and after screenshots of the change if applicable.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Mar 4, 2026
@ooctipus ooctipus changed the title Allow looser check on asset spawning Allows looser check on asset spawning Mar 4, 2026

@xyao-nv xyao-nv 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.

Thx for fixing!

@ooctipus
ooctipus marked this pull request as ready for review March 4, 2026 23:40
@ooctipus
ooctipus merged commit 2d9d823 into isaac-sim:develop Mar 4, 2026
5 of 10 checks passed
@ooctipus
ooctipus deleted the fix/develop/allow_looser_check_on_asset_spawning branch March 4, 2026 23:41
@greptile-apps

greptile-apps Bot commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR relaxes the prim-existence check in AssetBase.__init__ so that it is only performed after an explicit spawn call (cfg.spawn is not None). When spawn is None — meaning the user intends to handle spawning themselves — the check is skipped entirely and execution continues to callback registration.

The logic change itself is straightforward and intentional. The new path (no check when spawn is None) is an explicit opt-out that matches the stated use-case.

Issues identified:

  • The else branch retains check_path = self.cfg.prim_path which is never read again; it should be removed or replaced with pass.
  • The Raises section of __init__ still describes an unconditional RuntimeError, but the error is now conditional on cfg.spawn being set.
  • No tests or changelog entry have been added for this behavioural change.

Confidence Score: 4/5

  • Low-risk change affecting only AssetBase.__init__ with intentional, straightforward logic. Two style issues prevent a perfect score.
  • The core logic change is sound and matches the stated intent — when spawn is None, the user handles spawning and no upfront prim-existence check is needed. However, this score is reduced by: (1) dead code assignment in the else branch that should be removed, (2) a stale Raises docstring that no longer accurately describes conditional error behaviour, and (3) absence of tests or changelog entry for this behavioural change.
  • source/isaaclab/isaaclab/assets/asset_base.py — dead check_path assignment in the else branch and outdated Raises docstring.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["AssetBase.__init__"] --> B{"cfg.spawn is not None?"}
    B -- Yes --> C["Resolve check_path\n(spawn_path or prim_path)"]
    C --> D["Call cfg.spawn.func(check_path, ...)"]
    D --> E["find_matching_prims(check_path)"]
    E --> F{"len == 0?"}
    F -- Yes --> G["raise RuntimeError"]
    F -- No --> H["_register_callbacks()"]
    B -- No --> I["check_path = cfg.prim_path\n(unused / dead code)"]
    I --> H
Loading

Last reviewed commit: baedf12

Comment on lines 89 to 91
else:
# asset should already exist at prim_path
# asset should exist at run time
check_path = self.cfg.prim_path

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Dead code in else branch.

check_path is assigned at line 91 but is never read after this point — the prim-existence check has been moved inside the if block, so nothing downstream consumes check_path when spawn is None. This is dead code and should be removed to keep the intent clear.

Suggested change
else:
# asset should already exist at prim_path
# asset should exist at run time
check_path = self.cfg.prim_path
else:
# asset should exist at run time
pass

@greptile-apps

greptile-apps Bot commented Mar 4, 2026

Copy link
Copy Markdown
Contributor
Additional Comments (1)

source/isaaclab/isaaclab/assets/asset_base.py
Outdated Raises docstring.

The __init__ docstring still states that RuntimeError is unconditionally raised if no prims are found. However, after this change, the RuntimeError is only raised when self.cfg.spawn is not None (line 87). When spawn is None, the check is skipped entirely. The docstring should be updated to reflect the new conditional behaviour:

        Raises:
            RuntimeError: If no prims found at input prim path or prim path expression
                after spawning (only checked when ``cfg.spawn`` is not None).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants