Ejemplo n.º 1
0
  def __init__(self, object_name, pap, start_config, base_trajs, oracle):
    super(self.__class__, self).__init__(arg_info(currentframe(), ignore=['self', 'oracle', 'base_trajs']))
    self.base_trajs = base_trajs
    holding = Holding(object_name, pap.grasp)

    self.conditions = [
      SubstateCondition(Substate({object_name: pap.pose})),
      SubstateCondition(Substate({'robot': start_config})),
      SubstateCondition(Substate({'holding': False})),
    ]
    for obst in oracle.objects:
      if obst != object_name:
        if ONLY_HOLDING_COLLISIONS:
          self.conditions.append(CollisionCondition(obst,
            lambda value, obst=obst: oracle.holding_collision(pap.grasp_config, obst, value, holding), base_name=object_name))
        else:
          self.conditions.append(CollisionCondition(obst,
            lambda value, obst=obst: oracle.traj_holding_collision(pap.approach_config, pap.trajs, obst, value, holding) or
              (BASE_TRAJECTORY_COLLISIONS and oracle.traj_collision(start_config, base_trajs, obst, value)), base_name=object_name))

    self.effects = {
      object_name: ValueEffect(False),
      'holding': ValueEffect(holding),
      'robot': ValueEffect(pap.approach_config),
      (object_name, 'on'): ValueEffect(False) # NOTE - for unstacking
    }
Ejemplo n.º 2
0
 def __init__(self, name, env_file=None, camera_trans=CAMERA_TRANS,
     object_names=[], floor_object_names=[], # TODO - list which objects can be grasped in what ways/constrained
     table_names=[], sink_names=[], stove_names=[], regions=[],
     start_holding=False, start_stackings={}, start_constrained={},
     goal_config=None, goal_holding=None, goal_poses={}, goal_regions={}, goal_stackings={}, goal_constrained={},
     goal_cleaned=[], goal_cooked=[]):
   for k, v in arg_info(currentframe(), ignore=['self']).items():
     setattr(self, k, v)
Ejemplo n.º 3
0
  def __init__(self, start_config, end_config, base_trajs, oracle):
    super(self.__class__, self).__init__(arg_info(currentframe(), ignore=['self', 'oracle', 'base_trajs']))
    self.base_trajs = base_trajs

    self.conditions = [
      SubstateCondition(Substate({'robot': start_config})),
      SubstateCondition(Substate({'holding': False}))
    ]
    for obst in oracle.objects:
      if ONLY_HOLDING_COLLISIONS:
        self.conditions.append(CollisionCondition(obst,
            lambda value, obst=obst: oracle.holding_collision(start_config, obst, value, None) or \
            oracle.holding_collision(end_config, obst, value, None)))
      else:
        self.conditions.append(CollisionCondition(obst,
            lambda value, obst=obst: BASE_TRAJECTORY_COLLISIONS and
            oracle.traj_collision(start_config, base_trajs, obst, value)))

    self.effects = {
      'robot': ValueEffect(end_config),
    }
Ejemplo n.º 4
0
  def __init__(self, object_name, push, start_config, base_trajs, oracle):
    super(self.__class__, self).__init__(arg_info(currentframe(), ignore=['self', 'oracle', 'base_trajs']))
    self.base_trajs = base_trajs

    self.conditions = [
      SubstateCondition(Substate({object_name: push.start_pose})),
      SubstateCondition(Substate({'robot': start_config})),
      SubstateCondition(Substate({'holding': False}))
    ]
    for obst in oracle.objects:
      if obst != object_name:
        if ONLY_HOLDING_COLLISIONS:
          raise RuntimeError() # Really cannot get away with only a holding condition for a push
        else:
          self.conditions.append(CollisionCondition(obst,
            lambda value, obst=obst: oracle.traj_collision(push.approach_config, push.start_trajs, obst, value) or
              oracle.traj_holding_collision(push.start_contact_config, (push.push_traj,), obst, value, Holding(object_name, push.contact)) or
              oracle.traj_collision(push.end_contact_config, push.end_trajs, obst, value) or
              (BASE_TRAJECTORY_COLLISIONS and oracle.traj_collision(start_config, base_trajs, obst, value))))
    self.effects = {
      object_name: ValueEffect(push.end_pose),
      'robot': ValueEffect(push.approach_config)
    }