Hi,
I have set up a scene with physics enabled. I would like to start the timeline programmatically via a Python script running headlessly and render frames to image files.
I know how to do this using Isaac Sim. Is there also a way to achieve this using Kit only, without any Isaac Sim dependencies/extensions?
Best,
Bruno
What I have achieved so far is this:
I run a simple python script like this:
kit --exec "test.py" --no-window --enable [some extensions]
In the script I open an existing USD scene with physics driven objects:
ctx = get_context()
ctx.open_stage("omniverse://nucleus.dsdlab.db.de/Users/brunovetter/kit_test/nucleus_test_0ad68bf8.usd")
stage = ctx.get_stage()
I was also able to do some physics stepping like this, and retrieve an object’s position after each step:
...
for i in range(20):
physx_interface.update_simulation(0.1, 0.0)
physx_interface.update_transformations(
True, True, True, True)
train_world_xform = train_xform.ComputeLocalToWorldTransform(Usd.TimeCode.Default())
train_xlat = train_world_xform.ExtractTranslation()
So here is another question: In this setup, is it possible to just start the timeline instead and use some callbacks to react on physics steps?
Thanks for any help
Bruno
Hi Bruno,
You should be able to start a timeline like this:
omni.timeline.get_timeline_interface().play()
(if async, add await omni.kit.app.get_app().next_update_async())
You can also add callbacks to physics events like
physx_interface.subscribe_physics_step_events(callback_fn)
Generally, I suggest you to look into World, SimulationContext and PhysicsContext classes of Isaac SIM to have an idea on how to do these. In IS we wrap these concepts around a simpler to use API but they use PhysX and Kit APIs under the hood. If you take a look into the classes you will find most of these functionalities and calls.