I did an ominigraph to the jetbot robot in a different file and i add it to it when the simulation starts, any ideas how i can change the parameters of the graph after loading it?
I want to do it with python code.
Thanks a lot
my best regards
I did an ominigraph to the jetbot robot in a different file and i add it to it when the simulation starts, any ideas how i can change the parameters of the graph after loading it?
I want to do it with python code.
Thanks a lot
my best regards
Heya alexander!
I am not sure I understand your question. which node are you using specifically? A screenshot of your graph would also help :D
thanks!
Gus
Hi Gus,
thank you for your reply.
I created this graph to export the information of the robots, to ros2 side of things, based on some of the tutorials you provided. I saved it as an .svd file, and was able to input it into the robot that is imported into our scene. The problem I’m facing is that after i import the grph into the robot i need to change some parameters of the graph. since some of it are robot specific and i intend to apply the same graph to a few robots and than just change those parameters.
Since the robots are first introduced to the scene after it, starts i can’t just apply to it using the gui.
my best regards,
second_graph.zip (4.4 KB)
ok, I think I understand what you’re looking for now. You have the graph saved and once you load it in your scene, you want to programmatically alter the graph in some way. This can be done! :D
You will probably want the API as well
https://docs.omniverse.nvidia.com/kit/docs/omni.graph/latest/Overview.html
https://docs.omniverse.nvidia.com/kit/docs/omni.graph.docs/latest/Overview.html
However, this sounds very complicated. It is possible to save the graph as a layer to the stage. If you impose some useful fixed structure on the stage (like the robot always being at /root/robot/the_robot_reference_prim
) then you can build the graph with those assumptions in mind. Loading and running the graph on the scene with a new robot would then just be a matter of changing the reference on the stage.
It may be possible to point to other data as well through references like this (json configuration files for example), but I haven’t tried or experimented with this yet.
Does this help? Do I understand your problem?
Hi,
thank you for your help.
you did understand my problem.
I didn’t fully understand your alternative approach. If you could elaborate it a bit more would be great.
also,
After inputting the graph to the robot with ‘stage.add_reference_to_stage(graph_path, object_path)’
how can I find the graph or use it as an object in my script?
This is the specific document you want
https://docs.omniverse.nvidia.com/kit/docs/omni.graph.docs/latest/howto/Controller.html#omnigraph-controller-class
This class is the main way a user interacts with omnigraph through python.
As for my alternative method, it really depends on how you need to apply the parameters to the graph and when. Using layers and a structured stage may greatly simplify your process. I haven’t actually tried this, so there may be complications I’m not aware of, but it could be worth trying!
you construct a graph to control the robot assuming it exists at some fixed path /robot/my_robot
. you leave all the parameters as default
you create a sublayer, set it to the authoring layer, and then modify the defaults to the specific robot type you want to apply it to. You then save the sublayer my_specific_robot_control_graph.usd
when you open the stage in which you want to apply this control graph, you would load the default stage, then the robot, then the specific sublayer for the robot (as here Add a SubLayer — Omniverse Developer Guide latest documentation). This would apply the “deltas” from the sublayer to the graph, as the nodes are just prims on the stage like anything else.
However this makes assumptions like the number of robots being controlled at a time, and the ability to set these parameters ahead of time without input from the user.
Hope this helps!
Gus
Heyo Gus,
I’m trying to do it the way you recommended and it seem to work, if i insert the layer through the GUI , but i can’t seem to find the method that would insert a layer using code.
If i just use the code from “Add a Sublayer” with the the Method CreateNew() ,it just clears out the usd file where the action graph is.
best wishes
Alexander
I managed to find a solution, i just set the Usd.Stage = my_previously_created_stage
and instead of CreateNew, i used FindOrOpen
Huzzah! :D let me know how it works out! I’m still not 100% sure I know what your goals are and I don’t want to mislead you
Hi Gus @mgussert ,
I add two graphs to my stage, with sub-layers, one to give out odometric data and one RTXLIdar graph for point cloud data. Now i want to call the output of those graphs into my python script where I merge the layers.
do you have any idea how i could get the outputs of the omnigraph so i can use as variables in the python script?
this is what i tried, but doesn’t work…
best regards,
Alex
hmm i think some of the code is missing, at least as far as I can see it in the post. can you attach the file?
you want this
https://docs.omniverse.nvidia.com/kit/docs/omni.graph.docs/latest/howto/Controller.html#omnigraph-controller-class
and specifically the attribute function
https://docs.omniverse.nvidia.com/kit/docs/omni.graph.docs/latest/howto/Controller.html#attribute
so in your case, i think it would be something like
pc_attribute_data = og.Controller.attribute("/RTXLidar/isaac_compute_rtx_lidar_point_cloud_node.outputs:pointCloudData").get()
does yours throw a specific error?