Skip to content

Conversation

@pascal-roth
Copy link
Collaborator

@pascal-roth pascal-roth commented Nov 3, 2025

Description

Remove dependency on IsaacSim prim_utils for integration of new simulation engines like newton.

NOTE: this PR depends on #3923

Type of change

  • Dependency removal

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 enhancement New feature or request isaac-lab Related to Isaac Lab team labels Nov 3, 2025
@pascal-roth pascal-roth self-assigned this Nov 3, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Greptile Summary

This PR updates a docstring reference in visualization_markers.py to align documentation with the actual implementation. The reference to isaacsim.core.utils.create_prim has been replaced with isaaclab.sim.utils.prims.create_prim.

Context:

  • In commit 8e411a8, the prim_utils functionality was reimplemented in IsaacLab at isaaclab/sim/utils/prims.py
  • The actual code implementation (in spawner modules) already uses the IsaacLab version via import isaaclab.sim.utils.prims
  • This PR simply updates the docstring to reflect the correct module path that's already in use

Changes:

  • Updated docstring reference from isaacsim.core.utils.create_prim to isaaclab.sim.utils.prims.create_prim in VisualizationMarkers class documentation

This is a documentation-only change with no functional impact.

Confidence Score: 5/5

  • This PR is safe to merge with no risk - it's a documentation-only change that fixes an outdated reference
  • Score reflects that this is purely a documentation update with zero functional changes. The docstring reference is being updated to match the actual implementation that was already changed in a previous commit (8e411a8). The new reference correctly points to the IsaacLab prim_utils module that is already being used by the codebase.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
source/isaaclab/isaaclab/markers/visualization_markers.py 5/5 Documentation-only update: replaced outdated isaacsim.core.utils.create_prim reference with correct isaaclab.sim.utils.prims.create_prim reference

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant Doc as Documentation
    participant Code as Implementation Code
    participant IsaacLab as isaaclab.sim.utils.prims
    
    Note over Dev,IsaacLab: PR #3924: Documentation Update
    
    Dev->>Doc: Update docstring reference
    Doc->>Doc: Change isaacsim.core.utils.create_prim
    Doc->>Doc: To isaaclab.sim.utils.prims.create_prim
    
    Note over Code,IsaacLab: Implementation (already updated in commit 8e411a8)
    Code->>IsaacLab: Already imports prim_utils
    Code->>IsaacLab: Uses create_prim() from IsaacLab
    
    Note over Dev,IsaacLab: Result: Documentation now matches implementation
Loading

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@pascal-roth pascal-roth moved this to In review in Isaac Lab Nov 3, 2025
@ooctipus
Copy link
Collaborator

ooctipus commented Nov 5, 2025

Looks like tests are failing 👀

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 11, 2025

Greptile Overview

Greptile Summary

This PR successfully replaces IsaacSim's prim_utils with a new IsaacLab implementation to remove the dependency and enable integration of new simulation engines like Newton.

Key Changes

  • New isaaclab.sim.utils.prims module: Implements ~1000 lines of prim utility functions previously provided by IsaacSim, including get_prim_at_path, create_prim, delete_prim, is_prim_path_valid, and many others
  • New isaaclab.sim.utils.semantics module: Implements semantic label management using UsdSemantics.LabelsAPI, including add_labels, get_labels, remove_labels, and upgrade utilities
  • Import refactoring: Updated 58 files to import from isaaclab.sim.utils.prims instead of isaacsim.core.utils.prims
  • Function migration: find_matching_prim_paths moved from prim_utils to sim_utils, with string utilities moved to isaaclab.utils.string
  • Circular import fix: Fixed circular dependency in sim/utils/utils.py by using lazy import for schemas module

Architecture Impact

The refactoring maintains backward compatibility at the API level - all existing function signatures remain unchanged. The new implementation still depends on IsaacSim for core functionality (XFormPrim, SimulationContext) but removes the dependency on IsaacSim's prim utilities layer, providing more control for future engine integrations.

