def run_linear(time_limit=_DEFAULT_TIME_LIMIT, random=None, environment_kwargs=None):
  """Returns the run task."""
  physics = Physics.from_xml_string(*get_model_and_assets())
  task = Cheetah(random=random, distractor_style=1)
  environment_kwargs = environment_kwargs or {}
  return control.Environment(physics, task, time_limit=time_limit,
                             **environment_kwargs)
Esempio n. 2
0
def hard(time_limit=_DEFAULT_TIME_LIMIT, random=None, environment_kwargs=None):
  """Returns the hard point_mass task."""
  physics = Physics.from_xml_string(*get_model_and_assets())
  task = PointMass(randomize_gains=True, random=random)
  environment_kwargs = environment_kwargs or {}
  return control.Environment(
      physics, task, time_limit=time_limit, **environment_kwargs)
Esempio n. 3
0
def run(time_limit=_DEFAULT_TIME_LIMIT, random=None, environment_kwargs=None, setting_kwargs=None):
  """Returns the run task."""
  physics = Physics.from_xml_string(*common.settings.get_model_and_assets_from_setting_kwargs('cheetah.xml', setting_kwargs))
  task = Cheetah(random=random)
  environment_kwargs = environment_kwargs or {}
  return control.Environment(physics, task, time_limit=time_limit,
                             **environment_kwargs)
Esempio n. 4
0
def _make_lqr(n_bodies, n_actuators, control_cost_coef, time_limit, random,
              environment_kwargs):
    """Returns a LQR environment.

  Args:
    n_bodies: An int, number of bodies of the LQR.
    n_actuators: An int, number of actuated bodies of the LQR. `n_actuators`
      should be less or equal than `n_bodies`.
    control_cost_coef: A number, the coefficient of the control cost.
    time_limit: An int, maximum time for each episode in seconds.
    random: Either an existing `numpy.random.RandomState` instance, an
      integer seed for creating a new `RandomState`, or None to select a seed
      automatically.
    environment_kwargs: A `dict` specifying keyword arguments for the
      environment, or None.

  Returns:
    A LQR environment with `n_bodies` bodies of which first `n_actuators` are
    actuated.
  """

    if not isinstance(random, np.random.RandomState):
        random = np.random.RandomState(random)

    model_string, assets = get_model_and_assets(n_bodies,
                                                n_actuators,
                                                random=random)
    physics = Physics.from_xml_string(model_string, assets=assets)
    task = LQRLevel(control_cost_coef, random=random)
    environment_kwargs = environment_kwargs or {}
    return control.Environment(physics,
                               task,
                               time_limit=time_limit,
                               **environment_kwargs)
Esempio n. 5
0
def hard(time_limit=_DEFAULT_TIME_LIMIT, random=None, environment_kwargs=None):
  """Returns reacher with sparse reward with 1e-2 tol and randomized target."""
  physics = Physics.from_xml_string(*get_model_and_assets())
  task = Reacher(target_size=_SMALL_TARGET, random=random)
  environment_kwargs = environment_kwargs or {}
  return control.Environment(
      physics, task, time_limit=time_limit, **environment_kwargs)
Esempio n. 6
0
def swingup(time_limit=_DEFAULT_TIME_LIMIT, random=None,
            environment_kwargs=None, c_m=1., p_m=.1, p_l=1., p_r=.045, dt=.1):
    """Returns the Cartpole Swing-Up task."""
    physics = Physics.from_xml_string(*get_model_and_assets(c_m=c_m, p_m=p_m, p_l_1=p_l, p_r=p_r, dt=dt))
    task = Balance(swing_up=True, sparse=False, random=random)
    environment_kwargs = environment_kwargs or {}
    return control.Environment(
        physics, task, time_limit=time_limit, **environment_kwargs)
Esempio n. 7
0
def balance(time_limit=_DEFAULT_TIME_LIMIT, random=None,
            environment_kwargs=None):
  """Returns the Cartpole Balance task."""
  physics = Physics.from_xml_string(*get_model_and_assets())
  task = Balance(swing_up=False, sparse=False, random=random)
  environment_kwargs = environment_kwargs or {}
  return control.Environment(
      physics, task, time_limit=time_limit, **environment_kwargs)
Esempio n. 8
0
def easy(time_limit=_DEFAULT_TIME_LIMIT, random=None, environment_kwargs=None, **kwargs):
  """Returns the easy cloth task."""

  physics = Physics.from_xml_string(*get_model_and_assets())
  task = Rope(randomize_gains=False, random=random, **kwargs)
  environment_kwargs = environment_kwargs or {}
  return control.Environment(
      physics, task, time_limit=time_limit,n_frame_skip=1, rope_task=True,**environment_kwargs)
Esempio n. 9
0
def stand(time_limit=_DEFAULT_TIME_LIMIT, random=None, environment_kwargs=None):
  """Returns a Hopper that strives to stand upright, balancing its pose."""
  physics = Physics.from_xml_string(*get_model_and_assets())
  task = Hopper(hopping=False, random=random)
  environment_kwargs = environment_kwargs or {}
  return control.Environment(
      physics, task, time_limit=time_limit, control_timestep=_CONTROL_TIMESTEP,
      **environment_kwargs)
