Time_step_index is 2 at simulation start

Hi @prath4 - The time_step_index argument in the pre_step function of a BaseTask in Isaac Sim represents the current simulation step index. This index is incremented each time the simulation takes a step.

The initial value of time_step_index being 2 is a result of the simulation initialization process and should be consistent across different simulation setups. However, this is an implementation detail of the simulation engine and could potentially change in future versions of the software.

If you add a task in the middle of the simulation, the time_step_index for that task’s pre_step function will start from the current simulation step index, not from 0 or 2. This is because the time_step_index is tied to the simulation itself, not to individual tasks.

Task initialization does not always require a world reset. You can add tasks to the simulation at any time, and they will start running from the current simulation step. However, if you want to reset the state of a task or the entire simulation, you can do so by resetting the world.

You’re correct that the time_step_index counts steps from the last world reset. If you reset the world, the time_step_index will go back to 0, and the next call to pre_step will have a time_step_index of 2.

1 Like