How can I create vector attribute in OmniGraph script node?

Isaac Sim Version 5.0.0

Operating System Ubuntu 22.04

Topic Description

  1. I am writing a callback to create OmniGraph in Isaac Sim, but I cannot create inputs with vector type

Steps to Reproduce

  1. my callback
import omni.graph.core as og

def create_script_node(graph_path: str = "/World/ScriptNode"):
    """
    Create a ROS2 clock publishing graph that matches the image shown.
    This graph publishes simulation time to ROS2 /clock topic.

    Args:
        graph_path: Path where the graph will be created
        node_namespace: ROS2 node namespace
        topic_name: ROS2 topic name for clock data
    """
    # Define nodes using GraphNode class
    on_playback_tick = GraphNode("OnPhysicsStep", NodeTypes.ON_PLAYBACK_TICK)
    script = GraphNode("ScriptNode", NodeTypes.SCRIPT)

    try:
        # (_, (_, script_node), _, _) = og.Controller.edit(
        (_, (_, script_node), _, _) = og.Controller.edit(
            {"graph_path": graph_path, "evaluator_name": "execution"},
            {
                og.Controller.Keys.CREATE_NODES: [
                    (on_playback_tick.name, on_playback_tick.type),
                    (script.name, script.type),
                ],
                og.Controller.Keys.CONNECT: [
                    # Physics step triggers execution
                    (on_playback_tick.outputs.tick, script.inputs.execIn),
                    # Simulation time connection
                ],
                og.Controller.Keys.SET_VALUES: [
                    # Clock publisher configuration
                ],
            },
        )

        og.Controller.create_attribute(
            script_node,
            "inputs:x",
            og.Type(og.BaseDataType.DOUBLE, 1, 0, og.AttributeRole.NONE),
            og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT,
        )
        og.Controller.create_attribute(
            script_node,
            "inputs:y",
            og.Type(og.BaseDataType.DOUBLE, 1, 0, og.AttributeRole.NONE),
            og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT,
        )

        og.Controller.create_attribute(
            script_node,
            "inputs:vec",
            og.Type(og.BaseDataType.DOUBLE, 1, 3, og.AttributeRole.VECTOR),
            og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT,
        )
        # script_node.get_attribute("inputs:step").set(2)

        print(f"ROS2 Clock graph created at {graph_path}")
    except Exception as e:
        print(f"Error creating ROS2 Script graph: {e}")

Error Messages

Error creating ROS2 Script graph: OmniGraphError: Attribute type double (vector) does not represent a legal OGN type

Additional Information

Additional Context

Workflow: UI Extension using generated extension.

Hi, The problem is the argument order in og.Type, not the script node. The signature is:

 og.Type(base_type, tuple_count=1, array_depth=0, role=AttributeRole.NONE)

The third positional argument is array_depth, not the vector width. Your call

og.Type(og.BaseDataType.DOUBLE, 1, 3, og.AttributeRole.VECTOR)

asks for a scalar double with a VECTOR role, and that combination genuinely isn’t a legal OGN type — which is what the error is telling you. The 3 needs to be the tuple count:

og.Controller.create_attribute(
    script_node,
    "inputs:vec",
    og.Type(og.BaseDataType.DOUBLE, 3, 0, og.AttributeRole.VECTOR),   # -> double3 (vector)
    og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT,
)

You can also just pass the OGN type name as a string, which I find easier to read and is exactly equivalent:

og.Controller.create_attribute(
    script_node, "inputs:vec", "vectord[3]",
    og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT,
)

Closing the topic, please open new topics if you need other help.