Implementation of a custom OmnyGraph node in Python

Hello.
I’m trying to write an Omnigraph node implementation that subscribes to a custom ROS message. I want the node state to reset to its initial state when the model is stopped. I have a few questions:

  1. Isaac Sim guide describes one function (compute), which is called (probably) when a signal arrives at the execution input. What are other functions exist?

  2. What node functions are called when opening/closing the graph, starting the model, stopping the model? I would like to get a description like this:
    Simulink Engine Interaction with C S-Functions - MATLAB & Simulink

  3. I have met the release and initialize functions in the code of other OmnyGraph nodes. What are their functional purposes? When are they called?

this tutorial lists all of the ABIs that can be overridden
https://docs.omniverse.nvidia.com/py/kit/source/extensions/omni.graph.tutorials/tutorials/tutorial12/tutorial12.html

In isaac sim we use this base class for nodes that need to reset when simulation is stopped.

#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto.  Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#

import omni.usd
import carb.events


class BaseResetNode:
    """
        Base class for nodes that automatically reset when stop is pressed.
    """

    def __init__(self, initialize=False):
        self.initialized = initialize

        stage = omni.usd.get_context()

        self.stage_event_sub = stage.get_stage_event_stream().create_subscription_to_pop(
            self.on_stage_event, name="IsaacSimOGNCoreNodesStageEventHandler"
        )

    def on_stage_event(self, event: carb.events.IEvent):
        if event.type == int(omni.usd.StageEventType.SIMULATION_STOP_PLAY):
            self.custom_reset()
            self.initialized = False

    # Defined by subclass
    def custom_reset(self):
        pass

    def reset(self):
        self.stage_event_sub = None
        self.initialized = None

Hammad_M, thank you so much for your helpness.

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