MCPcopy Create free account
hub / github.com/google-deepmind/dm_control / __init__

Method __init__

dm_control/manipulation/bricks.py:292–352  ·  view source on GitHub ↗

Initializes a new `Reassemble` task. Args: arena: `composer.Entity` instance. arm: `robot_base.RobotArm` instance. hand: `robot_base.RobotHand` instance. num_bricks: The total number of bricks; must be between 2 and 6. randomize_initial_order: Boolean specifying wh

(self,
               arena,
               arm,
               hand,
               num_bricks,
               randomize_initial_order,
               randomize_desired_order,
               obs_settings,
               workspace,
               control_timestep)

Source from the content-addressed store, hash-verified

290 """Disassemble a stack of Duplo bricks and reassemble it in another order."""
291
292 def __init__(self,
293 arena,
294 arm,
295 hand,
296 num_bricks,
297 randomize_initial_order,
298 randomize_desired_order,
299 obs_settings,
300 workspace,
301 control_timestep):
302 """Initializes a new `Reassemble` task.
303
304 Args:
305 arena: `composer.Entity` instance.
306 arm: `robot_base.RobotArm` instance.
307 hand: `robot_base.RobotHand` instance.
308 num_bricks: The total number of bricks; must be between 2 and 6.
309 randomize_initial_order: Boolean specifying whether to randomize the
310 initial order of bricks in the stack at the start of each episode.
311 randomize_desired_order: Boolean specifying whether to independently
312 randomize the desired order of bricks in the stack at the start of each
313 episode. By default the desired order will be the reverse of the initial
314 order, with the exception of the base brick which is always the same as
315 in the initial order since it is welded in place.
316 obs_settings: `observations.ObservationSettings` instance.
317 workspace: A `_BrickWorkspace` instance.
318 control_timestep: Float specifying the control timestep in seconds.
319
320 Raises:
321 ValueError: If `num_bricks` is not between 2 and 6.
322 """
323 super().__init__(
324 arena=arena,
325 arm=arm,
326 hand=hand,
327 num_bricks=num_bricks,
328 obs_settings=obs_settings,
329 workspace=workspace,
330 control_timestep=control_timestep)
331 self._randomize_initial_order = randomize_initial_order
332 self._randomize_desired_order = randomize_desired_order
333
334 # Randomized at the start of each episode if `randomize_initial_order` is
335 # True.
336 self._initial_order = np.arange(num_bricks)
337
338 # Randomized at the start of each episode if `randomize_desired_order` is
339 # True.
340 self._desired_order = self._initial_order.copy()
341 self._desired_order[1:] = self._desired_order[-1:0:-1]
342
343 # In the random order case, create a `prop_pose` observable that informs the
344 # agent of the desired order.
345 if randomize_desired_order:
346 desired_order_observable = observable.Generic(self._get_desired_order)
347 desired_order_observable.configure(**obs_settings.prop_pose._asdict())
348 self._task_observables['desired_order'] = desired_order_observable
349

Callers

nothing calls this directly

Calls 4

configureMethod · 0.80
_asdictMethod · 0.80
__init__Method · 0.45
copyMethod · 0.45

Tested by

no test coverage detected