Confidence Score: 3/5

  • This PR is relatively safe to merge but requires testing due to eval() usage and large-scale refactoring
  • Score reflects: (1) use of eval() with string concatenation in set_prim_attribute_value (lines 192, 194) which poses a security concern despite controlled input dictionary, (2) extensive refactoring across 58 files increasing regression risk, (3) new ~1000-line implementation of critical prim utilities that needs thorough testing, (4) circular import fix suggests complexity in module dependencies. The refactoring is well-structured and imports are consistently updated, but the eval() usage and scale of changes warrant careful testing before merge.
  • Pay close attention to source/isaaclab/isaaclab/sim/utils/prims.py (eval usage, new implementation) and ensure thorough integration testing across all spawner modules

Important Files Changed

File Analysis

Filename Score Overview
source/isaaclab/isaaclab/sim/utils/prims.py 3/5 New prim_utils implementation replacing IsaacSim dependency. Contains eval() usage with string concatenation (line 192, 194) for type mapping - security concern already noted.
source/isaaclab/test/sim/test_utils.py 5/5 Import replacement and removed test for find_matching_prim_paths (now in sim_utils)
source/isaaclab/isaaclab/sim/utils/utils.py 5/5 Fixed circular import by using lazy import for schemas module and removed top-level schemas import
source/isaaclab/isaaclab/utils/string.py 5/5 Added utility functions find_unique_string_name and find_root_prim_path_from_regex (moved from IsaacSim prim_utils)
source/isaaclab/isaaclab/sim/utils/semantics.py 5/5 New semantics utilities implementation replacing IsaacSim dependency for semantic label handling
source/isaaclab/isaaclab/sim/spawners/shapes/shapes.py 5/5 Import replacement from isaacsim.core.utils.prims to isaaclab.sim.utils.prims

Sequence Diagram

sequenceDiagram
    participant User as User Code
    participant Spawners as Spawners<br/>(shapes, meshes, etc.)
    participant PrimUtils as isaaclab.sim.utils.prims
    participant SimUtils as isaaclab.sim.utils
    participant Semantics as isaaclab.sim.utils.semantics
    participant IsaacSim as IsaacSim Core<br/>(XFormPrim, SimulationContext)
    participant USD as USD Stage

    User->>Spawners: spawn_cone(cfg)
    Spawners->>PrimUtils: create_prim(path, type, ...)
    PrimUtils->>PrimUtils: define_prim(path, type)
    PrimUtils->>USD: DefinePrim()
    USD-->>PrimUtils: Usd.Prim
    
    alt semantic_label provided
        PrimUtils->>Semantics: add_labels(prim, labels)
        Semantics->>USD: Apply UsdSemantics.LabelsAPI
    end
    
    alt transformations provided
        PrimUtils->>IsaacSim: XFormPrim(path, positions, ...)
        IsaacSim->>USD: Apply transforms
    end
    
    PrimUtils-->>Spawners: Usd.Prim
    
    alt cloning needed
        Spawners->>SimUtils: clone(func)(cfg, prim_path)
        SimUtils->>SimUtils: find_matching_prim_paths(regex)
        SimUtils->>USD: Traverse and match paths
        USD-->>SimUtils: matched paths
        SimUtils->>USD: Clone prims
    end
    
    Spawners-->>User: spawned prims
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

59 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines 192 to 194
eval("attr.Set(usdrt." + SDF_type_to_Gf[type_name] + "(*value))")
else:
eval("attr.Set(" + SDF_type_to_Gf[type_name] + "(*value))")
Copy link
Contributor

Choose a reason for hiding this comment

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

style: uses eval() with string concatenation - while SDF_type_to_Gf dict is controlled and validated, prefer safer alternatives like getattr() or direct type mapping

Suggested change
eval("attr.Set(usdrt." + SDF_type_to_Gf[type_name] + "(*value))")
else:
eval("attr.Set(" + SDF_type_to_Gf[type_name] + "(*value))")
if fabric:
import usdrt.Gf as Gf
type_class = getattr(Gf, SDF_type_to_Gf[type_name].split('.')[-1])
attr.Set(type_class(*value))
else:
from pxr import Gf
type_class = getattr(Gf, SDF_type_to_Gf[type_name].split('.')[-1])
attr.Set(type_class(*value))

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

