Can't create simulation view

Hello,

I am currently developing a customized pick and place robotics application. While the standalone script runs without issues, I am encountering an error when I incorporate my code into an extension. Specifically, when I try to reset the world using self._world.reset(), I receive the following error:

2023-05-10 14:54:17 [29,214ms] [Error] [omni.physx.tensors.plugin] Failed to create simulation view: no active physics scene found
2023-05-10 14:54:17 [29,215ms] [Error] [omni.ui.python] Exception: Failed to create simulation view backend

At:
c:\omniverse\pkg\isaac_sim-2022.2.1\kit\extsphysics\omni.physics.tensors-104.2.4-5.1\omni\physics\tensors\impl\api.py(12): create_simulation_view
c:\omniverse\pkg\isaac_sim-2022.2.1\exts\omni.isaac.core\omni\isaac\core\simulation_context\simulation_context.py(389): initialize_physics
c:\omniverse\pkg\isaac_sim-2022.2.1\exts\omni.isaac.core\omni\isaac\core\simulation_context\simulation_context.py(409): reset
c:\omniverse\pkg\isaac_sim-2022.2.1\exts\omni.isaac.core\omni\isaac\core\world\world.py(281): reset

I do have a physics scene located at /physicsScene.

Can anyone provide insight into the root cause of this issue?

The problem also occurs when I use the base extension template and create my world with:

self.my_world = World(stage_units_in_meters=1.0)

and then reset it with:

self.my_world.reset()

This is the whole extension code:

import omni.ext
import omni.ui as ui
from omni.isaac.core import World


# Functions and vars are available to other extension as usual in python: `example.python_ext.some_public_function(x)`
def some_public_function(x: int):
    print("[company.hello.world] some_public_function was called with x: ", x)
    return x ** x


# Any class derived from `omni.ext.IExt` in top level module (defined in `python.modules` of `extension.toml`) will be
# instantiated when extension gets enabled and `on_startup(ext_id)` will be called. Later when extension gets disabled
# on_shutdown() is called.
class CompanyHelloWorldExtension(omni.ext.IExt):
    # ext_id is current extension id. It can be used with extension manager to query additional information, like where
    # this extension is located on filesystem.
    def on_startup(self, ext_id):
        print("[company.hello.world] company hello world startup")
        self.my_world = World(stage_units_in_meters=1.0)
        self.my_world.reset()


        self._count = 0

        self._window = ui.Window("My Window", width=300, height=300)
        with self._window.frame:
            with ui.VStack():
                label = ui.Label("")


                def on_click():
                    self._count += 1
                    label.text = f"count: {self._count}"


                def on_reset():
                    self._count = 0
                    label.text = "empty"

                on_reset()

                with ui.HStack():
                    ui.Button("Add", clicked_fn=on_click)
                    ui.Button("Reset", clicked_fn=on_reset)

    def on_shutdown(self):
        print("[company.hello.world] company hello world shutdown")

And this is the error message:

2023-05-12 09:50:22 [527,488ms] [Error] [omni.physx.tensors.plugin] Failed to create simulation view: no active physics scene found
2023-05-12 09:50:22 [527,489ms] [Error] [carb.scripting-python.plugin] Exception: Failed to create simulation view backend

At:
  c:\omniverse\pkg\isaac_sim-2022.2.1\kit\extsphysics\omni.physics.tensors-104.2.4-5.1\omni\physics\tensors\impl\api.py(12): create_simulation_view
  c:\omniverse\pkg\isaac_sim-2022.2.1\exts\omni.isaac.core\omni\isaac\core\simulation_context\simulation_context.py(389): initialize_physics
  c:\omniverse\pkg\isaac_sim-2022.2.1\exts\omni.isaac.core\omni\isaac\core\simulation_context\simulation_context.py(409): reset
  c:\omniverse\pkg\isaac_sim-2022.2.1\exts\omni.isaac.core\omni\isaac\core\world\world.py(281): reset
  c:\users\user\documents\kit-exts-project\exts\company.hello.world\company\hello\world\extension.py(21): on_startup
  c:/omniverse/pkg/isaac_sim-2022.2.1/kit/kernel/py\omni\ext\_impl\_internal.py(147): _startup_ext
  c:/omniverse/pkg/isaac_sim-2022.2.1/kit/kernel/py\carb\profiler\__init__.py(81): wrapper
  c:/omniverse/pkg/isaac_sim-2022.2.1/kit/kernel/py\omni\ext\_impl\_internal.py(198): startup
  c:/omniverse/pkg/isaac_sim-2022.2.1/kit/kernel/py\omni\ext\_impl\_internal.py(285): startup_extension
  PythonExtension.cpp::startup()(2): <module>

2023-05-12 09:50:22 [527,490ms] [Error] [omni.ext.plugin] [ext: company.hello.world-1.0.0] Failed to startup python extension.

you want to use the async version of the reset function, i.e., replace your code with something like

        async def _on_load_world_async():
            await omni.kit.app.get_app().next_update_async()
            print("[company.hello.world] company hello world startup")
            self.my_world = World(stage_units_in_meters=1.0)
            await self.my_world.reset_async()
        asyncio.ensure_future(_on_load_world_async())

see the BaseSampleExtension class for more information

1 Like

Hi mrakhsha,

thank you, the async version works!

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