Ejemplo n.º 1
0
def turn_hard(time_limit=_DEFAULT_TIME_LIMIT, random=None, params=None,
              environment_kwargs=None):
  """Returns the hard Turn task."""
  physics = Physics.from_xml_string(*get_model_and_assets())
  task = Turn(target_radius=_HARD_TARGET_SIZE, random=random)
  environment_kwargs = environment_kwargs or {}
  return control.Environment(
      physics, task, time_limit=time_limit, control_timestep=_CONTROL_TIMESTEP,
      **environment_kwargs)
Ejemplo n.º 2
0
def run(time_limit=_DEFAULT_TIME_LIMIT, random=None, params=None, environment_kwargs=None):
  """Returns the run task."""
  physics = []
  for body_length in params:
    physic = Physics.from_xml_string(*get_model_and_assets(body_length))
    physics.append(physic)
  task = Cheetah(random=random)
  environment_kwargs = environment_kwargs or {}
  return control.Environment(physics, task, time_limit=time_limit,
                             **environment_kwargs)
Ejemplo n.º 3
0
def two_poles(time_limit=_DEFAULT_TIME_LIMIT,
              random=None,
              environment_kwargs=None):
    """Returns the Cartpole Balance task with two poles."""
    physics = Physics.from_xml_string(*get_model_and_assets(num_poles=2))
    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)
Ejemplo n.º 4
0
def spin(time_limit=_DEFAULT_TIME_LIMIT, random=None, params=None, environment_kwargs=None):
  """Returns the Spin task."""
  physics = []
  for length in params:
    physic = Physics.from_xml_string(*get_model_and_assets(length))
    physics.append(physic)
  task = Spin(random=random)
  environment_kwargs = environment_kwargs or {}
  return control.Environment(
      physics, task, time_limit=time_limit, control_timestep=_CONTROL_TIMESTEP,
      **environment_kwargs)
Ejemplo n.º 5
0
def swingup(time_limit=_DEFAULT_TIME_LIMIT,
            random=None,
            params=None,
            environment_kwargs=None):
    """Returns the Cartpole Swing-Up task."""
    physics = []
    for pole_length in params:
        physic = Physics.from_xml_string(*get_model_and_assets(pole_length))
        physics.append(physic)
    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)
Ejemplo n.º 6
0
def catch(time_limit=_DEFAULT_TIME_LIMIT,
          random=None,
          params=None,
          environment_kwargs=None):
    """Returns the Ball-in-Cup task."""
    physics = []
    for ball_size in params:
        physic = Physics.from_xml_string(*get_model_and_assets(ball_size))
        physics.append(physic)
    task = BallInCup(random=random)
    environment_kwargs = environment_kwargs or {}
    return control.Environment(physics,
                               task,
                               time_limit=time_limit,
                               control_timestep=_CONTROL_TIMESTEP,
                               **environment_kwargs)
Ejemplo n.º 7
0
def walk(time_limit=_DEFAULT_TIME_LIMIT,
         random=None,
         params=None,
         environment_kwargs=None):
    """Returns the Walk task."""
    physics = []
    for leg_length in params:
        physic = Physics.from_xml_string(*get_model_and_assets(leg_length))
        physics.append(physic)
    task = PlanarWalker(move_speed=_WALK_SPEED, random=random)
    environment_kwargs = environment_kwargs or {}
    return control.Environment(physics,
                               task,
                               time_limit=time_limit,
                               control_timestep=_CONTROL_TIMESTEP,
                               **environment_kwargs)