-
Notifications
You must be signed in to change notification settings - Fork 3k
[WIP] Add Visualizers and Scene Data Providers #4474
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
Open
matthewtrepte
wants to merge
16
commits into
isaac-sim:develop
Choose a base branch
from
matthewtrepte:mtrepte/add_viz
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,975
−35
Open
Changes from 5 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
5b6bbea
initial work on omni physx compat newton-based viewers
matthewtrepte 3c53d7a
testing
matthewtrepte 434908b
wip: initial design for adding viz
matthewtrepte 3e6fbef
simplify
matthewtrepte 323f638
correction
matthewtrepte 24a515e
clean
matthewtrepte 7bb61d1
rm files
matthewtrepte 700af2f
restore
matthewtrepte 2da5d71
revert file
matthewtrepte 35e5adb
fixes + rm contact debug
matthewtrepte 8370a81
fix ov visualizer, edit docs
matthewtrepte 0705f33
prepping for review
matthewtrepte 70a13ff
Merge branch 'develop', remote-tracking branch 'upstream' into mtrept…
matthewtrepte b6c91a9
sanatize ov camera path
matthewtrepte 17f7538
Merge branch 'develop' into mtrepte/add_viz
matthewtrepte 5dadc37
refactor scene data provider, unify apis
matthewtrepte File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -120,6 +120,10 @@ def __init__(self, cfg: InteractiveSceneCfg): | |
| cfg.validate() | ||
| # store inputs | ||
| self.cfg = cfg | ||
|
|
||
| # TODO(mtrepte): remove | ||
|
||
| self.cfg.clone_in_fabric = False | ||
|
|
||
| # initialize scene elements | ||
| self._terrain = None | ||
| self._articulations = dict() | ||
|
|
@@ -133,6 +137,11 @@ def __init__(self, cfg: InteractiveSceneCfg): | |
| self.sim = SimulationContext.instance() | ||
| self.stage = get_current_stage() | ||
| self.stage_id = get_current_stage_id() | ||
| # publish num_envs for consumers outside the scene | ||
| try: | ||
| self.sim.set_setting("/isaaclab/scene/num_envs", int(self.cfg.num_envs)) | ||
| except Exception: | ||
| pass | ||
| # physics scene path | ||
| self._physics_scene_path = None | ||
| # prepare cloner for environment replication | ||
|
|
@@ -270,6 +279,18 @@ def clone_environments(self, copy_from_source: bool = False): | |
| if self._default_env_origins is None: | ||
| self._default_env_origins = torch.tensor(env_origins, device=self.device, dtype=torch.float32) | ||
|
|
||
| # publish env origins for consumers that cannot read USD (e.g., Fabric clones) | ||
| try: | ||
| if hasattr(env_origins, "flatten"): | ||
| origins_list = env_origins.flatten().tolist() | ||
| else: | ||
| origins_list = [] | ||
| for origin in env_origins: | ||
| origins_list.extend(list(origin)) | ||
| self.sim.set_setting("/isaaclab/scene/env_origins", origins_list) | ||
| except Exception: | ||
| pass | ||
|
|
||
| def filter_collisions(self, global_prim_paths: list[str] | None = None): | ||
| """Filter environments collisions. | ||
|
|
||
|
|
||
17 changes: 17 additions & 0 deletions
17
source/isaaclab/isaaclab/sim/scene_data_providers/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #!/usr/bin/env python3 | ||
| # Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). | ||
| # All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| """Scene data providers for visualizers and renderers.""" | ||
|
|
||
| from .newton_scene_data_provider import NewtonSceneDataProvider | ||
| from .ov_scene_data_provider import OVSceneDataProvider | ||
| from .scene_data_provider import SceneDataProvider | ||
|
|
||
| __all__ = [ | ||
| "SceneDataProvider", | ||
| "NewtonSceneDataProvider", | ||
| "OVSceneDataProvider", | ||
| ] |
96 changes: 96 additions & 0 deletions
96
source/isaaclab/isaaclab/sim/scene_data_providers/newton_scene_data_provider.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| #!/usr/bin/env python3 | ||
| # Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). | ||
| # All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| """Newton-backed scene data provider.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import logging | ||
| from typing import Any | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| class NewtonSceneDataProvider: | ||
| """Scene data provider for Newton Warp physics backend. | ||
|
|
||
| Native (cheap): Newton Model/State from NewtonManager | ||
| Adapted (future): USD stage (would need Newton→USD sync for OV visualizer) | ||
| """ | ||
|
|
||
| def __init__(self, visualizer_cfgs: list[Any] | None) -> None: | ||
| self._has_ov_visualizer = False | ||
| self._metadata: dict[str, Any] = {} | ||
|
|
||
| if visualizer_cfgs: | ||
| for cfg in visualizer_cfgs: | ||
| if getattr(cfg, "visualizer_type", None) == "omniverse": | ||
| self._has_ov_visualizer = True | ||
|
|
||
| try: | ||
| from isaaclab.sim._impl.newton_manager import NewtonManager | ||
|
|
||
| self._metadata = { | ||
| "physics_backend": "newton", | ||
| "num_envs": NewtonManager._num_envs if NewtonManager._num_envs is not None else 0, | ||
| "gravity_vector": NewtonManager._gravity_vector, | ||
| "clone_physics_only": NewtonManager._clone_physics_only, | ||
| } | ||
| except Exception: | ||
| self._metadata = {"physics_backend": "newton"} | ||
|
|
||
| def update(self) -> None: | ||
| """No-op for Newton backend (state updated by Newton solver).""" | ||
| pass | ||
|
|
||
| def get_newton_model(self) -> Any | None: | ||
| """NATIVE: Newton Model from NewtonManager.""" | ||
| try: | ||
| from isaaclab.sim._impl.newton_manager import NewtonManager | ||
| return NewtonManager._model | ||
| except Exception: | ||
| return None | ||
|
|
||
| def get_newton_state(self) -> Any | None: | ||
| """NATIVE: Newton State from NewtonManager.""" | ||
| try: | ||
| from isaaclab.sim._impl.newton_manager import NewtonManager | ||
| return NewtonManager._state_0 | ||
| except Exception: | ||
| return None | ||
|
|
||
| def get_usd_stage(self) -> None: | ||
| """UNAVAILABLE: Newton backend doesn't provide USD (future: Newton→USD sync).""" | ||
| return None | ||
|
|
||
| def get_metadata(self) -> dict[str, Any]: | ||
| return dict(self._metadata) | ||
|
|
||
| def get_transforms(self) -> dict[str, Any] | None: | ||
| """Extract transforms from Newton state (future work).""" | ||
| return None | ||
|
|
||
| def get_velocities(self) -> dict[str, Any] | None: | ||
| try: | ||
| from isaaclab.sim._impl.newton_manager import NewtonManager | ||
| if NewtonManager._state_0 is None: | ||
| return None | ||
| return {"body_qd": NewtonManager._state_0.body_qd} | ||
| except Exception: | ||
| return None | ||
|
|
||
| def get_contacts(self) -> dict[str, Any] | None: | ||
| try: | ||
| from isaaclab.sim._impl.newton_manager import NewtonManager | ||
| if NewtonManager._contacts is None: | ||
| return None | ||
| return {"contacts": NewtonManager._contacts} | ||
| except Exception: | ||
| return None | ||
|
|
||
| def get_mesh_data(self) -> dict[str, Any] | None: | ||
| """ADAPTED: Extract mesh data from Newton shapes (future work).""" | ||
| return None |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Debug print and commented debugger breakpoint left in production code