From e31c12a14f71c091d2280de12b9251112b2eeb20 Mon Sep 17 00:00:00 2001 From: cremebrule <84cremebrule@gmail.com> Date: Fri, 13 Dec 2024 10:47:01 -0800 Subject: [PATCH] make urdf paths relative during custom asset import --- omnigibson/utils/asset_conversion_utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/omnigibson/utils/asset_conversion_utils.py b/omnigibson/utils/asset_conversion_utils.py index dac1fb5f6..ed49e3130 100644 --- a/omnigibson/utils/asset_conversion_utils.py +++ b/omnigibson/utils/asset_conversion_utils.py @@ -1914,6 +1914,7 @@ def get_collision_approximation_for_urdf( during collision generation process """ # Load URDF + urdf_dir = os.path.dirname(urdf_path) tree = ET.parse(urdf_path) root = tree.getroot() @@ -1923,7 +1924,8 @@ def get_collision_approximation_for_urdf( no_decompose_links = set() if no_decompose_links is None else set(no_decompose_links) visual_only_links = set() if visual_only_links is None else set(visual_only_links) ignore_links = set() if ignore_links is None else set(ignore_links) - col_mesh_folder = pathlib.Path(os.path.dirname(urdf_path)) / "meshes" / "collision" + col_mesh_rel_folder = "meshes/collision" + col_mesh_folder = pathlib.Path(urdf_dir) / col_mesh_rel_folder col_mesh_folder.mkdir(exist_ok=True, parents=True) for link in root.findall("link"): link_name = link.attrib["name"] @@ -1996,7 +1998,7 @@ def get_collision_approximation_for_urdf( collision_geometry_xml = ET.SubElement(collision_xml, "geometry") collision_mesh_xml = ET.SubElement(collision_geometry_xml, "mesh") collision_mesh_xml.attrib = { - "filename": str(col_mesh_folder / collision_filename), + "filename": os.path.join(col_mesh_rel_folder, collision_filename), "scale": " ".join([str(item) for item in collision_scale]), }