-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Replaces IsaacSim stage_utils with IsaacLab stage_utils
#3923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Replaces IsaacSim stage_utils with IsaacLab stage_utils
#3923
Conversation
There was a problem hiding this 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
Reimplemented IsaacSim's stage_utils module within IsaacLab to remove dependency on IsaacSim's stage utilities, enabling integration with new simulation engines like Newton.
Key Changes:
- Created new
isaaclab/sim/utils/stage.pymodule (795 lines) implementing stage utility functions previously imported fromisaacsim.core.utils.stage - Restructured
isaaclab/sim/utils.pytoisaaclab/sim/utils/utils.pywith corresponding__init__.py - Updated all 51 files across the codebase to import from local
isaaclab.sim.utils.stageinstead ofisaacsim.core.utils.stage - Maintained backward compatibility with Isaac Sim versions < 5.0 through version checks
- Preserved all existing functionality including stage-in-memory support, stage manipulation, and USD operations
Issue Found:
- Critical import error in
source/isaaclab/isaaclab/sim/utils/utils.py:35- incorrect relative import path after file restructure (.spawnersshould be..spawners)
Confidence Score: 2/5
- This PR has a critical import error that will cause runtime failures
- The PR successfully reimplements IsaacSim's stage utilities and updates imports across 51 files consistently. However, there is a critical syntax error in
utils.pyline 35 with an incorrect relative import path (.spawnersinstead of..spawners) after the file was moved fromsim/utils.pytosim/utils/utils.py. This will cause import failures at runtime when the TYPE_CHECKING guard is bypassed or when the module is actually imported. - Pay close attention to
source/isaaclab/isaaclab/sim/utils/utils.py- the relative import on line 35 must be fixed before merge
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| source/isaaclab/isaaclab/sim/utils/stage.py | 4/5 | new stage_utils implementation reimplementing IsaacSim functionality - comprehensive and follows original patterns closely |
| source/isaaclab/isaaclab/sim/utils/utils.py | 2/5 | moved from sim/utils.py to sim/utils/utils.py with incorrect relative import path on line 35 |
| source/isaaclab/isaaclab/sim/simulation_context.py | 5/5 | updated imports to use local stage_utils instead of IsaacSim's version - clean refactor |
Sequence Diagram
sequenceDiagram
participant App as Application Code
participant SimCtx as SimulationContext
participant StageUtils as isaaclab.sim.utils.stage
participant USD as USD Stage
participant PhysX as PhysX Interface
Note over App,PhysX: Before PR: Used isaacsim.core.utils.stage
Note over App,PhysX: After PR: Uses isaaclab.sim.utils.stage
App->>SimCtx: create_new_stage_in_memory()
SimCtx->>StageUtils: create_new_stage_in_memory()
StageUtils->>USD: Usd.Stage.CreateInMemory()
USD-->>StageUtils: stage
StageUtils-->>SimCtx: stage
App->>StageUtils: use_stage(stage)
Note over StageUtils: Sets thread-local context
StageUtils->>StageUtils: _context.stage = stage
App->>StageUtils: get_current_stage()
StageUtils->>StageUtils: getattr(_context, "stage", ...)
StageUtils-->>App: current stage
App->>StageUtils: attach_stage_to_usd_context()
StageUtils->>StageUtils: get_current_stage_id()
StageUtils->>PhysX: attach_stage(stage_id)
StageUtils->>SimCtx: skip_next_stage_open_callback()
StageUtils->>USD: attach_stage_with_callback(stage_id)
StageUtils->>PhysX: attach_stage(stage_id)
51 files reviewed, 1 comment
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Pascal Roth <[email protected]>
There was a problem hiding this 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
Reimplements IsaacSim stage_utils as IsaacLab sim.utils.utils to remove external dependency for Newton engine integration.
Key Changes:
- Adds new
utils.pywith USD prim manipulation utilities (1031 lines) - Implements decorators (
@apply_nested,@clone) for prim operations - Provides material binding, export, and stage traversal functions
- Handles Isaac Sim version compatibility (4.x vs 5.x)
Issues Found:
- Line 292: Version parsing bug - attempts to join single string
get_version()[2]which will cause runtime error
Confidence Score: 2/5
- Contains critical version parsing bug that will cause runtime failures when cloning prims in Isaac Sim 5.0+
- The version parsing bug on line 292 will cause an AttributeError when the
clonedecorator is used with multiple prim paths, breaking core spawning functionality. While the overall architecture is sound and the dependency removal goal is achieved, this syntax error needs immediate fixing before merge. source/isaaclab/isaaclab/sim/utils/utils.py- fix line 292 version parsing before merge
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| source/isaaclab/isaaclab/sim/utils/utils.py | 3/5 | New file reimplements IsaacSim stage_utils to remove dependency; contains version parsing bug on line 292 |
Sequence Diagram
sequenceDiagram
participant User as User Code
participant Utils as sim.utils.utils
participant Stage as sim.utils.stage
participant Spawners as sim.spawners
participant IsaacSim as isaacsim.core
Note over Utils: Removed IsaacSim stage_utils dependency
User->>Utils: clone() decorator
Utils->>Stage: get_current_stage()
Stage->>IsaacSim: omni.usd context
IsaacSim-->>Stage: USD Stage
Stage-->>Utils: stage handle
Utils->>Utils: find_matching_prim_paths()
Utils->>Spawners: SpawnerCfg (TYPE_CHECKING)
Utils->>IsaacSim: Cloner(stage)
IsaacSim-->>Utils: cloner instance
Utils->>IsaacSim: get_version()
IsaacSim-->>Utils: version tuple
Note over Utils: Bug: incorrect version parsing
Utils->>IsaacSim: cloner.clone()
IsaacSim-->>Utils: cloned prims
Utils-->>User: spawned prim
Additional Comments (1)
-
source/isaaclab/isaaclab/sim/utils/utils.py, line 292 (link)syntax: incorrect version parsing -
get_version()[2]returns a single string (e.g. "5"), cannot join it
1 file reviewed, 1 comment
Description
Remove dependency on IsaacSim
stage_utilsfor integration of new simulation engines likenewton.Type of change
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there