I am new to Isaac Sim, it is probably a beginner question.
I am writing a custom Python extension in Isaac Sim. I have a USD scene setup, it has a world object in it. For testing, I also configured physics time steps per second to 1.
Now in my extension I want to add render callback in my scene. I found in the documentation, that I can use add_render_callback. To use this method I need a World object. To my surprise in most examples on the internet, this object is created from scratch, this does not work in my case because I already have it on my scene (see screenshot above) and I don’t want to configure it in the code from scratch.
Here is the code for my extension:
def callback_render(event):
print("render called:", event)
class MyExtension(omni.ext.IExt):
def on_startup(self, ext_id):
print("my extension startup")
# here I am creating a new instance of world, but I don't want to create a new instance of world,
# I already have it on my scene, I just want to somehow retrieve it
self.__world = World()
self.__world.add_render_callback("render_callback", callback_fn=callback_render)
def on_shutdown(self):
print("my extension shutdown")
self.__world.remove_render_callback("render_callback")
An interesting thing is that when I create a World object like above, callback_render
method does get called, but it is called many times per second. As I pointed out on the screenshot above, the physics time steps per second equals to 1, so it seems I am working with the wrong world object, that is not matching my scene. How can I retrieve the correct World object? Maybe I am asking the wrong question and this problem should be solved in another way, if so please clarify that?