File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -383,10 +383,7 @@ def step(self, action):
383383
384384 try :
385385 for i in range (self ._n_sub_steps ):
386- self ._hooks .before_substep (self ._physics_proxy , action ,
387- self ._random_state )
388- self ._physics .step ()
389- self ._hooks .after_substep (self ._physics_proxy , self ._random_state )
386+ self ._substep (action )
390387 # The final observation update must happen after all the hooks in
391388 # `self._hooks.after_step` is called. Otherwise, if any of these hooks
392389 # modify the physics state then we might capture an observation that is
@@ -424,6 +421,12 @@ def step(self, action):
424421 self ._reset_next_step = True
425422 return dm_env .TimeStep (dm_env .StepType .LAST , reward , discount , obs )
426423
424+ def _substep (self , action ):
425+ self ._hooks .before_substep (
426+ self ._physics_proxy , action , self ._random_state )
427+ self ._physics .step ()
428+ self ._hooks .after_substep (self ._physics_proxy , self ._random_state )
429+
427430 def action_spec (self ):
428431 """Returns the action specification for this environment."""
429432 return self ._task .action_spec (self ._physics_proxy )
You can’t perform that action at this time.
0 commit comments