Skip to content

Commit

Permalink
prune utils, update docs, update package deps version
Browse files Browse the repository at this point in the history
  • Loading branch information
cremebrule committed Dec 12, 2024
1 parent 2e9cb38 commit 1ca3f87
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 88 deletions.
3 changes: 1 addition & 2 deletions docs/tutorials/custom_robot_import.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ There are two ways to convert our raw robot URDF into an OmniGibson-compatible U
Our custom robot importer [`import_custom_robot.py`](https://github.com/StanfordVL/OmniGibson/tree/main/omnigibson/examples/robots/import_custom_robot.py) wraps the native URDF Importer from Isaac Sim to convert our robot URDF model into USD format. Please see the following steps for running this script:

1. All that is required is a single source config yaml file that dictates how the URDF should be post-processed when being converted into a USD. You can run `import_custom_robot.py --help` to see a detailed example configuration used, which is also shown below (`r1_pro_source_config.yaml`) for your convenience.
2. All output files are written to `<gm.EXTERNAL_DATASET_PATH>/objects/robot/<name>`. Please copy / move this directory to `<gm.ASSET_PATH>/objects/<name>` so it can be imported into **OmniGibson**.
3. That's it!
2. All output files are written to `<gm.EXTERNAL_DATASET_PATH>/objects/robot/<name>`. Please move this directory to `<gm.ASSET_PATH>/objects/<name>` so it can be imported into **OmniGibson**.

Some notes about the importing script:

Expand Down
85 changes: 0 additions & 85 deletions omnigibson/utils/asset_conversion_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,91 +560,6 @@ def _import_rendering_channels(obj_prim, obj_category, obj_model, model_root_pat
# Lastly, we copy object_state texture maps that are state-conditioned; e.g.: cooked, soaked, etc.
_copy_object_state_textures(obj_category=obj_category, obj_model=obj_model, dataset_root=dataset_root)

# ###################################
#
# # Iterate over all children of the object prim, if /<obj_name>/<link_name>/visual exists, then we
# # know <link_name> is a valid link, and we check explicitly for these material files in our set
# # Note: we assume that the link name is included as a string within the mat_file!
# for prim in obj_prim.GetChildren():
# if prim.GetPrimTypeInfo().GetTypeName() == "Xform":
# # This could be a link, check if it owns a visual subprim
# link_name = prim.GetName()
# visual_prim = lazy.omni.isaac.core.utils.prims.get_prim_at_path(f"{prim.GetPrimPath().pathString}/visuals")
# log.debug(f"path: {prim.GetPrimPath().pathString}/visuals")
# log.debug(f"visual prim: {visual_prim}")
#
# if visual_prim:
# # Aggregate all material files for this prim
# link_mat_files = []
# for mat_file in deepcopy(mat_files):
# if link_name in mat_file:
# # Add this mat file and remove it from the set
# link_mat_files.append(mat_file)
# mat_files.remove(mat_file)
# # Potentially write material files for this prim if we have any valid materials
# log.debug("link_mat_files:", link_mat_files)
# if not link_mat_files:
# # Bind default material to the visual prim
# shade = lazy.pxr.UsdShade.Material(default_mat)
# lazy.pxr.UsdShade.MaterialBindingAPI(visual_prim).Bind(shade, lazy.pxr.UsdShade.Tokens.strongerThanDescendants)
# default_mat_is_used = True
# else:
# # Create new material for this link
# mtl_created_list = []
# lazy.omni.kit.commands.execute(
# "CreateAndBindMdlMaterialFromLibrary",
# mdl_name="OmniPBR.mdl",
# mtl_name="OmniPBR",
# mtl_created_list=mtl_created_list,
# )
# log.debug(f"Created material for link {link_name}:", mtl_created_list[0])
# mat = lazy.omni.isaac.core.utils.prims.get_prim_at_path(mtl_created_list[0])
#
# shade = lazy.pxr.UsdShade.Material(mat)
# # Bind the created link material to the visual prim
# lazy.pxr.UsdShade.MaterialBindingAPI(visual_prim).Bind(shade, lazy.pxr.UsdShade.Tokens.strongerThanDescendants)
#
# # Iterate over all material channels and write them to the material
# for link_mat_file in link_mat_files:
# # Copy this file into the materials folder
# mat_fpath = os.path.join(usd_dir, "materials")
# shutil.copy(os.path.join(mat_dir, link_mat_file), mat_fpath)
# # Check if any valid rendering channel
# mat_type = link_mat_file.split("_")[-1].split(".")[0].lower()
# # Apply the material if it exists
# render_channel_fcn = rendering_channel_mappings.get(mat_type, None)
# if render_channel_fcn is not None:
# render_channel_fcn(mat, os.path.join("materials", link_mat_file))
# else:
# # Warn user that we didn't find the correct rendering channel
# log.warning(f"Warning: could not find rendering channel function for material: {mat_type}, skipping")
#
# # Rename material
# mat = rename_prim(prim=mat, name=f"material_{link_name}")
#
# # For any remaining materials, we write them to the default material
# # default_mat = lazy.omni.isaac.core.utils.prims.get_prim_at_path(f"{obj_prim.GetPrimPath().pathString}/Looks/material_material_0")
# # default_mat = lazy.omni.isaac.core.utils.prims.get_prim_at_path(f"{obj_prim.GetPrimPath().pathString}/Looks/material_default")
# log.debug(f"default mat: {default_mat}, obj: {obj_category}, {prim.GetPrimPath().pathString}")
# for mat_file in mat_files:
# # Copy this file into the materials folder
# mat_fpath = os.path.join(usd_dir, "materials")
# shutil.copy(os.path.join(mat_dir, mat_file), mat_fpath)
# # Check if any valid rendering channel
# mat_type = mat_file.split("_")[-1].split(".")[0].lower()
# # Apply the material if it exists
# render_channel_fcn = rendering_channel_mappings.get(mat_type, None)
# if render_channel_fcn is not None:
# render_channel_fcn(default_mat, os.path.join("materials", mat_file))
# default_mat_is_used = True
# else:
# # Warn user that we didn't find the correct rendering channel
# log.warning(f"Could not find rendering channel function for material: {mat_type}")
#
# # Possibly delete the default material prim if it was never used
# if not default_mat_is_used:
# stage.RemovePrim(default_mat.GetPrimPath())


def _add_xform_properties(prim):
"""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"rtree>=1.2.0",
"graphviz>=0.20",
"matplotlib>=3.0.0",
"lxml",
"lxml>=5.3.0",
],
extras_require={
"dev": [
Expand Down

0 comments on commit 1ca3f87

Please sign in to comment.