Unverified Commit 492beb04 authored by Mayank Mittal's avatar Mayank Mittal Committed by GitHub

Fixes resolving of material paths when using URDF converter (#468)

# Description

With Isaac Sim 2023.1.1, the main asset file stores all the meshes as
well (even for instanceable case) when using the URDF improter. However,
the referenced paths to materials are absolute which does not allow
moving the asset around freely. This MR adds a fix to make sure all
paths are relative in the converted USD file.

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] I have run all the tests with `./orbit.sh --test` and they pass
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
parent 95a4927c
......@@ -102,6 +102,12 @@ Executing the above script will create two USD files inside the
* ``anymal_d.usd`` - This is the main asset file. It contains all the non-mesh data.
* ``Props/instanceable_assets.usd`` - This is the mesh data file.
.. note::
Since Isaac Sim 2023.1.1, the URDF importer behavior has changed and it stores the mesh data inside the
main asset file even if the ``--make-instanceable`` flag is set. This means that the
``Props/instanceable_assets.usd`` file is created but not used anymore.
You can press play on the opened window to see the asset in the scene. The asset should "collapse"
if everything is working correctly. If it blows up, then it might be that you have self-collisions
present in the URDF.
......
[package]
# Note: Semantic Versioning is used: https://semver.org/
version = "0.15.1"
version = "0.15.2"
# Description
title = "ORBIT framework for Robot Learning"
......
Changelog
---------
0.15.2 (2024-03-21)
~~~~~~~~~~~~~~~~~~~
Fixed
^^^^^
* Added resolving of relative paths for the main asset USD file when using the
:class:`omni.isaac.orbit.sim.converters.UrdfConverter` class. This is to ensure that the material paths are
resolved correctly when the main asset file is moved to a different location.
0.15.1 (2024-03-19)
~~~~~~~~~~~~~~~~~~~
......
......@@ -85,13 +85,21 @@ class UrdfConverter(AssetConverterBase):
)
# fix the issue that material paths are not relative
if self.cfg.make_instanceable:
usd_path = os.path.join(self.usd_dir, self.usd_instanceable_meshes_path)
stage = Usd.Stage.Open(usd_path)
instanced_usd_path = os.path.join(self.usd_dir, self.usd_instanceable_meshes_path)
stage = Usd.Stage.Open(instanced_usd_path)
# resolve all paths relative to layer path
source_layer = stage.GetRootLayer()
omni.usd.resolve_paths(source_layer.identifier, source_layer.identifier)
stage.Save()
# fix the issue that material paths are not relative
# note: This issue seems to have popped up in Isaac Sim 2023.1.1
stage = Usd.Stage.Open(self.usd_path)
# resolve all paths relative to layer path
source_layer = stage.GetRootLayer()
omni.usd.resolve_paths(source_layer.identifier, source_layer.identifier)
stage.Save()
"""
Helper methods.
"""
......
......@@ -19,7 +19,6 @@ import unittest
import omni.isaac.core.utils.prims as prim_utils
import omni.isaac.core.utils.stage as stage_utils
from omni.isaac.core.simulation_context import SimulationContext
from omni.isaac.version import get_version
from pxr import UsdLux
import omni.isaac.orbit.sim as sim_utils
......@@ -39,8 +38,6 @@ class TestSpawningLights(unittest.TestCase):
self.sim = SimulationContext(physics_dt=self.dt, rendering_dt=self.dt, backend="numpy")
# Wait for spawning
stage_utils.update_stage()
# obtain isaac sim version
self.isaac_sim_version = int(get_version()[2])
def tearDown(self) -> None:
"""Stops simulator after each test."""
......
......@@ -19,7 +19,6 @@ import unittest
import omni.isaac.core.utils.prims as prim_utils
import omni.isaac.core.utils.stage as stage_utils
from omni.isaac.core.simulation_context import SimulationContext
from omni.isaac.version import get_version
import omni.isaac.orbit.sim as sim_utils
from omni.isaac.orbit.sim.spawners.sensors.sensors import (
......@@ -42,8 +41,6 @@ class TestSpawningSensors(unittest.TestCase):
self.sim = SimulationContext(physics_dt=self.dt, rendering_dt=self.dt, backend="numpy")
# Wait for spawning
stage_utils.update_stage()
# obtain isaac sim version
self.isaac_sim_version = int(get_version()[2])
def tearDown(self) -> None:
"""Stops simulator after each test."""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment