How to change physics_dt of Standalone application?

I designed a standalone application with world and task. I found that there is a physics dt in world, so I change the setting like this:

the_world = World(physics_dt=0.1,stage_units_in_meters=1.0)
task=TASK('name')
the_world.add_task(task)
epoch=0
while simulation_app.is_running():
    the_world.reset()
    for t in range(100):
        the_world.step()
    epoch+=1

and in pre_step function of TASK, print every time step:

    def pre_step(self, time_step_index: int, simulation_time: float) -> None:
        print("time_step_index",time_step_index)
        print("sim_time",simulation_time)

However, the result like this:

time_step_index 0
sim_time 0
time_step_index 0
sim_time 0
time_step_index 0
sim_time 0
time_step_index 0
sim_time 0
time_step_index 0
sim_time 0
time_step_index 1
sim_time 0.10000000149011612
time_step_index 1
sim_time 0.10000000149011612
time_step_index 1
sim_time 0.10000000149011612
time_step_index 1
sim_time 0.10000000149011612
time_step_index 1
sim_time 0.10000000149011612
time_step_index 1
sim_time 0.10000000149011612
time_step_index 2
sim_time 0.20000000298023224
time_step_index 2
sim_time 0.20000000298023224
time_step_index 2
sim_time 0.20000000298023224
time_step_index 2
sim_time 0.20000000298023224
time_step_index 2
sim_time 0.20000000298023224

It seems that the changing physics_dt of world doesn’t change the frequency of calling step(), so multi-times step() and pre_step() could change sim time once.

This does change the sim dt, but multi-times calling function lead to performance waste. Are there some better way to achieve changing dt of sim time?

You need to also change the rendering_dt accordingly. What you set now is physics_dt=0.1 and rendering_dt = 0.0166 so every 6 rendering steps, 1 physics step is executed only. The pre_step function is called every rendering step and sim_time and time_step_index corresponds to physics.

Take a look at standalone_examples/api/omni.isaac.core/time_stepping.py to understand time stepping more.

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