Skip to content
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

Upgrade to isaac sim 4.2 & VR #906

Draft
wants to merge 47 commits into
base: og-develop
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
4c9d1e1
Upgrade to isaac sim 4.2
hang-yin Sep 25, 2024
13fe889
Add version 4.2 to KIT_FILES
hang-yin Sep 25, 2024
36dee3b
Merge branch 'og-develop' of https://github.com/StanfordVL/OmniGibson…
hang-yin Oct 2, 2024
5c2d25a
Merge branch 'og-develop' of https://github.com/StanfordVL/OmniGibson…
hang-yin Oct 3, 2024
5cddc03
Fix ObjectsInFOVOfRobot test
hang-yin Oct 7, 2024
14051b2
Isaac 4 2 update
hang-yin Oct 7, 2024
c303a0b
Deprecate projection emitter
hang-yin Oct 7, 2024
ffdce57
Retrieve default shader input from shader node
hang-yin Oct 7, 2024
1e13d9e
Merge branch 'og-develop' into isaac_4_2
hang-yin Oct 7, 2024
aab3b3b
Unbreak ObjectsInFOVOfRobot test
hang-yin Oct 7, 2024
1e04111
Fix transform util
hang-yin Oct 7, 2024
8a7f3af
Fix material prim shader input bug
hang-yin Oct 8, 2024
c8cf5b9
Rename shader_input_names_by_type
hang-yin Oct 8, 2024
99f0999
Update robot pictures
hang-yin Oct 8, 2024
c210870
Mist effect initial implementation
hang-yin Oct 23, 2024
d03bfd4
VR scene tour demo without robot control
hang-yin Oct 31, 2024
4aeed8f
VR robot control with A1 demo
hang-yin Oct 31, 2024
97e85cc
Small infra changes for VR teleop
hang-yin Oct 31, 2024
552d87c
Teleop utils refactor, WIP
hang-yin Oct 31, 2024
90efba5
Update 4-2-0 kit file to include vr/xr extension
hang-yin Oct 31, 2024
2e6e63a
Merge branch 'isaac_4_2' of https://github.com/StanfordVL/OmniGibson …
hang-yin Nov 4, 2024
bc74a5c
WIP
hang-yin Nov 27, 2024
8f41145
Merge branch 'asset-conversion' of https://github.com/StanfordVL/Omni…
hang-yin Nov 27, 2024
bf3c2f9
Minor updates
hang-yin Dec 2, 2024
cfb5f30
Merge branch 'isaac_4_2' of https://github.com/StanfordVL/OmniGibson …
hang-yin Dec 2, 2024
f30bf9e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 2, 2024
397a34d
Clean up vr utils
hang-yin Dec 3, 2024
0d808f2
Merge branch 'feat/np-opt' of https://github.com/StanfordVL/OmniGibso…
hang-yin Dec 4, 2024
54a351d
Allow headset to follow xformprim
hang-yin Dec 5, 2024
e73e1ab
Merge branch 'feat/np-opt' of https://github.com/StanfordVL/OmniGibso…
hang-yin Dec 5, 2024
d8d009e
Merge branch 'feat/np-opt' of https://github.com/StanfordVL/OmniGibso…
hang-yin Dec 5, 2024
20d4da2
Numpy optimization and data collection wrapper bug fixes
hang-yin Dec 9, 2024
4377a57
Allow VR free head orientation motion; optimize VR for data collection
hang-yin Dec 9, 2024
deccf82
Add view angle limits to VR
hang-yin Dec 12, 2024
40cc3f0
Merge branch 'og-develop' of https://github.com/StanfordVL/OmniGibson…
hang-yin Dec 17, 2024
f455421
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 17, 2024
ffa72bc
Merge branch 'feat/np-opt' of https://github.com/StanfordVL/OmniGibso…
hang-yin Dec 18, 2024
1c57085
Tiny bug fixes
hang-yin Dec 18, 2024
7d02e86
Merge branch 'isaac_4_2' of https://github.com/StanfordVL/OmniGibson …
hang-yin Dec 18, 2024
9615cd6
Write videos with data wrapper
hang-yin Dec 20, 2024
c10ed28
Add recording flag to data wrapper and VR support
hang-yin Dec 20, 2024
e935957
tmp fix
hang-yin Jan 19, 2025
f2c154a
Merge branch 'feat/data-wrapper-vr' of https://github.com/StanfordVL/…
hang-yin Jan 20, 2025
de6850c
TMP changes
hang-yin Jan 21, 2025
e944a68
quick change
hang-yin Jan 21, 2025
c73e7b8
tmp changes
hang-yin Jan 22, 2025
6a73adb
VR scene tour fix
hang-yin Feb 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Deprecate projection emitter
hang-yin committed Oct 7, 2024
commit c303a0be6c74c0f80e5f60837678648946f3f624
88 changes: 2 additions & 86 deletions omnigibson/object_states/particle_modifier.py
Original file line number Diff line number Diff line change
@@ -1012,7 +1012,6 @@ def __init__(

self.projection_system = None
self.projection_system_prim = None
self.projection_emitter = None

# Run super
super().__init__(obj=obj, method=method, conditions=conditions, projection_mesh_params=projection_mesh_params)
@@ -1026,79 +1025,6 @@ def _initialize(self):
# This will initialize the system if it's not initialized already.
system = self.obj.scene.get_system(system_name)

if self.visualize:
assert self._projection_mesh_params["type"] in {
"Cylinder",
"Cone",
}, f"{self.__class__.__name__} visualization only supports Cylinder and Cone types!"
radius, height = (
th.mean(self._projection_mesh_params["extents"][:2]) / 2.0,
self._projection_mesh_params["extents"][2],
)
# Generate the projection visualization
particle_radius = (
m.VISUAL_PARTICLE_PROJECTION_PARTICLE_RADIUS
if self.obj.scene.is_visual_particle_system(system_name=system.name)
else system.particle_radius
)

name_prefix = f"{self.obj.name}_{self.__class__.__name__}"
# Create the projection visualization if it doesn't already exist, otherwise we reference it directly
projection_name = f"{name_prefix}_projection_visualization"
projection_path = f"/OmniGraph/{projection_name}"
projection_visualization_path = f"{self.link.prim_path}/projection_visualization"
if lazy.omni.isaac.core.utils.prims.is_prim_path_valid(projection_path):
self.projection_system = lazy.omni.isaac.core.utils.prims.get_prim_at_path(projection_path)
self.projection_emitter = lazy.omni.isaac.core.utils.prims.get_prim_at_path(
f"{projection_path}/emitter"
)
else:
self.projection_system, self.projection_emitter = create_projection_visualization(
scene=self.obj.scene,
prim_path=projection_visualization_path,
shape=self._projection_mesh_params["type"],
projection_name=projection_name,
projection_radius=radius,
projection_height=height,
particle_radius=particle_radius,
parent_scale=self.link.scale,
material=system.material,
)
relative_projection_system_path = absolute_prim_path_to_scene_relative(
self.obj.scene, self.projection_system.GetPrimPath().pathString
)
self.projection_system_prim = BasePrim(
relative_prim_path=relative_projection_system_path, name=projection_name
)
self.projection_system_prim.load(self.obj.scene)

# Create the visual geom instance referencing the generated source mesh prim, and then hide it
relative_projection_source_path = absolute_prim_path_to_scene_relative(
self.obj.scene, projection_visualization_path
)
self.projection_source_sphere = VisualGeomPrim(
relative_prim_path=relative_projection_source_path, name=f"{name_prefix}_projection_source_sphere"
)
self.projection_source_sphere.load(self.obj.scene)
self.projection_source_sphere.initialize()
self.projection_source_sphere.visible = False
# Rotate by 90 degrees in y-axis so that the projection visualization aligns with the projection mesh
self.projection_source_sphere.set_position_orientation(
orientation=T.euler2quat(th.tensor([0, math.pi / 2, 0], dtype=th.float32)), frame="parent"
)

# Make sure the meta mesh is aligned with the meta link if visualizing
# This corresponds to checking (a) position of tip of projection mesh should align with origin of
# metalink, and (b) zero relative orientation between the metalink and the projection mesh
local_pos, local_quat = self.projection_mesh.get_position_orientation(frame="parent")
assert th.all(
th.isclose(local_pos + th.tensor([0, 0, height / 2.0]), th.zeros_like(local_pos))
), "Projection mesh tip should align with metalink position!"
local_euler = T.quat2euler(local_quat)
assert th.all(
th.isclose(local_euler, th.zeros_like(local_euler))
), "Projection mesh orientation should align with metalink orientation!"

# Store which method to use for sampling particle locations
if self._sample_with_raycast:
if self.method == ParticleModifyMethod.PROJECTION:
@@ -1193,16 +1119,6 @@ def _compute_particle_spawn_information(self, system):
)
self._in_mesh_local_particle_directions = directions / th.norm(directions, dim=-1).reshape(-1, 1)