58 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

58 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@pascal-roth
Copy link
Collaborator Author

@ooctipus lets get that one merged too

@ooctipus
Copy link
Collaborator

the package import for prim_utils doesn't work for the same reason as stage_utils, we used too many wild card
import isaaclab.sim.utils.prims as prim_utils

need to change to from isaaclab.sim.utils import prims as prim_utils so python can correctly recognized it as module

@pascal-roth
Copy link
Collaborator Author

the package import for prim_utils doesn't work for the same reason as stage_utils, we used too many wild card

import isaaclab.sim.utils.prims as prim_utils

need to change to from isaaclab.sim.utils import prims as prim_utils so python can correctly recognized it as module

That's not great, let's split up the utils/utils.py now to enable those imports again

@ooctipus ooctipus force-pushed the feature/replace-prim-utils branch from 86086e0 to 9be7fe9 Compare November 23, 2025 00:13
Copy link
Contributor

@kellyguo11 kellyguo11 left a comment

Choose a reason for hiding this comment

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

we are adding a lot of new code, do we have plans to add tests for all the new utils?

Copy link
Collaborator

@AntoineRichard AntoineRichard left a comment

Choose a reason for hiding this comment

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

What do we do with these?

@Mayankm96
Copy link
Contributor

@pascal-roth Thanks for putting this together. I’m not fully convinced these one-line wrappers add much value, though. Since USD already has solid documentation, I wonder if maintaining parallel Isaac Sim functions might increase overhead without clear benefit. Would it make sense to remove these helpers and reference USD directly instead?

Personally, I’d prefer removing the wrappers altogether, but I’m fine handling that either here or in a follow-up MR depending on what keeps the review simplest.

@ooctipus
Copy link
Collaborator

ooctipus commented Dec 1, 2025

I agree is Mayank, my personal opinion is to remove this wrapper in follow up PR, as thorough removal require more thorough refactor, this pr is more likely what will lands in newton for the only purpose of remove kit dependency, and we make sure the main has something similar.

@kellyguo11
Copy link
Contributor

kellyguo11 commented Dec 3, 2025

sounds like we are mostly ok with this PR to go in for now to be in alignment with the newton branch, but we should look into cleaning up all of the utilities in a follow-up PR. I think we should get this merged in then so that we also do not block the multi-mesh raycaster PR.

@Mayankm96 @ooctipus @AntoineRichard are you guys ok to give approval to merge this?

@kellyguo11 kellyguo11 merged commit aec36d9 into isaac-sim:main Dec 10, 2025
9 of 10 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Isaac Lab Dec 10, 2025
T-K-233 pushed a commit to ucb-bar/IsaacLab that referenced this pull request Dec 29, 2025
…3924)

# Description

Remove dependency on IsaacSim `prim_utils` for integration of new
simulation engines like `newton`.

NOTE: this PR depends on isaac-sim#3923 

## Type of change

- Dependency removal

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] 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

---------

Signed-off-by: ooctipus <[email protected]>
Signed-off-by: Kelly Guo <[email protected]>
Co-authored-by: Octi Zhang <[email protected]>
Co-authored-by: Kelly Guo <[email protected]>
Edify0991 pushed a commit to Edify0991/IsaacLab that referenced this pull request Jan 14, 2026
…3924)

# Description

Remove dependency on IsaacSim `prim_utils` for integration of new
simulation engines like `newton`.

NOTE: this PR depends on isaac-sim#3923 

## Type of change

- Dependency removal

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] 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

---------

Signed-off-by: ooctipus <[email protected]>
Signed-off-by: Kelly Guo <[email protected]>
Co-authored-by: Octi Zhang <[email protected]>
Co-authored-by: Kelly Guo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request isaac-lab Related to Isaac Lab team

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants