Advanced Extension Template Generator from VS Code#

The Isaac Sim VS Code Edition is a Visual Studio Code extension that provides development support for NVIDIA Omniverse in general and Isaac Sim in particular. One of its features is the generation of advanced extension templates.

Isaac Sim VS Code Edition's Extension template generator wizard

Isaac Sim VS Code Edition’s Extension template generator wizard#

Extension templates can be generated in the following forms:

  • Ready-to-use extensions (Python)

  • Extensions requiring a Kit-based build system (C++ and/or Python)

The following table list the extension components that can be generated by the template as well as their availability according to the programming language to be used.

Extension components that can be generated by the template#

Component

Python

C++

Description

Extension

yes

yes

Define an extension class that derives from omni.ext.IExt

API

yes

yes

Define/expose codebase Application Programming Interface (API)

OmniGraph

yes

yes

Create nodes using the OmniGraph framework for visual scripting

Pybind

no

yes

Reflect C++ code using pybind11 so that it can be called from Python

UI

yes

no

Create Graphical User Interfaces (GUI) using Omniverse UI framework

Tests

yes

yes

Create test cases for the extension



Ready-To-Use Extensions#

A ready-to-use extension (Python), as the name suggests, is an extension that can be used as-is once created without the need for any extra configuration or build system.

The subsequent subsections describe how to generate and run this type of extensions.

Creating the Extension#

Note

The folder containing the extension to be created had to be listed in the Isaac Sim extension search path in order to be discoverable.

If this is not the case, you can use the Isaac Sim’s Extensions Manager (Window > Extensions menu) to add it. Click on the hamburger icon in the Extensions Manager, and then Settings in the sub-menu, to add the path to the folder containing your extensions.

Hint

For convenience, the extsUser folder at the root of the Isaac Sim installation is listed in the extension search path, so it is recommended to create the extension in that folder.

Open, in the VS Code Editor, the Isaac Sim VS Code Edition’s extension template generator wizard (Templates > Extension) and fill/check, at least, the following fields:

  • Ext. name: Given extension name. E.g. my.custom.extension.

  • Ext. path: Folder path that will contain the extension. E.g.: PATH_TO_ISAAC_SIM/extsUser.

  • Enable the Ready-to-use extension checkbox.

  • Enable the specific component(s) to generate.

Then, press Create to generate the extension. Check that the generated extension exists in the specified path. At this point, the extension is ready to be modified with your own code.

Running the Extension#

Launch Isaac Sim, then search and enable the created extension in the Extension Manager (using the given extension name). Depending on the component(s) created, the following can be expected (without additional modification):

  • Extension/API: Simply, the extension is enabled.

  • OmniGraph: The node OgnMyCustomExtensionPy can be instantiated in an Action Graph (e.g.: through Create > Visual Scripting > Action Graph).

  • UI: A sample window can be opened when clicking on the Window > My Custom Extension menu.

  • Tests: The tests can be run from an opened terminal in the root directory of Isaac Sim as follows:

    ./kit/kit --empty --enable omni.kit.test --/exts/omni.kit.test/runTestsAndQuit=true --/exts/omni.kit.test/testExts/0='my.custom.extension' --ext-folder "extsUser" --no-window --allow-root
    
    .\kit\kit --empty --enable omni.kit.test --/exts/omni.kit.test/runTestsAndQuit=true --/exts/omni.kit.test/testExts/0='my.custom.extension' --ext-folder "extsUser" --no-window --allow-root
    



Extensions Requiring a Kit-based Build System#

Extensions (C++ and/or Python) requiring Kit-based build system, as the name suggests, need to be configured as part of a Kit SDK-based application (such as the Isaac Sim App Template or the Omniverse Kit App Template) in order to be compiled.

The subsequent subsections describe how to generate and run this type of extensions.

Building the App Template#

Get the Isaac Sim App Template, and setup and build it according to its documentation.

Creating the Extension#

Hint

For convenience, the source/extensions folder at the root of the Isaac Sim App Template is configured, in the build system, as a place to search for the extensions’ source code. Therefore, it is recommended to create the extension there. Create it if the folder doesn’t exist.

Open, in the VS Code Editor, the Isaac Sim VS Code Edition’s extension template generator wizard (Templates > Extension) and fill/check, at least, the following fields:

  • Ext. name: Given extension name. E.g. my.custom.extension.

  • Ext. path: Folder path that will contain the extension source code. E.g.: PATH_TO_ISAAC_SIM_APP_TEMPLATE/source/extensions.

  • Disable the Ready-to-use extension checkbox (if it is already enabled).

  • Enable the specific component(s) to generate.

Then, press Create to generate the extension. Check that the generated extension exists in the specified path.

Configuring the Build System#

Depending on the component(s) created, the following configuration is necessary:

  • OmniGraph: Edit the tools/deps/kit-sdk-deps.packman.xml file to include the USD dependency:

    <import path="...all-deps.packman.xml">
        <!-- JUST ADD THE NEXT LINE -->
        <filter include="usd-${config}"/>
    </import>
    
    <!-- JUST ADD THE NEXT LINE -->
    <dependency name="usd-${config}" linkPath="../../_build/target-deps/usd/${config}"/>
    
  • Tests: Edit the tools/deps/kit-sdk-deps.packman.xml file to include the doctest dependency:

    <import path="...all-deps.packman.xml">
        <!-- JUST ADD THE NEXT LINE -->
        <filter include="doctest"/>
    </import>
    
    <!-- JUST ADD THE NEXT LINE -->
    <dependency name="doctest" linkPath="../../_build/target-deps/doctest"/>
    

Building the Extension#

To build the extension, simply run the following command from an opened terminal in the root directory of the Isaac Sim App Template:

./repo.sh build
.\repo.bat build

Running the Extension#

Launch Isaac Sim, then search and enable the created extension in the Extension Manager (using the given extension name). Depending on the component(s) created, the following can be expected (without additional modification):

  • Extension/API: Simply, the extension is enabled.

  • OmniGraph: The node OgnMyCustomExtensionPy (Python) and/or OgnMyCustomExtensionCpp (C++) can be instantiated in an Action Graph (e.g.: through Create > Visual Scripting > Action Graph).

  • Pybind (C++ only): The exposed C++ API via pybind11 can be called from Python.

    For example, execute the following code in the Script Editor (Window > Script Editor menu):

    import my.custom.extension
    
    interface = my.custom.extension.acquire_extension_interface()
    my.custom.extension.set_default_status("custom status")
    interface.register_object(10)
    my.custom.extension.release_extension_interface()
    
  • UI (Python only): A sample window can be opened when clicking on the Window > My Custom Extension menu.

  • Tests: The tests can be run from an opened terminal in the root directory of the Isaac Sim App Template as follows:

    ./_build/linux-x86_64/release/tests-my.custom.extension.sh
    
    .\_build\windows-x86_64\release\tests-my.custom.extension.bat