Read value from Omnigraph Node

controller = og.Controller()
keys = og.Controller.Keys
(graph, nodes_constructed, prims_constructed, path_to_object_map) = controller.edit(
{“graph_path”: “/ActionGraph”, “evaluator_name”: “execution”},
(“ROS2Context”, “omni.isaac.ros2_bridge.ROS2Context”),
(“OnPlaybackTick”, “omni.graph.action.OnPlaybackTick”),
(“PublishJointState”, “omni.isaac.ros2_bridge.ROS2PublishJointState”),
(“SubscribeJointState”, “omni.isaac.ros2_bridge.ROS2SubscribeJointState”),
keys.CONNECT: [
(“ROS2Context.outputs:context”, “PublishJointState.inputs:context”),
(“ROS2Context.outputs:context”, “SubscribeJointState.inputs:context”),
(“OnPlaybackTick.outputs:tick”, “PublishJointState.inputs:execIn”),
(“OnPlaybackTick.outputs:tick”, “SubscribeJointState.inputs:execIn”),
keys.SET_VALUES: [
(“ROS2Context.inputs:useDomainIDEnvVar”, True),
#(“PublishJointState.inputs:targetPrim”, “/World/UR5”)

                set_target_prims(primPath="/ActionGraph/PublishJointState", targetPrimPaths =["/World/UR5"], inputName = "inputs:targetPrim")

I have the above snippet to create and connect action graph. How do I read the values in a specific node output now?
For eg, I would like to read out the value subscribed by SubscribeJointState in outputs:positionCommand

Thank you

Hi @yadun.murali.kurikalveed - To read the output values of a node in action graph, you can use get_values method of the controller object.

# Get the values of the 'positionCommand' output of the 'SubscribeJointState' node
values = controller.get_values({
    keys.GET_VALUES: [

# The 'values' variable now contains the output values of the 'positionCommand' output
position_command = values["/ActionGraph/SubscribeJointState.outputs:positionCommand"]

In this code, keys.GET_VALUES is used to specify the outputs you want to read. You provide a list of strings, where each string is the path to an output in the action graph.

The get_values method returns a dictionary where the keys are the paths you provided and the values are the corresponding output values.

Please note that you need to replace "/ActionGraph/SubscribeJointState.outputs:positionCommand" with the actual path to the positionCommand output in your action graph. The exact path might be different depending on how you constructed your action graph.

2023-07-07 11:12:02 [412,280ms] [Error] [omni.ui.python] AttributeError: ‘Controller’ object has no attribute ‘get_values’
[omni.ui.python] AttributeError: type object ‘GraphSetupKeys’ has no attribute ‘GET_VALUES’

I get these errors

Hi @yadun.murali.kurikalveed - Can you check if the get_values method is available in your version?

you can use Python’s built-in dir() function. This function returns a list of all the attributes and methods of an object.

Here’s how you can use it:

controller = og.Controller()

In this code, dir(controller) returns a list of all the attributes and methods of the controller object. The print statement then prints this list to the console.

If get_values is in the list, then the get_values method is available. If it’s not in the list, then the get_values method is not available.