Speed up the simulation without affecting the physics

The parameter "/physics/timeStepsPerSecond" tells the simulator what is the physics time stepping.

Isaac sim is set to run real-time, and automatically compute how many simulation steps to run per rendering, constrained by the Max num steps (/physics/maxNumSteps) setting.

Below is a script to force execute physics time-steps decoupled from rendering or timeline buttons. Bear in mind that the stepping loop is a locking function, and UI will freeze for the duration of the loop. There is a known bug currently being worked on on this approach where the simulation may freeze if a contact report happens during one of the steps.

from pxr import Usd, UsdGeom
import omni.usd
from omni.physx import  acquire_physx_interface


stage = omni.usd.get_context().get_stage()
print(stage)

physx = acquire_physx_interface()

dt = 1/60.0
physx.reset_simulation()
physx.start_simulation()
# Simulate 20 steps, increase start_time if the desired initial step time is not at zero
start_time = 0.0
for i in range(20):
    physx.update_simulation(dt, start_time+ i*dt)
    physx.update_transformations(False, True)

# To stop the simulation and reset the scene:
def stop():
    physx.reset_simulation()
    physx.update_transformations(False, True)
2 Likes