def init_episode(self, index: int) -> List[str]: detectors = [ProximitySensor('success%d' % i) for i in range(2)] self.register_success_conditions([ self.joint_conditions[index], DetectedCondition(self.remote, detectors[0]), DetectedCondition(self.remote, detectors[1]) ]) self.register_graspable_objects([self.remote]) w6 = Dummy('waypoint6') _, _, z = w6.get_position(relative_to=self.remote) rel_pos_lst = [ Shape('target_button_wrap1').get_position(relative_to=self.remote), Shape('target_button_wrap2').get_position(relative_to=self.remote) ] rel_pos_lst[index % 2][2] = z w6.set_position(rel_pos_lst[index], relative_to=self.remote, reset_dynamics=False) b = SpawnBoundary([self.boundary]) b.sample(self.remote) btn = {0: 'plus', 1: 'minus'} chnl = {0: 'up', 1: 'minus'} return [ 'turn the channel %s' % chnl[index], 'change the television channel %s' % chnl[index], 'point the remote at the tv and press the %s button to turn ' 'the channel %s' % (btn[index], chnl[index]), 'using the tv remote, ensure it is facing the television and ' 'press the %s button to increment the channel %s by one' % (btn[index], chnl[index]), 'find the %s button on the remote, rotate the remote such that' ' it is pointed at the tv, then press the button to change ' 'the channel %s' % (chnl[index], btn[index]) ]
def init_task(self) -> None: self.lid = Shape('lid') self.register_success_conditions([ DetectedCondition(self.lid, ProximitySensor('sensor_handle'), negated=True), DetectedCondition(self.lid, ProximitySensor('sensor_grill_top')) ])
def init_task(self) -> None: rope_head = Shape('head') rope_tail = Shape('tail') success_head = ProximitySensor('success_head') success_tail = ProximitySensor('success_tail') self.register_success_conditions([ DetectedCondition(rope_head, success_head), DetectedCondition(rope_tail, success_tail) ])
def init_task(self): shoe1 = Shape('shoe1') shoe2 = Shape('shoe2') self.register_graspable_objects([shoe1, shoe2]) success_sensor = ProximitySensor('success') self.register_success_conditions([ DetectedCondition(shoe1, success_sensor), DetectedCondition(shoe2, success_sensor), NothingGrasped(self.robot.gripper) ])
def init_task(self) -> None: middle_sensor = ProximitySensor('middle_sensor') right_sensor = ProximitySensor('right_sensor') wand = Shape('wand') self.register_graspable_objects([wand]) self.register_success_conditions([ DetectedCondition(wand, middle_sensor, negated=True), DetectedCondition(wand, right_sensor), NothingGrasped(self.robot.gripper) ])
def init_task(self) -> None: frame = Shape('frame') self.register_graspable_objects([frame]) self.register_success_conditions([ DetectedCondition(frame, ProximitySensor('hanger_detector'), negated=True), DetectedCondition(frame, ProximitySensor('success')), NothingGrasped(self.robot.gripper) ])
def init_task(self) -> None: self.plate = Shape('plate') self.success_poses = [Dummy('success_pos%d' % i) for i in range(3)] self.register_graspable_objects([self.plate]) self.register_success_conditions([ DetectedCondition(self.plate, ProximitySensor('success_source'), negated=True), DetectedCondition(self.plate, ProximitySensor('success_target')), NothingGrasped(self.robot.gripper) ])
def init_task(self) -> None: target = Shape('target_cuboid') original_detector = ProximitySensor('original_detector') bricks = [Shape('Cuboid%d' % i) for i in range(13)] conds = [DetectedCondition(b, original_detector) for b in bricks] conds.extend([ DetectedCondition(target, original_detector, negated=True), NothingGrasped(self.robot.gripper) ]) self.register_success_conditions(conds) self.register_graspable_objects([target])
def init_task(self) -> None: bottle_detector = ProximitySensor("bottle_detector") cap_detector = ProximitySensor("cap_detector") bottle = Shape('bottle') self.joint = Joint('joint') self.cap = Shape('cap') self.register_success_conditions( [DetectedCondition(bottle, bottle_detector), DetectedCondition(self.cap, cap_detector, negated=True), NothingGrasped(self.robot.gripper)]) self.cap_turned_condition = JointCondition( self.joint, np.deg2rad(150))
def init_task(self) -> None: success_sensor = ProximitySensor('success') book0 = Shape('book0') book1 = Shape('book1') book2 = Shape('book2') self.register_success_conditions([ DetectedCondition(book0, success_sensor), DetectedCondition(book1, success_sensor), DetectedCondition(book2, success_sensor), NothingGrasped(self.robot.gripper) ]) self.register_graspable_objects([book2, book1, book0])
def init_episode(self, index: int) -> List[str]: self._variation_index = index self.bin_objects = sample_procedural_objects(self.get_base(), 3) self.bin_objects_not_done = list(self.bin_objects) self.register_graspable_objects(self.bin_objects) self.spawn_boundary.clear() for ob in self.bin_objects: ob.set_position([0.0, 0.0, 0.2], relative_to=self.large_container, reset_dynamics=False) self.spawn_boundary.sample(ob, ignore_collisions=True, min_distance=0.05) target_pos = [-5.9605e-8, -2.5005e-1, +1.7e-1] conditions = [] target_color_name, target_color_rgb = colors[index] color_choice = np.random.choice(list(range(index)) + list(range(index + 1, len(colors))), size=1, replace=False)[0] _, distractor_color_rgb = colors[color_choice] if index % 2 == 0: self.target_container0.set_color(target_color_rgb) self.target_container1.set_color(distractor_color_rgb) for ob in self.bin_objects: conditions.append(DetectedCondition(ob, self.success_detector0)) else: self.target_container1.set_color(target_color_rgb) self.target_container0.set_color(distractor_color_rgb) for ob in self.bin_objects: conditions.append(DetectedCondition(ob, self.success_detector1)) target_pos[1] = -target_pos[1] self.target_waypoint.set_position(target_pos, relative_to=self.large_container, reset_dynamics=True) self.register_success_conditions( [ConditionSet(conditions, simultaneously_met=True)]) return [ 'empty the container in the to %s container' % target_color_name, 'clear all items from the large tray and put them in the %s ' 'tray' % target_color_name, 'move all objects from the large container and drop them into ' 'the smaller %s one' % target_color_name, 'remove whatever you find in the big box in the middle and ' 'leave them in the %s one' % target_color_name, 'grasp and move all objects into the %s container' % target_color_name ]
def init_task(self) -> None: sensor_right_hole = ProximitySensor('sensor1') sensor_left_hole = ProximitySensor('sensor2') charger = Shape('charger') self.charger_base = Dummy('charger_base') charger_right_stick = Shape('detector1') charger_left_stick = Shape('detector2') self.boundary = SpawnBoundary([Shape('charger_boundary')]) self.register_graspable_objects([charger]) self.register_success_conditions([ DetectedCondition(charger_right_stick, sensor_right_hole), DetectedCondition(charger_left_stick, sensor_left_hole), NothingGrasped(self.robot.gripper) ])
def init_task(self) -> None: plate = Shape('plate') fork = Shape('fork') knife = Shape('knife') spoon = Shape('spoon') glass = Shape('glass') self.register_success_conditions([ DetectedCondition(plate, ProximitySensor('plate_detector')), DetectedCondition(fork, ProximitySensor('fork_detector')), DetectedCondition(knife, ProximitySensor('knife_detector')), DetectedCondition(spoon, ProximitySensor('spoon_detector')), DetectedCondition(glass, ProximitySensor('glass_detector')), NothingGrasped(self.robot.gripper) ]) self.register_graspable_objects([plate, fork, knife, spoon, glass])
def init_task(self) -> None: roll = Shape('toilet_roll') success_sensor = ProximitySensor('success') self.register_graspable_objects([roll]) self.register_success_conditions( [DetectedCondition(roll, success_sensor, negated=True), NothingGrasped(self.robot.gripper)])
def init_task(self) -> None: spatula = Shape('scoop_with_spatula_spatula') self.register_graspable_objects([spatula]) self.register_success_conditions([ DetectedCondition(Shape('Cuboid'), ProximitySensor('success')), GraspedCondition(self.robot.gripper, spatula) ])
def init_task(self) -> None: phone = Shape('phone') self.register_graspable_objects([phone]) self.register_success_conditions([ DetectedCondition(phone, ProximitySensor('success')), NothingGrasped(self.robot.gripper) ])
def init_task(self) -> None: bottle = Shape('bottle') success_sensor = ProximitySensor('success') self.register_graspable_objects([bottle]) self.register_success_conditions( [DetectedCondition(bottle, success_sensor), NothingGrasped(self.robot.gripper)])
def init_task(self) -> None: success_sensor = ProximitySensor('success') frame = Shape('frame') frame_detector = Shape('frame_detector') self.register_graspable_objects([frame]) self.register_success_conditions( [DetectedCondition(frame_detector, success_sensor)])
def init_task(self): wine_bottle = Shape('wine_bottle') self.register_graspable_objects([wine_bottle]) self.register_success_conditions([ DetectedCondition(wine_bottle, ProximitySensor('success')), NothingGrasped(self.robot.gripper) ])
def init_episode(self, index: int) -> List[str]: self.cups_removed = -1 self.cups_to_remove = 1 + index % MAX_CUPS_TO_REMOVE self.w5_new_pos = self.w5_new_pos_saved self.w1.set_position(self.w1_rel_pos, relative_to=self.cups[0], reset_dynamics=False) for i in range(self.cups_to_remove): self.success_conditions.append( DetectedCondition(self.cups[i], self.success_detectors[i])) self.register_success_conditions(self.success_conditions) self.register_waypoint_ability_start(0, self._move_above_next_target) self.register_waypoints_should_repeat(self._repeat) if self.cups_to_remove == 1: return [ 'remove 1 cup from the cup holder and place it on the ' 'table', 'remove one cup from the mug holder', 'pick up 1 cup from the mug tree and place it on the table', 'slide 1 mug off of its spoke on the cup holder and leave ' 'it on the table top' ] else: return [ 'remove %d cups from the cup holder and place it on the ' 'table' % self.cups_to_remove, 'remove %d cups from the cup holder' % self.cups_to_remove, 'pick up %d cups from the mug tree and place them on the ' 'table' % self.cups_to_remove, 'slide %d mugs off of their spokes on the cup holder and ' 'leave them on the table top' % self.cups_to_remove ]
def init_episode(self, index: int) -> List[str]: option = OPTIONS[index] conditions = [ DetectedCondition(self.cup, self.success_sensor), NothingGrasped(self.robot.gripper) ] if option == 'left': self.waypoint0.set_position( self.left_initial_waypoint.get_position()) self.waypoint1.set_position( self.left_close_waypoint.get_position()) self.waypoint2.set_position(self.left_far_waypoint.get_position()) self.waypoint6.set_position( self.place_cup_left_waypoint.get_position()) conditions.append(JointCondition(self.left_joint, 0.06)) else: conditions.append(JointCondition(self.right_joint, 0.06)) self.register_success_conditions(conditions) return [ 'put cup in %s cabinet' % option, 'put the mug away in the %s half of the cabinet' % option, 'open the %s side of the cabinet and put the cup away in it' % option, 'grasping the %s handle, open the cabinet, then pick up the cup' ' and set it down inside the cabinet' % option, 'slide open the %s door on the cabinet and put away the mug' % option ]
def init_task(self) -> None: needle_minute = Shape('clock_needle_minute') success_detector = ProximitySensor('detector_minute0') self.register_success_conditions([ NothingGrasped(self.robot.gripper), DetectedCondition(needle_minute, success_detector) ])
def init_task(self): success_sensor = ProximitySensor('success') umbrella = Shape('umbrella') self.register_graspable_objects([umbrella]) self.register_success_conditions( [DetectedCondition(umbrella, success_sensor), NothingGrasped(self.robot.gripper)])
def init_episode(self, index: int) -> List[str]: self.target_shelf = index w4 = Dummy('waypoint4') target_dummy_name = 'dummy_shelf' + str(self.target_shelf) target_pos_dummy = Dummy(target_dummy_name) target_pos = target_pos_dummy.get_position() w4.set_position(target_pos, reset_dynamics=False) self.success_detector = ProximitySensor( ('success_detector' + str(self.target_shelf)) ) while len(self.success_conditions) > 1: self.success_conditions.pop() self.success_conditions.append( DetectedCondition(self.money, self.success_detector) ) self.register_success_conditions(self.success_conditions) b = SpawnBoundary([self.money_boundary]) b.sample(self.money, min_rotation=(0.00, 0.00, 0.00), max_rotation=(0.00, 0.00, +0.5 * np.pi)) return ['put the money away in the safe on the %s shelf' % self.index_dic[index], 'leave the money on the %s shelf on the safe' % self.index_dic[index], 'place the stack of bank notes on the %s shelf of the safe' % self.index_dic[index]]
def init_task(self) -> None: piece2 = Shape('solve_puzzle_piece2') self.register_graspable_objects([piece2]) self.register_success_conditions([ NothingGrasped(self.robot.gripper), DetectedCondition(piece2, ProximitySensor('success')) ])
def init_episode(self, index: int) -> List[str]: b = SpawnBoundary([self.boundary]) success = ProximitySensor('success') for obj in self.jars: b.sample(obj, min_distance=0.01) w0 = Dummy('waypoint0') w0.set_orientation([-np.pi, 0, -np.pi], reset_dynamics=False) w0.set_position([0, 0, 0.1], relative_to=self.lids[index % 2], reset_dynamics=False) target_color_name, target_color_rgb = colors[index] color_choice = np.random.choice(list(range(index)) + list(range(index + 1, len(colors))), size=1, replace=False)[0] _, distractor_color_rgb = colors[color_choice] self.jars[index % 2].set_color(target_color_rgb) other_index = {0: 1, 1: 0} self.jars[other_index[index % 2]].set_color(distractor_color_rgb) self.conditions += [DetectedCondition(self.lids[index % 2], success)] self.register_success_conditions(self.conditions) return [ 'open the %s jar' % target_color_name, 'unscrew the %s jar' % target_color_name, 'grasp the lid of the %s jar, unscrew it in an anti_clockwise ' 'direction until it is removed from the jar, and leave it on ' 'the table top' % target_color_name, 'remove the lid from the %s jam jar and set it down on the ' 'table' % target_color_name ]
def init_task(self) -> None: success_sensor = ProximitySensor('success') usb = Shape('usb') usb_tip = Shape('tip') self.register_graspable_objects([usb]) self.register_success_conditions( [DetectedCondition(usb_tip, success_sensor)])
def init_task(self) -> None: self.needle = Shape('scales_meter_needle') self.needle_pivot = Shape('scales_meter_pivot') self.top_plate = Shape('scales_tray_visual') self.joint = Joint('scales_joint') _, _, starting_z = self.top_plate.get_position() self.top_plate_starting_z = starting_z self.needle_starting_ori = self.needle.get_orientation( relative_to=self.needle_pivot) self.peppers = [Shape('pepper%d' % i) for i in range(3)] self.register_graspable_objects(self.peppers) self.boundary = Shape('peppers_boundary') self.success_detector = ProximitySensor('success_detector') self.needle_detector = ProximitySensor('needle_sensor') self.success_conditions = [ NothingGrasped(self.robot.gripper), DetectedCondition(self.needle, self.needle_detector) ] self.w0 = Dummy('waypoint0') self.w0_rel_pos = [ +2.6203 * 10**(-3), -1.7881 * 10**(-7), +1.5197 * 10**(-1) ] self.w0_rel_ori = [-3.1416, -1.7467 * 10**(-2), -3.1416]
def init_episode(self, index: int) -> List[str]: self._variation_index = index b = SpawnBoundary([self.boundary]) for holder in self.holders: b.sample(holder, min_distance=0.01) self.w1 = Dummy('waypoint1') self.w1.set_position([0, 0, +10*10**(-3)], relative_to=self.bulb_glass_visual[index % 2], reset_dynamics=False) target_color_name, target_color_rgb = colors[index] color_choice = np.random.choice( list(range(index)) + list( range(index + 1, len(colors))), size=1, replace=False)[0] _, distractor_color_rgb = colors[color_choice] self.holders[index % 2].set_color(target_color_rgb) other_index = {0: 1, 1: 0} self.holders[other_index[index % 2]].set_color(distractor_color_rgb) self.register_success_conditions([DetectedCondition( self.bulbs[index % 2], ProximitySensor('success')), NothingGrasped(self.robot.gripper)]) return ['screw in the %s light bulb' % target_color_name, 'screw the light bulb from the %s holder into the lamp' % target_color_name, 'pick up the light bulb from the %s stand, lift it up to just ' 'above the lamp, then screw it down into the lamp in a ' 'clockwise fashion' % target_color_name, 'put the light bulb from the %s casing into the lamp' % target_color_name]
def init_task(self) -> None: cup = Shape('cup') self.register_graspable_objects([cup]) self.register_success_conditions([ JointCondition(Joint('joint'), np.deg2rad(1)), DetectedCondition(cup, ProximitySensor('success')) ])