def _update(self):
# If we're about to check for modification, update whether it the visualization should be active or not
if self.visualize and self._current_step == 0:
# Only one system in our conditions, so next(iter()) suffices
is_active = all(condition(self.obj) for condition in next(iter(self.conditions.values())))
self.projection_emitter.GetProperty("inputs:active").Set(is_active)

# Run super
super()._update()

def remove(self):
# We need to remove the projection visualization if it exists
if self.projection_system_prim is not None:
@@ -1489,8 +1405,8 @@ def systems_to_check(self):

@property
def projection_is_active(self):
# Only active if the projection mesh is enabled
return self.projection_emitter.GetProperty("inputs:active").Get()
# Only one system in our conditions, so next(iter()) suffices
return all(condition(self.obj) for condition in next(iter(self.conditions.values())))

@classproperty
def metalink_prefix(cls):
92 changes: 0 additions & 92 deletions omnigibson/utils/deprecated_utils.py
Original file line number Diff line number Diff line change
@@ -20,8 +20,6 @@
from omni.isaac.core.utils.prims import get_prim_at_path, get_prim_parent
from omni.kit.primitive.mesh.command import CreateMeshPrimWithDefaultXformCommand as CMPWDXC
from omni.kit.primitive.mesh.command import _get_all_evaluators
from omni.particle.system.core.scripts.core import Core as OmniCore
from omni.particle.system.core.scripts.utils import Utils as OmniUtils
from omni.replicator.core import random_colours
from PIL import Image, ImageDraw
from pxr import PhysxSchema, Sdf, Usd, UsdGeom, UsdPhysics, UsdShade
@@ -82,96 +80,6 @@ def __init__(self, prim_type: str, **kwargs):
assert isinstance(self._evaluator_class, type)


