How can I get simulation-time?

Hi, I’m looking for a API that returns simulation time or simulation dt.

I found some examples, but it’s for the standalone.

Is there a API that works on the ScriptEditor or IsaacExample-HelloWorld?

You can get the dt inside of a physics callback

def my_callback(step_size):
    return
simulation_context.add_physics_callback("physics_callback_1", my_callback)

simulation_context also has a get_physics_dt function that can return the last physics dt

Just for future readers who are interested in how to get the time in a standalone Python application, you can do it by first importing

from omni.isaac.core import SimulationContext

and defining

simulation_context = SimulationContext()

I believe we have to define it before the world.reset() is called, but I may be wrong. Then if you call

t = simulation_context.current_time

you will get the simulation time. An example of this can be found in the simulation_callbacks.py file within standalone_examples/api/omni.isaac.core/.

Hope this helps.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.