Replaces Isaac Sim SimulationManager with IsaacLab SimulationManager#4475
Replaces Isaac Sim SimulationManager with IsaacLab SimulationManager#4475ooctipus wants to merge 154 commits intoisaac-sim:developfrom
Conversation
AntoineRichard
left a comment
There was a problem hiding this comment.
Intermediary review. I feel the code is a bit too convoluted at times. Let's sync on that.
There was a problem hiding this comment.
Should we remove the isaacsim_4_5 apps or do we plan on supporting those still?
There was a problem hiding this comment.
Should we remove the isaacsim_4_5 apps or do we plan on supporting those still?
| "isaacsim.core.cloner" = {} | ||
| "isaacsim.core.nodes" = {} | ||
| "isaacsim.core.simulation_manager" = {} | ||
| # "isaacsim.core.simulation_manager" = {} # Replaced by isaaclab.sim.simulation_manager |
There was a problem hiding this comment.
This can just be removed?
apps/isaaclab.python.kit
Outdated
| "isaacsim.core.cloner" = {} | ||
| "isaacsim.core.nodes" = {} | ||
| "isaacsim.core.simulation_manager" = {} | ||
| # "isaacsim.core.simulation_manager" = {} # Replaced by isaaclab.sim.simulation_manager |
There was a problem hiding this comment.
This could be removed directly?
| ) | ||
| # register prim deletion callback | ||
| self._prim_deletion_callback_id = SimulationManager.register_callback( | ||
| self._prim_deletion_callback_id = PhysxManager.register_callback( |
There was a problem hiding this comment.
I think the callbacks should live in the simulation context. It's something that we could take a look at in an other PR.
There was a problem hiding this comment.
Let's not have that here. I understand that it was used for testing, but let's keep things pure PhysX for now.
There was a problem hiding this comment.
Let's not have that here
| # from .newton_manager import NewtonManager | ||
| # from .newton_manager_cfg import NewtonManagerCfg |
| # "NewtonManager", | ||
| # "NewtonManagerCfg", |
There was a problem hiding this comment.
In general let's try to have only things that we can use here.
| desired_orientation[:, 1] = 1.0 | ||
| # create state machine | ||
| open_sm = OpenDrawerSm(env_cfg.sim.dt * env_cfg.decimation, env.unwrapped.num_envs, env.unwrapped.device) | ||
| open_sm = OpenDrawerSm(env_cfg.sim.physics_manager_cfg.dt * env_cfg.decimation, env.unwrapped.num_envs, env.unwrapped.device) |
There was a problem hiding this comment.
I think I like retrieving the attributes from env_cfg.sim.dt directly a bit more - would it make sense to still keep some common attributes in the SimulationCfg? probably also less breaking changes for user scripts
| # | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| """Newton physics manager for Isaac Lab.""" |
There was a problem hiding this comment.
is this being added here to also refactor it to match the new PhysicsManager interface? I'm not sure if we anticipate more changes for this in the dev/newton branch before merging things in.
| # | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| """PhysX Manager for Isaac Lab. |
There was a problem hiding this comment.
I think this would likely be the OV manager, since ovphysx will probably have a different set of APIs
| from .simulation_context import SimulationContext | ||
|
|
||
|
|
||
| class Interface(ABC): |
There was a problem hiding this comment.
this does feel maybe a bit too abstracted, perhaps we can just combine the interface idea into the SimulationContext?
we can probably go with the approach we talked about today where we design the classes with interface in mind, but flatten them out when we do the implementation.
| # | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| """Visualizer interface for SimulationContext.""" |
There was a problem hiding this comment.
would be good for @matthewtrepte to provide feedback for the visualizers
| from .legacy import * # noqa: F401, F403 | ||
| from .prims import * # noqa: F401, F403 | ||
| from .queries import * # noqa: F401, F403 | ||
| from .semantics import * # noqa: F401, F403 | ||
| from .stage import * # noqa: F401, F403 | ||
| from .transforms import * # noqa: F401, F403 | ||
|
|
||
|
|
||
| def raise_callback_exception_if_any() -> None: |
There was a problem hiding this comment.
I wonder if there's a better way to handle the exceptions if we follow our own callback system? I think this was kind of a hacky way we had to do to force exceptions to be propagated from the OV callbacks
| # Monkey-patch Isaac Sim's PhysxManager to use Isaac Lab's implementation | ||
| # This ensures all code (including Isaac Sim internals) uses our manager | ||
| try: | ||
| import isaacsim.core.simulation_manager as _isaacsim_sim_manager |
There was a problem hiding this comment.
hmm...this feels a bit scary haha, is there any way we can avoid referencing Isaac Sim's SimulationManager all together?
There was a problem hiding this comment.
I think we want to avoid cases where there is isaacsim manager and isaaclab manager, since both are singeton, just like we point isaaclab stage as isaacsim stage x)
| raise | ||
| finally: | ||
| if not sim.has_gui(): | ||
| # Stop simulation only if we aren't rendering otherwise the app will hang indefinitely | ||
| if not sim.get_setting("/isaaclab/has_gui"): |
There was a problem hiding this comment.
is the has_gui flag important for non-OV workflows as well?
| # | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| """Newton OpenGL Visualizer implementation.""" |
There was a problem hiding this comment.
let's sync with @matthewtrepte on the visualizer classes since he's been looking at integrating these with the PhysX backend.
There was a problem hiding this comment.
we can probably also bring things in piece by piece so we can keep this PR somewhat smaller
28009e4 to
2fa5656
Compare
Description
Adds simulation manager that replaces Isaac sim simulation manager,
this is currently a draft, things are mostly working, but lacks clean up.