Esempio n. 10
0
def walk(time_limit=_DEFAULT_TIME_LIMIT, random=None):
    """Returns the Walk task."""
    physics = Physics.from_xml_string(*get_model_and_assets())
    task = Humanoid(move_speed=_WALK_SPEED, pure_state=False, random=random)
    return control.Environment(physics,
                               task,
                               time_limit=time_limit,
                               control_timestep=_CONTROL_TIMESTEP)
Esempio n. 11
0
def stand(time_limit=_DEFAULT_TIME_LIMIT, random=None, environment_kwargs=None):
  """Returns the Stand task."""
  physics = Physics.from_xml_string(*get_model_and_assets())
  task = HumanoidCMU(move_speed=0, random=random)
  environment_kwargs = environment_kwargs or {}
  return control.Environment(
      physics, task, time_limit=time_limit, control_timestep=_CONTROL_TIMESTEP,
      **environment_kwargs)
Esempio n. 12
0
def swingup(time_limit=_DEFAULT_TIME_LIMIT, random=None,
            environment_kwargs=None, setting_kwargs=None):
  """Returns the Cartpole Swing-Up task."""
  physics = Physics.from_xml_string(*common.settings.get_model_and_assets_from_setting_kwargs('cartpole.xml', setting_kwargs))
  task = Balance(swing_up=True, sparse=False, random=random)
  environment_kwargs = environment_kwargs or {}
  return control.Environment(
      physics, task, time_limit=time_limit, **environment_kwargs)
Esempio n. 13
0
def stand(time_limit=_DEFAULT_TIME_LIMIT, random=None):
    """Returns the Stand task."""
    physics = Physics.from_xml_string(*get_model_and_assets())
    task = PlanarWalker(move_speed=0, random=random)
    return control.Environment(physics,
                               task,
                               time_limit=time_limit,
                               control_timestep=_CONTROL_TIMESTEP)
Esempio n. 14
0
def turn_hard(time_limit=_DEFAULT_TIME_LIMIT, random=None):
    """Returns the hard Turn task."""
    physics = Physics.from_xml_string(*get_model_and_assets())
    task = Turn(target_radius=_HARD_TARGET_SIZE, random=random)
    return control.Environment(physics,
                               task,
                               time_limit=time_limit,
                               control_timestep=_CONTROL_TIMESTEP)
Esempio n. 15
0
def swim(time_limit=_DEFAULT_TIME_LIMIT, random=None):
    """Returns the Fish Swim task."""
    physics = Physics.from_xml_string(*get_model_and_assets())
    task = Swim(random=random)
    return control.Environment(physics,
                               task,
                               control_timestep=_CONTROL_TIMESTEP,
                               time_limit=time_limit)
Esempio n. 16
0
def run(time_limit=_DEFAULT_TIME_LIMIT, random=None, environment_kwargs=None):
  """Returns the Run task."""
  physics = Physics.from_xml_string(*get_model_and_assets())
  task = PlanarWalker(move_speed=_RUN_SPEED, random=random)
  environment_kwargs = environment_kwargs or {}
  return control.Environment(
      physics, task, time_limit=time_limit, control_timestep=_CONTROL_TIMESTEP,
      **environment_kwargs)
Esempio n. 17
0
def swingup_sparse(time_limit=_DEFAULT_TIME_LIMIT, random=None,
                   environment_kwargs=None):
  """Returns Acrobot sparse balance."""
  physics = Physics.from_xml_string(*get_model_and_assets())
  task = Balance(sparse=True, random=random)
  environment_kwargs = environment_kwargs or {}
  return control.Environment(
      physics, task, time_limit=time_limit, **environment_kwargs)
Esempio n. 18
0
def hard(
    time_limit=_DEFAULT_TIME_LIMIT, dynamics_seed=None, visual_seed=None, vary=DMCR_VARY
):
    model = get_model(visual_seed, vary)
    assets, _ = get_assets(visual_seed, vary)
    physics = Physics.from_xml_string(model, assets)
    task = Reacher(target_size=_SMALL_TARGET, random=dynamics_seed)
    return control.Environment(physics, task, time_limit=time_limit,)
Esempio n. 19
0
def hop(time_limit=_DEFAULT_TIME_LIMIT, random=None, environment_kwargs=None):
  """Returns a Hopper that strives to hop forward."""
  physics = Physics.from_xml_string(*get_model_and_assets())
  task = Hopper(hopping=True, random=random)
  environment_kwargs = environment_kwargs or {}
  return control.Environment(
      physics, task, time_limit=time_limit, control_timestep=_CONTROL_TIMESTEP,
      **environment_kwargs)
Esempio n. 20
0
def swingup(
    time_limit=_DEFAULT_TIME_LIMIT, dynamics_seed=None, visual_seed=None, vary=DMCR_VARY
):
    model = get_model(visual_seed, vary)
    assets, _ = get_assets(visual_seed, vary)
    physics = Physics.from_xml_string(model, assets)
    task = Balance(swing_up=True, sparse=False, random=dynamics_seed)
    return control.Environment(physics, task, time_limit=time_limit)
