Ejemplo n.º 1
0
from dm_control.utils import rewards
import numpy as np
from six.moves import range
from six.moves import zip

mjlib = mjbindings.mjlib

_BrickWorkspace = collections.namedtuple(
    '_BrickWorkspace',
    ['prop_bbox', 'tcp_bbox', 'goal_hint_pos', 'goal_hint_quat', 'arm_offset'])

# Ensures that the prop does not collide with the table during initialization.
_PROP_Z_OFFSET = 1e-6

_WORKSPACE = _BrickWorkspace(
    prop_bbox=workspaces.BoundingBox(lower=(-0.1, -0.1, _PROP_Z_OFFSET),
                                     upper=(0.1, 0.1, _PROP_Z_OFFSET)),
    tcp_bbox=workspaces.BoundingBox(lower=(-0.1, -0.1, 0.15),
                                    upper=(0.1, 0.1, 0.4)),
    goal_hint_pos=(0.2, 0.1, 0.),
    goal_hint_quat=(-0.38268343, 0., 0., 0.92387953),
    arm_offset=robots.ARM_OFFSET)

# Alpha value of the visual goal hint representing the goal state for each task.
_HINT_ALPHA = 0.75

# Distance thresholds for the shaping rewards for getting the top brick close
# to the bottom brick, and for 'clicking' them together.
_CLOSE_THRESHOLD = 0.01
_CLICK_THRESHOLD = 0.001

# Sequence of colors for the brick(s).
Ejemplo n.º 2
0
from dm_control.manipulation.shared import observations
from dm_control.manipulation.shared import registry
from dm_control.manipulation.shared import robots
from dm_control.manipulation.shared import tags
from dm_control.manipulation.shared import workspaces
from dm_control.utils import rewards
import numpy as np

_ReachWorkspace = collections.namedtuple(
    '_ReachWorkspace', ['target_bbox', 'tcp_bbox', 'arm_offset'])

# Ensures that the props are not touching the table before settling.
_PROP_Z_OFFSET = 0.001

_DUPLO_WORKSPACE = _ReachWorkspace(
    target_bbox=workspaces.BoundingBox(lower=(-0.1, -0.1, _PROP_Z_OFFSET),
                                       upper=(0.1, 0.1, _PROP_Z_OFFSET)),
    tcp_bbox=workspaces.BoundingBox(lower=(-0.1, -0.1, 0.2),
                                    upper=(0.1, 0.1, 0.4)),
    arm_offset=robots.ARM_OFFSET)

_SITE_WORKSPACE = _ReachWorkspace(
    target_bbox=workspaces.BoundingBox(lower=(-0.2, -0.2, 0.02),
                                       upper=(0.2, 0.2, 0.4)),
    tcp_bbox=workspaces.BoundingBox(lower=(-0.2, -0.2, 0.02),
                                    upper=(0.2, 0.2, 0.4)),
    arm_offset=robots.ARM_OFFSET)

_TARGET_RADIUS = 0.05


class Reach(composer.Task):
Ejemplo n.º 3
0
from dm_control.manipulation.shared import registry
from dm_control.manipulation.shared import robots
from dm_control.manipulation.shared import tags
from dm_control.manipulation.shared import workspaces
from dm_control.utils import rewards
import numpy as np

_PushWorkspace = collections.namedtuple(
    '_PushWorkspace', ['target_bbox', 'tcp_bbox', 'arm_offset'])

# Ensures that the props are not touching the table before settling.
_PROP_Z_OFFSET = 0.001

_DUPLO_WORKSPACE = _PushWorkspace(
    target_bbox=workspaces.BoundingBox(
        lower=(-0.1, -0.1, _PROP_Z_OFFSET),
        upper=(0.0, 0.1, _PROP_Z_OFFSET)),  # start on left side
    tcp_bbox=workspaces.BoundingBox(lower=(-0.1, -0.1, 0.2),
                                    upper=(0.1, 0.1, 0.4)),
    arm_offset=robots.ARM_OFFSET)

_HAND_TARGET_RADIUS = 0.05
_TARGET_RADIUS = 0.025
_TARGET_PROP_XPOS = 0.1


class Push(composer.Task):
    """Bring the hand close to a target prop or site."""
    def __init__(self, arena, arm, hand, prop, obs_settings, workspace,
                 control_timestep):
        """Initializes a new `Push` task.
Ejemplo n.º 4
0
from dm_control.manipulation.shared import arenas
from dm_control.manipulation.shared import cameras
from dm_control.manipulation.shared import constants
from dm_control.manipulation.shared import observations
from dm_control.manipulation.shared import registry
from dm_control.manipulation.shared import robots
from dm_control.manipulation.shared import tags
from dm_control.manipulation.shared import workspaces
from dm_control.utils import rewards
import numpy as np

_LiftWorkspace = collections.namedtuple(
    '_LiftWorkspace', ['prop_bbox', 'tcp_bbox', 'arm_offset'])

_DUPLO_WORKSPACE = _LiftWorkspace(
    prop_bbox=workspaces.BoundingBox(lower=(-0.1, -0.1, 0.0),
                                     upper=(0.1, 0.1, 0.0)),
    tcp_bbox=workspaces.BoundingBox(lower=(-0.1, -0.1, 0.2),
                                    upper=(0.1, 0.1, 0.4)),
    arm_offset=robots.ARM_OFFSET)

_BOX_SIZE = 0.09
_BOX_MASS = 1.3
_BOX_WORKSPACE = _LiftWorkspace(
    prop_bbox=workspaces.BoundingBox(lower=(-0.1, -0.1, _BOX_SIZE),
                                     upper=(0.1, 0.1, _BOX_SIZE)),
    tcp_bbox=workspaces.BoundingBox(lower=(-0.1, -0.1, 0.2),
                                    upper=(0.1, 0.1, 0.4)),
    arm_offset=robots.ARM_OFFSET)

_DISTANCE_TO_LIFT = 0.3
Ejemplo n.º 5
0
from dm_control.manipulation.shared import workspaces
from dm_control.utils import rewards
import numpy as np
import six

_PlaceWorkspace = collections.namedtuple(
    '_PlaceWorkspace', ['prop_bbox', 'target_bbox', 'tcp_bbox', 'arm_offset'])

_TARGET_RADIUS = 0.05
_PEDESTAL_RADIUS = 0.07

# Ensures that the prop does not collide with the table during initialization.
_PROP_Z_OFFSET = 1e-6

_WORKSPACE = _PlaceWorkspace(
    prop_bbox=workspaces.BoundingBox(lower=(-0.1, -0.1, _PROP_Z_OFFSET),
                                     upper=(0.1, 0.1, _PROP_Z_OFFSET)),
    tcp_bbox=workspaces.BoundingBox(lower=(-0.1, -0.1, _PEDESTAL_RADIUS + 0.1),
                                    upper=(0.1, 0.1, 0.4)),
    target_bbox=workspaces.BoundingBox(lower=(-0.1, -0.1, _PEDESTAL_RADIUS),
                                       upper=(0.1, 0.1,
                                              _PEDESTAL_RADIUS + 0.1)),
    arm_offset=robots.ARM_OFFSET)


class SphereCradle(composer.Entity):
    """A concave shape for easy placement."""
    _SPHERE_COUNT = 3

    def _build(self):
        self._mjcf_root = mjcf.element.RootElement(model='cradle')
        sphere_radius = _PEDESTAL_RADIUS * 0.7