-
Notifications
You must be signed in to change notification settings - Fork 3k
Replaces Isaac Sim SimulationManager with IsaacLab SimulationManager #4475
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: develop
Are you sure you want to change the base?
Conversation
Greptile OverviewGreptile SummaryReplaces Isaac Sim's Key Changes
ArchitectureThe new Potential Concerns
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant SimContext as SimulationContext
participant SimMgr as SimulationManager
participant Timeline
participant PhysX
participant Assets
participant Sensors
User->>SimContext: __init__(cfg)
SimContext->>SimContext: Create stage
SimContext->>SimMgr: initialize()
SimMgr->>Timeline: Subscribe to PLAY/STOP events
SimMgr->>SimMgr: Setup internal callbacks
SimContext->>SimContext: Configure physics scene
SimContext->>PhysX: Apply physics settings
User->>SimContext: reset()
SimContext->>Timeline: stop() then play()
Timeline->>SimMgr: _on_play event
SimMgr->>SimMgr: initialize_physics()
SimMgr->>PhysX: force_load_physics_from_usd()
SimMgr->>PhysX: start_simulation()
SimMgr->>SimMgr: Dispatch PHYSICS_WARMUP event
SimMgr->>SimMgr: _create_views()
SimMgr->>PhysX: create_simulation_view(backend)
SimMgr->>SimMgr: Dispatch SIMULATION_VIEW_CREATED
SimMgr->>SimMgr: Dispatch PHYSICS_READY
Assets->>SimMgr: Register callbacks (PHYSICS_READY)
Sensors->>SimMgr: Register callbacks (PHYSICS_READY)
Assets->>Assets: _initialize_impl()
Sensors->>Sensors: _initialize_impl()
User->>SimContext: step()
SimContext->>PhysX: simulate(dt)
PhysX->>SimMgr: PRE_PHYSICS_STEP callbacks
PhysX->>PhysX: Physics update
PhysX->>SimMgr: POST_PHYSICS_STEP callbacks
SimContext->>SimContext: render()
User->>SimContext: clear_instance()
SimContext->>SimMgr: clear()
SimMgr->>SimMgr: dispatch_prim_deletion("/")
Assets->>Assets: _clear_callbacks()
Sensors->>Sensors: _clear_callbacks()
SimMgr->>SimMgr: Invalidate views
SimMgr->>SimMgr: Clear all state
SimContext->>PhysX: detach_stage()
|
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.
7 files reviewed, 2 comments
| if hasattr(callback, "__self__"): | ||
| obj_ref = weakref.proxy(callback.__self__) | ||
| method_name = callback.__name__ | ||
| cb = lambda e, o=obj_ref, m=method_name: getattr(o, m)(e) |
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.
Using weakref.proxy in a lambda can cause issues if the object is garbage collected before the callback is invoked
| if hasattr(callback, "__self__"): | |
| obj_ref = weakref.proxy(callback.__self__) | |
| method_name = callback.__name__ | |
| cb = lambda e, o=obj_ref, m=method_name: getattr(o, m)(e) | |
| if hasattr(callback, "__self__"): | |
| obj_ref = weakref.ref(callback.__self__) | |
| method_name = callback.__name__ | |
| def cb(e): | |
| obj = obj_ref() | |
| if obj is not None: | |
| getattr(obj, method_name)(e) |
| # This ensures all code (including Isaac Sim internals) uses our manager | ||
| try: | ||
| import isaacsim.core.simulation_manager as _isaacsim_sim_manager | ||
| import isaacsim.core.simulation_manager.impl.simulation_manager as _isaacsim_sim_manager_impl | ||
|
|
||
| # Get reference to the ORIGINAL Isaac Sim SimulationManager before patching | ||
| _OriginalSimManager = _isaacsim_sim_manager_impl.SimulationManager | ||
|
|
||
| # Disable all default callbacks from Isaac Sim's manager to prevent double-dispatch | ||
| # These callbacks were already set up when the extension loaded, so we need to disable them | ||
| _OriginalSimManager.enable_all_default_callbacks(False) |
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.
Verify that monkey-patching occurs before any Isaac Sim code caches references to the original SimulationManager class, otherwise those references will still point to the old implementation
…ode our of simulation context
2720041 to
6ac6ed4
Compare
Description
Adds simulation manager that replaces Isaac sim simulation manager,
this is currently a draft, things are mostly working, but lacks clean up.