def run(time_limit=_DEFAULT_TIME_LIMIT, random=None):
    """Returns the Run task."""
    physics = Physics.from_xml_string(*get_model_and_assets())
    task = HumanoidCMU(move_speed=_RUN_SPEED, random=random)
    return control.Environment(physics,
                               task,
                               time_limit=time_limit,
                               control_timestep=_CONTROL_TIMESTEP)
Esempio n. 22
0
def collide(time_limit=_DEFAULT_TIME_LIMIT, random=None, environment_kwargs=None):
	"""Returns the Collide task."""
	physics = Physics.from_xml_string(*get_model_and_assets())
	task = Simple()
	environment_kwargs = environment_kwargs or {}
	return control.Environment(
		physics, task, time_limit=time_limit, control_timestep=_CONTROL_TIMESTEP,
		**environment_kwargs)
Esempio n. 23
0
def swingup(time_limit=_DEFAULT_TIME_LIMIT, random=None,
            environment_kwargs=None):
  """Returns pendulum swingup task ."""
  physics = Physics.from_xml_string(*get_model_and_assets())
  task = SwingUp(random=random)
  environment_kwargs = environment_kwargs or {}
  return control.Environment(
      physics, task, time_limit=time_limit, **environment_kwargs)
Esempio n. 24
0
def catch(time_limit=_DEFAULT_TIME_LIMIT, random=None):
    """Returns the Ball-in-Cup task."""
    physics = Physics.from_xml_string(*get_model_and_assets())
    task = BallInCup(random=random)
    return control.Environment(physics,
                               task,
                               time_limit=time_limit,
                               control_timestep=_CONTROL_TIMESTEP)
Esempio n. 25
0
 def mocap(time_limit=_DEFAULT_TIME_LIMIT, random=None, environment_kwargs=None):
     """Returns the mocap task."""
     physics = mujoco.Physics.from_xml_string(*get_model_and_assets())
     task = jeffRat(random=random)
     environment_kwargs = environment_kwargs or {}
     return control.Environment(
         physics, task, time_limit=time_limit, n_sub_steps=_CONTROL_SUBSTEPS,
         **environment_kwargs)
Esempio n. 26
0
def chase(time_limit=_TIME_LIMIT, random=None, environment_kwargs=None):
  """Returns manipulator bring task with the ball prop."""
  physics = Physics.from_xml_string(*make_model(False, False))
  task = Chase(use_peg=False, insert=False, fully_observable=True, random=random)
  environment_kwargs = environment_kwargs or {}
  return control.Environment(
      physics, task, control_timestep=_CONTROL_TIMESTEP, time_limit=time_limit,
      **environment_kwargs)
Esempio n. 27
0
def three_poles(time_limit=_DEFAULT_TIME_LIMIT, random=None, num_poles=3,
                sparse=False, environment_kwargs=None):
  """Returns the Cartpole Balance task with three or more poles."""
  physics = Physics.from_xml_string(*get_model_and_assets(num_poles=num_poles))
  task = Balance(swing_up=True, sparse=sparse, random=random)
  environment_kwargs = environment_kwargs or {}
  return control.Environment(
      physics, task, time_limit=time_limit, **environment_kwargs)
Esempio n. 28
0
def swingup_acrobot(time_limit=_DEFAULT_TIME_LIMIT, random=None,
                    environment_kwargs=None, p_m=1., p_l_1=.5, p_l_2=None, p_r=.045, dt=.1):
    """Returns Acrobot balance task."""
    physics = Physics.from_xml_string(*get_model_and_assets(p_m=p_m, p_l_1=p_l_1, p_l_2=p_l_2, p_r=p_r, dt=dt))
    task = Balance(sparse=False, random=random)
    environment_kwargs = environment_kwargs or {}
    return control.Environment(
        physics, task, time_limit=time_limit, **environment_kwargs)
Esempio n. 29
0
def swingup_sparse(time_limit=_DEFAULT_TIME_LIMIT, random=None,
                   environment_kwargs=None):
    """Returns the sparse reward variant of teh Cartpole Swing-Up task."""
    physics = Physics.from_xml_string(*get_model_and_assets())
    task = Balance(swing_up=True, sparse=True, random=random)
    environment_kwargs = environment_kwargs or {}
    return control.Environment(
        physics, task, time_limit=time_limit, **environment_kwargs)
Esempio n. 30
0
def fetch(time_limit=_DEFAULT_TIME_LIMIT, random=None, environment_kwargs=None):
  """Returns the Fetch task."""
  physics = Physics.from_xml_string(*get_model_and_assets(remove_ball=False))
  task = Fetch(random=random)
  environment_kwargs = environment_kwargs or {}
  return control.Environment(physics, task, time_limit=time_limit,
                             control_timestep=_CONTROL_TIMESTEP,
                             **environment_kwargs)