Skip to content

Commit c4e60f4

Browse files
saran-talimuldal
authored andcommitted
Factor out the creation of observation updater from the _recompile_physics method.
PiperOrigin-RevId: 220705572
1 parent dadc933 commit c4e60f4

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

dm_control/composer/environment.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,7 @@ def _recompile_physics(self):
224224
self._physics_proxy = weakref.proxy(self._physics)
225225
self._hooks.refresh_entity_hooks()
226226

227-
self._observation_updater = observation.Updater(
228-
self._task.observables, self._task.physics_steps_per_control_step,
229-
self._strip_singleton_obs_buffer_dim)
227+
self._observation_updater = self._make_observation_updater()
230228
self._observation_updater.reset(self._physics_proxy, self._random_state)
231229

232230
# NB: `physics.after_reset()` is called after `task.after_compile()` so
@@ -240,6 +238,11 @@ def _recompile_physics(self):
240238
def _make_physics(self):
241239
return mjcf.Physics.from_mjcf_model(self._task.root_entity.mjcf_model)
242240

241+
def _make_observation_updater(self):
242+
return observation.Updater(
243+
self._task.observables, self._task.physics_steps_per_control_step,
244+
self._strip_singleton_obs_buffer_dim)
245+
243246
@property
244247
def physics(self):
245248
"""Returns a `weakref.ProxyType` pointing to the current `mjcf.Physics`.

0 commit comments

Comments
 (0)