Skip to content

Commit

Permalink
rename EXTERNAL_DATASET -> CUSTOM_DATASET
Browse files Browse the repository at this point in the history
  • Loading branch information
cremebrule committed Dec 12, 2024
1 parent 813b4f7 commit fea8975
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions docs/tutorials/custom_robot_import.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ 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 move this directory to `<gm.ASSET_PATH>/objects/<name>` so it can be imported into **OmniGibson**.
2. All output files are written to `<gm.CUSTOM_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:

- The importing procedure can be summarized as follows:

1. Copy the raw URDF file + any dependencies into the `gm.EXTERNAL_DATASET_PATH` directory
1. Copy the raw URDF file + any dependencies into the `gm.CUSTOM_DATASET_PATH` directory
2. Updates the URDF + meshes to ensure all scaling is positive
3. Generates collision meshes for each robot link (as specified by the source config)
4. Generates metadata necessary for **OmniGibson**
Expand Down
2 changes: 1 addition & 1 deletion omnigibson/examples/objects/import_custom_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def import_custom_object(
):
"""
Imports an externally-defined object asset into an OmniGibson-compatible USD format and saves the imported asset
files to the external dataset directory (gm.EXTERNAL_DATASET_PATH)
files to the external dataset directory (gm.CUSTOM_DATASET_PATH)
"""
assert len(model) == 6 and model.isalpha(), "Model name must be 6 characters long and contain only letters."
collision_method = None if collision_method == "none" else collision_method
Expand Down
4 changes: 2 additions & 2 deletions omnigibson/examples/robots/import_custom_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@


_DOCSTRING = """
Imports an externally-defined robot URDF asset into an OmniGibson-compatible USD format and saves the imported asset
files to the external dataset directory (gm.EXTERNAL_DATASET_PATH)
Imports an custom-defined robot URDF asset into an OmniGibson-compatible USD format and saves the imported asset
files to the custom dataset directory (gm.CUSTOM_DATASET_PATH)
Note that @config is expected to follow the following format (R1 config shown as an example):
Expand Down
4 changes: 2 additions & 2 deletions omnigibson/macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def determine_gm_path(default_path, env_var_name):
# can override assets_path and dataset_path from environment variable
gm.ASSET_PATH = determine_gm_path(os.path.join("data", "assets"), "OMNIGIBSON_ASSET_PATH")
gm.DATASET_PATH = determine_gm_path(os.path.join("data", "og_dataset"), "OMNIGIBSON_DATASET_PATH")
gm.EXTERNAL_DATASET_PATH = determine_gm_path(
os.path.join("data", "external_dataset"), "OMNIGIBSON_EXTERNAL_DATASET_PATH"
gm.CUSTOM_DATASET_PATH = determine_gm_path(
os.path.join("data", "custom_dataset"), "OMNIGIBSON_CUSTOM_DATASET_PATH"
)
gm.KEY_PATH = determine_gm_path(os.path.join("data", "omnigibson.key"), "OMNIGIBSON_KEY_PATH")

Expand Down
8 changes: 4 additions & 4 deletions omnigibson/objects/dataset_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

class DatasetType(IntEnum):
BEHAVIOR = 0
EXTERNAL = 1
CUSTOM = 1


class DatasetObject(USDObject):
Expand Down Expand Up @@ -70,8 +70,8 @@ def __init__(
Otherwise, will randomly sample a model given @category
dataset_type (DatasetType): Dataset to search for this object. Default is BEHAVIOR, corresponding to the
proprietary (encrypted) BEHAVIOR-1K dataset (gm.DATASET_PATH). Possible values are {BEHAVIOR, EXTERNAL}.
If EXTERNAL, assumes asset is found at gm.EXTERNAL_DATASET_PATH and additionally not encrypted.
proprietary (encrypted) BEHAVIOR-1K dataset (gm.DATASET_PATH). Possible values are {BEHAVIOR, CUSTOM}.
If CUSTOM, assumes asset is found at gm.CUSTOM_DATASET_PATH and additionally not encrypted.
scale (None or float or 3-array): if specified, sets either the uniform (float) or x,y,z (3-array) scale
for this object. A single number corresponds to uniform scaling along the x,y,z axes, whereas a
3-array specifies per-axis scaling.
Expand Down Expand Up @@ -167,7 +167,7 @@ def get_usd_path(cls, category, model, dataset_type=DatasetType.BEHAVIOR):
Returns:
str: Absolute filepath to the corresponding USD asset file
"""
dataset_path = gm.DATASET_PATH if dataset_type == DatasetType.BEHAVIOR else gm.EXTERNAL_DATASET_PATH
dataset_path = gm.DATASET_PATH if dataset_type == DatasetType.BEHAVIOR else gm.CUSTOM_DATASET_PATH
return os.path.join(dataset_path, "objects", category, model, "usd", f"{model}.usd")

def sample_orientation(self):
Expand Down
8 changes: 4 additions & 4 deletions omnigibson/utils/asset_conversion_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ def import_obj_urdf(
urdf_path,
obj_category,
obj_model,
dataset_root=gm.EXTERNAL_DATASET_PATH,
dataset_root=gm.CUSTOM_DATASET_PATH,
use_omni_convex_decomp=False,
use_usda=False,
merge_fixed_joints=False,
Expand Down Expand Up @@ -2018,7 +2018,7 @@ def get_collision_approximation_for_urdf(


def copy_urdf_to_dataset(
urdf_path, category, mdl, dataset_root=gm.EXTERNAL_DATASET_PATH, suffix="original", overwrite=False
urdf_path, category, mdl, dataset_root=gm.CUSTOM_DATASET_PATH, suffix="original", overwrite=False
):
# Create a directory for the object
obj_dir = pathlib.Path(dataset_root) / "objects" / category / mdl / "urdf"
Expand Down Expand Up @@ -2052,7 +2052,7 @@ def copy_urdf_to_dataset(


def generate_urdf_for_obj(
visual_mesh, collision_meshes, category, mdl, dataset_root=gm.EXTERNAL_DATASET_PATH, overwrite=False
visual_mesh, collision_meshes, category, mdl, dataset_root=gm.CUSTOM_DATASET_PATH, overwrite=False
):
# Create a directory for the object
obj_dir = pathlib.Path(dataset_root) / "objects" / category / mdl
Expand Down Expand Up @@ -2286,7 +2286,7 @@ def import_og_asset_from_urdf(
no_decompose_links=None,
visual_only_links=None,
merge_fixed_joints=False,
dataset_root=gm.EXTERNAL_DATASET_PATH,
dataset_root=gm.CUSTOM_DATASET_PATH,
hull_count=32,
overwrite=False,
use_usda=False,
Expand Down

0 comments on commit fea8975

Please sign in to comment.