Loading .usd scene in standalone application

Hi,
I created own app using users examples and I’m trying to rewrite example to standalone version. In the example, I load usd file with (I don’t know why I have to recreate new physics context, but without it it crashed):

omni.usd.get_context().open_stage(world_usd_file, None)
self._world = self.get_world()
self._world.reset()

self._world.reset()
self._world.clear_instance()
self._world.get_physics_context()._create_new_physics_scene("/World/physicsScene")

This is my standalone version, which doesn’t work:

from omni.isaac.kit import SimulationApp
simulation_app = SimulationApp({"headless": False})

import omni
from omni.isaac.core import World

world = World()
omni.usd.get_context().open_stage(scene_path, None)
world.reset()
world.clear_instance()
world.get_physics_context()._create_new_physics_scene("/World/physicsScene")
while True:
    world.step()

simulation_app.close()

The error message is:

Exception: The Physics Context's physics scene path is invalid, you need to reinit Physics Context

What is the propper way tzo load .usd files? Thank you

Finally got it! (solving this for whole day, but after I wrote to the forum I found the solution :D )
If somebody has simillar issue, I load usd file with this piece of code and it works:

from omni.isaac.kit import SimulationApp
simulation_app = SimulationApp({"headless": False})

from omni.isaac.core import World
from omni.isaac.core.utils.stage import open_stage

open_stage(usd_path=scene_path)
world = World()

world.reset()
while True:
    world.step()

simulation_app.close()

7 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.