Running the Extension from command line or python environment

I am trying to run a custom extension as follows, but not working.

Q1: What does it mean running kit.exe on a command line? Is this only for Windows?
Q2: How to use omni.kit.app.get_app_interface().get_python_scripting().execute_file("script.py")in python script (outside of the script editor)?
I got error as follows when I tried.

Traceback (most recent call last):
  File "/home/urakamiy/robot/isaac-sim/roboeye/simulator/ContactReportDemo.py", line 216, in <module>
    omni.kit.app.get_app_interface().get_python_scripting().execute_file("omni.isaac.samples.scripts.collision.py")
TypeError: execute_file(): incompatible function arguments. The following argument types are supported:
    1. (self: omni.kit.app._app.IAppScripting, path: str, args: List[str]) -> bool

Invoked with: <omni.kit.app._app.IAppScripting object at 0x7fc756768068>, 'omni.isaac.samples.scripts.collision.py'

Thanks,

Hi @yusuke_urakami,

Maybe NVIDIA staffs could help provide a more detailed answer, but as I see if you would like to add a custom extension module into the Editor, you could add a similar folder into ISAAC_SIM/_build/linux-x86_64/release/exts (or whatever folder you want but you need to specify the extension path in .json files (at ISAAC_SIM/_build/linux-x86_64/release/experiences), for example:

extension_name_dir
|--> extension_module.py (This is where you write your script content)
|--> config_dir
        |--> extension.toml (In this file you could specify the module name under [[python.modules]] as "extension_name_dir.extension_module")

There are various examples of Extension in the sources that you could refer to, one could be this:

ISAAC_SIM/_build/linux-x86_64/release/exts/omni.isaac.samples/omni/isaac/samples/scripts/ur10_preview.py
ISAAC_SIM/_build/linux-x86_64/release/exts/omni.isaac.samples/config/extension.toml

Hope it helps.
Cheers.

1 Like

Hi @Tadinu,

Thank you for your reply. I have already run my custom extension in the Editor and that was not difficult. My problem is that I am not sure how to run functions in this extension from the command line or external python script.

I want to run CI to test if our robot is not contact with anything when I push the code into Github. Therefore, I want to run the simulator and the extension from the command line.

Hi @yusuke_urakami,

Sorry for its not being useful. So, how about embedding the content of your script into a callback function, which is triggered after your extension is initiated?

Or if you mean a flexible way to let an external python program to interact with the Editor extension, I also would like to know about it.

Thanks @Tadinu for mentioning the steps to create an new extension and enable it in isaac-sim.json file.

@yusuke_urakami to add onto that, I would recommend that you can refer to omni.isaac.synthetic_utils extension here

/_build/linux-x86_64/release/exts/omni.isaac.synthetic_utils/omni/isaac/synthetic_utils

Also, check the __init__.py file and scripts/__init__.py

And then you can import classes and run functions like

from omni.isaac.synthetic_utils import OmniKitHelper, SyntheticDataHelper, shapenet, DomainRandomization

We have many examples of how we use functions from an extension like omni.isaac.synthetic_utils in an external python script like python_samples folder. You can refer to examples like

ISAAC_SIM/python_samples/syntheticdata/offline_dataset/record_scenario.py

The same also applies if you want to run in the Window->Script Editor

Hi @sdebnath, and @ltorabi

Just by the way, I am looking for an API to check whether a custom extension is enabled, technically be having a Tick mark on the Editor menu. I need to decide whether to start its operation or not upon clicking on UI’s Play button.
I have been searching around but could not find an example. Do you happen to know about one?

Thanks.

So it seems to be omni.kit.ui.Window.is_visible().

1 Like

Hi @sdebnath

Thank you for your reply. Yes I am already using the extension module in the extensions as you said.
However, the biggest interest for me is to know how the external python program to interact with the Editor extension as @Tadinu said.

In more straight forward way of saying, how can I run “Isaac Robotics>Samples>UR10 Preview” simulation from external script without using GUI? I want to integrate the simulation as part of our circle CI for test.

Thanks,

@yusuke_urakami We provide couple of samples that can be run from external python script (without using GUI)

To get started, refer here. After completing the setup, you can run a basic example.

You can also refer to complex examples like offline dataset generation where there are examples to import extension like from omni.isaac.synthetic_utils import OmniKitHelper, SyntheticDataHelper, shapenet, DomainRandomization