# Is there a way to change the actions only after 150ms?

Hi,

assuming `self.sim_params.dt= 0.05` is set to 0.05, I want the agent changes its action after 150ms. Basically after every 3 simulation iterations. Is there a way for this?

Hi @hosei2

You can use the `controlFrequencyInv` configuration parameter for it. This parameter simulates as many specified iterations as shown below:

1 Like

I am a little bit confused. So in this example of AllegroHand, the sim.dt is set to 0.01667 (which 60Hz). Every 0.01667 seconds, the controller is simulated twice, which makes the control frequency to 30Hz.

However, in my case, the sim.dt is set to 0.05s (which is 20Hz) and the control frequency should be set to 0.15s (~6.67Hz). So, ignore in the first two simulation steps (dont apply `self.gym.simulate(self.sim)` and only in the third simulation step apply it.

Wouldn’t this badly confuse the agent? Because the computed actions sometimes produce results and sometimes not…?

Hi @hosei2

According to tho the framework documentation (and the implemented code) `controlFrequencyInv` is defined as the control decimation, ie. how many simulator steps between RL actions. Defaults to 1.

In your case, setting it to 3 will apply new actions at 150ms (control frequency will be lower than a simulation frequency for physics propagating forward) for `dt=0.05`.

By the way, I think that (depending on the nature of the task) for that `dt`, there may be a loss in simulation accuracy… unless `substeps` be higher enough (See Isaac Gym documentation `faqs.html` in `PATH_TO_ISAAC_GYM_PREVIEW/docs` folder)

1 Like

According to the code from AllegroHand.py:

``````# step physics and render each frame
for i in range(self.control_freq_inv):
if self.force_render:
self.render()
self.gym.simulate(self.sim)
``````

In each of the simulation step (which is set to 60Hz), `self.gym.simulate(self.sim`) is applied twice, as the `self.control_freq_inv` is set to 2 (see the AllegroHand.yaml). This will make the control frequency to 120Hz, right and not 30Hz, as they have stated in AllegroHand.yaml??

Hi @hosei2

For `AllegroHand` it means executing the following sequence on each interaction of the agent with the environment

``````pre_physics_step (apply actions)
simulate (0.01667 sec)
simulate (0.01667 sec)
post_physics_step
``````

Then, the actions are applied every `2 * 0.01667 sec` (29.9940012 Hz) simulation time

1 Like

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