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?