class Utils(OmniUtils):
def create_material(self, name):
material_url = carb.settings.get_settings().get("/exts/omni.particle.system.core/material")

# TODO: THIS IS THE ONLY LINE WE CHANGE! "/" SHOULD BE ""
material_path = ""
default_prim = self.stage.GetDefaultPrim()
if default_prim:
material_path = default_prim.GetPath().pathString

if not self.stage.GetPrimAtPath(material_path + "/Looks"):
self.stage.DefinePrim(material_path + "/Looks", "Scope")
material_path += "/Looks/" + name
material_path = ou.get_stage_next_free_path(self.stage, material_path, False)
prim = self.stage.DefinePrim(material_path, "Material")
if material_url:
prim.GetReferences().AddReference(material_url)
else:
carb.log_error("Failed to find material URL in settings")

return [material_path]


class Core(OmniCore):
"""
Subclass that overrides a specific function within Omni's Core class to fix a bug
"""

def __init__(self, popup_callback: Callable[[str], None], particle_system_name: str):
self._popup_callback = popup_callback
self.utils = Utils()
self.context = ou.get_context()
self.stage = self.context.get_stage()
self.selection = self.context.get_selection()
self.particle_system_name = particle_system_name
self.sub_stage_update = self.context.get_stage_event_stream().create_subscription_to_pop(self.on_stage_update)
self.on_stage_update()

def get_compute_graph(self, selected_paths, create_new_graph=True, created_paths=None):
"""
Returns the first ComputeGraph found in selected_paths.
If no graph is found and create_new_graph is true, a new graph will be created and its
path appended to created_paths (if provided).
"""
graph = None
graph_paths = [
path
for path in selected_paths
if self.stage.GetPrimAtPath(path).GetTypeName() in ["ComputeGraph", "OmniGraph"]
]

if len(graph_paths) > 0:
graph = ogc.get_graph_by_path(graph_paths[0])
if len(graph_paths) > 1:
carb.log_warn(
f"Multiple ComputeGraph prims selected. Only the first will be used: {graph.get_path_to_graph()}"
)
elif create_new_graph:
# If no graph was found in the selected prims, we'll make a new graph.
# TODO: THIS IS THE ONLY LINE THAT WE CHANGE! ONCE FIXED, REMOVE THIS
graph_path = Sdf.Path(f"/OmniGraph/{self.particle_system_name}").MakeAbsolutePath(Sdf.Path.absoluteRootPath)
graph_path = ou.get_stage_next_free_path(self.stage, graph_path, True)

# prim = self.stage.GetDefaultPrim()
# path = str(prim.GetPath()) if prim else ""
self.stage.DefinePrim("/OmniGraph", "Scope")

container_graphs = ogc.get_global_container_graphs()
# FIXME: container_graphs[0] should be the simulation orchestration graph, but this may change in the future.
container_graph = container_graphs[0]
result, wrapper_node = ogc.cmds.CreateGraphAsNode(
graph=container_graph,
node_name=Sdf.Path(graph_path).name,
graph_path=graph_path,
evaluator_name="push",
is_global_graph=True,
backed_by_usd=True,
fc_backing_type=ogc.GraphBackingType.GRAPH_BACKING_TYPE_FLATCACHE_SHARED,
pipeline_stage=ogc.GraphPipelineStage.GRAPH_PIPELINE_STAGE_SIMULATION,
)
graph = wrapper_node.get_wrapped_graph()

if created_paths is not None:
created_paths.append(graph.get_path_to_graph())

carb.log_info(f"No ComputeGraph selected. A new graph has been created at {graph.get_path_to_graph()}")

return graph


class ArticulationView(_ArticulationView):
"""ArticulationView with some additional functionality implemented."""