Edit an existing Actiongraph for IsaacSim with Python script

Hello,
I am spawning several robots into a scene from .USD files. These have already set up action graphs,
However I am trying to modify the inputs for a constant string name called “namespace”.

I receive the following error:

2024-07-07 06:58:08 [6,054ms] [Error] [omni.graph.core.plugin] Unable to create prim for graph at /World/ROBOT0/ControllerGraph/
Traceback (most recent call last):
  File "FOLDER/setup_isaac_sim_env.py", line 69, in <module>
    
  File "FOLDER/setup_isaac_sim_env.py", line 55, in spawn_robot
    )
  File "/home/$USER/.local/share/ov/pkg/isaac_sim-2022.2.1/kit/exts/omni.graph/omni/graph/core/_impl/controller.py", line 889, in __edit_obj
    kwargs=kwargs,
  File "/home/$USER/.local/share/ov/pkg/isaac_sim-2022.2.1/kit/exts/omni.graph/omni/graph/core/_impl/controller.py", line 1038, in __edit
    return __do_the_edits()
  File "/home/$USER/.local/share/ov/pkg/isaac_sim-2022.2.1/kit/exts/omni.graph/omni/graph/core/_impl/controller.py", line 939, in __do_the_edits
    graph = obj.create_graph(graph_id)
  File "/home/$USER/.local/share/ov/pkg/isaac_sim-2022.2.1/kit/exts/omni.graph/omni/graph/core/_impl/graph_controller.py", line 111, in __create_graph_obj
    self, update_usd=self.__update_usd, undoable=self.__undoable, args=args, kwargs=kwargs
  File "/home/$USER/.local/share/ov/pkg/isaac_sim-2022.2.1/kit/exts/omni.graph/omni/graph/core/_impl/graph_controller.py", line 172, in __create_graph
    raise og.OmniGraphError(f"Failed to wrap graph in node given {graph_id}")
omni.graph.core._impl.errors.OmniGraphError: Failed to wrap graph in node given /World/ROBOT0/ControllerGraph/

My code:

def spawn_robot(name, usd_path, robot_id):
    prim_path = f"/World/{name}{robot_id}"
    robot_ref = add_reference_to_stage(usd_path=usd_path, prim_path=prim_path)

    keys = og.Controller.Keys  # Usually handy to keep this name short as it is used often
    controller = og.Controller()

    controller.edit(
        f'/World/{name}{robot_id}/ControllerGraph/',
        {
            keys.SET_VALUES: [
                (f"/World/{name}{robot_id}/ControllerGraph/namespace.inputs:value", "test")
            ]
        },
        path_to_object_map=None,  # Saved object-to-path map, bootstraps any created as part of the call
        update_usd=True,  # Immediately echo the changes to the underlying USD
        undoable=True,  # If False then do not remember previous state - useful for writing tests
        allow_exists_node=False,  # If True then silently succeed requests to create already existing nodes
        allow_exists_prim=False,  # If True then silently succeed requests to create already existing prims
    )
return robot_ref

Linking to:

Relevant Documentation: Controller — Omniverse Kit 1.135.0 documentation

Neither of these solutions seem allow to modify an already existing actionGraph.
I am using IsaacSIm 2022.2.1

Is there a known way to do this?

Best

1 Like