prompt,completion " ""align-box-corner"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""align-box-corner"" in a python code block. ### "," align-box-corner: {'assets-used': ['box/box-template.urdf', 'corner/corner-template.urdf'], 'task-description': 'pick up the randomly sized box and align one of its corners to the L-shaped marker on the tabletop..', 'task-name': 'align-box-corner'}``` ###Implementation: ```python import os import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class AlignBoxCorner(Task): """"""Pick up the randomly sized box and align one of its corners to the L-shaped marker on the tabletop."""""" def __init__(self): super().__init__() self.max_steps = 3 self.lang_template = ""align the brown box with the green corner"" self.task_completed_desc = ""done with alignment"" self.additional_reset() def reset(self, env): super().reset(env) # Generate randomly shaped box. box_size = self.get_random_size(0.05, 0.15, 0.05, 0.15, 0.01, 0.06) # Add corner. dimx = (box_size[0] / 2 - 0.025 + 0.0025, box_size[0] / 2 + 0.0025) dimy = (box_size[1] / 2 + 0.0025, box_size[1] / 2 - 0.025 + 0.0025) corner_template = 'corner/corner-template.urdf' replace = {'DIMX': dimx, 'DIMY': dimy} # IMPORTANT: REPLACE THE TEMPLATE URDF corner_urdf = self.fill_template(corner_template, replace) corner_size = (box_size[0], box_size[1], 0) corner_pose = self.get_random_pose(env, corner_size) env.add_object(corner_urdf, corner_pose, 'fixed') # Add possible placing poses. theta = utils.quatXYZW_to_eulerXYZ(corner_pose[1])[2] fip_rot = utils.eulerXYZ_to_quatXYZW((0, 0, theta + np.pi)) pose1 = (corner_pose[0], fip_rot) alt_x = (box_size[0] / 2) - (box_size[1] / 2) alt_y = (box_size[1] / 2) - (box_size[0] / 2) alt_pos = (alt_x, alt_y, 0) alt_rot0 = utils.eulerXYZ_to_quatXYZW((0, 0, np.pi / 2)) alt_rot1 = utils.eulerXYZ_to_quatXYZW((0, 0, 3 * np.pi / 2)) pose2 = utils.multiply(corner_pose, (alt_pos, alt_rot0)) pose3 = utils.multiply(corner_pose, (alt_pos, alt_rot1)) # Add box. box_template = 'box/box-template.urdf' # IMPORTANT: REPLACE THE TEMPLATE URDF box_urdf = self.fill_template(box_template, {'DIM': np.float32(box_size)}) box_pose = self.get_random_pose(env, box_size) box_id = env.add_object(box_urdf, box_pose) self.color_random_brown(box_id) # Goal: box is aligned with corner (1 of 4 possible poses). self.add_goal(objs=[box_id], matches=np.int32([[1, 1, 1, 1]]), targ_poses=[corner_pose, pose1, pose2, pose3], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1, symmetries=[2 * np.pi]) self.lang_goals.append(self.lang_template) ``` END" " ""align-rope"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""align-rope"" in a python code block. ### "," align-rope: {'assets-used': ['square/square-template.urdf'], 'task-description': 'manipulate a deformable rope to connect its end-points between two corners of a 3-sided square.', 'task-name': 'align-rope'}``` ###Implementation: ```python import os import numpy as np from cliport.tasks import primitives from cliport.tasks.task import Task from cliport.utils import utils import random import pybullet as p class AlignRope(Task): """"""Manipulate a deformable rope to connect its end-points between two corners of a 3-sided square."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""align the rope from {direction}"" self.task_completed_desc = ""done aligning the rope."" self.additional_reset() def reset(self, env): super().reset(env) n_parts = 20 radius = 0.005 length = 2 * radius * n_parts * np.sqrt(2) # Add 3-sided square. square_size = (length, length, 0) square_pose = self.get_random_pose(env, square_size) square_template = 'square/square-template.urdf' replace = {'DIM': (length,), 'HALF': (np.float32(length) / 2 - 0.005,)} # IMPORTANT: REPLACE THE TEMPLATE URDF urdf = self.fill_template(square_template, replace) env.add_object(urdf, square_pose, 'fixed') # Get four corner points of square. corner0 = ( length / 2, length / 2, 0.001) corner1 = (-length / 2, length / 2, 0.001) corner2 = ( length / 2, -length / 2, 0.001) corner3 = (-length / 2, -length / 2, 0.001) corner0 = utils.apply(square_pose, corner0) corner1 = utils.apply(square_pose, corner1) corner2 = utils.apply(square_pose, corner2) corner3 = utils.apply(square_pose, corner3) # Four possible alignment tasks. task_descs = [ ((corner0, corner1), ""front left tip to front right tip""), ((corner0, corner2), ""front right tip to back right corner""), ((corner1, corner3), ""front left tip to back left corner""), ((corner3, corner2), ""back right corner to back left corner"") ] chosen_task = np.random.choice(len(task_descs), 1)[0] (corner_0, corner_1), direction = task_descs[chosen_task] # IMPORTANT: use `make_ropes` to add cable (series of articulated small blocks). objects, targets, matches = self.make_ropes(env, corners=(corner_0, corner_1)) self.add_goal(objs=objects, matches=matches, targ_poses=targets, replace=False, rotations=False, metric='pose', params=None, step_max_reward=1.) self.lang_goals += [self.lang_template.format(direction=direction)] * len(self.goals) # wait for the scene to settle down for i in range(480): p.stepSimulation()``` END" " ""assembling-kits"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""assembling-kits"" in a python code block. ### "," assembling-kits: {'assets-used': ['kitting/kit.urdf', 'kitting/object-template.urdf'], 'task-description': 'pick up different objects and arrange them on a board marked with corresponding silhouettes.', 'task-name': 'assembling-kits'}``` ###Implementation: ```python import os import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class AssemblingKits(Task): """"""pick up different objects and arrange them on a board marked with corresponding silhouettes."""""" def __init__(self): super().__init__() self.max_steps = 10 self.homogeneous = False self.lang_template = ""put all the blocks inside the holes they fit in"" self.task_completed_desc = ""done assembling blocks."" self.additional_reset() def reset(self, env): super().reset(env) # Add kit. kit_size = (0.28, 0.2, 0.005) kit_urdf = 'kitting/kit.urdf' kit_pose = self.get_random_pose(env, kit_size) env.add_object(kit_urdf, kit_pose, 'fixed') n_objects = 5 obj_shapes = self.get_kitting_shapes(n_objects) colors = [ utils.COLORS['purple'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow'], utils.COLORS['red'] ] # Build kit. targets = [] targ_pos = [[-0.09, 0.045, 0.0014], [0, 0.045, 0.0014], [0.09, 0.045, 0.0014], [-0.045, -0.045, 0.0014], [0.045, -0.045, 0.0014]] template = 'kitting/object-template.urdf' for i in range(n_objects): shape = os.path.join(self.assets_root, 'kitting', f'{obj_shapes[i]:02d}.obj') scale = [0.003, 0.003, 0.0001] # .0005 pos = utils.apply(kit_pose, targ_pos[i]) theta = np.random.rand() * 2 * np.pi rot = utils.eulerXYZ_to_quatXYZW((0, 0, theta)) replace = {'FNAME': (shape,), 'SCALE': scale, 'COLOR': [0.2, 0.2, 0.2]} # IMPORTANT: REPLACE THE TEMPLATE URDF urdf = self.fill_template(template, replace) env.add_object(urdf, (pos, rot), 'fixed') targets.append((pos, rot)) # Add objects. objects, matches = self.make_kitting_objects(env, targets=targets, obj_shapes=obj_shapes, n_objects=n_objects, colors=colors) matches = np.int32(matches) self.add_goal(objs=objects, matches=matches, targ_poses=targets, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1) self.lang_goals.append(self.lang_template) ``` END" " ""manipulating-rope"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""manipulating-rope"" in a python code block. ### "," manipulating-rope: {'assets-used': ['square/square-template.urdf'], 'task-description': 'rearrange a deformable rope such that it connects the two endpoints of a 3-sided square.', 'task-name': 'manipulating-rope'}``` ###Implementation: ```python import os import numpy as np from cliport.tasks import primitives from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ManipulatingRope(Task): """"""rearrange a deformable rope such that it connects the two endpoints of a 3-sided square."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""manipulate the rope to complete the square"" self.task_completed_desc = ""done manipulating the rope."" self.additional_reset() def reset(self, env): super().reset(env) n_parts = 20 radius = 0.005 length = 2 * radius * n_parts * np.sqrt(2) # Add 3-sided square. square_size = (length, length, 0) square_pose = self.get_random_pose(env, square_size) square_template = 'square/square-template.urdf' # IMPORTANT: REPLACE THE TEMPLATE URDF with `fill_template` replace = {'DIM': (length,), 'HALF': (np.float32(length) / 2 - 0.005,)} urdf = self.fill_template(square_template, replace) env.add_object(urdf, square_pose, 'fixed') # compute corners corner0 = (length / 2, length / 2, 0.001) corner1 = (-length / 2, length / 2, 0.001) corner_0 = utils.apply(square_pose, corner0) corner_1 = utils.apply(square_pose, corner1) # IMPORTANT: use `make_ropes` to add cable (series of articulated small blocks). objects, targets, matches = self.make_ropes(env, corners=(corner_0, corner_1)) self.add_goal(objs=objects, matches=matches, targ_poses=targets, replace=False, rotations=False, metric='pose', params=None, step_max_reward=1.) self.lang_goals.append(self.lang_template) for i in range(480): p.stepSimulation() ``` END" " ""packing-boxes"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""packing-boxes"" in a python code block. ### "," packing-boxes: {'assets-used': ['container/container-template.urdf', 'box/box-template.urdf'], 'task-description': 'pick up randomly sized boxes and place them tightly into a container.', 'task-name': 'packing-boxes'}``` ###Implementation: ```python import os import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class PackingBoxes(Task): """"""pick up randomly sized boxes and place them tightly into a container."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""pack all the boxes inside the brown box"" self.task_completed_desc = ""done packing boxes."" self.zone_bounds = np.array([[0.25, 0.75], [-0.5, 0.5], [0, 0.08]]) self.additional_reset() def reset(self, env): super().reset(env) # Add container box. zone_size = self.get_random_size(0.05, 0.3, 0.05, 0.3, 0.05, 0.05) zone_pose = self.get_random_pose(env, zone_size) container_template = 'container/container-template.urdf' replace = {'DIM': zone_size, 'HALF': (zone_size[0] / 2, zone_size[1] / 2, zone_size[2] / 2)} # IMPORTANT: REPLACE THE TEMPLATE URDF container_urdf = self.fill_template(container_template, replace) env.add_object(container_urdf, zone_pose, 'fixed') margin = 0.01 min_object_dim = 0.05 bboxes = [] # Split container space with KD trees. stack_size = np.array(zone_size) stack_size[0] -= 0.01 stack_size[1] -= 0.01 root_size = (0.01, 0.01, 0) + tuple(stack_size) root = utils.TreeNode(None, [], bbox=np.array(root_size)) utils.KDTree(root, min_object_dim, margin, bboxes) colors = [utils.COLORS[c] for c in utils.COLORS if c != 'brown'] # Add objects in container. object_ids = [] bboxes = np.array(bboxes) object_template = 'box/box-template.urdf' # Compute object points that are needed for zone for bbox in bboxes: size = bbox[3:] - bbox[:3] position = size / 2. + bbox[:3] position[0] += -zone_size[0] / 2 position[1] += -zone_size[1] / 2 pose = (position, (0, 0, 0, 1)) pose = utils.multiply(zone_pose, pose) # IMPORTANT: REPLACE THE TEMPLATE URDF urdf = self.fill_template(object_template, {'DIM': size}) icolor = np.random.choice(range(len(colors)), 1).squeeze() box_id = env.add_object(urdf, pose, color=colors[icolor]) object_ids.append(box_id) # Randomly select object in box and save ground truth pose. object_volumes = [] true_poses = [] for object_id in object_ids: true_pose = p.getBasePositionAndOrientation(object_id) object_size = p.getVisualShapeData(object_id)[0][3] object_volumes.append(np.prod(np.array(object_size) * 100)) pose = self.get_random_pose(env, object_size) p.resetBasePositionAndOrientation(object_id, pose[0], pose[1]) true_poses.append(true_pose) self.add_goal(objs=object_ids, matches=np.eye(len(object_ids)), targ_poses=true_poses, replace=False, rotations=True, metric='zone', params=[(zone_pose, zone_size)], step_max_reward=1) self.lang_goals.append(self.lang_template) ``` END" " ""palletizing-boxes"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""palletizing-boxes"" in a python code block. ### "," palletizing-boxes: {'assets-used': ['pallet/pallet.urdf', 'box/box-template.urdf'], 'task-description': 'pick up homogeneous fixed-sized boxes and stack them in transposed layers on the pallet.', 'task-name': 'palletizing-boxes'}``` ###Implementation: ```python import os import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class PalletizingBoxes(Task): """"""Pick up homogeneous fixed-sized boxes and stack them in transposed layers on the pallet."""""" def __init__(self): super().__init__() self.max_steps = 30 self.lang_template = ""stack all the boxes on the pallet"" self.task_completed_desc = ""done stacking boxes."" self.additional_reset() def reset(self, env): super().reset(env) # Add pallet. zone_size = (0.3, 0.25, 0.25) zone_urdf = 'pallet/pallet.urdf' rotation = utils.eulerXYZ_to_quatXYZW((0, 0, 0)) zone_pose = ((0.5, 0.25, 0.02), rotation) env.add_object(zone_urdf, zone_pose, 'fixed') # Add stack of boxes on pallet. margin = 0.01 object_ids = [] # x, y, z dimensions for the asset size stack_size = (0.19, 0.19, 0.19) box_template = 'box/box-template.urdf' stack_dim = np.int32([2, 3, 3]) box_size = (stack_size - (stack_dim - 1) * margin) / stack_dim for z in range(stack_dim[2]): # Transpose every layer. stack_dim[0], stack_dim[1] = stack_dim[1], stack_dim[0] box_size[0], box_size[1] = box_size[1], box_size[0] # IMPORTANT: Compute object points and store as a dictionary for the `goal` for y in range(stack_dim[1]): for x in range(stack_dim[0]): position = list((x + 0.5, y + 0.5, z + 0.5) * box_size) position[0] += x * margin - stack_size[0] / 2 position[1] += y * margin - stack_size[1] / 2 position[2] += z * margin + 0.03 pose = (position, (0, 0, 0, 1)) pose = utils.multiply(zone_pose, pose) # IMPORTANT: REPLACE THE TEMPLATE URDF urdf = self.fill_template(box_template, {'DIM': box_size}) box_id = env.add_object(urdf, pose) object_ids.append(box_id) self.color_random_brown(box_id) # Randomly select top box on pallet and save ground truth pose. targets = [] self.steps = [] boxes = object_ids[:] # make copy while boxes: _, height, object_mask = self.get_true_image(env) top = np.argwhere(height > (np.max(height) - 0.03)) rpixel = top[int(np.floor(np.random.random() * len(top)))] # y, x box_id = int(object_mask[rpixel[0], rpixel[1]]) if box_id in boxes: position, rotation = p.getBasePositionAndOrientation(box_id) rposition = np.float32(position) + np.float32([0, -10, 0]) p.resetBasePositionAndOrientation(box_id, rposition, rotation) self.steps.append(box_id) targets.append((position, rotation)) boxes.remove(box_id) self.steps.reverse() # Time-reversed depalletizing. self.add_goal(objs=object_ids, matches=np.eye(len(object_ids)), targ_poses=targets, replace=False, rotations=True, metric='zone', params=[(zone_pose, zone_size)], step_max_reward=1) self.lang_goals.append(self.lang_template) self.spawn_box() def reward(self): reward, info = super().reward() self.spawn_box() return reward, info``` END" " ""place-red-in-green"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""place-red-in-green"" in a python code block. ### "," place-red-in-green: {'assets-used': ['bowl/bowl.urdf', 'stacking/block.urdf'], 'task-description': 'pick up the red blocks and place them into the green bowls amidst other objects.', 'task-name': 'place-red-in-green'}``` ###Implementation: ```python import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class PlaceRedInGreen(Task): """"""pick up the red blocks and place them into the green bowls amidst other objects."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""put the red blocks in a green bowl"" self.task_completed_desc = ""done placing blocks in bowls."" self.additional_reset() def reset(self, env): super().reset(env) n_bowls = np.random.randint(1, 4) n_blocks = np.random.randint(1, n_bowls + 1) # Add bowls. # x, y, z dimensions for the asset size bowl_size = (0.12, 0.12, 0) bowl_urdf = 'bowl/bowl.urdf' bowl_poses = [] for _ in range(n_bowls): bowl_pose = self.get_random_pose(env, obj_size=bowl_size) env.add_object(urdf=bowl_urdf, pose=bowl_pose, category='fixed') bowl_poses.append(bowl_pose) # Add blocks. # x, y, z dimensions for the asset size blocks = [] block_size = (0.04, 0.04, 0.04) block_urdf = 'stacking/block.urdf' for _ in range(n_blocks): block_pose = self.get_random_pose(env, obj_size=block_size) block_id = env.add_object(block_urdf, block_pose) blocks.append(block_id) # Goal: each red block is in a different green bowl. self.add_goal(objs=blocks, matches=np.ones((len(blocks), len(bowl_poses))), targ_poses=bowl_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1) self.lang_goals.append(self.lang_template) # Colors of distractor objects. bowl_colors = [utils.COLORS[c] for c in utils.COLORS if c != 'green'] block_colors = [utils.COLORS[c] for c in utils.COLORS if c != 'red'] # Add distractors. n_distractors = 0 while n_distractors < 6: is_block = np.random.rand() > 0.5 urdf = block_urdf if is_block else bowl_urdf size = block_size if is_block else bowl_size colors = block_colors if is_block else bowl_colors pose = self.get_random_pose(env, obj_size=size) color = colors[n_distractors % len(colors)] obj_id = env.add_object(urdf, pose, color=color) n_distractors += 1 ``` END" " ""stack-block-pyramid"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""stack-block-pyramid"" in a python code block. ### "," stack-block-pyramid: {'assets-used': ['stacking/stand.urdf', 'stacking/block.urdf'], 'task-description': 'sequentially stack 6 blocks into a pyramid of 3-2-1 with rainbow colored ordering.', 'task-name': 'stack-block-pyramid'}``` ###Implementation: ```python import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class StackBlockPyramid(Task): """"""Build a pyramid of colored blocks in a color sequence"""""" def __init__(self): super().__init__() self.max_steps = 12 self.lang_template = ""make the {row} row with {blocks}"" self.task_completed_desc = ""done stacking block pyramid."" self.additional_reset() def reset(self, env): super().reset(env) # Add base. base_size = (0.05, 0.15, 0.005) base_urdf = 'stacking/stand.urdf' base_pose = self.get_random_pose(env, base_size) env.add_object(base_urdf, base_pose, category='fixed') # Block colors. colors = [ utils.COLORS['purple'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow'], utils.COLORS['orange'], utils.COLORS['red'] ] # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'stacking/block.urdf' objs = [] for i in range(6): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=colors[i]) objs.append(block_id) # IMPORTANT Associate placement locations for goals. place_pos = [(0, -0.05, 0.03), (0, 0, 0.03), (0, 0.05, 0.03), (0, -0.025, 0.08), (0, 0.025, 0.08), (0, 0, 0.13)] targs = [(utils.apply(base_pose, i), base_pose[1]) for i in place_pos] # Goal: blocks are stacked in a pyramid (bottom row: green, blue, purple). self.add_goal(objs=objs[:3], matches=np.ones((3, 3)), targ_poses=targs[:3], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]*3) self.lang_goals.append(self.lang_template.format(blocks=""the green, blue and purple blocks"", row=""bottom"")) # Goal: blocks are stacked in a pyramid (middle row: yellow, orange). self.add_goal(objs=objs[3:5], matches=np.ones((2, 2)), targ_poses=targs[3:5], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]*2) self.lang_goals.append(self.lang_template.format(blocks=""the yellow and orange blocks"", row=""middle"")) # Goal: blocks are stacked in a pyramid (top row: red). self.add_goal(objs=objs[5:], matches=np.ones((1, 1)), targ_poses=targs[5:], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 6, symmetries=[np.pi/2]*1) self.lang_goals.append(self.lang_template.format(blocks=""the red block"", row=""top"")) ``` END" " ""sweeping-piles"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""sweeping-piles"" in a python code block. ### "," sweeping-piles: {'assets-used': ['zone/zone.urdf', 'block/small.urdf'], 'task-description': 'push piles of small objects into a target goal zone marked on the tabletop.', 'task-name': 'sweeping-piles'}``` ###Implementation: ```python import numpy as np from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils class SweepingPiles(Task): """"""Push piles of small objects into a target goal zone marked on the tabletop."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""push the pile of blocks into the green square"" self.task_completed_desc = ""done sweeping."" self.primitive = primitives.push self.ee = Spatula self.additional_reset() def reset(self, env): super().reset(env) # Add goal zone. zone_size = (0.12, 0.12, 0) zone_pose = self.get_random_pose(env, zone_size) env.add_object('zone/zone.urdf', zone_pose, 'fixed') # Add pile of small blocks with `make_piles` function obj_ids = self.make_piles(env) # Add goal self.add_goal(objs=obj_ids, matches=np.ones((50, 1)), targ_poses=[zone_pose], replace=True, rotations=False, metric='zone', params=[(zone_pose, zone_size)], step_max_reward=1) self.lang_goals.append(self.lang_template)``` END" " ""build-wheel"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""build-wheel"" in a python code block. ### "," build-wheel: {'task-name': 'build-wheel', 'task-description': 'Construct a wheel using blocks and a sphere. First, position eight blocks in a circular layout on the tabletop. Each block should be touching its two neighbors and colored in alternating red and blue. Then place a green sphere in the center of the circular layout, completing the wheel.', 'assets-used': ['block/block.urdf', 'sphere/sphere.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class BuildWheel(Task): """"""Construct a wheel using blocks and a sphere."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""Construct a wheel using blocks and a sphere. First, position eight blocks in a circular layout on the tabletop. Each block should be touching its two neighbors and colored in alternating red and blue. Then place a green sphere in the center of the circular layout, completing the wheel."" self.task_completed_desc = ""done building wheel."" self.additional_reset() def reset(self, env): super().reset(env) # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' block_colors = [utils.COLORS['red'], utils.COLORS['blue']] blocks = [] for i in range(8): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=block_colors[i % 2]) blocks.append(block_id) # Add sphere. sphere_size = (0.04, 0.04, 0.04) sphere_urdf = 'sphere/sphere.urdf' sphere_color = utils.COLORS['green'] sphere_pose = ((0.5, 0.0, 0.0), (0,0,0,1)) # fixed pose sphere_id = env.add_object(sphere_urdf, sphere_pose, color=sphere_color) # Goal: blocks are arranged in a circle and sphere is in the center. circle_radius = 0.1 circle_center = (0, 0, block_size[2] / 2) angles = np.linspace(0, 2 * np.pi, 8, endpoint=False) block_poses = [(circle_center[0] + circle_radius * np.cos(angle), circle_center[1] + circle_radius * np.sin(angle), circle_center[2]) for angle in angles] block_poses = [(utils.apply(sphere_pose, pos), sphere_pose[1]) for pos in block_poses] self.add_goal(objs=blocks, matches=np.ones((8, 8)), targ_poses=block_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=8 / 9) # Goal: sphere is in the center of the blocks. self.add_goal(objs=[sphere_id], matches=np.ones((1, 1)), targ_poses=[sphere_pose], replace=False, rotations=False, metric='pose', params=None, step_max_reward=1 / 9) self.lang_goals.append(self.lang_template) ``` END" " ""push-piles-into-letter"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""push-piles-into-letter"" in a python code block. ### "," push-piles-into-letter: {'task-name': 'push-piles-into-letter', 'task-description': 'Push piles of small objects into a target goal zone shaped in some letters.', 'assets-used': ['kitting/kit.urdf', 'kitting/object-template-nocollision.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class BuildWheel(Task): """"""Construct a wheel using blocks and a sphere."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""Construct a wheel using blocks and a sphere. First, position eight blocks in a circular layout on the tabletop. Each block should be touching its two neighbors and colored in alternating red and blue. Then place a green sphere in the center of the circular layout, completing the wheel."" self.task_completed_desc = ""done building wheel."" self.additional_reset() def reset(self, env): super().reset(env) # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' block_colors = [utils.COLORS['red'], utils.COLORS['blue']] blocks = [] for i in range(8): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=block_colors[i % 2]) blocks.append(block_id) # Add sphere. sphere_size = (0.04, 0.04, 0.04) sphere_urdf = 'sphere/sphere.urdf' sphere_color = utils.COLORS['green'] sphere_pose = ((0.5, 0.0, 0.0), (0,0,0,1)) # fixed pose sphere_id = env.add_object(sphere_urdf, sphere_pose, color=sphere_color) # Goal: blocks are arranged in a circle and sphere is in the center. circle_radius = 0.1 circle_center = (0, 0, block_size[2] / 2) angles = np.linspace(0, 2 * np.pi, 8, endpoint=False) block_poses = [(circle_center[0] + circle_radius * np.cos(angle), circle_center[1] + circle_radius * np.sin(angle), circle_center[2]) for angle in angles] block_poses = [(utils.apply(sphere_pose, pos), sphere_pose[1]) for pos in block_poses] self.add_goal(objs=blocks, matches=np.ones((8, 8)), targ_poses=block_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=8 / 9) # Goal: sphere is in the center of the blocks. self.add_goal(objs=[sphere_id], matches=np.ones((1, 1)), targ_poses=[sphere_pose], replace=False, rotations=False, metric='pose', params=None, step_max_reward=1 / 9) self.lang_goals.append(self.lang_template) ``` END" " ""connect-boxes-with-rope"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""connect-boxes-with-rope"" in a python code block. ### "," connect-boxes-with-rope: {'task-name': 'connect-boxes-with-rope', 'task-description': 'Connect two colored blocks with ropes.', 'assets-used': ['block/block.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import IPython class ConnectBoxesWithRope(Task): """"""Connect two colored blocks with ropes."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""connect the {color1} and {color2} blocks with the rope."" self.task_completed_desc = ""done connecting."" self.additional_reset() self.pos_eps = 0.04 # higher tolerance def reset(self, env): super().reset(env) colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'] blocks = [] target_colors = np.random.choice(colors, 2, replace=False) block_size = (0.04, 0.04, 0.04) block_urdf = 'stacking/block.urdf' corner_poses = [] for color in colors: block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=color) blocks.append(block_id) if color in target_colors: corner_poses.append(block_pose) dist = np.linalg.norm(np.array(corner_poses[0][0])-np.array(corner_poses[1][0])) n_parts = int(20 * dist / 0.4) # IMPORTANT: use `make_ropes` to add cable (series of articulated small blocks). objects, targets, matches = self.make_ropes(env, corners=(corner_poses[0][0], corner_poses[1][0]), n_parts=n_parts) self.add_goal(objs=objects, matches=matches, targ_poses=targets, replace=False, rotations=False, metric='pose', params=None, step_max_reward=1.) self.lang_goals.append(self.lang_template.format(color1=target_colors[0], color2=target_colors[1])) # wait for the scene to settle down for i in range(600): p.stepSimulation()``` END" " ""build-car"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""build-car"" in a python code block. ### "," build-car: {'task-name': 'build-car', 'task-description': 'Construct a simple car structure using blocks and cylinders.', 'assets-used': ['block/block.urdf', 'ball/ball-template.urdf']}``` ###Implementation: ```python import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class BuildCar(Task): """"""Construct a simple car structure using blocks and cylinders."""""" def __init__(self): super().__init__() self.max_steps = 15 self.lang_template = ""Construct a simple car structure using blocks and cylinders. "" \ ""Firstly, create the base of the car by positioning two red blocks side by side. "" \ ""Then, add the car body by stacking a blue block on top of the base. "" \ ""For the wheels, place a black cylinder on each side of the base blocks."" self.task_completed_desc = ""done building car."" self.additional_reset() def reset(self, env): super().reset(env) car_pose = ((0.5, 0.0, 0.0), (0,0,0,1)) # fixed pose base_length = 0.04 self.add_corner_anchor_for_pose(env, car_pose) # Add base blocks. Use box template so that we can change its size. base_size = (0.02, 0.04, 0.02) base_block_urdf = ""box/box-template.urdf"" base_block_urdf = self.fill_template(base_block_urdf, {'DIM': base_size}) anchor_base_poses = [(utils.apply(car_pose, (base_length / 2, base_length / 2, 0.001)), car_pose[1]), (utils.apply(car_pose, (-base_length / 2, base_length / 2, 0.001)), car_pose[1])] base_blocks = [] for idx in range(2): base_block_pose = self.get_random_pose(env, base_size) base_block_id = env.add_object(base_block_urdf, base_block_pose, color=utils.COLORS['red']) base_blocks.append(base_block_id) # Add car body block. body_size = (0.04, 0.02, 0.02) # x, y, z dimensions for the asset size body_block_urdf = ""box/box-template.urdf"" body_block_urdf = self.fill_template(body_block_urdf, {'DIM': body_size}) body_block_pose = self.get_random_pose(env, body_size) body_block_id = env.add_object(body_block_urdf, body_block_pose, color=utils.COLORS['blue']) anchor_body_poses = [car_pose] wheel_length = 0.12 anchor_wheel_poses = [(utils.apply(car_pose, ( wheel_length / 2, wheel_length / 2, 0.001)), car_pose[1]), (utils.apply(car_pose, (-wheel_length / 2, wheel_length / 2, 0.001)), car_pose[1]), (utils.apply(car_pose, ( wheel_length / 2, -wheel_length / 2, 0.001)), car_pose[1]), (utils.apply(car_pose, (-wheel_length / 2, -wheel_length / 2, 0.001)), car_pose[1])] # Add wheels. wheel_size = (0.02, 0.02, 0.02) # x, y, z dimensions for the asset size wheel_urdf = 'cylinder/cylinder-template.urdf' wheel_urdf = self.fill_template(wheel_urdf, {'DIM': wheel_size}) wheels = [] for idx in range(4): wheel_pose = self.get_random_pose(env, wheel_size) wheel_id = env.add_object(wheel_urdf, wheel_pose, color=utils.COLORS['black']) wheels.append(wheel_id) # Goal: Firstly, create the base of the car by positioning two red blocks side by side. self.add_goal(objs=base_blocks, matches=np.ones((2, 2)), targ_poses=anchor_base_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1./3) self.lang_goals.append(""Firstly, create the base of the car by positioning two red blocks side by side."") # Then, add the car body by stacking a blue block on top of the base. self.add_goal(objs=[body_block_id], matches=np.ones((1, 1)), targ_poses=anchor_body_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1./3) self.lang_goals.append(""Then, add the car body by stacking a blue block on top of the base."") # For the wheels, place a black cylinder on each side of the base blocks. self.add_goal(objs=wheels, matches=np.ones((4, 4)), targ_poses=anchor_wheel_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1./3) self.lang_goals.append(""For the wheels, place a black cylinder on each side of the base blocks."") ``` END" " ""manipulating-two-ropes"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""manipulating-two-ropes"" in a python code block. ### "," manipulating-two-ropes: {'task-name': 'manipulating-two-ropes', 'task-description': 'rearrange the red and blue deformable ropes such that it connects the two endpoints of a 3-sided square of corresponding color.', 'assets-used': ['square/square-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random import numpy as np from cliport.tasks.task import Task from cliport.utils import utils from cliport.tasks import primitives from cliport.tasks.grippers import Spatula class ManipulatingTwoRopes(Task): """"""rearrange the red and blue deformable ropes such that it connects the two endpoints of a 3-sided square of corresponding color."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""rearrange the {color_name} rope such that it connects the two endpoints of a 3-sided square of corresponding color."" self.task_completed_desc = ""done manipulating two ropes."" self.additional_reset() def reset(self, env): super().reset(env) n_parts = 20 radius = 0.005 length = 2 * radius * n_parts * np.sqrt(2) # Add 3-sided square for the red rope. color_list = ['red', 'blue'] for color_name in color_list: square_size = (length, length, 0) square_pose = self.get_random_pose(env, square_size) square_template = 'square/square-template.urdf' # IMPORTANT: REPLACE THE TEMPLATE URDF with `fill_template` replace = {'DIM': (length,), 'HALF': (np.float32(length) / 2 - 0.005,)} urdf = self.fill_template(square_template, replace) env.add_object(urdf, square_pose, 'fixed', color=utils.COLORS[color_name]) # compute corners corner0 = (length / 2, length / 2, 0.001) corner1 = (-length / 2, length / 2, 0.001) corner_0 = utils.apply(square_pose, corner0) corner_1 = utils.apply(square_pose, corner1) # IMPORTANT: use `make_ropes` to add cable (series of articulated small blocks). objects, targets, matches = self.make_ropes(env, corners=(corner_0, corner_1), color_name=color_name) self.add_goal(objs=objects, matches=matches, targ_poses=targets, replace=False, rotations=False, metric='pose', params=None, step_max_reward=1. / len(color_list)) self.lang_goals.append(self.lang_template.format(color_name=color_name)) print(f""len of languages: {len(self.lang_goals)} obj:{len(objects)}"") for i in range(480): p.stepSimulation() ``` END" " ""insert-sphere-into-container"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""insert-sphere-into-container"" in a python code block. ### "," insert-sphere-into-container: {'task-name': 'insert-sphere-into-container', 'task-description': 'Pick up a blue sphere and place it into an open container.', 'assets-used': ['sphere/sphere.urdf', 'container/container-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class InsertSphereIntoContainer(Task): """"""Pick up a blue sphere and place it into an open container."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""pick up a blue sphere and place it into an open container"" self.task_completed_desc = ""done inserting sphere into container."" self.additional_reset() def reset(self, env): super().reset(env) # Add container. # x, y, z dimensions for the asset size container_size = (0.1, 0.1, 0.1) container_pose = self.get_random_pose(env, container_size) container_template = 'container/container-template.urdf' replace = {'DIM': container_size, 'HALF': (container_size[0] / 2, container_size[1] / 2, container_size[2] / 2)} # IMPORTANT: REPLACE THE TEMPLATE URDF with `fill_template` container_urdf = self.fill_template(container_template, replace) container_id = env.add_object(container_urdf, container_pose, 'fixed') # Add sphere. # x, y, z dimensions for the asset size sphere_size = (0.04, 0.04, 0.04) sphere_pose = self.get_random_pose(env, sphere_size) sphere_urdf = 'sphere/sphere.urdf' sphere_id = env.add_object(sphere_urdf, sphere_pose, color=utils.COLORS['blue']) # Goal: the blue sphere is in the container. self.add_goal(objs=[sphere_id], matches=np.ones((1, 1)), targ_poses=[container_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1) self.lang_goals.append(self.lang_template)``` END" " ""insert-cylinder-in-container"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""insert-cylinder-in-container"" in a python code block. ### "," insert-cylinder-in-container: {'task-name': 'insert-cylinder-in-container', 'task-description': 'Pick up a blue cylindrical block and place it into an empty container.', 'assets-used': ['cylinder/cylinder-template.urdf', 'container/container-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class InsertSphereIntoContainer(Task): """"""Pick up a blue sphere and place it into an open container."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""pick up a blue sphere and place it into an open container"" self.task_completed_desc = ""done inserting sphere into container."" self.additional_reset() def reset(self, env): super().reset(env) # Add container. # x, y, z dimensions for the asset size container_size = (0.1, 0.1, 0.1) container_pose = self.get_random_pose(env, container_size) container_template = 'container/container-template.urdf' replace = {'DIM': container_size, 'HALF': (container_size[0] / 2, container_size[1] / 2, container_size[2] / 2)} # IMPORTANT: REPLACE THE TEMPLATE URDF with `fill_template` container_urdf = self.fill_template(container_template, replace) container_id = env.add_object(container_urdf, container_pose, 'fixed') # Add sphere. # x, y, z dimensions for the asset size sphere_size = (0.04, 0.04, 0.04) sphere_pose = self.get_random_pose(env, sphere_size) sphere_urdf = 'sphere/sphere.urdf' sphere_id = env.add_object(sphere_urdf, sphere_pose, color=utils.COLORS['blue']) # Goal: the blue sphere is in the container. self.add_goal(objs=[sphere_id], matches=np.ones((1, 1)), targ_poses=[container_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1) self.lang_goals.append(self.lang_template)``` END" " ""build-bridge"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""build-bridge"" in a python code block. ### "," build-bridge: {'task-name': 'build-bridge', 'task-description': 'Construct a bridge using two yellow blocks and three blue blocks. Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between. Then, place the blue block horizontally on top of the yellow blocks.', 'assets-used': ['block/block.urdf', 'ball/ball-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils class BuildBridge(Task): """"""Construct a bridge using two yellow blocks and three blue blocks. Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between. Then, place the blue block horizontally on top of the yellow blocks."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""build a bridge using four yellow blocks and one long blue block"" self.task_completed_desc = ""done building bridge."" def reset(self, env): super().reset(env) # Add yellow blocks. base_length = 0.04 base_size = (base_length, base_length, base_length) base_block_urdf = ""box/box-template.urdf"" bridge_pose = ((0.5, 0.0, 0.0), (0, 0, 0, 1)) # fixed pose self.add_corner_anchor_for_pose(env, bridge_pose) base_block_urdf = self.fill_template(base_block_urdf, {'DIM': base_size}) anchor_base_poses = [(utils.apply(bridge_pose, (- 3 * base_length / 2, 0, 0.001)), bridge_pose[1]), (utils.apply(bridge_pose, ( 3 * base_length / 2, 0, 0.001)), bridge_pose[1]), (utils.apply(bridge_pose, (- 3 * base_length / 2, 0, 0.041)), bridge_pose[1]), (utils.apply(bridge_pose, ( 3 * base_length / 2, 0, 0.041)), bridge_pose[1])] base_blocks = [] for idx in range(4): base_block_pose = self.get_random_pose(env, base_size) base_block_id = env.add_object(base_block_urdf, base_block_pose, color=utils.COLORS['yellow']) base_blocks.append(base_block_id) # Add car body block. body_size = (0.12, 0.04, 0.02) # x, y, z dimensions for the asset size body_block_urdf = ""box/box-template.urdf"" body_block_urdf = self.fill_template(body_block_urdf, {'DIM': body_size}) body_block_pose = self.get_random_pose(env, body_size) body_block_id = env.add_object(body_block_urdf, body_block_pose, color=utils.COLORS['blue']) anchor_body_poses = [bridge_pose] # Goal: Firstly, create the base of the car by positioning two red blocks side by side. self.add_goal(objs=base_blocks[:2], matches=np.ones((2, 2)), targ_poses=anchor_base_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1./4) self.add_goal(objs=base_blocks[2:], matches=np.ones((2, 2)), targ_poses=anchor_base_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1./2) self.lang_goals.append(""Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between."") # Then, add the car body by stacking a blue block on top of the base. self.add_goal(objs=[body_block_id], matches=np.ones((1, 1)), targ_poses=anchor_body_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1./4) self.lang_goals.append(""Then, place the blue block horizontally on top of the yellow blocks."") ``` END" " ""insert-ell-in-fixture"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""insert-ell-in-fixture"" in a python code block. ### "," insert-ell-in-fixture: {'task-name': 'insert-ell-in-fixture', 'task-description': 'Pick up an Ell shaped block and insert it into a fixture on the tabletop.', 'assets-used': ['insertion/ell.urdf', 'insertion/fixture.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils class BuildBridge(Task): """"""Construct a bridge using two yellow blocks and three blue blocks. Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between. Then, place the blue block horizontally on top of the yellow blocks."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""build a bridge using four yellow blocks and one long blue block"" self.task_completed_desc = ""done building bridge."" def reset(self, env): super().reset(env) # Add yellow blocks. base_length = 0.04 base_size = (base_length, base_length, base_length) base_block_urdf = ""box/box-template.urdf"" bridge_pose = ((0.5, 0.0, 0.0), (0, 0, 0, 1)) # fixed pose self.add_corner_anchor_for_pose(env, bridge_pose) base_block_urdf = self.fill_template(base_block_urdf, {'DIM': base_size}) anchor_base_poses = [(utils.apply(bridge_pose, (- 3 * base_length / 2, 0, 0.001)), bridge_pose[1]), (utils.apply(bridge_pose, ( 3 * base_length / 2, 0, 0.001)), bridge_pose[1]), (utils.apply(bridge_pose, (- 3 * base_length / 2, 0, 0.041)), bridge_pose[1]), (utils.apply(bridge_pose, ( 3 * base_length / 2, 0, 0.041)), bridge_pose[1])] base_blocks = [] for idx in range(4): base_block_pose = self.get_random_pose(env, base_size) base_block_id = env.add_object(base_block_urdf, base_block_pose, color=utils.COLORS['yellow']) base_blocks.append(base_block_id) # Add car body block. body_size = (0.12, 0.04, 0.02) # x, y, z dimensions for the asset size body_block_urdf = ""box/box-template.urdf"" body_block_urdf = self.fill_template(body_block_urdf, {'DIM': body_size}) body_block_pose = self.get_random_pose(env, body_size) body_block_id = env.add_object(body_block_urdf, body_block_pose, color=utils.COLORS['blue']) anchor_body_poses = [bridge_pose] # Goal: Firstly, create the base of the car by positioning two red blocks side by side. self.add_goal(objs=base_blocks[:2], matches=np.ones((2, 2)), targ_poses=anchor_base_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1./4) self.add_goal(objs=base_blocks[2:], matches=np.ones((2, 2)), targ_poses=anchor_base_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1./2) self.lang_goals.append(""Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between."") # Then, add the car body by stacking a blue block on top of the base. self.add_goal(objs=[body_block_id], matches=np.ones((1, 1)), targ_poses=anchor_body_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1./4) self.lang_goals.append(""Then, place the blue block horizontally on top of the yellow blocks."") ``` END" " ""build-block-tower-on-pallet"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""build-block-tower-on-pallet"" in a python code block. ### "," build-block-tower-on-pallet: {'task-name': 'build-block-tower-on-pallet', 'task-description': 'Pick up six blocks in two colors (three red and three blue) and stack them in alternating colors on the pallet. The tower should start with a red block at the bottom.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils class BuildBridge(Task): """"""Construct a bridge using two yellow blocks and three blue blocks. Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between. Then, place the blue block horizontally on top of the yellow blocks."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""build a bridge using four yellow blocks and one long blue block"" self.task_completed_desc = ""done building bridge."" def reset(self, env): super().reset(env) # Add yellow blocks. base_length = 0.04 base_size = (base_length, base_length, base_length) base_block_urdf = ""box/box-template.urdf"" bridge_pose = ((0.5, 0.0, 0.0), (0, 0, 0, 1)) # fixed pose self.add_corner_anchor_for_pose(env, bridge_pose) base_block_urdf = self.fill_template(base_block_urdf, {'DIM': base_size}) anchor_base_poses = [(utils.apply(bridge_pose, (- 3 * base_length / 2, 0, 0.001)), bridge_pose[1]), (utils.apply(bridge_pose, ( 3 * base_length / 2, 0, 0.001)), bridge_pose[1]), (utils.apply(bridge_pose, (- 3 * base_length / 2, 0, 0.041)), bridge_pose[1]), (utils.apply(bridge_pose, ( 3 * base_length / 2, 0, 0.041)), bridge_pose[1])] base_blocks = [] for idx in range(4): base_block_pose = self.get_random_pose(env, base_size) base_block_id = env.add_object(base_block_urdf, base_block_pose, color=utils.COLORS['yellow']) base_blocks.append(base_block_id) # Add car body block. body_size = (0.12, 0.04, 0.02) # x, y, z dimensions for the asset size body_block_urdf = ""box/box-template.urdf"" body_block_urdf = self.fill_template(body_block_urdf, {'DIM': body_size}) body_block_pose = self.get_random_pose(env, body_size) body_block_id = env.add_object(body_block_urdf, body_block_pose, color=utils.COLORS['blue']) anchor_body_poses = [bridge_pose] # Goal: Firstly, create the base of the car by positioning two red blocks side by side. self.add_goal(objs=base_blocks[:2], matches=np.ones((2, 2)), targ_poses=anchor_base_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1./4) self.add_goal(objs=base_blocks[2:], matches=np.ones((2, 2)), targ_poses=anchor_base_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1./2) self.lang_goals.append(""Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between."") # Then, add the car body by stacking a blue block on top of the base. self.add_goal(objs=[body_block_id], matches=np.ones((1, 1)), targ_poses=anchor_body_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1./4) self.lang_goals.append(""Then, place the blue block horizontally on top of the yellow blocks."") ``` END" " ""color-coordinated-tower"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-tower"" in a python code block. ### "," color-coordinated-tower: {'task-name': 'color-coordinated-tower', 'task-description': 'Pick up blocks of five different colors (red, blue, green, yellow, and orange) and stack them on a pallet in the specific sequence. The bottom of the tower should start with a red block followed by a blue, green, yellow and finally an orange block at the top.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils class BuildBridge(Task): """"""Construct a bridge using two yellow blocks and three blue blocks. Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between. Then, place the blue block horizontally on top of the yellow blocks."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""build a bridge using four yellow blocks and one long blue block"" self.task_completed_desc = ""done building bridge."" def reset(self, env): super().reset(env) # Add yellow blocks. base_length = 0.04 base_size = (base_length, base_length, base_length) base_block_urdf = ""box/box-template.urdf"" bridge_pose = ((0.5, 0.0, 0.0), (0, 0, 0, 1)) # fixed pose self.add_corner_anchor_for_pose(env, bridge_pose) base_block_urdf = self.fill_template(base_block_urdf, {'DIM': base_size}) anchor_base_poses = [(utils.apply(bridge_pose, (- 3 * base_length / 2, 0, 0.001)), bridge_pose[1]), (utils.apply(bridge_pose, ( 3 * base_length / 2, 0, 0.001)), bridge_pose[1]), (utils.apply(bridge_pose, (- 3 * base_length / 2, 0, 0.041)), bridge_pose[1]), (utils.apply(bridge_pose, ( 3 * base_length / 2, 0, 0.041)), bridge_pose[1])] base_blocks = [] for idx in range(4): base_block_pose = self.get_random_pose(env, base_size) base_block_id = env.add_object(base_block_urdf, base_block_pose, color=utils.COLORS['yellow']) base_blocks.append(base_block_id) # Add car body block. body_size = (0.12, 0.04, 0.02) # x, y, z dimensions for the asset size body_block_urdf = ""box/box-template.urdf"" body_block_urdf = self.fill_template(body_block_urdf, {'DIM': body_size}) body_block_pose = self.get_random_pose(env, body_size) body_block_id = env.add_object(body_block_urdf, body_block_pose, color=utils.COLORS['blue']) anchor_body_poses = [bridge_pose] # Goal: Firstly, create the base of the car by positioning two red blocks side by side. self.add_goal(objs=base_blocks[:2], matches=np.ones((2, 2)), targ_poses=anchor_base_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1./4) self.add_goal(objs=base_blocks[2:], matches=np.ones((2, 2)), targ_poses=anchor_base_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1./2) self.lang_goals.append(""Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between."") # Then, add the car body by stacking a blue block on top of the base. self.add_goal(objs=[body_block_id], matches=np.ones((1, 1)), targ_poses=anchor_body_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1./4) self.lang_goals.append(""Then, place the blue block horizontally on top of the yellow blocks."") ``` END" " ""stack-blocks-in-container"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""stack-blocks-in-container"" in a python code block. ### "," stack-blocks-in-container: {'task-name': 'stack-blocks-in-container', 'task-description': 'Pick up five blocks of different colors (red, blue, green, yellow, and orange) and stack them in a container in a specific sequence. The bottom of the stack should start with a red block followed by a blue, green, yellow and finally an orange block at the top.', 'assets-used': ['block/block.urdf', 'container/container-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class StackBlocksInContainer(Task): """"""Pick up five blocks of different colors (red, blue, green, yellow, and orange) and stack them in a container in a specific sequence. The bottom of the stack should start with a red block followed by a blue, green, yellow and finally an orange block at the top."""""" def __init__(self): super().__init__() self.max_steps = 15 self.lang_template = ""stack the blocks in the container in the following order: {order}"" self.task_completed_desc = ""done stacking blocks in container."" self.order = ['red', 'blue', 'green', 'yellow', 'orange'] self.colors = [utils.COLORS[color] for color in self.order] def reset(self, env): super().reset(env) # Add container. container_size = (0.15, 0.15, 0.15) # x, y, z dimensions for the container size container_pose = self.get_random_pose(env, container_size) container_urdf = 'container/container-template.urdf' replace = {'DIM': container_size, 'HALF': (container_size[0] / 2, container_size[1] / 2, container_size[2] / 2)} container_urdf = self.fill_template(container_urdf, replace) env.add_object(container_urdf, container_pose, 'fixed') # Add blocks. block_size = (0.04, 0.04, 0.04) # x, y, z dimensions for the block size block_urdf = 'block/block.urdf' blocks = [] for color in self.colors: block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=color) blocks.append(block_id) # Goal: each block is stacked in the container in the specified order. for i in range(len(blocks)): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[container_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / len(blocks)) self.lang_goals.append(self.lang_template.format(order=', '.join(self.order)))``` END" " ""insert-blocks-into-fixture"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""insert-blocks-into-fixture"" in a python code block. ### "," insert-blocks-into-fixture: {'task-name': 'insert-blocks-into-fixture', 'task-description': 'Pick up four colored blocks (red, blue, green, and yellow) and insert them one-by-one into a fixture on the tabletop. The order of insertion starts with the red block, followed by the blue, green, and lastly the yellow block.', 'assets-used': ['block/block.urdf', 'insertion/fixture.urdf']}``` ###Implementation: ```python import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class InsertBlocksIntoFixture(Task): """"""Pick up four colored blocks (red, blue, green) and insert them one-by-one into a fixture on the tabletop. The order of insertion starts with the red block, followed by the blue, and green."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""insert the {color} block into the fixture"" self.task_completed_desc = ""done inserting blocks into fixture."" self.additional_reset() def reset(self, env): super().reset(env) # Add fixture. # x, y, z dimensions for the asset size fixture_size = (0.15, 0.15, 0.05) fixture_pose = self.get_random_pose(env, fixture_size) fixture_urdf = 'insertion/fixture.urdf' env.add_object(fixture_urdf, fixture_pose, 'fixed') anchor_base_poses = [fixture_pose, (utils.apply(fixture_pose, (0.04, 0, 0.001)), fixture_pose[1]), (utils.apply(fixture_pose, (0, 0.04, 0.001)), fixture_pose[1])] # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' block_colors = ['red', 'blue', 'green'] blocks = [] for color in block_colors: block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=color) blocks.append(block_id) # Goal: each block is inserted into the fixture in the order of red, blue, green, yellow. for i, block in enumerate(blocks): self.add_goal(objs=[block], matches=np.ones((1, 1)), targ_poses=[anchor_base_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(self.lang_template.format(color=block_colors[i])) ``` END" " ""color-coordinated-block-tower"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-block-tower"" in a python code block. ### "," color-coordinated-block-tower: {'task-name': 'color-coordinated-block-tower', 'task-description': 'On a tabletop, there are fifteen blocks of three different colors (five red, five blue, and five green). The task is to pick up these blocks and stack them onto three different stands on the table, creating three different towers. Each stand should have a tower of the same color blocks with five blocks each. The blocks in each tower should be stacked in a way that the block on top is slightly displaced in relation to the block underneath, creating a spiral-like effect. The challenge lies in the color-based sorting, precise placement for achieving the spiral effect and careful stacking of the blocks to avoid toppling.', 'assets-used': ['block/block.urdf', 'stacking/stand.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedBlockTower(Task): """"""Stack four blocks on a pallet in the following order from bottom to top: two blue blocks side by side, one red block centered on the blue blocks, and one green block on top of the red block."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""stack four blocks on a pallet in the following order from bottom to top: two blue blocks side by side, one red block centered on the blue blocks, and one green block on top of the red block."" self.task_completed_desc = ""done stacking blocks."" self.additional_reset() def reset(self, env): super().reset(env) # Add pallet. # x, y, z dimensions for the asset size pallet_size = (0.15, 0.15, 0.015) pallet_urdf = 'pallet/pallet.urdf' pallet_pose = self.get_random_pose(env, pallet_size) env.add_object(pallet_urdf, pallet_pose, 'fixed') # Add blocks. # x, y, z dimensions for the asset size block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' block_colors = [utils.COLORS['blue'], utils.COLORS['blue'], utils.COLORS['red'], utils.COLORS['green']] blocks = [] for i in range(4): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=block_colors[i]) blocks.append(block_id) # Associate placement locations for goals. place_pos = [(0, -0.02, 0.02), (0, 0.02, 0.02), (0, 0, 0.06), (0, 0, 0.10)] targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos] # Goal: two blue blocks are placed side by side on the pallet. # Break the language prompt step-by-step self.add_goal(objs=blocks[:2], matches=np.ones((2, 2)), targ_poses=targs[:2], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]*2) self.lang_goals.append(""place two blue blocks side by side on the pallet"") # Goal: one red block is placed centered on the blue blocks. self.add_goal(objs=blocks[2:3], matches=np.ones((1, 1)), targ_poses=targs[2:3], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]) self.lang_goals.append(""place one red block centered on the blue blocks"") # Goal: one green block is placed on top of the red block. self.add_goal(objs=blocks[3:], matches=np.ones((1, 1)), targ_poses=targs[3:], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]) self.lang_goals.append(""place one green block on top of the red block"")``` END" " ""color-structured-block-tower"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-structured-block-tower"" in a python code block. ### "," color-structured-block-tower: {'task-name': 'color-structured-block-tower', 'task-description': 'Construct a tower using six blocks: two red, two blue, and two green. The tower should be built in the order of a red block at the base, followed by a blue, then green, then red, blue and green at the top.', 'assets-used': ['block/block.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorStructuredBlockTower(Task): """"""Construct a tower using six blocks: two red, two blue, and two green. The tower should be built in the order of a red block at the base, followed by a blue, then green, then red, blue and green at the top."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""construct a tower using six blocks: two red, two blue, and two green. "" \ ""The tower should be built in the order of a red block at the base, "" \ ""followed by a blue, then green, then red, blue and green at the top."" self.task_completed_desc = ""done building color-structured block tower."" self.additional_reset() def reset(self, env): super().reset(env) # Define block colors and sizes colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green']] * 2 block_size = (0.04, 0.04, 0.04) # Add blocks block_urdf = 'block/block.urdf' blocks = [] for i in range(6): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=colors[i]) blocks.append(block_id) # Define target poses for the blocks in the tower base_pose = self.get_random_pose(env, block_size) targ_poses = [base_pose] for i in range(1, 6): targ_poses.append((np.array(base_pose[0]) + np.array([0, 0, i * block_size[2]]), base_pose[1])) # Add goals for i in range(6): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[targ_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/6, symmetries=[np.pi/2]) self.lang_goals.append(self.lang_template)``` END" " ""stack-color-coordinated-blocks"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""stack-color-coordinated-blocks"" in a python code block. ### "," stack-color-coordinated-blocks: {'task-name': 'stack-color-coordinated-blocks', 'task-description': 'Pick up six blocks of different colors (red, blue, green, yellow, orange, and purple) and stack them on a pallet in two separate stacks. The first stack should be red at the bottom, blue in the middle, and green at top. The second stack should be yellow at the bottom, orange in the middle, and purple at the top.', 'assets-used': ['box/box-template.urdf', 'pallet/pallet.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class StackColorCoordinatedBlocks(Task): """"""Pick up six blocks of different colors (red, blue, green, yellow, orange, and purple) and stack them on a pallet in two separate stacks. The first stack should be red at the bottom, blue in the middle, and green at top. The second stack should be yellow at the bottom, orange in the middle, and purple at the top."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""stack the blocks on the pallet in two separate stacks. "" \ ""The first stack should be red at the bottom, blue in the middle, "" \ ""and green at top. The second stack should be yellow at the bottom, "" \ ""orange in the middle, and purple at the top."" self.task_completed_desc = ""done stacking color-coordinated blocks."" def reset(self, env): super().reset(env) # Add pallet. # x, y, z dimensions for the asset size pallet_size = (0.15, 0.15, 0.01) pallet_urdf = 'pallet/pallet.urdf' pallet_pose = self.get_random_pose(env, pallet_size) env.add_object(pallet_urdf, pallet_pose, 'fixed') # Block colors. colors = [ utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow'], utils.COLORS['orange'], utils.COLORS['purple'] ] # Add blocks. # x, y, z dimensions for the asset size block_size = (0.04, 0.04, 0.04) block_urdf = 'box/box-template.urdf' blocks = [] for i in range(6): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=colors[i]) blocks.append(block_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.02), (0, 0, 0.02), (0, 0.05, 0.02), (0, -0.05, 0.06), (0, 0, 0.06), (0, 0.05, 0.06)] targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos] # Goal: blocks are stacked on the pallet in two separate stacks. # First stack: red at the bottom, blue in the middle, and green at top. self.add_goal(objs=blocks[:3], matches=np.ones((3, 3)), targ_poses=targs[:3], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]*3) # Second stack: yellow at the bottom, orange in the middle, and purple at the top. self.add_goal(objs=blocks[3:], matches=np.ones((3, 3)), targ_poses=targs[3:], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]*3) self.lang_goals.append(self.lang_template)``` END" " ""assemble-single-car"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""assemble-single-car"" in a python code block. ### "," assemble-single-car: {'task-name': 'assemble-single-car', 'task-description': 'Build a mini car using a large blue box as the body, a smaller red box on top as the roof, and two tiny green boxes on the sides as wheels.', 'assets-used': ['box/box-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class AssembleSingleCar(Task): """"""Assemble a mini car using a large blue box as the body, a smaller red box on top as the roof, and two tiny green boxes on the sides as wheels."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""build a mini car using a large blue box as the body, a smaller red box on top as the roof, and two tiny green boxes on the sides as wheels"" self.task_completed_desc = ""done assembling the car."" def reset(self, env): super().reset(env) # Add car body (large blue box). body_size = (0.1, 0.05, 0.02) # x, y, z dimensions body_pose = self.get_random_pose(env, body_size) body_urdf = 'box/box-template.urdf' body_color = utils.COLORS['blue'] body_id = env.add_object(body_urdf, body_pose, color=body_color) # Add car roof (smaller red box). roof_size = (0.08, 0.04, 0.02) # x, y, z dimensions roof_pose = self.get_random_pose(env, roof_size) roof_urdf = 'box/box-template.urdf' roof_color = utils.COLORS['red'] roof_id = env.add_object(roof_urdf, roof_pose, color=roof_color) # Add car wheels (two tiny green boxes). wheel_size = (0.02, 0.02, 0.01) # x, y, z dimensions wheel_urdf = 'box/box-template.urdf' wheel_color = utils.COLORS['green'] wheel_ids = [] for _ in range(2): wheel_pose = self.get_random_pose(env, wheel_size) wheel_id = env.add_object(wheel_urdf, wheel_pose, color=wheel_color) wheel_ids.append(wheel_id) # Goal: assemble the car by placing the roof on the body and the wheels on the sides. # The target poses are calculated based on the body pose. roof_targ_pose = (body_pose[0] + np.array([0, 0, body_size[2] + roof_size[2]/2]), body_pose[1]) wheel_targ_poses = [(body_pose[0] + np.array([0, body_size[1]/2 + wheel_size[1]/2, -body_size[2]/2]), body_pose[1]), (body_pose[0] + np.array([0, -body_size[1]/2 - wheel_size[1]/2, -body_size[2]/2]), body_pose[1])] # Add the goals. self.add_goal(objs=[roof_id], matches=np.ones((1, 1)), targ_poses=[roof_targ_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/3) self.add_goal(objs=wheel_ids, matches=np.ones((2, 2)), targ_poses=wheel_targ_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=2/3) self.lang_goals.append(self.lang_template)``` END" " ""sort-and-stack-clr-blocks"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""sort-and-stack-clr-blocks"" in a python code block. ### "," sort-and-stack-clr-blocks: {'task-name': 'sort-and-stack-clr-blocks', 'task-description': 'Pick up four blocks of different colors (red, blue, green, yellow) and place them into separate corners of a pallet. After sorting, stack them in a specific sequence on top of the pallet. The bottom of the stack should start with a green block followed by a blue, then red, and finally a yellow block at the top.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class SortAndStackClrBlocks(Task): """"""Pick up four blocks of different colors (red, blue, green, yellow) and place them into separate corners of a pallet. After sorting, stack them in a specific sequence on top of the pallet. The bottom of the stack should start with a green block followed by a blue, then red, and finally a yellow block at the top."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""sort and stack the blocks in the order of green, blue, red, and yellow"" self.task_completed_desc = ""done sorting and stacking blocks."" self.additional_reset() def reset(self, env): super().reset(env) # Add pallet. # x, y, z dimensions for the asset size pallet_size = (0.15, 0.15, 0.01) pallet_urdf = 'pallet/pallet.urdf' pallet_pose = self.get_random_pose(env, pallet_size) env.add_object(pallet_urdf, pallet_pose, 'fixed') # Block colors. colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow']] # Add blocks. # x, y, z dimensions for the asset size block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' blocks = [] for i in range(4): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=colors[i]) blocks.append(block_id) # Associate placement locations for goals. place_pos = [(0.05, 0.05, 0.02), (-0.05, 0.05, 0.02), (-0.05, -0.05, 0.02), (0.05, -0.05, 0.02)] targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos] # Goal: blocks are sorted into separate corners of the pallet. self.add_goal(objs=blocks, matches=np.eye(4), targ_poses=targs, replace=False, rotations=True, metric='pose', params=None, step_max_reward=0.5, symmetries=[np.pi/2]*4) self.lang_goals.append(self.lang_template) # Associate stacking locations for goals. stack_pos = [(0, 0, 0.02), (0, 0, 0.06), (0, 0, 0.10), (0, 0, 0.14)] targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in stack_pos] # Goal: blocks are stacked on top of the pallet in the order of green, blue, red, and yellow. self.add_goal(objs=blocks, matches=np.eye(4), targ_poses=targs, replace=False, rotations=True, metric='pose', params=None, step_max_reward=0.5, symmetries=[np.pi/2]*4) self.lang_goals.append(self.lang_template)``` END" " ""create-pyramid-blocks-and-container"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""create-pyramid-blocks-and-container"" in a python code block. ### "," create-pyramid-blocks-and-container: {'task-name': 'create-pyramid-blocks-and-container', 'task-description': 'Create a pyramid structure using six blocks of three different colors (two red, two green, and two blue) inside a container. The first layer of the pyramid should consist of the two green and one blue block. The second layer should be the two red blocks, and the last block which is the top of the pyramid should be the remaining blue block.', 'assets-used': ['container/container-template.urdf', 'block/block.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class CreatePyramidBlocksAndContainer(Task): """"""Create a pyramid structure using six blocks of three different colors (two red, two green, and two blue) inside a container."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""Create a pyramid structure using six blocks of three different colors (two red, two green, and two blue) inside a container."" self.task_completed_desc = ""done creating pyramid."" self.additional_reset() def reset(self, env): super().reset(env) # Add container. # x, y, z dimensions for the asset size container_size = (0.3, 0.3, 0.1) container_pose = self.get_random_pose(env, container_size) container_urdf = 'container/container-template.urdf' replace = {'DIM': container_size, 'HALF': (container_size[0] / 2, container_size[1] / 2, container_size[2] / 2)} container_urdf = self.fill_template(container_urdf, replace) env.add_object(container_urdf, container_pose, 'fixed') # Add blocks. # x, y, z dimensions for the asset size block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' block_colors = [utils.COLORS['red'], utils.COLORS['red'], utils.COLORS['green'], utils.COLORS['green'], utils.COLORS['blue'], utils.COLORS['blue']] blocks = [] for i in range(6): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=block_colors[i]) blocks.append(block_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.03), (0, 0, 0.03), (0, 0.05, 0.03), (0, -0.025, 0.08), (0, 0.025, 0.08), (0, 0, 0.13)] targs = [(utils.apply(container_pose, i), container_pose[1]) for i in place_pos] # Goal: blocks are stacked in a pyramid (bottom row: green, green, blue). self.add_goal(objs=blocks[2:5], matches=np.ones((3, 3)), targ_poses=targs[:3], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]*3) self.lang_goals.append(self.lang_template.format(blocks=""the green and blue blocks"", row=""bottom"")) # Goal: blocks are stacked in a pyramid (middle row: red, red). self.add_goal(objs=blocks[:2], matches=np.ones((2, 2)), targ_poses=targs[3:5], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]*2) self.lang_goals.append(self.lang_template.format(blocks=""the red blocks"", row=""middle"")) # Goal: blocks are stacked in a pyramid (top row: blue). self.add_goal(objs=blocks[5:], matches=np.ones((1, 1)), targ_poses=targs[5:], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]) self.lang_goals.append(self.lang_template.format(blocks=""the blue block"", row=""top""))``` END" " ""Four-corner-pyramid-challenge"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""Four-corner-pyramid-challenge"" in a python code block. ### "," Four-corner-pyramid-challenge: {'task-name': 'Four-corner-pyramid-challenge', 'task-description': ""A tabletop is partitioned into four different zones using the 'zone/zone.urdf' asset. In each zone, there are four blocks of different colors (red, blue, green, and yellow). The task is to construct a pyramid of blocks in each zone using the 'block/block.urdf' asset such that the sequence of blocks from bottom to top is red, blue, green, and yellow. The task is challenging because it requires precise stack control and color recognition."", 'assets-used': ['block/block.urdf', 'zone/zone.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class FourCornerPyramidChallenge(Task): """"""Construct a pyramid of blocks in each zone with a specific color sequence."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""build a pyramid of blocks in each zone with the sequence red, blue, green, and yellow from bottom to top"" self.task_completed_desc = ""done building pyramids."" self.additional_reset() def reset(self, env): super().reset(env) # Add zones. zone_size = (0.12, 0.12, 0) zone_urdf = 'zone/zone.urdf' zone_poses = [] for _ in range(4): zone_pose = self.get_random_pose(env, zone_size) env.add_object(zone_urdf, zone_pose, 'fixed') zone_poses.append(zone_pose) # Block colors. colors = [ utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow'] ] # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' blocks = [] for i in range(4): for _ in range(4): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=colors[i]) blocks.append(block_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.03), (0, 0, 0.03), (0, 0.05, 0.03), (0, -0.025, 0.08), (0, 0.025, 0.08), (0, 0, 0.13)] targs = [(utils.apply(zone_pose, i), zone_pose[1]) for i in place_pos for zone_pose in zone_poses] # Goal: blocks are stacked in a pyramid in each zone. for i in range(4): self.add_goal(objs=blocks[i*4:(i+1)*4], matches=np.ones((4, 4)), targ_poses=targs[i*4:(i+1)*4], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4, symmetries=[np.pi/2]*4) self.lang_goals.append(self.lang_template)``` END" " ""colorful-block-tower-on-cylinder-base"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""colorful-block-tower-on-cylinder-base"" in a python code block. ### "," colorful-block-tower-on-cylinder-base: {'task-name': 'colorful-block-tower-on-cylinder-base', 'task-description': 'Construct a tower using four blocks of different colors (red, blue, green, and yellow) on a placed cylindrical base at the corner of the tabletop. The sequence from bottom to top should be red, blue, green, and yellow.', 'assets-used': ['block/block.urdf', 'corner/corner-template.urdf', 'cylinder/cylinder-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorfulBlockTowerOnCylinderBase(Task): """"""Construct a tower using four blocks of different colors (red, blue, green, and yellow) on a placed cylindrical base at the corner of the tabletop. The sequence from bottom to top should be red, blue, green, and yellow."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""construct a tower using four blocks of different colors (red, blue, green, and yellow) on a placed cylindrical base at the corner of the tabletop. The sequence from bottom to top should be red, blue, green, and yellow."" self.task_completed_desc = ""done building the tower."" self.additional_reset() def reset(self, env): super().reset(env) # Add cylindrical base. # x, y, z dimensions for the asset size base_size = (0.05, 0.05, 0.05) base_urdf = 'cylinder/cylinder-template.urdf' base_pose = self.get_random_pose(env, base_size) base_id = env.add_object(base_urdf, base_pose, 'fixed') # Block colors. colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow']] # Add blocks. # x, y, z dimensions for the asset size block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' objs = [] for i in range(4): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=colors[i]) objs.append(block_id) # Associate placement locations for goals. place_pos = [(0, 0, 0.05), (0, 0, 0.09), (0, 0, 0.13), (0, 0, 0.17)] targs = [(utils.apply(base_pose, i), base_pose[1]) for i in place_pos] # Goal: blocks are stacked on the cylindrical base in the order red, blue, green, yellow from bottom to top. for i in range(4): self.add_goal(objs=[objs[i]], matches=np.ones((1, 1)), targ_poses=[targs[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4, symmetries=[np.pi/2]) self.lang_goals.append(self.lang_template)``` END" " ""align-cylinders-in-square"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""align-cylinders-in-square"" in a python code block. ### "," align-cylinders-in-square: {'task-name': 'align-cylinders-in-square', 'task-description': 'Arrange four cylinders of different colors (red, blue, green, yellow) on the corners of a square facing the center. The square is outlined by four zones of matching colors at each corner. The red cylinder should be placed at the red zone and facing the center of the square, and same for the remaining colors.', 'assets-used': ['cylinder/cylinder-template.urdf', 'zone/zone.urdf', 'square/square-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class AlignCylindersInSquare(Task): """"""Arrange four cylinders of different colors (red, blue, green, yellow) on the corners of a square facing the center. The square is outlined by four zones of matching colors at each corner. The red cylinder should be placed at the red zone and facing the center of the square, and same for the remaining colors."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""arrange the {color} cylinder at the {color} corner of the square"" self.task_completed_desc = ""done arranging cylinders."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and corresponding zones colors = ['red', 'blue', 'green', 'yellow'] zones = ['zone-red', 'zone-blue', 'zone-green', 'zone-yellow'] # Add zones at the corners of a square zone_size = (0.05, 0.05, 0.005) zone_urdf = 'zone/zone.urdf' zone_poses = [] for i in range(4): zone_pose = self.get_random_pose(env, zone_size) env.add_object(zone_urdf, zone_pose, 'fixed') zone_poses.append(zone_pose) # Add cylinders of different colors cylinder_size = (0.02, 0.02, 0.08) cylinder_urdf = 'cylinder/cylinder-template.urdf' cylinders = [] for i in range(4): cylinder_pose = self.get_random_pose(env, cylinder_size) color = utils.COLORS[colors[i]] cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=color) cylinders.append(cylinder_id) # Goal: each cylinder is in a different zone of the same color for i in range(4): self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[zone_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""construct-corner-blocks"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""construct-corner-blocks"" in a python code block. ### "," construct-corner-blocks: {'task-name': 'construct-corner-blocks', 'task-description': 'Create a corner structure using four blocks. Two red blocks form the base, one on each side of the corner, followed by a green block that is positioned on the red blocks at the corner junction, and finally a blue block on top of the green one. The overall structure forms a 3-D corner.', 'assets-used': ['block/block.urdf', 'corner/corner-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ConstructCornerBlocks(Task): """"""Create a corner structure using four blocks. Two red blocks form the base, one on each side of the corner, followed by a green block that is positioned on the red blocks at the corner junction, and finally a blue block on top of the green one. The overall structure forms a 3-D corner."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""Create a corner structure using four blocks. Two red blocks form the base, one on each side of the corner, followed by a green block that is positioned on the red blocks at the corner junction, and finally a blue block on top of the green one. The overall structure forms a 3-D corner."" self.task_completed_desc = ""done constructing corner blocks."" self.additional_reset() def reset(self, env): super().reset(env) # Add corner. corner_size = (0.15, 0.15, 0.05) corner_urdf = 'corner/corner-template.urdf' corner_pose = self.get_random_pose(env, corner_size) env.add_object(corner_urdf, corner_pose, 'fixed') # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' block_colors = [utils.COLORS['red'], utils.COLORS['red'], utils.COLORS['green'], utils.COLORS['blue']] blocks = [] for i in range(4): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=block_colors[i]) blocks.append(block_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.02), (0, 0.05, 0.02), (0, 0, 0.06), (0, 0, 0.10)] targs = [(utils.apply(corner_pose, i), corner_pose[1]) for i in place_pos] # Goal: blocks are stacked in a corner (bottom row: two red blocks). self.add_goal(objs=blocks[:2], matches=np.ones((2, 2)), targ_poses=targs[:2], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]*2) # Goal: blocks are stacked in a corner (middle row: one green block). self.add_goal(objs=blocks[2:3], matches=np.ones((1, 1)), targ_poses=targs[2:3], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]*1) # Goal: blocks are stacked in a corner (top row: one blue block). self.add_goal(objs=blocks[3:], matches=np.ones((1, 1)), targ_poses=targs[3:], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4, symmetries=[np.pi/2]*1)``` END" " ""corner-sort-cylinders"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""corner-sort-cylinders"" in a python code block. ### "," corner-sort-cylinders: {'task-name': 'corner-sort-cylinders', 'task-description': 'Pick up cylinders of four different colors (red, blue, green, yellow) and place them into four corners accordingly marked on the tabletop. The corner is designed as a 2-block-size square where only one cylinder can fit. The task is challenging due to precise placement and the need for identifying the corners accurately.', 'assets-used': ['corner/corner-template.urdf', 'cylinder/cylinder-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class CornerSortCylinders(Task): """"""Pick up cylinders of four different colors (red, blue, green, yellow) and place them into four corners accordingly marked on the tabletop."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""place the {color} cylinder in the {color} corner"" self.task_completed_desc = ""done sorting cylinders."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors colors = ['red', 'blue', 'green', 'yellow'] # Add corners corner_size = (0.04, 0.04, 0.04) # x, y, z dimensions for the asset size corner_template = 'corner/corner-template.urdf' corner_poses = [] for color in colors: replace = {'DIM': corner_size, 'HALF': (corner_size[0] / 2, corner_size[1] / 2, corner_size[2] / 2), 'COLOR': utils.COLORS[color]} corner_urdf = self.fill_template(corner_template, replace) corner_pose = self.get_random_pose(env, corner_size) env.add_object(corner_urdf, corner_pose, 'fixed') corner_poses.append(corner_pose) # Add cylinders cylinder_size = (0.02, 0.02, 0.06) # x, y, z dimensions for the asset size cylinder_template = 'cylinder/cylinder-template.urdf' cylinders = [] for color in colors: replace = {'DIM': cylinder_size, 'HALF': (cylinder_size[0] / 2, cylinder_size[1] / 2, cylinder_size[2] / 2), 'COLOR': utils.COLORS[color]} cylinder_urdf = self.fill_template(cylinder_template, replace) cylinder_pose = self.get_random_pose(env, cylinder_size) cylinder_id = env.add_object(cylinder_urdf, cylinder_pose) cylinders.append(cylinder_id) # Add goals for i in range(len(cylinders)): self.add_goal(objs=[cylinders[i]], matches=np.int32([[1]]), targ_poses=[corner_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / len(cylinders)) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""sorting-blocks-into-pallets"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""sorting-blocks-into-pallets"" in a python code block. ### "," sorting-blocks-into-pallets: {'task-name': 'sorting-blocks-into-pallets', 'task-description': 'Pick up blocks of four different colors (red, blue, green, yellow) and place them into four separate pallets of matching color. The pallets are placed in a row and the blocks are scattered randomly on the table.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class SortingBlocksIntoPallets(Task): """"""Pick up blocks of four different colors (red, blue, green, yellow) and place them into four separate pallets of matching color. The pallets are placed in a row and the blocks are scattered randomly on the table."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""put the {color} block into the {color} pallet"" self.task_completed_desc = ""done sorting blocks into pallets."" self.additional_reset() def reset(self, env): super().reset(env) # Add pallets. # x, y, z dimensions for the asset size pallet_size = (0.12, 0.12, 0.02) pallet_urdf = 'pallet/pallet.urdf' pallet_poses = [] pallet_colors = ['red', 'blue', 'green', 'yellow'] for color in pallet_colors: pallet_pose = self.get_random_pose(env, pallet_size) env.add_object(pallet_urdf, pallet_pose, 'fixed', color=utils.COLORS[color]) pallet_poses.append(pallet_pose) # Add blocks. # x, y, z dimensions for the asset size blocks = [] block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' for color in pallet_colors: block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color]) blocks.append(block_id) # Goal: each block is in a different pallet of matching color. for i in range(len(blocks)): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[pallet_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(blocks)) self.lang_goals.append(self.lang_template.format(color=pallet_colors[i]))``` END" " ""sort-and-assemble-block-castle"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""sort-and-assemble-block-castle"" in a python code block. ### "," sort-and-assemble-block-castle: {'task-name': 'sort-and-assemble-block-castle', 'task-description': 'On a tabletop, there are twelve blocks of three different colors (four red, four green, and four blue). The task involves sorting the blocks according to the color in three marked zones on the tabletop and subsequently constructing a castle in each zone. In each castle, the first layer should consist of the two blocks of the same color, followed by the second layer of one block and finally the last block on the top forming a castle-like structure. The challenge lies in the color-based sorting and careful assembly of the blocks to avoid toppling.', 'assets-used': ['block/block.urdf', 'zone/zone.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class SortAndAssembleBlockCastle(Task): """"""Sort blocks by color and assemble them into a castle-like structure."""""" def __init__(self): super().__init__() self.max_steps = 50 self.lang_template = ""sort the blocks by color and assemble them into a castle"" self.task_completed_desc = ""done sorting and assembling."" self.additional_reset() def reset(self, env): super().reset(env) # Add zones. zone_size = (0.12, 0.12, 0) zone_urdf = 'zone/zone.urdf' zone_poses = [] for _ in range(3): zone_pose = self.get_random_pose(env, zone_size) env.add_object(zone_urdf, zone_pose, 'fixed') zone_poses.append(zone_pose) # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' block_colors = [utils.COLORS['red'], utils.COLORS['green'], utils.COLORS['blue']] blocks = [] for color in block_colors: for _ in range(4): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=color) blocks.append(block_id) # Goal: each block is in a different zone based on color. for i in range(12): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 3)), targ_poses=zone_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/12) # Goal: blocks are stacked in a pyramid in each zone. for i in range(3): zone_blocks = blocks[i*4:(i+1)*4] place_pos = [(0, -0.02, 0.02), (0, 0.02, 0.02), (0, 0, 0.06), (0, 0, 0.10)] targs = [(utils.apply(zone_poses[i], pos), zone_poses[i][1]) for pos in place_pos] for j in range(4): self.add_goal(objs=[zone_blocks[j]], matches=np.ones((1, 1)), targ_poses=[targs[j]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/12) self.lang_goals.append(self.lang_template)``` END" " ""vertical-insertion-blocks"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""vertical-insertion-blocks"" in a python code block. ### "," vertical-insertion-blocks: {'task-name': 'vertical-insertion-blocks', 'task-description': 'The task involves picking up four color specific blocks (red, blue, green, and yellow) and inserting each block into four differently colored stands set upright on the tabletop. The block-colored with red needs to be inserted into the red-colored stand, and the same sequence is maintained for each colored blocks and stands. This task is challenging due to the requirement for precise insertion and the manipulation of vertical objects.', 'assets-used': ['stacking/block.urdf', 'stacking/stand.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class VerticalInsertionBlocks(Task): """"""Pick up four color specific blocks and insert each block into four differently colored stands set upright on the tabletop."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""insert the {color} block into the {color} stand"" self.task_completed_desc = ""done inserting blocks into stands."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors for blocks and stands colors = ['red', 'blue', 'green', 'yellow'] # Add stands. # x, y, z dimensions for the asset size stand_size = (0.04, 0.04, 0.1) stand_urdf = 'stacking/stand.urdf' stands = [] for color in colors: stand_pose = self.get_random_pose(env, stand_size) stand_id = env.add_object(stand_urdf, stand_pose, color=utils.COLORS[color], category='fixed') stands.append(stand_id) # Add blocks. # x, y, z dimensions for the asset size block_size = (0.04, 0.04, 0.04) block_urdf = 'stacking/block.urdf' blocks = [] for color in colors: block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color]) blocks.append(block_id) # Goal: each block is inserted into the stand of the same color. for i in range(len(blocks)): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(stands[i])], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(blocks)) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-coordinated-sphere-insertion"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-sphere-insertion"" in a python code block. ### "," color-coordinated-sphere-insertion: {'task-name': 'color-coordinated-sphere-insertion', 'task-description': 'There are four spheres and four boxes of different colors (red, blue, green, and yellow). Each sphere is inside a box, but not corresponding to the color of the box. The task is to pick up each sphere and place it in the box of the same color. The challenge lies in the precise placement and color matching.', 'assets-used': ['sphere/sphere.urdf', 'box/box-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedSphereInsertion(Task): """"""Insert each sphere into the bowl of the same color."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""insert each sphere into the bowl of the same color"" self.task_completed_desc = ""done inserting spheres into bowls."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and corresponding names colors = ['red', 'blue', 'green', 'yellow'] color_values = [utils.COLORS[color] for color in colors] # Add bowls. # x, y, z dimensions for the asset size bowl_size = (0.12, 0.12, 0.02) bowl_urdf = 'bowl/bowl.urdf' bowl_poses = [] for i in range(4): bowl_pose = self.get_random_pose(env, bowl_size) env.add_object(bowl_urdf, bowl_pose, 'fixed', color=color_values[i]) bowl_poses.append(bowl_pose) # Add spheres. # x, y, z dimensions for the asset size sphere_size = (0.04, 0.04, 0.04) sphere_template = 'sphere/sphere-template.urdf' spheres = [] for i in range(4): sphere_pose = self.get_random_pose(env, sphere_size) replace = {'DIM': sphere_size, 'HALF': (sphere_size[0] / 2, sphere_size[1] / 2, sphere_size[2] / 2)} sphere_urdf = self.fill_template(sphere_template, replace) sphere_id = env.add_object(sphere_urdf, sphere_pose, color=color_values[i]) spheres.append(sphere_id) # Goal: each sphere is in a bowl of the same color. for i in range(4): self.add_goal(objs=[spheres[i]], matches=np.ones((1, 1)), targ_poses=[bowl_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(f""insert the {colors[i]} sphere into the {colors[i]} bowl"")``` END" " ""block-pyramid-with-limited-space"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""block-pyramid-with-limited-space"" in a python code block. ### "," block-pyramid-with-limited-space: {'task-name': 'block-pyramid-with-limited-space', 'task-description': 'On a tabletop, there are twelve blocks of four different colors (three red, three green, three blue, three yellow). Three zones are defined, each with a triangle-shaped border that is marked. The task involves sorting the blocks according to the color into three zones on the tabletop and constructing a pyramid in each zone. In each pyramid, the base should contain two blocks of the same color, followed by the second layer of one block, thus forming a pyramid-like structure. However, the third yellow block should be placed in the center of the zones forming a smaller pyramid. The challenge lies in the color-based sorting, careful assembly of the blocks to avoid topple, and limited space in the zones which adds to the complexity.', 'assets-used': ['block/block.urdf', 'zone/zone.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class BlockPyramidWithLimitedSpace(Task): """"""Sort blocks according to color into three zones on the tabletop and construct a pyramid in each zone."""""" def __init__(self): super().__init__() self.max_steps = 50 self.lang_template = ""sort the blocks according to color into three zones and construct a pyramid in each zone"" self.task_completed_desc = ""done sorting and constructing pyramids."" self.additional_reset() def reset(self, env): super().reset(env) # Add zones. zone_size = (0.12, 0.12, 0) zone_urdf = 'zone/zone.urdf' zone_poses = [] for _ in range(3): zone_pose = self.get_random_pose(env, zone_size) env.add_object(zone_urdf, zone_pose, 'fixed') zone_poses.append(zone_pose) # Block colors. colors = [ utils.COLORS['red'], utils.COLORS['green'], utils.COLORS['blue'], utils.COLORS['yellow'] ] # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' blocks = [] for color in colors: for _ in range(3): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=color) blocks.append(block_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.03), (0, 0, 0.03), (0, 0.05, 0.03), (0, -0.025, 0.08), (0, 0.025, 0.08), (0, 0, 0.13)] targs = [(utils.apply(zone_pose, i), zone_pose[1]) for zone_pose in zone_poses for i in place_pos] # Goal: blocks are sorted and stacked in a pyramid in each zone. for i in range(3): self.add_goal(objs=blocks[i*3:(i+1)*3], matches=np.ones((3, 3)), targ_poses=targs[i*3:(i+1)*3], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]*3) self.lang_goals.append(self.lang_template)``` END" " ""build-cylinder-structure"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""build-cylinder-structure"" in a python code block. ### "," build-cylinder-structure: {'task-name': 'build-cylinder-structure', 'task-description': ""Using four colored cylinders (red, blue, green, yellow), construct a structure atop a square base. The red and blue cylinders should be sealed by the square base side by side, while the green cylinder should be on top of the blue one, and the yellow one on top of the red. The final look should resemble the letter 'H'."", 'assets-used': ['cylinder/cylinder-template.urdf', 'square/square-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class BuildCylinderStructure(Task): """"""Construct a structure using four colored cylinders (red, blue, green, yellow) on a square base."""""" def __init__(self): super().__init__() self.max_steps = 5 self.lang_template = ""construct a structure using four colored cylinders on a square base"" self.task_completed_desc = ""done building the cylinder structure."" self.additional_reset() def reset(self, env): super().reset(env) # Add square base. # x, y, z dimensions for the asset size base_size = (0.15, 0.15, 0.005) base_urdf = 'square/square-template.urdf' base_pose = self.get_random_pose(env, base_size) env.add_object(base_urdf, base_pose, category='fixed') # Cylinder colors. colors = [ utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow'] ] # Add cylinders. # x, y, z dimensions for the asset size cylinder_size = (0.04, 0.04, 0.08) cylinder_urdf = 'cylinder/cylinder-template.urdf' objs = [] for i in range(4): cylinder_pose = self.get_random_pose(env, cylinder_size) cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=colors[i]) objs.append(cylinder_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.04), (0, 0.05, 0.04), (0, 0.05, 0.12), (0, -0.05, 0.12)] targs = [(utils.apply(base_pose, i), base_pose[1]) for i in place_pos] # Goal: red and blue cylinders are placed side by side on the base. self.add_goal(objs=objs[:2], matches=np.ones((2, 2)), targ_poses=targs[:2], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]*2) self.lang_goals.append(""place the red and blue cylinders side by side on the base"") # Goal: green cylinder is placed on top of the blue cylinder. self.add_goal(objs=[objs[2]], matches=np.ones((1, 1)), targ_poses=[targs[2]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]) self.lang_goals.append(""place the green cylinder on top of the blue cylinder"") # Goal: yellow cylinder is placed on top of the red cylinder. self.add_goal(objs=[objs[3]], matches=np.ones((1, 1)), targ_poses=[targs[3]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]) self.lang_goals.append(""place the yellow cylinder on top of the red cylinder"")``` END" " ""insert-blocks-lineup"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""insert-blocks-lineup"" in a python code block. ### "," insert-blocks-lineup: {'task-name': 'insert-blocks-lineup', 'task-description': 'On the tabletop, there are four different color blocks (red, blue, green, and yellow), and four fixtures in corresponding colors. The task is to pick up each block and insert it into the corresponding color fixture. However, the fixtures are arranged in a straight line, with a line of small blocks serving as barrier between the fixtures and the colored blocks initially scattered on the table, providing a challenge in precise navigation and placement.', 'assets-used': ['block/block.urdf', 'insertion/fixture.urdf', 'block/small.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class InsertBlocksLineup(Task): """"""Pick up four different color blocks and insert them into the corresponding color fixtures."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""insert the {color} block into the {color} fixture"" self.task_completed_desc = ""done inserting blocks."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors for blocks and fixtures colors = ['red', 'blue', 'green', 'yellow'] # Add fixtures. fixture_size = (0.04, 0.04, 0.04) fixture_urdf = 'insertion/fixture.urdf' fixture_poses = [] for i in range(4): fixture_pose = self.get_random_pose(env, fixture_size) fixture_id = env.add_object(fixture_urdf, fixture_pose, color=utils.COLORS[colors[i]], category='fixed') fixture_poses.append((fixture_pose, fixture_id)) # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' blocks = [] for i in range(4): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[colors[i]]) blocks.append(block_id) # Add small blocks as barriers. small_block_size = (0.02, 0.02, 0.02) small_block_urdf = 'block/small.urdf' for _ in range(10): small_block_pose = self.get_random_pose(env, small_block_size) env.add_object(small_block_urdf, small_block_pose) # Goal: each block is in the corresponding color fixture. for i in range(4): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[fixture_poses[i][0]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-specific-container-fill"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-specific-container-fill"" in a python code block. ### "," color-specific-container-fill: {'task-name': 'color-specific-container-fill', 'task-description': 'Arrange four colored blocks (red, blue, green, and yellow) around a pallet. Then, pick up these blocks and place them inside a container marked in the same color. The task requires precise placement, color matching, and an understanding of spatial structures.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf', 'container/container-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorSpecificContainerFill(Task): """"""Arrange four colored blocks (red, blue, green, and yellow) around a pallet. Then, pick up these blocks and place them inside a container marked in the same color. The task requires precise placement, color matching, and an understanding of spatial structures."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""put the {color} block in the {color} container"" self.task_completed_desc = ""done arranging blocks in containers."" self.additional_reset() def reset(self, env): super().reset(env) # Add pallet. # x, y, z dimensions for the asset size pallet_size = (0.15, 0.15, 0.01) pallet_urdf = 'pallet/pallet.urdf' pallet_pose = self.get_random_pose(env, pallet_size) env.add_object(pallet_urdf, pallet_pose, 'fixed') # Define block and container colors. colors = ['red', 'blue', 'green', 'yellow'] # Add blocks and containers. # x, y, z dimensions for the asset size block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' container_size = (0.12, 0.12, 0.05) container_template = 'container/container-template.urdf' blocks = [] containers = [] for color in colors: # Add block. block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color]) blocks.append(block_id) # Add container. container_pose = self.get_random_pose(env, container_size) replace = {'DIM': container_size, 'HALF': (container_size[0] / 2, container_size[1] / 2, container_size[2] / 2)} container_urdf = self.fill_template(container_template, replace) container_id = env.add_object(container_urdf, container_pose, 'fixed', color=utils.COLORS[color]) containers.append(container_id) # Goal: each block is in a container of the same color. for i in range(len(colors)): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(containers[i])], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / len(colors)) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""multicolor-block-bridge"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""multicolor-block-bridge"" in a python code block. ### "," multicolor-block-bridge: {'task-name': 'multicolor-block-bridge', 'task-description': 'Build a bridge by stacking three red, three blue, and three green blocks on a pallet. Arrange in a sequence from left to right: red, blue, and green. Then, place three cylinders of corresponding colors on top of the stacked blocks, forming a bridge. The cylinders should roll from the top block to the pallet, creating a challenge of precision and control.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf', 'cylinder/cylinder-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class MulticolorBlockBridge(Task): """"""Build a bridge by stacking three red, three blue, and three green blocks on a pallet. Arrange in a sequence from left to right: red, blue, and green. Then, place three cylinders of corresponding colors on top of the stacked blocks, forming a bridge. The cylinders should roll from the top block to the pallet, creating a challenge of precision and control."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""Build a bridge by stacking three red, three blue, and three green blocks on a pallet. Arrange in a sequence from left to right: red, blue, and green. Then, place three cylinders of corresponding colors on top of the stacked blocks, forming a bridge."" self.task_completed_desc = ""done building the bridge."" self.additional_reset() def reset(self, env): super().reset(env) # Add pallet. # x, y, z dimensions for the asset size pallet_size = (0.15, 0.15, 0.01) pallet_urdf = 'pallet/pallet.urdf' pallet_pose = self.get_random_pose(env, pallet_size) env.add_object(pallet_urdf, pallet_pose, 'fixed') # Add blocks. # x, y, z dimensions for the asset size block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' block_colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green']] blocks = [] for i in range(9): # 3 blocks of each color block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=block_colors[i // 3]) blocks.append(block_id) # Add cylinders. # x, y, z dimensions for the asset size cylinder_size = (0.04, 0.04, 0.04) cylinder_template = 'cylinder/cylinder-template.urdf' cylinders = [] for i in range(3): # 1 cylinder of each color cylinder_pose = self.get_random_pose(env, cylinder_size) replace = {'DIM': cylinder_size, 'HALF': (cylinder_size[0] / 2, cylinder_size[1] / 2, cylinder_size[2] / 2)} cylinder_urdf = self.fill_template(cylinder_template, replace) cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=block_colors[i]) cylinders.append(cylinder_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.03), (0, 0, 0.03), (0, 0.05, 0.03)] targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos] # Goal: blocks are stacked on the pallet in the order red, blue, green. for i in range(9): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[targs[i // 3]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 9, symmetries=[np.pi/2]) # Goal: cylinders are placed on top of the stacked blocks. for i in range(3): self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[targs[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]) self.lang_goals.append(self.lang_template)``` END" " ""pyramid-blocks-assemble"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""pyramid-blocks-assemble"" in a python code block. ### "," pyramid-blocks-assemble: {'task-name': 'pyramid-blocks-assemble', 'task-description': 'Construct a pyramid using nine blocks in a specific color order on a pallet. The bottom layer should contain five blocks: red, blue, green, yellow, and orange (in that order from left to right). The middle layer should consist of three blocks: yellow, red, and blue (from left to right). The top layer should contain a single green block. The pyramid requires careful placement and color matching.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class PyramidBlocksAssemble(Task): """"""Construct a pyramid using nine blocks in a specific color order on a pallet."""""" def __init__(self): super().__init__() self.max_steps = 15 self.lang_template = ""construct a pyramid using nine blocks in a specific color order on a pallet"" self.task_completed_desc = ""done constructing pyramid."" self.additional_reset() def reset(self, env): super().reset(env) # Add pallet. # x, y, z dimensions for the asset size pallet_size = (0.35, 0.35, 0.01) pallet_urdf = 'pallet/pallet.urdf' pallet_pose = self.get_random_pose(env, pallet_size) env.add_object(pallet_urdf, pallet_pose, 'fixed') # Block colors. colors = [ utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow'], utils.COLORS['orange'] ] # Add blocks. # x, y, z dimensions for the asset size block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' blocks = [] for _ in range(9): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose) blocks.append(block_id) # Associate placement locations for goals. place_pos = [ (-0.1, -0.1, 0.02), (0, -0.1, 0.02), (0.1, -0.1, 0.02), (-0.1, 0, 0.02), (0.1, 0, 0.02), (-0.05, 0.05, 0.06), (0.05, 0.05, 0.06), (0, 0.1, 0.06), (0, 0.05, 0.1) ] targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos] # Goal: blocks are stacked in a pyramid in a specific color order. for i in range(9): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[targs[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 9) self.lang_goals.append(self.lang_template.format(blocks=""the blocks"", row=""row""))``` END" " ""triangle-block-arrangement"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""triangle-block-arrangement"" in a python code block. ### "," triangle-block-arrangement: {'task-name': 'triangle-block-arrangement', 'task-description': 'Arrange blocks of three different colors (red, green, and blue) in a triangular layout on the tabletop. The base of the triangle should consist of three red blocks, followed by a row of two green blocks, and finally a single blue block at the top of the triangle. The task is challenging due to the need for precise placement and color coordination.', 'assets-used': ['block/block.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class TriangleBlockArrangement(Task): """"""Arrange blocks of three different colors (red, green, and blue) in a triangular layout on the tabletop."""""" def __init__(self): super().__init__() self.max_steps = 6 self.lang_template = ""Arrange blocks of three different colors (red, green, and blue) in a triangular layout on the tabletop."" self.task_completed_desc = ""done arranging blocks in a triangle."" self.additional_reset() def reset(self, env): super().reset(env) # Add blocks. # x, y, z dimensions for the asset size block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' colors = [utils.COLORS['red'], utils.COLORS['green'], utils.COLORS['blue']] blocks = [] for i in range(6): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=colors[i//2]) blocks.append(block_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.02), (0, 0, 0.02), (0, 0.05, 0.02), (0, -0.025, 0.06), (0, 0.025, 0.06), (0, 0, 0.10)] base_pose = self.get_random_pose(env, block_size) targs = [(utils.apply(base_pose, i), base_pose[1]) for i in place_pos] # Goal: blocks are stacked in a triangle (bottom row: red, middle row: green, top row: blue). self.add_goal(objs=blocks[:3], matches=np.ones((3, 3)), targ_poses=targs[:3], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]*3) self.lang_goals.append(""Arrange the red blocks in a row at the base of the triangle."") self.add_goal(objs=blocks[3:5], matches=np.ones((2, 2)), targ_poses=targs[3:5], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]*2) self.lang_goals.append(""Arrange the green blocks in a row above the red blocks."") self.add_goal(objs=blocks[5:], matches=np.ones((1, 1)), targ_poses=targs[5:], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 6, symmetries=[np.pi/2]) self.lang_goals.append(""Place the blue block at the top of the triangle."")``` END" " ""place-ball-in-elevated-bowl"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""place-ball-in-elevated-bowl"" in a python code block. ### "," place-ball-in-elevated-bowl: {'task-name': 'place-ball-in-elevated-bowl', 'task-description': 'The primary objective of the task is to pick up a red ball and carefully place it into a bowl, which is positioned on a raised platform that is surrounded by small blocks. The challenge lies in precise navigation, maintaining a hold of the ball, and avoiding the surrounding blocks.', 'assets-used': ['ball/ball-template.urdf', 'bowl/bowl.urdf', 'block/small.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class PlaceBallInElevatedBowl(Task): """"""Pick up a red ball and carefully place it into a bowl, which is positioned on a raised platform that is surrounded by small blocks."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""place the red ball in the elevated bowl"" self.task_completed_desc = ""done placing ball in bowl."" self.additional_reset() def reset(self, env): super().reset(env) # Add elevated platform. platform_size = (0.3, 0.3, 0.05) platform_urdf = 'platform/platform.urdf' platform_pose = self.get_random_pose(env, platform_size) env.add_object(platform_urdf, platform_pose, 'fixed') # Add bowl on the platform. bowl_size = (0.12, 0.12, 0) bowl_urdf = 'bowl/bowl.urdf' bowl_pose = self.get_random_pose(env, bowl_size) bowl_pose[0][2] += platform_size[2] # place the bowl on top of the platform bowl_id = env.add_object(bowl_urdf, bowl_pose, 'fixed') # Add red ball. ball_size = (0.04, 0.04, 0.04) ball_urdf = 'ball/ball-template.urdf' ball_pose = self.get_random_pose(env, ball_size) ball_id = env.add_object(ball_urdf, ball_pose, color=utils.COLORS['red']) # Add small blocks around the platform. block_size = (0.02, 0.02, 0.02) block_urdf = 'block/small.urdf' for _ in range(5): block_pose = self.get_random_pose(env, block_size) env.add_object(block_urdf, block_pose) # Goal: the red ball is in the bowl. self.add_goal(objs=[ball_id], matches=np.ones((1, 1)), targ_poses=[bowl_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1) self.lang_goals.append(self.lang_template)``` END" " ""align-balls-in-colored-zones"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""align-balls-in-colored-zones"" in a python code block. ### "," align-balls-in-colored-zones: {'task-name': 'align-balls-in-colored-zones', 'task-description': 'There are six balls of different colors (red, blue, green, yellow, orange, and purple) and six zones correspondingly colored. The task is to pick up each ball and place it in the zone of the same color, arranging the balls in a straight line. The challenge lies in the precise placement and color matching.', 'assets-used': ['ball/ball-template.urdf', 'zone/zone.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class AlignBallsInColoredZones(Task): """"""Align balls of different colors in correspondingly colored zones."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""place the {color} ball in the {color} zone"" self.task_completed_desc = ""done aligning balls in colored zones."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors for balls and zones colors = ['red', 'blue', 'green', 'yellow', 'orange', 'purple'] color_names = ['Red', 'Blue', 'Green', 'Yellow', 'Orange', 'Purple'] # Add zones. zone_size = (0.12, 0.12, 0) zone_urdf = 'zone/zone.urdf' zone_poses = [] for i in range(6): zone_pose = self.get_random_pose(env, zone_size) env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[colors[i]]) zone_poses.append(zone_pose) # Add balls. ball_size = (0.04, 0.04, 0.04) ball_urdf = 'ball/ball-template.urdf' balls = [] for i in range(6): ball_pose = self.get_random_pose(env, ball_size) replace = {'DIM': ball_size, 'HALF': (ball_size[0] / 2, ball_size[1] / 2, ball_size[2] / 2), 'COLOR': colors[i]} ball_urdf = self.fill_template(ball_urdf, replace) ball_id = env.add_object(ball_urdf, ball_pose) balls.append(ball_id) # Goal: each ball is in a different colored zone. for i in range(6): self.add_goal(objs=[balls[i]], matches=np.int32([[1]]), targ_poses=[zone_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 6) self.lang_goals.append(self.lang_template.format(color=color_names[i]))``` END" " ""color-coordinated-cylinder-tower"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-cylinder-tower"" in a python code block. ### "," color-coordinated-cylinder-tower: {'task-name': 'color-coordinated-cylinder-tower', 'task-description': 'Stack cylinders of four different colors (red, blue, green, yellow) on top of each other on a square stand in a specific sequence. The bottom of the stack should start with a blue cylinder, follow by a green cylinder, then a red one, and finally a yellow cylinder at the top. Each cylinder has to be aligned correctly to avoid falling.', 'assets-used': ['cylinder/cylinder-template.urdf', 'stacking/stand.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedCylinderTower(Task): """"""Stack cylinders of four different colors (red, blue, green, yellow) on top of each other on a square stand in a specific sequence. The bottom of the stack should start with a blue cylinder, follow by a green cylinder, then a red one, and finally a yellow cylinder at the top. Each cylinder has to be aligned correctly to avoid falling."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""Stack cylinders of four different colors (red, blue, green, yellow) on top of each other on a square stand in a specific sequence. The bottom of the stack should start with a blue cylinder, follow by a green cylinder, then a red one, and finally a yellow cylinder at the top."" self.task_completed_desc = ""done stacking cylinders."" self.additional_reset() def reset(self, env): super().reset(env) # Add base. base_size = (0.05, 0.15, 0.005) base_urdf = 'stacking/stand.urdf' base_pose = self.get_random_pose(env, base_size) env.add_object(base_urdf, base_pose, category='fixed') # Cylinder colors. colors = [utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['red'], utils.COLORS['yellow']] # Add cylinders. cylinder_size = (0.04, 0.04, 0.04) cylinder_urdf = 'cylinder/cylinder-template.urdf' objs = [] for i in range(4): cylinder_pose = self.get_random_pose(env, cylinder_size) cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=colors[i]) objs.append(cylinder_id) # Associate placement locations for goals. place_pos = [(0, 0, 0.03), (0, 0, 0.08), (0, 0, 0.13), (0, 0, 0.18)] targs = [(utils.apply(base_pose, i), base_pose[1]) for i in place_pos] # Goal: cylinders are stacked in a tower (bottom to top: blue, green, red, yellow). for i in range(4): self.add_goal(objs=[objs[i]], matches=np.ones((1, 1)), targ_poses=[targs[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4, symmetries=[np.pi/2]) self.lang_goals.append(self.lang_template)``` END" " ""symmetric-block-bridge-construction"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""symmetric-block-bridge-construction"" in a python code block. ### "," symmetric-block-bridge-construction: {'task-name': 'symmetric-block-bridge-construction', 'task-description': 'Create a symmetrical bridge-shaped structure on a stand using eight blocks of two different colors (four red and four blue). Start by placing two red blocks side by side at the center of the stand to form the base of the bridge. Then, take a blue block and place it on top of the red blocks, followed by another red block on top of the blue one, and this pattern continues till you exhaust all the blocks. The final structure should be a bridge with alternating colors (red, blue, red, blue). The challenge lies in ensuring symmetry and balancing the blocks without making them fall.', 'assets-used': ['stacking/stand.urdf', 'block/block-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class SymmetricBlockBridgeConstruction(Task): """"""Create a symmetrical bridge-shaped structure on a stand using eight blocks of two different colors (four red and four blue)."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""create a symmetrical bridge-shaped structure on a stand using eight blocks of two different colors (four red and four blue)"" self.task_completed_desc = ""done building the bridge."" self.additional_reset() def reset(self, env): super().reset(env) # Add base. base_size = (0.05, 0.15, 0.005) base_urdf = 'stacking/stand.urdf' base_pose = self.get_random_pose(env, base_size) env.add_object(base_urdf, base_pose, category='fixed') # Block colors. colors = [utils.COLORS['red'], utils.COLORS['blue']] # Add blocks. # x, y, z dimensions for the asset size block_size = (0.04, 0.04, 0.04) block_urdf = 'stacking/block.urdf' objs = [] for i in range(8): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=colors[i%2]) objs.append(block_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.03), (0, 0, 0.03), (0, 0.05, 0.03), (0, -0.025, 0.08), (0, 0.025, 0.08), (0, 0, 0.13), (0, -0.025, 0.18), (0, 0.025, 0.18)] targs = [(utils.apply(base_pose, i), base_pose[1]) for i in place_pos] # Goal: blocks are stacked in a bridge (bottom row: red, red). self.add_goal(objs=objs[:2], matches=np.ones((2, 2)), targ_poses=targs[:2], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4, symmetries=[np.pi/2]*2) self.lang_goals.append(self.lang_template) # Goal: blocks are stacked in a bridge (second row: blue). self.add_goal(objs=objs[2:3], matches=np.ones((1, 1)), targ_poses=targs[2:3], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4, symmetries=[np.pi/2]) self.lang_goals.append(self.lang_template) # Goal: blocks are stacked in a bridge (third row: red). self.add_goal(objs=objs[3:4], matches=np.ones((1, 1)), targ_poses=targs[3:4], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4, symmetries=[np.pi/2]) self.lang_goals.append(self.lang_template) # Goal: blocks are stacked in a bridge (fourth row: blue). self.add_goal(objs=objs[4:5], matches=np.ones((1, 1)), targ_poses=targs[4:5], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4, symmetries=[np.pi/2]) self.lang_goals.append(self.lang_template) # Goal: blocks are stacked in a bridge (fifth row: red). self.add_goal(objs=objs[5:6], matches=np.ones((1, 1)), targ_poses=targs[5:6], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4, symmetries=[np.pi/2]) self.lang_goals.append(self.lang_template) # Goal: blocks are stacked in a bridge (sixth row: blue). self.add_goal(objs=objs[6:7], matches=np.ones((1, 1)), targ_poses=targs[6:7], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4, symmetries=[np.pi/2]) self.lang_goals.append(self.lang_template) # Goal: blocks are stacked in a bridge (top row: red, red). self.add_goal(objs=objs[7:], matches=np.ones((1, 1)), targ_poses=targs[7:], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4, symmetries=[np.pi/2]) self.lang_goals.append(self.lang_template)``` END" " ""sphere-align-stand"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""sphere-align-stand"" in a python code block. ### "," sphere-align-stand: {'task-name': 'sphere-align-stand', 'task-description': 'On a table there are five differently colored stands and five spheres. The task involves picking up each sphere and placing it on the stand of the matching color. The task is challenging due to the precision required in picking up and placing the spheres, and the color coordination.', 'assets-used': ['stacking/stand.urdf', 'sphere/sphere.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class SphereAlignStand(Task): """"""Pick up each sphere and place it on the stand of the matching color."""""" def __init__(self): super().__init__() self.max_steps = 5 self.lang_template = ""place the {color} sphere on the {color} stand"" self.task_completed_desc = ""done aligning spheres with stands."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors for the spheres and stands colors = ['red', 'green', 'blue', 'yellow', 'purple'] color_names = ['red', 'green', 'blue', 'yellow', 'purple'] # Add stands. # x, y, z dimensions for the asset size stand_size = (0.05, 0.05, 0.05) stand_urdf = 'stacking/stand.urdf' stand_poses = [] for i in range(5): stand_pose = self.get_random_pose(env, stand_size) env.add_object(stand_urdf, stand_pose, 'fixed', color=utils.COLORS[colors[i]]) stand_poses.append(stand_pose) # Add spheres. # x, y, z dimensions for the asset size sphere_size = (0.04, 0.04, 0.04) sphere_urdf = 'sphere/sphere.urdf' spheres = [] for i in range(5): sphere_pose = self.get_random_pose(env, sphere_size) sphere_id = env.add_object(sphere_urdf, sphere_pose, color=utils.COLORS[colors[i]]) spheres.append(sphere_id) # Goal: each sphere is on the stand of the matching color. for i in range(5): self.add_goal(objs=[spheres[i]], matches=np.ones((1, 1)), targ_poses=[stand_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/5) self.lang_goals.append(self.lang_template.format(color=color_names[i]))``` END" " ""construct-colorful-arch"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""construct-colorful-arch"" in a python code block. ### "," construct-colorful-arch: {'task-name': 'construct-colorful-arch', 'task-description': 'Construct an arch using six blocks: three red, and three blue. Place two red blocks on the tabletop parallel to each other, then place a blue block on top of the red blocks to form a basic arch. Repeat the process by placing a red block on each side of the base arch and bridge them with the last blue block. Finally, place the last two red blocks on top of the second layer of the red blocks, on either side. The overall structure forms a colorful 3D arch.', 'assets-used': ['block/block.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ConstructColorfulArch(Task): """"""Construct an arch using six blocks: three red, and three blue."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""Construct an arch using six blocks: three red, and three blue."" self.task_completed_desc = ""done constructing colorful arch."" self.additional_reset() def reset(self, env): super().reset(env) # Add blocks. # x, y, z dimensions for the asset size block_size = (0.04, 0.04, 0.04) block_urdf = 'stacking/block.urdf' colors = [utils.COLORS['red'], utils.COLORS['blue']] blocks = [] for i in range(6): block_pose = self.get_random_pose(env, block_size) color = colors[i // 3] # First three blocks are red, last three are blue block_id = env.add_object(block_urdf, block_pose, color=color) blocks.append(block_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.02), (0, 0.05, 0.02), # Base layer (0, 0, 0.06), # Second layer (0, -0.05, 0.10), (0, 0.05, 0.10), # Third layer (0, 0, 0.14)] # Top layer targs = [(utils.apply(block_pose, i), block_pose[1]) for i in place_pos] # Goal: blocks are stacked in an arch (bottom layer: red, red). self.add_goal(objs=blocks[:2], matches=np.ones((2, 2)), targ_poses=targs[:2], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]*2) self.lang_goals.append(""Place two red blocks on the tabletop parallel to each other"") # Goal: blocks are stacked in an arch (second layer: blue). self.add_goal(objs=blocks[2:3], matches=np.ones((1, 1)), targ_poses=targs[2:3], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]) self.lang_goals.append(""Place a blue block on top of the red blocks to form a basic arch"") # Goal: blocks are stacked in an arch (third layer: red, red). self.add_goal(objs=blocks[3:5], matches=np.ones((2, 2)), targ_poses=targs[3:5], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]*2) self.lang_goals.append(""Place a red block on each side of the base arch"") # Goal: blocks are stacked in an arch (top layer: blue). self.add_goal(objs=blocks[5:], matches=np.ones((1, 1)), targ_poses=targs[5:], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]) self.lang_goals.append(""Bridge them with the last blue block"")``` END" " ""color-sorted-container-stack"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-sorted-container-stack"" in a python code block. ### "," color-sorted-container-stack: {'task-name': 'color-sorted-container-stack', 'task-description': 'The challenge is to stack four differently colored blocks (red, blue, green, yellow) inside a container. These blocks are initially placed inside two separate bowls. The red and blue blocks are in one bowl, the yellow and green blocks are in another. The robot has to pick up the blocks from the two bowls and stack them inside the container in the specific order: red, blue, green, then yellow.', 'assets-used': ['bowl/bowl.urdf', 'container/container-template.urdf', 'block/block.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorSortedContainerStack(Task): """"""Stack four differently colored blocks (red, blue, green, yellow) inside a container."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""stack the blocks in the container in the order: red, blue, green, then yellow"" self.task_completed_desc = ""done stacking blocks."" self.additional_reset() def reset(self, env): super().reset(env) # Add container. # x, y, z dimensions for the asset size container_size = (0.15, 0.15, 0.15) container_pose = self.get_random_pose(env, container_size) container_urdf = 'container/container-template.urdf' replace = {'DIM': container_size, 'HALF': (container_size[0] / 2, container_size[1] / 2, container_size[2] / 2)} container_urdf = self.fill_template(container_urdf, replace) env.add_object(container_urdf, container_pose, 'fixed') # Add blocks. # x, y, z dimensions for the asset size block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' block_colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow']] blocks = [] for i in range(4): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=block_colors[i]) blocks.append(block_id) # Add bowls. # x, y, z dimensions for the asset size bowl_size = (0.12, 0.12, 0) bowl_urdf = 'bowl/bowl.urdf' for i in range(2): bowl_pose = self.get_random_pose(env, bowl_size) env.add_object(bowl_urdf, bowl_pose, 'fixed') # Goal: each block is stacked in the container in the order: red, blue, green, yellow. for i in range(4): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[container_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4) self.lang_goals.append(self.lang_template)``` END" " ""align-spheres-in-colored-zones"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""align-spheres-in-colored-zones"" in a python code block. ### "," align-spheres-in-colored-zones: {'task-name': 'align-spheres-in-colored-zones', 'task-description': 'There are four spheres of different colors (red, blue, green, yellow) positioned randomly on the table along with four zones marked with matching colors. The task is to pick up each sphere and place it into the matching colored zone with precise placement.', 'assets-used': ['sphere/sphere-template.urdf', 'zone/zone.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class AlignSpheresInColoredZones(Task): """"""Align spheres of different colors in the matching colored zones."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""place the {color} sphere in the {color} zone"" self.task_completed_desc = ""done aligning spheres in colored zones."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors colors = ['red', 'blue', 'green', 'yellow'] color_names = ['red', 'blue', 'green', 'yellow'] # Add zones. zone_size = (0.12, 0.12, 0) zone_urdf = 'zone/zone.urdf' zone_poses = [] for color in colors: zone_pose = self.get_random_pose(env, zone_size) env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[color]) zone_poses.append(zone_pose) # Add spheres. sphere_size = (0.04, 0.04, 0.04) sphere_urdf = 'sphere/sphere-template.urdf' spheres = [] for i, color in enumerate(colors): sphere_pose = self.get_random_pose(env, sphere_size) replace = {'DIM': sphere_size, 'HALF': (sphere_size[0] / 2, sphere_size[1] / 2, sphere_size[2] / 2)} sphere_urdf = self.fill_template(sphere_urdf, replace) sphere_id = env.add_object(sphere_urdf, sphere_pose, color=utils.COLORS[color]) spheres.append(sphere_id) # Add goal self.add_goal(objs=[sphere_id], matches=np.ones((1, 1)), targ_poses=[zone_poses[i]], replace=False, rotations=False, metric='pose', params=None, step_max_reward=1) self.lang_goals.append(self.lang_template.format(color=color_names[i]))``` END" " ""sort-insert-color-coordinated-blocks"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""sort-insert-color-coordinated-blocks"" in a python code block. ### "," sort-insert-color-coordinated-blocks: {'task-name': 'sort-insert-color-coordinated-blocks', 'task-description': 'There are six blocks of three different colors (two red, two blue, and two green), two red containers, two blue containers, and two green containers scattered on the table. The task is to sort the blocks by their colors and place (insert) them into the containers of the matching color. Two blocks of the same color should go into two different containers of the same color. The challenge lies in the color-based sorting and insertion of the blocks into the containers.', 'assets-used': ['block/block.urdf', 'container/container-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class SortInsertColorCoordinatedBlocks(Task): """"""Sort blocks by their colors and place them into the containers of the matching color."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""sort the blocks by their colors and place them into the containers of the matching color"" self.task_completed_desc = ""done sorting and inserting blocks."" self.additional_reset() def reset(self, env): super().reset(env) # Add containers. container_size = (0.12, 0.12, 0.12) container_urdf = 'container/container-template.urdf' container_colors = ['red', 'blue', 'green'] container_poses = [] for color in container_colors: container_pose = self.get_random_pose(env, container_size) env.add_object(container_urdf, container_pose, color=utils.COLORS[color]) container_poses.append(container_pose) # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' block_colors = ['red', 'red', 'blue', 'blue', 'green', 'green'] blocks = [] for color in block_colors: block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color]) blocks.append(block_id) # Goal: each block is in a container of the same color. for i in range(len(blocks)): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[container_poses[i//2]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(blocks)) self.lang_goals.append(self.lang_template)``` END" " ""color-ordered-insertion"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-ordered-insertion"" in a python code block. ### "," color-ordered-insertion: {'task-name': 'color-ordered-insertion', 'task-description': 'There are four differently-colored ell objects (red, blue, green, yellow) and a corresponding set of color-coded fixtures. The task involves picking up each ell object and inserting it into the matching color fixture in a specific order: from left to right, insert red, blue, green, and finally yellow. The challenge lies in the precise manipulation of the ell objects and the color-coordination required. The fixtures are arranged in a straight line, and can only be approached from one direction, demanding careful navigation.', 'assets-used': ['insertion/ell.urdf', 'insertion/fixture.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorOrderedInsertion(Task): """"""Insert differently-colored ell objects into the matching color fixture in a specific order."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""insert the {color} ell into the matching fixture"" self.task_completed_desc = ""done inserting ells."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and their order colors = ['red', 'blue', 'green', 'yellow'] color_order = {color: i for i, color in enumerate(colors)} # Add fixtures. fixture_size = (0.12, 0.12, 0.02) fixture_urdf = 'insertion/fixture.urdf' fixtures = [] for color in colors: fixture_pose = self.get_random_pose(env, fixture_size) fixture_id = env.add_object(fixture_urdf, fixture_pose, color=utils.COLORS[color], category='fixed') fixtures.append(fixture_id) # Add ell objects. ell_size = (0.04, 0.04, 0.04) ell_urdf = 'insertion/ell.urdf' ells = [] for color in colors: ell_pose = self.get_random_pose(env, ell_size) ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[color]) ells.append(ell_id) # Goal: each ell is inserted into the matching color fixture in the correct order. for i, ell in enumerate(ells): self.add_goal(objs=[ell], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(fixtures[i])], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / len(ells)) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-coordinated-cylinders-in-boxes"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-cylinders-in-boxes"" in a python code block. ### "," color-coordinated-cylinders-in-boxes: {'task-name': 'color-coordinated-cylinders-in-boxes', 'task-description': 'Arrange four cylinders of different colors (red, blue, green, and yellow) into four matching colored boxes, such that each box contains a cylinder of the same color. The task is challenging due to the manipulation of cylindrical objects and the color coordination required.', 'assets-used': ['cylinder/cylinder-template.urdf', 'box/box-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedCylindersInBoxes(Task): """"""Arrange four cylinders of different colors (red, blue, green, and yellow) into four matching colored boxes, such that each box contains a cylinder of the same color."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""put the {color} cylinder in the {color} box"" self.task_completed_desc = ""done arranging cylinders in boxes."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and corresponding names colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow']] color_names = ['red', 'blue', 'green', 'yellow'] # Add boxes. box_size = (0.05, 0.05, 0.05) # x, y, z dimensions for the box size box_urdf = 'box/box-template.urdf' boxes = [] for i in range(4): box_pose = self.get_random_pose(env, box_size) box_id = env.add_object(box_urdf, box_pose, color=colors[i]) boxes.append(box_id) # Add cylinders. cylinder_size = (0.02, 0.02, 0.05) # x, y, z dimensions for the cylinder size cylinder_urdf = 'cylinder/cylinder-template.urdf' cylinders = [] for i in range(4): cylinder_pose = self.get_random_pose(env, cylinder_size) cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=colors[i]) cylinders.append(cylinder_id) # Goal: each cylinder is in a box of the same color. for i in range(4): self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[box_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4) self.lang_goals.append(self.lang_template.format(color=color_names[i]))``` END" " ""color-coordinated-insertion"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-insertion"" in a python code block. ### "," color-coordinated-insertion: {'task-name': 'color-coordinated-insertion', 'task-description': 'There are three insertion fixtures and three ell shaped blocks of different colors (red, blue, green) on the table top. The task is to pick up the ell shaped blocks and insert each one of them into the fixture of the same color. However, the ell blocks should be inserted in a specific sequence - red first, then blue, and finally green. This task is challenging due to the precision required for insertion and the need for color coordination and sequencing.', 'assets-used': ['insertion/ell.urdf', 'insertion/fixture.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCoordinatedInsertion(Task): """"""Insert each block into the fixture of the same color, and then place these fixtures onto a pallet."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""insert each block into the fixture of the same color, and then place these fixtures onto a pallet"" self.task_completed_desc = ""done with color-coordinated-insertion."" self.additional_reset() def reset(self, env): super().reset(env) # Add pallet. pallet_size = (0.35, 0.35, 0.01) pallet_pose = self.get_random_pose(env, pallet_size) pallet_urdf = 'pallet/pallet.urdf' env.add_object(pallet_urdf, pallet_pose, 'fixed') # Add fixtures and blocks. colors = ['red', 'blue', 'green', 'yellow'] fixtures = [] blocks = [] fixture_size = (0.05, 0.05, 0.05) block_size = (0.04, 0.04, 0.04) fixture_urdf = 'insertion/fixture.urdf' block_urdf = 'block/block.urdf' for color in colors: # Add fixture. fixture_pose = self.get_random_pose(env, fixture_size) fixture_id = env.add_object(fixture_urdf, fixture_pose, color=utils.COLORS[color]) fixtures.append(fixture_id) # Add block. block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color]) blocks.append(block_id) # Goal: each block is in the fixture of the same color. for i in range(len(blocks)): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(fixtures[i])], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / len(blocks)) # Goal: each fixture is on the pallet. for i in range(len(fixtures)): self.add_goal(objs=[fixtures[i]], matches=np.ones((1, 1)), targ_poses=[pallet_pose], replace=False, rotations=True, metric='zone', params=[(pallet_pose, pallet_size)], step_max_reward=1 / len(fixtures)) self.lang_goals.append(self.lang_template)``` END" " ""cylinder-stand-alignment"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""cylinder-stand-alignment"" in a python code block. ### "," cylinder-stand-alignment: {'task-name': 'cylinder-stand-alignment', 'task-description': 'Arrange four colored cylinders (red, blue, green, yellow) in order of their colors on four stands of matching color. However, the stands are placed in a random order on the table, which increases the complexity of the task as it requires careful planning and color matching.', 'assets-used': ['cylinder/cylinder-template.urdf', 'stacking/stand.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class CylinderStandAlignment(Task): """"""Arrange four colored cylinders (red, blue, green, yellow) in order of their colors on four stands of matching color."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""Arrange the {color} cylinder on the {color} stand"" self.task_completed_desc = ""done arranging cylinders."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and corresponding names colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow']] color_names = ['red', 'blue', 'green', 'yellow'] # Add cylinders. # x, y, z dimensions for the asset size cylinder_size = (0.04, 0.04, 0.04) cylinder_urdf = 'cylinder/cylinder-template.urdf' cylinders = [] for i in range(4): cylinder_pose = self.get_random_pose(env, cylinder_size) replace = {'DIM': cylinder_size, 'HALF': (cylinder_size[0] / 2, cylinder_size[1] / 2, cylinder_size[2] / 2), 'COLOR': colors[i]} # IMPORTANT: REPLACE THE TEMPLATE URDF urdf = self.fill_template(cylinder_urdf, replace) cylinder_id = env.add_object(urdf, cylinder_pose) cylinders.append(cylinder_id) # Add stands. # x, y, z dimensions for the asset size stand_size = (0.05, 0.05, 0.005) stand_urdf = 'stacking/stand.urdf' stands = [] for i in range(4): stand_pose = self.get_random_pose(env, stand_size) env.add_object(stand_urdf, stand_pose, color=colors[i], category='fixed') stands.append(stand_pose) # Goal: each cylinder is on a stand of the same color. for i in range(4): self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[stands[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4) self.lang_goals.append(self.lang_template.format(color=color_names[i]))``` END" " ""color-coordinated-container-sorting"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-container-sorting"" in a python code block. ### "," color-coordinated-container-sorting: {'task-name': 'color-coordinated-container-sorting', 'task-description': 'On the table there are four different colored containers (red, blue, green and yellow) and sixteen blocks of the same four colors (four blocks of each color). The task challenges the robot to pick up these blocks and sort them into the containers of the same color, with each container having one of each color of blocks in it. To make the task interesting, each container should have the blocks in a different order. One container might have them in the order red, blue, green, yellow; another one in the order yellow, green, blue, red; and the last two could have them in the orders green, red, yellow, blue; and blue, yellow, red, green. The robot would need to first identify the correct container for sorting, and then plan the correct order of the blocks.', 'assets-used': ['block/block.urdf', 'container/container-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedContainerSorting(Task): """"""Sort blocks into containers of the same color in a specific order."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""sort the blocks into the containers of the same color in the specified order"" self.task_completed_desc = ""done sorting blocks into containers."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and their orders in containers colors = ['red', 'blue', 'green', 'yellow'] orders = [ ['red', 'blue', 'green', 'yellow'], ['yellow', 'green', 'blue', 'red'], ['green', 'red', 'yellow', 'blue'], ['blue', 'yellow', 'red', 'green'] ] # Add containers. container_size = (0.12, 0.12, 0.02) container_urdf = 'container/container-template.urdf' containers = [] for i in range(4): container_pose = self.get_random_pose(env, container_size) color = utils.COLORS[colors[i]] container_id = env.add_object(container_urdf, container_pose, color=color) containers.append(container_id) # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' blocks = [] for i in range(4): for _ in range(4): block_pose = self.get_random_pose(env, block_size) color = utils.COLORS[colors[i]] block_id = env.add_object(block_urdf, block_pose, color=color) blocks.append(block_id) # Add goals. for i in range(4): for j in range(4): # Find the block and container of the same color block_id = blocks[i*4 + j] container_id = containers[i] # Define the target pose based on the order in the container container_pose = p.getBasePositionAndOrientation(container_id)[0] targ_pose = (container_pose[0], container_pose[1], container_pose[2] + block_size[2] * (j + 1)) self.add_goal(objs=[block_id], matches=np.ones((1, 1)), targ_poses=[targ_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/16) self.lang_goals.append(self.lang_template)``` END" " ""color-sorted-block-race"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-sorted-block-race"" in a python code block. ### "," color-sorted-block-race: {'task-name': 'color-sorted-block-race', 'task-description': 'On one end of a tabletop, there are six blocks in two colors (three red and three blue). On the other end of the tabletop, two sets of three small marked zones are arranged in a straight line, one set for blue and one set for red. The task involves picking up one block at a time and placing it in the corresponding colored zone in a sequence from the bottom end zone to the top end zone. The blocks must be placed following the rule: the three colored blocks must be transported consecutively, e.g., first place all three blue blocks and then place all three red blocks. The challenge lies in careful transportation and placement of the blocks and follows the specific rule.', 'assets-used': ['block/block.urdf', 'zone/zone.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorSortedBlockRace(Task): """"""Pick up blocks of two colors and place them in corresponding colored zones in a sequence."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""place the blocks in the corresponding colored zones in sequence"" self.task_completed_desc = ""done placing blocks in zones."" self.additional_reset() def reset(self, env): super().reset(env) # Add zones. zone_size = (0.12, 0.12, 0) zone_urdf = 'zone/zone.urdf' zone_colors = ['blue', 'red'] zone_poses = [] for color in zone_colors: zone_pose = self.get_random_pose(env, zone_size) env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[color]) zone_poses.append(zone_pose) # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' block_colors = ['blue', 'red'] blocks = [] for color in block_colors: for _ in range(3): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color]) blocks.append(block_id) # Goal: each block is in the corresponding colored zone. for i, block in enumerate(blocks): self.add_goal(objs=[block], matches=np.ones((1, 1)), targ_poses=[zone_poses[i//3]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(blocks)) self.lang_goals.append(self.lang_template)``` END" " ""multi-level-block-construction"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""multi-level-block-construction"" in a python code block. ### "," multi-level-block-construction: {'task-name': 'multi-level-block-construction', 'task-description': 'Construct a two-level structure on a pallet using four blocks: two red and two blue. The lower level should be a rectangle created by placing the red blocks side by side. The upper level is made up by placing the blue blocks placed on top of the red blocks creating a line aligned perpendicular to the red blocks. The challenge lies in the precise placement of blocks, maintaining balance of the structure, and correct color arrangement.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class MultiLevelBlockConstruction(Task): """"""Construct a two-level structure on a pallet using four blocks: two red and two blue. The lower level should be a rectangle created by placing the red blocks side by side. The upper level is made up by placing the blue blocks placed on top of the red blocks creating a line aligned perpendicular to the red blocks."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""construct a two-level structure on a pallet using four blocks: two red and two blue"" self.task_completed_desc = ""done constructing multi-level block structure."" def reset(self, env): super().reset(env) # Add pallet. # x, y, z dimensions for the asset size pallet_size = (0.15, 0.15, 0.015) pallet_urdf = 'pallet/pallet.urdf' pallet_pose = self.get_random_pose(env, pallet_size) env.add_object(pallet_urdf, pallet_pose, 'fixed') # Add blocks. # x, y, z dimensions for the asset size block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' block_colors = [utils.COLORS['red'], utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['blue']] blocks = [] for i in range(4): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=block_colors[i]) blocks.append(block_id) # Associate placement locations for goals. place_pos = [(0, -0.02, 0.02), (0, 0.02, 0.02), (0, -0.02, 0.06), (0, 0.02, 0.06)] targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos] # Goal: red blocks are placed side by side on the pallet. self.add_goal(objs=blocks[:2], matches=np.ones((2, 2)), targ_poses=targs[:2], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]*2) # Goal: blue blocks are stacked on top of the red blocks. self.add_goal(objs=blocks[2:], matches=np.ones((2, 2)), targ_poses=targs[2:], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]*2)``` END" " ""color-linked-ball-bowl-ordering"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-linked-ball-bowl-ordering"" in a python code block. ### "," color-linked-ball-bowl-ordering: {'task-name': 'color-linked-ball-bowl-ordering', 'task-description': 'On a tabletop, there are four bowls and four balls of different colors (red, blue, green, and yellow). Each ball is inside a bowl, but not corresponding to the color of the bowl. The task is to pick up each ball and place it in the bowl of the same color, in the specific sequence of red, blue, green and yellow from left to right. The challenge lies in the precise placement, color matching and sequence following.', 'assets-used': ['bowl/bowl.urdf', 'ball/ball.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorLinkedBallBowlOrdering(Task): """"""Pick up each ball and place it in the bowl of the same color, in the specific sequence of red, blue, green and yellow from left to right."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""place the {color} ball in the {color} bowl"" self.task_completed_desc = ""done placing balls in bowls."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and their order colors = ['red', 'blue', 'green', 'yellow'] # Add bowls. # x, y, z dimensions for the asset size bowl_size = (0.12, 0.12, 0) bowl_urdf = 'bowl/bowl.urdf' bowl_poses = [] for i in range(4): bowl_pose = self.get_random_pose(env, bowl_size) env.add_object(bowl_urdf, bowl_pose, 'fixed', color=utils.COLORS[colors[i]]) bowl_poses.append(bowl_pose) # Add balls. # x, y, z dimensions for the asset size balls = [] ball_size = (0.04, 0.04, 0.04) ball_urdf = 'ball/ball.urdf' for i in range(4): ball_pose = self.get_random_pose(env, ball_size) ball_id = env.add_object(ball_urdf, ball_pose, color=utils.COLORS[colors[i]]) balls.append(ball_id) # Goal: each ball is in the bowl of the same color. for i in range(4): self.add_goal(objs=[balls[i]], matches=np.int32([[1]]), targ_poses=[bowl_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-blocks-in-cylinder-maze"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-blocks-in-cylinder-maze"" in a python code block. ### "," color-blocks-in-cylinder-maze: {'task-name': 'color-blocks-in-cylinder-maze', 'task-description': 'Pick up five differently colored blocks (red, blue, yellow, green, and orange) that are scattered randomly on the table top. Arrange three cylindrical containers in a row to create a maze-like structure. Place the red, yellow, and blue block into the first, second, and third cylinder from left respectively. Then, stack the green and orange block on top of any container, followed by placing the same color palette on the respective block.', 'assets-used': ['block/block.urdf', 'cylinder/cylinder-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorBlocksInCylinderMaze(Task): """"""Pick up five differently colored blocks (red, blue, yellow, green, and orange) that are scattered randomly on the table top. Arrange three cylindrical containers in a row to create a maze-like structure. Place the red, yellow, and blue block into the first, second, and third cylinder from left respectively. Then, stack the green and orange block on top of any container, followed by placing the same color palette on the respective block."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""arrange the blocks in the cylinders and stack the green and orange blocks"" self.task_completed_desc = ""done arranging blocks in cylinders."" self.additional_reset() def reset(self, env): super().reset(env) # Add cylinders. cylinder_size = (0.05, 0.05, 0.1) cylinder_urdf = 'cylinder/cylinder-template.urdf' cylinder_poses = [] for _ in range(3): cylinder_pose = self.get_random_pose(env, cylinder_size) env.add_object(cylinder_urdf, cylinder_pose, 'fixed') cylinder_poses.append(cylinder_pose) # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' block_colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['yellow'], utils.COLORS['green'], utils.COLORS['orange']] blocks = [] for i in range(5): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=block_colors[i]) blocks.append(block_id) # Goal: red, yellow, and blue blocks are in the first, second, and third cylinder respectively. self.add_goal(objs=blocks[:3], matches=np.ones((3, 3)), targ_poses=cylinder_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 2) # Goal: green and orange blocks are stacked on top of any cylinder. self.add_goal(objs=blocks[3:], matches=np.ones((2, 3)), targ_poses=cylinder_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 2) self.lang_goals.append(self.lang_template)``` END" " ""create-pyramid-with-color-coded-ells"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""create-pyramid-with-color-coded-ells"" in a python code block. ### "," create-pyramid-with-color-coded-ells: {'task-name': 'create-pyramid-with-color-coded-ells', 'task-description': ""There are four insertion ell-shaped objects ('insertion/ell.urdf') of different colors (red, blue, yellow, and green) placed randomly on the tabletop. The task is to pick up each of these objects and stack them onto a fixed-size pallet in the shape of a pyramid. The order of the pyramid from bottom to top should be red, blue, yellow, and green."", 'assets-used': ['insertion/ell.urdf', 'pallet/pallet.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class CreatePyramidWithColorCodedElls(Task): """"""Pick up ell-shaped objects of different colors and stack them onto a pallet in the shape of a pyramid."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""stack the {color} ell on the pyramid"" self.task_completed_desc = ""done stacking ell pyramid."" self.additional_reset() def reset(self, env): super().reset(env) # Add pallet. pallet_size = (0.15, 0.15, 0.01) pallet_urdf = 'pallet/pallet.urdf' pallet_pose = self.get_random_pose(env, pallet_size) env.add_object(pallet_urdf, pallet_pose, category='fixed') # Ell colors. colors = [ utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['yellow'], utils.COLORS['green'] ] color_names = ['red', 'blue', 'yellow', 'green'] # Add Ells. ell_size = (0.04, 0.04, 0.04) ell_urdf = 'insertion/ell.urdf' objs = [] for i in range(4): ell_pose = self.get_random_pose(env, ell_size) ell_id = env.add_object(ell_urdf, ell_pose, color=colors[i]) objs.append(ell_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.03), (0, 0, 0.03), (0, 0.05, 0.03), (0, 0, 0.08)] targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos] # Goal: Ells are stacked in a pyramid (bottom row: red, middle row: blue, top row: yellow, green). for i in range(4): self.add_goal(objs=[objs[i]], matches=np.ones((1, 1)), targ_poses=[targs[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4, symmetries=[np.pi/2]) self.lang_goals.append(self.lang_template.format(color=color_names[i]))``` END" " ""move-piles-along-line"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""move-piles-along-line"" in a python code block. ### "," move-piles-along-line: {'task-name': 'move-piles-along-line', 'task-description': 'Move three piles of small blocks, each pile a different color (red, blue, green), along three matching colored lines to three separate zones of the same color using a spatula.', 'assets-used': ['block/small.urdf', 'zone/zone.urdf', 'line/line-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils class MovePilesAlongLine(Task): """"""Move three piles of small blocks, each pile a different color (red, blue, green), along three matching colored lines to three separate zones of the same color using a spatula."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""move the piles of blocks along the lines to the matching colored zones"" self.task_completed_desc = ""done moving piles."" self.primitive = primitives.push self.ee = Spatula self.additional_reset() def reset(self, env): super().reset(env) # Add three colored lines. line_template = 'line/line-template.urdf' line_colors = ['red', 'blue', 'green'] line_poses = [] for color in line_colors: line_size = self.get_random_size(0.1, 0.15, 0.1, 0.15, 0.05, 0.05) line_pose = self.get_random_pose(env, line_size) replace = {'DIM': line_size, 'HALF': (line_size[0] / 2, line_size[1] / 2, line_size[2] / 2), 'COLOR': color} line_urdf = self.fill_template(line_template, replace) env.add_object(line_urdf, line_pose, 'fixed') line_poses.append(line_pose) # Add three colored zones. zone_template = 'zone/zone.urdf' zone_poses = [] for color in line_colors: zone_size = self.get_random_size(0.1, 0.15, 0.1, 0.15, 0.05, 0.05) zone_pose = self.get_random_pose(env, zone_size) replace = {'DIM': zone_size, 'HALF': (zone_size[0] / 2, zone_size[1] / 2, zone_size[2] / 2), 'COLOR': color} zone_urdf = self.fill_template(zone_template, replace) env.add_object(zone_urdf, zone_pose, 'fixed') zone_poses.append(zone_pose) # Add three piles of small blocks. block_template = 'block/small.urdf' block_colors = ['red', 'blue', 'green'] block_ids = [] for color in block_colors: block_size = self.get_random_size(0.1, 0.15, 0.1, 0.15, 0.05, 0.05) block_pose = self.get_random_pose(env, block_size) replace = {'DIM': block_size, 'HALF': (block_size[0] / 2, block_size[1] / 2, block_size[2] / 2), 'COLOR': color} block_urdf = self.fill_template(block_template, replace) block_id = env.add_object(block_urdf, block_pose) block_ids.append(block_id) # Add goals. for i in range(3): self.add_goal(objs=[block_ids[i]], matches=np.ones((1, 1)), targ_poses=[zone_poses[i]], replace=False, rotations=False, metric='zone', params=[(zone_poses[i], zone_size)], step_max_reward=1/3) self.lang_goals.append(self.lang_template)``` END" " ""color-ordered-blocks-on-pallet"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-ordered-blocks-on-pallet"" in a python code block. ### "," color-ordered-blocks-on-pallet: {'task-name': 'color-ordered-blocks-on-pallet', 'task-description': 'On a table there are six different colored blocks (red, blue, green, yellow, orange, and purple), a pallet, and a small corner structure. These colored blocks are arranged randomly within the small corner structure. The task involves picking up each colored block and placing it onto the pallet in specific color sequence: red, blue, green, yellow, orange, and finally purple.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf', 'corner/corner-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorOrderedBlocksOnPallet(Task): """"""Pick up each colored block and place it onto the pallet in specific color sequence: red, blue, green, yellow, orange, and finally purple."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""place the colored blocks onto the pallet in the following order: red, blue, green, yellow, orange, and purple"" self.task_completed_desc = ""done placing blocks on the pallet."" self.additional_reset() def reset(self, env): super().reset(env) # Add pallet. # x, y, z dimensions for the asset size pallet_size = (0.15, 0.15, 0.02) pallet_urdf = 'pallet/pallet.urdf' pallet_pose = self.get_random_pose(env, pallet_size) env.add_object(pallet_urdf, pallet_pose, 'fixed') # Block colors. colors = [ utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow'], utils.COLORS['orange'], utils.COLORS['purple'] ] # Add blocks. # x, y, z dimensions for the asset size block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' blocks = [] for i in range(6): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=colors[i]) blocks.append(block_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.03), (0, 0, 0.03), (0, 0.05, 0.03), (0, -0.025, 0.08), (0, 0.025, 0.08), (0, 0, 0.13)] targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos] # Goal: blocks are placed on the pallet in the order of red, blue, green, yellow, orange, purple. for i in range(6): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[targs[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 6, symmetries=[np.pi/2]) self.lang_goals.append(self.lang_template)``` END" " ""color-ordered-container-arrangement"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-ordered-container-arrangement"" in a python code block. ### "," color-ordered-container-arrangement: {'task-name': 'color-ordered-container-arrangement', 'task-description': 'On the tabletop, there are six containers and six blocks of different colors (red, blue, green, yellow, orange, purple). The task is to pick up each block and place it into a container of the same color, then arrange the containers in a line in the following color order: red, blue, green, yellow, orange, and purple.', 'assets-used': ['block/block.urdf', 'container/container-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorOrderedContainerArrangement(Task): """"""Arrange six containers with blocks of matching colors in a specific color order."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""arrange the containers in the color order: red, blue, green, yellow, orange, and purple"" self.task_completed_desc = ""done arranging containers."" self.additional_reset() def reset(self, env): super().reset(env) # Define color order color_order = ['red', 'blue', 'green', 'yellow', 'orange', 'purple'] # Add containers and blocks container_size = (0.12, 0.12, 0.02) block_size = (0.04, 0.04, 0.04) container_urdf = 'container/container-template.urdf' block_urdf = 'block/block.urdf' containers = [] blocks = [] for color in color_order: # Add container container_pose = self.get_random_pose(env, container_size) container_id = env.add_object(container_urdf, container_pose, color=utils.COLORS[color]) containers.append(container_id) # Add block block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color]) blocks.append(block_id) # Add subgoal to place block in container self.add_goal(objs=[block_id], matches=np.ones((1, 1)), targ_poses=[container_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/6) # Add final goal to arrange containers in color order container_poses = [self.get_random_pose(env, container_size) for _ in color_order] self.add_goal(objs=containers, matches=np.eye(len(color_order)), targ_poses=container_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1) self.lang_goals.append(self.lang_template)``` END" " ""multi-level-pyramid-construction"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""multi-level-pyramid-construction"" in a python code block. ### "," multi-level-pyramid-construction: {'task-name': 'multi-level-pyramid-construction', 'task-description': 'Construct a two-level pyramid on a pallet using six blocks: three green and three blue. The first level should be a triangle created by placing the green blocks side by side. The second level should be built by placing the blue blocks on top of the green blocks, forming another triangle rotated 60 degrees with respect to the first one. The challenge lies in the precise placement of blocks, maintaining balance of the structure, and correct color arrangement.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class MultiLevelPyramidConstruction(Task): """"""Construct a two-level pyramid on a pallet using six blocks: three green and three blue."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""Construct a two-level pyramid on a pallet using six blocks: three green and three blue. The first level should be a triangle created by placing the green blocks side by side. The second level should be built by placing the blue blocks on top of the green blocks, forming another triangle rotated 60 degrees with respect to the first one."" self.task_completed_desc = ""done constructing pyramid."" self.additional_reset() def reset(self, env): super().reset(env) # Add pallet. pallet_size = (0.35, 0.35, 0.01) # x, y, z dimensions for the pallet size pallet_pose = self.get_random_pose(env, pallet_size) pallet_urdf = 'pallet/pallet.urdf' env.add_object(pallet_urdf, pallet_pose, 'fixed') # Add blocks. block_size = (0.04, 0.04, 0.04) # x, y, z dimensions for the block size block_urdf = 'block/block.urdf' block_colors = [utils.COLORS['green']] * 3 + [utils.COLORS['blue']] * 3 # three green and three blue blocks blocks = [] for color in block_colors: block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=color) blocks.append(block_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.02), (0, 0, 0.02), (0, 0.05, 0.02), # first level (0, -0.025, 0.06), (0, 0.025, 0.06), (0, 0, 0.10)] # second level targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos] # Goal: blocks are stacked in a pyramid (first level: green blocks). self.add_goal(objs=blocks[:3], matches=np.ones((3, 3)), targ_poses=targs[:3], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]*3) self.lang_goals.append(self.lang_template.format(blocks=""the green blocks"", row=""bottom"")) # Goal: blocks are stacked in a pyramid (second level: blue blocks). self.add_goal(objs=blocks[3:], matches=np.ones((3, 3)), targ_poses=targs[3:], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]*3) self.lang_goals.append(self.lang_template.format(blocks=""the blue blocks"", row=""top""))``` END" " ""align-balls-in-colored-boxes"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""align-balls-in-colored-boxes"" in a python code block. ### "," align-balls-in-colored-boxes: {'task-name': 'align-balls-in-colored-boxes', 'task-description': 'On a tabletop, there are four balls and four boxes of different colors (red, blue, green, and yellow). Each ball is inside a box, but not corresponding to the color of the box. The task is to pick up each ball and place it in the box of the same color, in the specific sequence of red, blue, green and yellow from left to right. The challenge lies in the precise placement, color matching and sequence following.', 'assets-used': ['ball/ball.urdf', 'box/box-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class AlignBallsInColoredBoxes(Task): """"""Align balls in colored boxes according to the color and sequence."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""put the {color} ball in the {color} box"" self.task_completed_desc = ""done aligning balls in boxes."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and their sequence colors = ['red', 'blue', 'green', 'yellow'] color_sequence = np.random.permutation(colors) # Add boxes. box_size = (0.12, 0.12, 0.12) box_urdf = 'box/box-template.urdf' box_poses = [] boxes = [] for i in range(4): box_pose = self.get_random_pose(env, box_size) box_id = env.add_object(box_urdf, box_pose, color=utils.COLORS[color_sequence[i]]) boxes.append(box_id) box_poses.append(box_pose) # Add balls. ball_size = (0.04, 0.04, 0.04) ball_urdf = 'ball/ball.urdf' balls = [] for i in range(4): ball_pose = self.get_random_pose(env, ball_size) ball_id = env.add_object(ball_urdf, ball_pose, color=utils.COLORS[colors[i]]) balls.append(ball_id) # Goal: each ball is in the box of the same color. for i in range(4): self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[box_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-coordinated-pyramid-in-container"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-pyramid-in-container"" in a python code block. ### "," color-coordinated-pyramid-in-container: {'task-name': 'color-coordinated-pyramid-in-container', 'task-description': 'There are six blocks of three different colors (red, blue, green) and three containers of matching colors. The task involves picking up each color of blocks and placing them in the container of the same color in a pyramid formation, with two blocks at the base and one block on top. The challenge lies in the precise placement of blocks, maintaining balance of the pyramid, and color coordination.', 'assets-used': ['block/block.urdf', 'container/container-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedPyramidInContainer(Task): """"""Pick up each color of blocks and place them in the container of the same color in a pyramid formation."""""" def __init__(self): super().__init__() self.max_steps = 15 self.lang_template = ""build a pyramid of {color} blocks in the {color} container"" self.task_completed_desc = ""done building color-coordinated pyramids."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and corresponding names colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green']] color_names = ['red', 'blue', 'green'] # Add containers. container_size = (0.15, 0.15, 0.05) container_urdf = 'container/container-template.urdf' container_poses = [] for color in colors: container_pose = self.get_random_pose(env, container_size) env.add_object(container_urdf, container_pose, 'fixed', color=color) container_poses.append(container_pose) # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' blocks = [] for color in colors: for _ in range(3): # 3 blocks of each color block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=color) blocks.append(block_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.02), (0, 0.05, 0.02), (0, 0, 0.06)] targs = [(utils.apply(container_pose, i), container_pose[1]) for i in place_pos for container_pose in container_poses] # Goal: blocks are stacked in a pyramid in the container of the same color. for i, color_name in enumerate(color_names): self.add_goal(objs=blocks[i*3:(i+1)*3], matches=np.ones((3, 3)), targ_poses=targs[i*3:(i+1)*3], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]*3) self.lang_goals.append(self.lang_template.format(color=color_name))``` END" " ""colored-balls-sorting-in-corner"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""colored-balls-sorting-in-corner"" in a python code block. ### "," colored-balls-sorting-in-corner: {'task-name': 'colored-balls-sorting-in-corner', 'task-description': 'There are four balls and four corners of different colors (red, blue, green, and yellow). Each ball is located at a corner, but not corresponding to the color of the corner. The task is to pick up each ball and place it in the corner of the same color, in the specific sequence of red, blue, green and yellow, starting from the leftmost corner to the rightmost. The challenge lies in the precise placement, color matching and sequence following.', 'assets-used': ['ball/ball-template.urdf', 'corner/corner-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColoredBallsSortingInCorner(Task): """"""Pick up each ball and place it in the corner of the same color, in the specific sequence of red, blue, green and yellow, starting from the leftmost corner to the rightmost."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""place the {color} ball in the {color} corner"" self.task_completed_desc = ""done sorting balls."" self.additional_reset() def reset(self, env): super().reset(env) # Define the colors and their sequence colors = ['red', 'blue', 'green', 'yellow'] # Add corners. corner_size = (0.12, 0.12, 0) corner_urdf = 'corner/corner-template.urdf' corner_poses = [] for i in range(4): corner_pose = self.get_random_pose(env, corner_size) env.add_object(corner_urdf, corner_pose, 'fixed', color=utils.COLORS[colors[i]]) corner_poses.append(corner_pose) # Add balls. ball_size = (0.04, 0.04, 0.04) ball_urdf = 'ball/ball-template.urdf' balls = [] for i in range(4): ball_pose = self.get_random_pose(env, ball_size) ball_id = env.add_object(ball_urdf, ball_pose, color=utils.COLORS[colors[i]]) balls.append(ball_id) # Goal: each ball is in the corner of the same color. for i in range(4): self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[corner_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-coordinated-ball-insertion"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-ball-insertion"" in a python code block. ### "," color-coordinated-ball-insertion: {'task-name': 'color-coordinated-ball-insertion', 'task-description': 'There are five differently-colored ell objects (red, blue, green, yellow, orange) and five sphere-shaped containers of matching colors. The task involves picking up each ell object and inserting it into the sphere container of the same color, but in a specific sequence from left to right: red, blue, green, yellow, and finally orange. The task is challenging due to the sequence, color coordination, and accuracy of insertion required.', 'assets-used': ['insertion/ell.urdf', 'sphere/sphere-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCoordinatedBallInsertion(Task): """"""Insert balls into the cylinders of the same color in the order of red, blue, green, and yellow."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""insert the {color} ball into the {color} cylinder"" self.task_completed_desc = ""done inserting balls into cylinders."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and their order colors = ['red', 'blue', 'green', 'yellow'] # Add cylinders. # x, y, z dimensions for the asset size cylinder_size = (0.05, 0.05, 0.1) cylinder_urdf = 'cylinder/cylinder-template.urdf' cylinder_poses = [] for i in range(4): cylinder_pose = self.get_random_pose(env, cylinder_size) env.add_object(cylinder_urdf, cylinder_pose, category='fixed', color=utils.COLORS[colors[i]]) cylinder_poses.append(cylinder_pose) # Add balls. # x, y, z dimensions for the asset size balls = [] ball_size = (0.04, 0.04, 0.04) ball_urdf = 'ball/ball-template.urdf' for i in range(4): ball_pose = self.get_random_pose(env, ball_size) ball_id = env.add_object(ball_urdf, ball_pose, color=utils.COLORS[colors[i]]) balls.append(ball_id) # Goal: each ball is in the corresponding color cylinder. for i in range(4): self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[cylinder_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-sequenced-pyramid-packing"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-sequenced-pyramid-packing"" in a python code block. ### "," color-sequenced-pyramid-packing: {'task-name': 'color-sequenced-pyramid-packing', 'task-description': 'There are twelve cubes of different colors (three red, three green, three blue, and three yellow) scattered on the tabletop. The task is to pick up the cubes, sort them according to color into four pallets, and stack them in each pallet as a pyramid with the base layer containing two cubes and the top layer containing one cube. The challenge lies in the color-based sorting, the precise placement of cubes, and the construction of the pyramid in each pallet.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorSequencedPyramidPacking(Task): """"""Sort cubes by color into four pallets and stack them in each pallet as a pyramid"""""" def __init__(self): super().__init__() self.max_steps = 12 self.lang_template = ""sort the {color} cubes into the pallet and stack them as a pyramid"" self.task_completed_desc = ""done sorting and stacking cubes."" self.additional_reset() def reset(self, env): super().reset(env) # Add pallets. # x, y, z dimensions for the asset size pallet_size = (0.15, 0.15, 0.02) pallet_urdf = 'pallet/pallet.urdf' pallet_poses = [] for _ in range(4): pallet_pose = self.get_random_pose(env, pallet_size) env.add_object(pallet_urdf, pallet_pose, category='fixed') pallet_poses.append(pallet_pose) # Cube colors. colors = [ utils.COLORS['red'], utils.COLORS['green'], utils.COLORS['blue'], utils.COLORS['yellow'] ] # Add cubes. # x, y, z dimensions for the asset size cube_size = (0.04, 0.04, 0.04) cube_urdf = 'block/block.urdf' objs = [] for i in range(12): cube_pose = self.get_random_pose(env, cube_size) cube_id = env.add_object(cube_urdf, cube_pose, color=colors[i%4]) objs.append(cube_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.03), (0, 0, 0.03), (0, 0.05, 0.03), (0, -0.025, 0.08), (0, 0.025, 0.08), (0, 0, 0.13)] targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos for pallet_pose in pallet_poses] # Goal: cubes are sorted by color and stacked in a pyramid in each pallet. for i in range(4): self.add_goal(objs=objs[i*3:(i+1)*3], matches=np.ones((3, 3)), targ_poses=targs[i*3:(i+1)*3], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4, symmetries=[np.pi/2]*3) self.lang_goals.append(self.lang_template.format(color=list(utils.COLORS.keys())[i]))``` END" " ""color-block-ball-goal"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-block-ball-goal"" in a python code block. ### "," color-block-ball-goal: {'task-name': 'color-block-ball-goal', 'task-description': 'On a tabletop, there are four zones marked in four different colors (red, blue, green, and yellow) and four balls of matching colors. The task involves picking up each ball and precisely placing it in the zone of the same color. However, there are several small blocks randomly scattered in the path between the balls and the zones. The robot has to strategically navigate around these blocks without knocking them over while transporting the balls to the corresponding zones. The challenge lies in the precise navigation, placement of the balls, and color matching while avoiding the blocks.', 'assets-used': ['zone/zone.urdf', 'ball/ball-template.urdf', 'block/small.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorBlockBallGoal(Task): """"""Pick up each ball and precisely place it in the zone of the same color. Navigate around blocks without knocking them over."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""place the {color} ball in the {color} zone"" self.task_completed_desc = ""done placing balls in zones."" self.additional_reset() def reset(self, env): super().reset(env) # Add zones. zone_size = (0.12, 0.12, 0) zone_urdf = 'zone/zone.urdf' zone_colors = ['red', 'blue', 'green', 'yellow'] zone_poses = [] for color in zone_colors: zone_pose = self.get_random_pose(env, zone_size) env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[color]) zone_poses.append(zone_pose) # Add balls. balls = [] ball_size = (0.04, 0.04, 0.04) ball_urdf = 'ball/ball-template.urdf' for color in zone_colors: ball_pose = self.get_random_pose(env, ball_size) ball_id = env.add_object(ball_urdf, ball_pose, color=utils.COLORS[color]) balls.append(ball_id) # Add blocks. blocks = [] block_size = (0.04, 0.04, 0.04) block_urdf = 'block/small.urdf' for _ in range(10): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose) blocks.append(block_id) # Goal: each ball is in a zone of the same color. for i in range(len(balls)): self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[zone_poses[i]], replace=False, rotations=False, metric='pose', params=None, step_max_reward=1/len(balls)) self.lang_goals.append(self.lang_template.format(color=zone_colors[i]))``` END" " ""ball-sorting-with-blocks-barrier"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""ball-sorting-with-blocks-barrier"" in a python code block. ### "," ball-sorting-with-blocks-barrier: {'task-name': 'ball-sorting-with-blocks-barrier', 'task-description': 'On a tabletop, there are four balls and four zones of different colors (red, blue, green, and yellow). Each ball is located behind a line of small blocks of the same color. The task is to pick up each ball and place it into the zone of the same color, but without knocking over the blocks. The challenge lies in the precise navigation over the block barriers and color matching.', 'assets-used': ['ball/ball-template.urdf', 'zone/zone.urdf', 'block/small.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class BallSortingWithBlocksBarrier(Task): """"""Pick up each ball and place it into the zone of the same color, but without knocking over the blocks."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""place the {color} ball in the {color} zone without knocking over the blocks"" self.task_completed_desc = ""done sorting balls."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors for the balls and zones colors = ['red', 'blue', 'green', 'yellow'] # Add zones and blocks. zone_size = (0.12, 0.12, 0) block_size = (0.04, 0.04, 0.04) block_urdf = 'block/small.urdf' zone_urdf = 'zone/zone.urdf' zones = [] blocks = [] for color in colors: # Add zone of specific color zone_pose = self.get_random_pose(env, zone_size) env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[color]) zones.append(zone_pose) # Add line of blocks of the same color for _ in range(5): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color]) blocks.append(block_id) # Add balls. ball_size = (0.04, 0.04, 0.04) ball_urdf = 'ball/ball-template.urdf' balls = [] for color in colors: ball_pose = self.get_random_pose(env, ball_size) ball_id = env.add_object(ball_urdf, ball_pose, color=utils.COLORS[color]) balls.append(ball_id) # Goal: each ball is in a zone of the same color. for i in range(len(balls)): self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[zones[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(balls)) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-matched-blocks-insertion"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-matched-blocks-insertion"" in a python code block. ### "," color-matched-blocks-insertion: {'task-name': 'color-matched-blocks-insertion', 'task-description': 'There are four blocks and four fixtures of different colors (red, blue, green, and yellow). The task involves picking up each block and inserting it into the fixture of the same color, in the specific sequence of red, blue, green, and yellow, starting from the leftmost fixture to the rightmost. The challenge lies in the precise insertion, color matching and sequence following.', 'assets-used': ['insertion/ell.urdf', 'insertion/fixture.urdf', 'block/block.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorMatchedBlocksInsertion(Task): """"""Pick up each block and insert it into the fixture of the same color, in the specific sequence of red, blue, green, and yellow."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""insert the {color} block into the {color} fixture"" self.task_completed_desc = ""done inserting blocks into fixtures."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and their sequence colors = ['red', 'blue', 'green', 'yellow'] color_sequence = np.random.permutation(colors) # Add fixtures. fixture_size = (0.12, 0.12, 0.02) fixture_urdf = 'insertion/fixture.urdf' fixture_poses = [] for i in range(4): fixture_pose = self.get_random_pose(env, fixture_size) env.add_object(fixture_urdf, fixture_pose, 'fixed', color=utils.COLORS[color_sequence[i]]) fixture_poses.append(fixture_pose) # Add blocks. blocks = [] block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' for i in range(4): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color_sequence[i]]) blocks.append(block_id) # Goal: each block is in the fixture of the same color. for i in range(4): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[fixture_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(self.lang_template.format(color=color_sequence[i]))``` END" " ""color-coordinated-block-bridge"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-block-bridge"" in a python code block. ### "," color-coordinated-block-bridge: {'task-name': 'color-coordinated-block-bridge', 'task-description': 'Construct a bridge by interleaving three differently colored blocks (red, blue, and green) on a pallet in a specific sequence - red block at the edges, blue block in the middle, and a green block on top of the red and blue blocks. Repeat this sequence until a bridge is formed across the length of the pallet.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedBlockBridge(Task): """"""Construct a bridge by interleaving three differently colored blocks (red, blue, and green) on a pallet in a specific sequence - red block at the edges, blue block in the middle, and a green block on top of the red and blue blocks. Repeat this sequence until a bridge is formed across the length of the pallet."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""construct a bridge by interleaving three differently colored blocks (red, blue, and green) on a pallet in a specific sequence"" self.task_completed_desc = ""done constructing the bridge."" self.additional_reset() def reset(self, env): super().reset(env) # Add pallet. pallet_size = (0.30, 0.15, 0.02) pallet_pose = self.get_random_pose(env, pallet_size) env.add_object('pallet/pallet.urdf', pallet_pose, 'fixed') # Block colors. colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green']] # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' objs = [] for i in range(9): # 3 sets of 3 colored blocks block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=colors[i % 3]) objs.append(block_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.02), (0, 0, 0.02), (0, 0.05, 0.02), # bottom layer (0, -0.05, 0.06), (0, 0, 0.06), (0, 0.05, 0.06), # middle layer (0, -0.05, 0.10), (0, 0, 0.10), (0, 0.05, 0.10)] # top layer targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos] # Goal: blocks are stacked in a bridge (bottom layer: red, blue, red). self.add_goal(objs=objs[:3], matches=np.ones((3, 3)), targ_poses=targs[:3], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]*3) # Goal: blocks are stacked in a bridge (middle layer: green, green, green). self.add_goal(objs=objs[3:6], matches=np.ones((3, 3)), targ_poses=targs[3:6], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]*3) # Goal: blocks are stacked in a bridge (top layer: red, blue, red). self.add_goal(objs=objs[6:], matches=np.ones((3, 3)), targ_poses=targs[6:], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]*3)``` END" " ""insert-red-block-into-cylinder"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""insert-red-block-into-cylinder"" in a python code block. ### "," insert-red-block-into-cylinder: {'task-name': 'insert-red-block-into-cylinder', 'task-description': ""Position a red block ('insertion/ell.urdf') in front of a cylindrical fixture ('insertion/fixture.urdf'), then insert the red block into the cylinder. The challenge includes precision in positioning the block and the correct insertion into the fixture."", 'assets-used': ['insertion/ell.urdf', 'insertion/fixture.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class InsertRedBlockIntoCylinder(Task): """"""Insert a red block into a cylindrical fixture."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""insert the red block into the cylinder"" self.task_completed_desc = ""done inserting block into cylinder."" self.additional_reset() def reset(self, env): super().reset(env) # Add cylinder fixture. # x, y, z dimensions for the asset size fixture_size = (0.12, 0.12, 0.12) fixture_urdf = 'insertion/fixture.urdf' fixture_pose = self.get_random_pose(env, fixture_size) env.add_object(fixture_urdf, fixture_pose, category='fixed') # Add red block. # x, y, z dimensions for the asset size block_size = (0.04, 0.04, 0.04) block_urdf = 'insertion/ell.urdf' block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS['red']) # Goal: the red block is inside the cylindrical fixture. self.add_goal(objs=[block_id], matches=np.ones((1, 1)), targ_poses=[fixture_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1) self.lang_goals.append(self.lang_template)``` END" " ""color-sequential-ball-container-sorting"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-sequential-ball-container-sorting"" in a python code block. ### "," color-sequential-ball-container-sorting: {'task-name': 'color-sequential-ball-container-sorting', 'task-description': 'There are six balls of different colors (red, blue, green, yellow, orange, and purple) and six containers of matching colors. The task is to pick up each ball and place it in the container of the same color, but in a specific sequence of red, blue, green, yellow, orange, and purple from left to right. The challenge lies in the precise placement, color matching and sequence following.', 'assets-used': ['ball/ball-template.urdf', 'container/container-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorSequentialBallContainerSorting(Task): """"""Pick up each ball and place it in the container of the same color, but in a specific sequence of red, blue, green, yellow, orange, and purple from left to right."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""place the {color} ball in the {color} container"" self.task_completed_desc = ""done sorting balls into containers."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and their sequence colors = ['red', 'blue', 'green', 'yellow', 'orange', 'purple'] color_sequence = np.arange(len(colors)) # Add containers. container_size = (0.12, 0.12, 0) container_urdf = 'container/container-template.urdf' container_poses = [] for i in range(len(colors)): container_pose = self.get_random_pose(env, container_size) env.add_object(container_urdf, container_pose, color=utils.COLORS[colors[i]], category='fixed') container_poses.append(container_pose) # Add balls. balls = [] ball_size = (0.04, 0.04, 0.04) ball_urdf = 'ball/ball-template.urdf' for i in range(len(colors)): ball_pose = self.get_random_pose(env, ball_size) ball_id = env.add_object(ball_urdf, ball_pose, color=utils.COLORS[colors[i]]) balls.append(ball_id) # Goal: each ball is in a container of the same color, in the correct sequence. for i in range(len(colors)): self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[container_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(colors)) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-coordinated-cylinder-pyramid"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-cylinder-pyramid"" in a python code block. ### "," color-coordinated-cylinder-pyramid: {'task-name': 'color-coordinated-cylinder-pyramid', 'task-description': 'Construct a pyramid on a pallet using four cylinders of different colors (red, blue, green, and yellow). The first level should consist of a red cylinder and a blue cylinder side by side. The second level should consist of a green cylinder placed on top of the red and blue cylinders. The third and final level should consist of a yellow cylinder placed on top of the green cylinder. The challenge lies in the precise placement of cylinders, maintaining the balance of the structure, and correct color arrangement.', 'assets-used': ['cylinder/cylinder-template.urdf', 'pallet/pallet.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCoordinatedCylinderPyramid(Task): """"""Construct a pyramid on a pallet using four cylinders of different colors (red, blue, green, and yellow)."""""" def __init__(self): super().__init__() self.max_steps = 12 self.lang_template = ""make the {row} row with {cylinder}"" self.task_completed_desc = ""done stacking cylinder pyramid."" self.additional_reset() def reset(self, env): super().reset(env) # Add pallet. pallet_size = (0.15, 0.15, 0.005) pallet_urdf = 'pallet/pallet.urdf' pallet_pose = self.get_random_pose(env, pallet_size) env.add_object(pallet_urdf, pallet_pose, category='fixed') # Cylinder colors. colors = [ utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow'] ] # Add cylinders. # x, y, z dimensions for the asset size cylinder_size = (0.04, 0.04, 0.04) cylinder_urdf = 'cylinder/cylinder-template.urdf' cylinders = [] for i in range(4): cylinder_pose = self.get_random_pose(env, cylinder_size) cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=colors[i]) cylinders.append(cylinder_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.03), (0, 0.05, 0.03), (0, 0, 0.08), (0, 0, 0.13)] targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos] # Goal: cylinders are stacked in a pyramid (bottom row: red, blue). self.add_goal(objs=cylinders[:2], matches=np.ones((2, 2)), targ_poses=targs[:2], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]*2) self.lang_goals.append(self.lang_template.format(cylinder=""the red and blue cylinders"", row=""bottom"")) # Goal: cylinders are stacked in a pyramid (middle row: green). self.add_goal(objs=cylinders[2:3], matches=np.ones((1, 1)), targ_poses=targs[2:3], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]*1) self.lang_goals.append(self.lang_template.format(cylinder=""the green cylinder"", row=""middle"")) # Goal: cylinders are stacked in a pyramid (top row: yellow). self.add_goal(objs=cylinders[3:], matches=np.ones((1, 1)), targ_poses=targs[3:], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4, symmetries=[np.pi/2]*1) self.lang_goals.append(self.lang_template.format(cylinder=""the yellow cylinder"", row=""top""))``` END" " ""cylinder-sorting-with-zone"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""cylinder-sorting-with-zone"" in a python code block. ### "," cylinder-sorting-with-zone: {'task-name': 'cylinder-sorting-with-zone', 'task-description': 'On a tabletop, there are four colored cylinders (red, blue, green, and yellow) and four zones of different colors (red, blue, green, and yellow). Each cylinder is located at a zone, but not corresponding to the color of the zone. The task is to pick up each cylinder and place it in the zone of the same color, in the specific sequence of red, blue, green and yellow from left to right.', 'assets-used': ['cylinder/cylinder-template.urdf', 'zone/zone.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class CylinderSortingWithZone(Task): """"""Pick up each cylinder and place it in the zone of the same color, in the specific sequence of red, blue, green and yellow from left to right."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""place the {color} cylinder in the {color} zone"" self.task_completed_desc = ""done sorting cylinders."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and their sequence colors = ['red', 'blue', 'green', 'yellow'] color_sequence = np.arange(len(colors)) # Add zones. zone_size = (0.12, 0.12, 0) zone_urdf = 'zone/zone.urdf' zone_poses = [] for i in color_sequence: zone_pose = self.get_random_pose(env, zone_size) env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[colors[i]]) zone_poses.append(zone_pose) # Add cylinders. cylinders = [] cylinder_size = (0.04, 0.04, 0.04) cylinder_urdf = 'cylinder/cylinder-template.urdf' for i in color_sequence: cylinder_pose = self.get_random_pose(env, cylinder_size) cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=utils.COLORS[colors[i]]) cylinders.append(cylinder_id) # Goal: each cylinder is in the zone of the same color. self.add_goal(objs=cylinders, matches=np.eye(len(cylinders)), targ_poses=zone_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1) for i in color_sequence: self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-coordinated-ball-placement"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-ball-placement"" in a python code block. ### "," color-coordinated-ball-placement: {'task-name': 'color-coordinated-ball-placement', 'task-description': 'There are three zones marked in three different colors (red, blue, and green) and three balls of matching colors. The task involves picking up each ball and precisely placing it in the zone of the same color. However, there are a few small blocks randomly scattered in the path between the balls and the zones. The robot has to strategically navigate around these blocks without knocking them over while transporting the balls to the corresponding zones. To add to the complexity, the robot must place the balls in each zone in a specific order: red, blue, and then green from left to right. The challenge lies in the precise navigation, placement of the balls, color matching and sequence following while avoiding the blocks.', 'assets-used': ['zone/zone.urdf', 'ball/ball-template.urdf', 'block/small.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCoordinatedBallPlacement(Task): """"""Pick up each ball and precisely place it in the zone of the same color. The robot must place the balls in each zone in a specific order: red, blue, and then green."""""" def __init__(self): super().__init__() self.max_steps = 15 self.lang_template = ""place the {color} ball in the {color} zone"" self.task_completed_desc = ""done placing balls in zones."" self.additional_reset() def reset(self, env): super().reset(env) # Add zones. zone_size = (0.12, 0.12, 0) zone_urdf = 'zone/zone.urdf' zone_colors = ['red', 'blue', 'green'] zone_poses = [] for color in zone_colors: zone_pose = self.get_random_pose(env, zone_size) env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[color]) zone_poses.append(zone_pose) # Add balls. ball_size = (0.04, 0.04, 0.04) ball_urdf = 'ball/ball-template.urdf' balls = [] for color in zone_colors: ball_pose = self.get_random_pose(env, ball_size) ball_id = env.add_object(ball_urdf, ball_pose, color=utils.COLORS[color]) balls.append(ball_id) # Add blocks as obstacles. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/small.urdf' for _ in range(5): block_pose = self.get_random_pose(env, block_size) env.add_object(block_urdf, block_pose) # Goal: each ball is in the zone of the same color. for i in range(len(balls)): self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[zone_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/3) self.lang_goals.append(self.lang_template.format(color=zone_colors[i]))``` END" " ""sweep-and-sort-blocks"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""sweep-and-sort-blocks"" in a python code block. ### "," sweep-and-sort-blocks: {'task-name': 'sweep-and-sort-blocks', 'task-description': 'Sweep a pile of small blocks of different colors (red, blue, green, and yellow) into their corresponding colored zones marked on the tabletop. The challenge lies in the sweeping action, precise placement, and color coordination.', 'assets-used': ['zone/zone.urdf', 'block/small.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils class SweepAndSortBlocks(Task): """"""Sweep a pile of small blocks of different colors (red, blue, green, and yellow) into their corresponding colored zones marked on the tabletop."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""sweep the pile of {color} blocks into the {color} square"" self.task_completed_desc = ""done sweeping and sorting."" self.primitive = primitives.push self.ee = Spatula self.additional_reset() def reset(self, env): super().reset(env) # Add colored zones. zone_size = (0.12, 0.12, 0) zone_urdf = 'zone/zone.urdf' colors = ['red', 'blue', 'green', 'yellow'] zone_poses = [] for color in colors: zone_pose = self.get_random_pose(env, zone_size) env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[color]) zone_poses.append(zone_pose) # Add piles of colored blocks. block_urdf = 'block/small.urdf' block_size = (0.04, 0.04, 0.04) piles = [] for color in colors: pile = [] for _ in range(10): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color]) pile.append(block_id) piles.append(pile) # Add goals for each color. for i, color in enumerate(colors): self.add_goal(objs=piles[i], matches=np.ones((10, 1)), targ_poses=[zone_poses[i]], replace=True, rotations=False, metric='zone', params=[(zone_poses[i], zone_size)], step_max_reward=1) self.lang_goals.append(self.lang_template.format(color=color))``` END" " ""align-cylinders-in-zones"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""align-cylinders-in-zones"" in a python code block. ### "," align-cylinders-in-zones: {'task-name': 'align-cylinders-in-zones', 'task-description': 'Place four differently colored cylinders (red, blue, green, yellow) each into a matching colored zone. But, the zones are surrounded by small blocks, which the robot needs to move out of the way without knocking them out of their respective zones. The challenge includes precise placement of cylinders, color matching, and careful navigation around the small blocks.', 'assets-used': ['cylinder/cylinder-template.urdf', 'zone/zone.urdf', 'block/small.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class AlignCylindersInZones(Task): """"""Place four differently colored cylinders each into a matching colored zone. The zones are surrounded by small blocks, which the robot needs to move out of the way without knocking them out of their respective zones."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""place the {color} cylinder in the {color} zone"" self.task_completed_desc = ""done aligning cylinders."" self.additional_reset() def reset(self, env): super().reset(env) # Cylinder colors. colors = ['red', 'blue', 'green', 'yellow'] # Add cylinders. # x, y, z dimensions for the asset size cylinder_size = (0.04, 0.04, 0.04) cylinder_urdf = 'cylinder/cylinder-template.urdf' cylinders = [] for i in range(4): cylinder_pose = self.get_random_pose(env, cylinder_size) cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=utils.COLORS[colors[i]]) cylinders.append(cylinder_id) # Add zones. # x, y, z dimensions for the asset size zone_size = (0.12, 0.12, 0) zone_urdf = 'zone/zone.urdf' zones = [] for i in range(4): zone_pose = self.get_random_pose(env, zone_size) env.add_object(zone_urdf, zone_pose, color=utils.COLORS[colors[i]], category='fixed') zones.append(zone_pose) # Add small blocks around the zones. # x, y, z dimensions for the asset size block_size = (0.02, 0.02, 0.02) block_urdf = 'block/small.urdf' for _ in range(16): block_pose = self.get_random_pose(env, block_size) env.add_object(block_urdf, block_pose) # Goal: each cylinder is in a matching colored zone. for i in range(4): self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[zones[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""sphere-container-color-match"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""sphere-container-color-match"" in a python code block. ### "," sphere-container-color-match: {'task-name': 'sphere-container-color-match', 'task-description': 'On a tabletop, there are four spheres of different colors (red, blue, green, and yellow) inside four containers of a different color (red, blue, green, and yellow). The task is to pick up each sphere and place it into a container of the same color. The task is challenging due to the manipulation of spherical objects and the color coordination required.', 'assets-used': ['sphere/sphere.urdf', 'container/container-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class SphereContainerColorMatch(Task): """"""Pick up each sphere and place it into a container of the same color."""""" def __init__(self): super().__init__() self.max_steps = 4 self.lang_template = ""put the {color} sphere in the {color} container"" self.task_completed_desc = ""done matching spheres and containers."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and corresponding names colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow']] color_names = ['red', 'blue', 'green', 'yellow'] # Add containers. container_size = (0.12, 0.12, 0.12) container_urdf = 'container/container-template.urdf' containers = [] for i in range(4): container_pose = self.get_random_pose(env, container_size) container_id = env.add_object(container_urdf, container_pose, color=colors[i]) containers.append(container_id) # Add spheres. sphere_size = (0.04, 0.04, 0.04) sphere_urdf = 'sphere/sphere.urdf' spheres = [] for i in range(4): sphere_pose = self.get_random_pose(env, sphere_size) sphere_id = env.add_object(sphere_urdf, sphere_pose, color=colors[i]) spheres.append(sphere_id) # Goal: each sphere is in a container of the same color. for i in range(4): self.add_goal(objs=[spheres[i]], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(containers[i])], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(self.lang_template.format(color=color_names[i]))``` END" " ""insertion-and-color-sorting"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""insertion-and-color-sorting"" in a python code block. ### "," insertion-and-color-sorting: {'task-name': 'insertion-and-color-sorting', 'task-description': 'On the tabletop, there are two fixtures and four Ell-shaped blocks of different colors (red, blue, green, and yellow). The task is to pick up each block and insert it into a fixture of the same color, then arrange the fixtures in a line in the following color order: red, blue, green, yellow. The challenge lies in the precise insertion, color matching, and sequence following.', 'assets-used': ['insertion/ell.urdf', 'insertion/fixture.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class InsertionAndColorSorting(Task): """"""Pick up each Ell-shaped block, insert it into a fixture of the same color, then arrange the fixtures in a line in the following color order: red, blue, green, yellow."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""insert the {color} block into the {color} fixture and arrange the fixtures in color order"" self.task_completed_desc = ""done inserting and sorting."" self.additional_reset() def reset(self, env): super().reset(env) # Ell-shaped block colors. colors = ['red', 'blue', 'green', 'yellow'] # Add Ell-shaped blocks. block_size = (0.04, 0.04, 0.04) # x, y, z dimensions for the block size block_urdf = 'insertion/ell.urdf' # URDF file for Ell-shaped block blocks = [] for color in colors: block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=color) blocks.append(block_id) # Add fixtures. fixture_size = (0.05, 0.05, 0.05) # x, y, z dimensions for the fixture size fixture_urdf = 'insertion/fixture.urdf' # URDF file for fixture fixtures = [] for color in colors: fixture_pose = self.get_random_pose(env, fixture_size) fixture_id = env.add_object(fixture_urdf, fixture_pose, color=color) fixtures.append(fixture_id) # Goal: each block is inserted into a fixture of the same color. for i in range(len(blocks)): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[fixture_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / len(blocks)) self.lang_goals.append(self.lang_template.format(color=colors[i])) # Goal: fixtures are arranged in a line in color order. line_poses = [self.get_random_pose(env, fixture_size) for _ in range(len(fixtures))] line_poses.sort(key=lambda x: x[0]) # sort by x-coordinate to form a line for i in range(len(fixtures)): self.add_goal(objs=[fixtures[i]], matches=np.ones((1, 1)), targ_poses=[line_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / len(fixtures))``` END" " ""color-coordinated-cylinder-stack"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-cylinder-stack"" in a python code block. ### "," color-coordinated-cylinder-stack: {'task-name': 'color-coordinated-cylinder-stack', 'task-description': 'On the tabletop, there are four colored (red, blue, green, yellow) cylinders and four stands of corresponding colors. The task is to pick up each cylinder and stack it onto the stand of the same color - the red one at the bottom, followed by blue, green, and finally the yellow one at the top.', 'assets-used': ['cylinder/cylinder-template.urdf', 'stacking/stand.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCoordinatedCylinderStack(Task): """"""Stack cylinders on stands of the same color in a specific order."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""stack the cylinders on the stands of the same color in the order red, blue, green, yellow"" self.task_completed_desc = ""done stacking cylinders."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and corresponding names colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow']] color_names = ['red', 'blue', 'green', 'yellow'] # Add stands. # x, y, z dimensions for the asset size stand_size = (0.04, 0.04, 0.04) stand_urdf = 'stacking/stand.urdf' stands = [] for i in range(4): stand_pose = self.get_random_pose(env, stand_size) stand_id = env.add_object(stand_urdf, stand_pose, color=colors[i]) stands.append(stand_id) # Add cylinders. # x, y, z dimensions for the asset size cylinder_size = (0.04, 0.04, 0.04) cylinder_urdf = 'cylinder/cylinder-template.urdf' cylinders = [] for i in range(4): cylinder_pose = self.get_random_pose(env, cylinder_size) cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=colors[i]) cylinders.append(cylinder_id) # Goal: each cylinder is stacked on the stand of the same color in the order red, blue, green, yellow. for i in range(4): self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[stand_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(f""Place the {color_names[i]} cylinder on the {color_names[i]} stand."")``` END" " ""color-coordinated-container-insertion"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-container-insertion"" in a python code block. ### "," color-coordinated-container-insertion: {'task-name': 'color-coordinated-container-insertion', 'task-description': 'There are three containers and three ell shaped blocks of different colors (red, blue, green) on the table top. The task is to pick up the ell shaped blocks and insert each one of them into the container of the same color. However, the ell blocks should be inserted in a specific sequence - red first, then blue, and finally green. This task is challenging due to the precision required for insertion and the need for color coordination and sequencing.', 'assets-used': ['insertion/ell.urdf', 'container/container-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedContainerInsertion(Task): """"""Insert ell shaped blocks into the container of the same color in a specific sequence."""""" def __init__(self): super().__init__() self.max_steps = 3 self.lang_template = ""insert the {color} ell block into the {color} container"" self.task_completed_desc = ""done inserting ell blocks into containers."" self.additional_reset() def reset(self, env): super().reset(env) # Ell block and container colors. colors = ['red', 'blue', 'green'] # Add ell blocks and containers. ell_size = (0.04, 0.04, 0.04) ell_urdf = 'insertion/ell.urdf' container_size = (0.12, 0.12, 0) container_urdf = 'container/container-template.urdf' objs = [] for color in colors: # Add ell block. ell_pose = self.get_random_pose(env, ell_size) ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[color]) objs.append(ell_id) # Add container. container_pose = self.get_random_pose(env, container_size) env.add_object(container_urdf, container_pose, color=utils.COLORS[color], category='fixed') # Goal: each ell block is in the container of the same color. self.add_goal(objs=[ell_id], matches=np.ones((1, 1)), targ_poses=[container_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/3) self.lang_goals.append(self.lang_template.format(color=color))``` END" " ""color-coordinated-insertion-in-container"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-insertion-in-container"" in a python code block. ### "," color-coordinated-insertion-in-container: {'task-name': 'color-coordinated-insertion-in-container', 'task-description': 'There are four differently-colored ell objects (red, blue, green, yellow) and a corresponding container of matching colors. The task involves picking up each ell object and inserting it into the container of the same color in a specific order: from left to right, insert red, blue, green, and finally yellow. The challenge lies in the precise manipulation of the ell objects and the color-coordination required.', 'assets-used': ['insertion/ell.urdf', 'container/container-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedInsertionInContainer(Task): """"""Insert four differently-colored ell objects into the corresponding container of matching colors in a specific order."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""insert the {color} ell into the {color} container"" self.task_completed_desc = ""done inserting ell objects into containers."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and their order colors = ['red', 'blue', 'green', 'yellow'] # Add containers. container_size = (0.12, 0.12, 0.12) container_urdf = 'container/container-template.urdf' container_poses = [] for color in colors: container_pose = self.get_random_pose(env, container_size) env.add_object(container_urdf, container_pose, color=utils.COLORS[color], category='fixed') container_poses.append(container_pose) # Add ell objects. ell_size = (0.04, 0.04, 0.04) ell_urdf = 'insertion/ell.urdf' ells = [] for color in colors: ell_pose = self.get_random_pose(env, ell_size) ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[color]) ells.append(ell_id) # Goal: each ell object is in the corresponding container of the same color. for i in range(len(ells)): self.add_goal(objs=[ells[i]], matches=np.ones((1, 1)), targ_poses=[container_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(ells)) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""insert-ell-along-square-path"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""insert-ell-along-square-path"" in a python code block. ### "," insert-ell-along-square-path: {'task-name': 'insert-ell-along-square-path', 'task-description': 'On the tabletop, there is a square path marked by small blocks. Along the path, there are four colored ell-shaped blocks (red, blue, green, and yellow) and four fixtures of matching colors. The task is to pick up each ell block and insert it into the fixture of the same color. However, the robot must move each ell block along the marked square path to reach the fixture. The task is challenging because it requires precise navigation along the path, color coordination, and insertion accuracy.', 'assets-used': ['block/small.urdf', 'insertion/ell.urdf', 'insertion/fixture.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class InsertEllAlongSquarePath(Task): """"""Pick up each ell block and insert it into the fixture of the same color. However, the robot must move each ell block along the marked square path to reach the fixture."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""move the {color} ell block along the square path and insert it into the {color} fixture"" self.task_completed_desc = ""done inserting ell blocks."" self.additional_reset() def reset(self, env): super().reset(env) # Ell block colors. colors = ['red', 'blue', 'green', 'yellow'] # Add ell blocks and fixtures. ell_size = (0.04, 0.04, 0.04) ell_urdf = 'insertion/ell.urdf' fixture_urdf = 'insertion/fixture.urdf' ell_blocks = [] fixtures = [] for color in colors: # Add ell block ell_pose = self.get_random_pose(env, ell_size) ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[color]) ell_blocks.append(ell_id) # Add fixture fixture_pose = self.get_random_pose(env, ell_size) fixture_id = env.add_object(fixture_urdf, fixture_pose, color=utils.COLORS[color]) fixtures.append(fixture_id) # Goal: each ell block is inserted into the fixture of the same color. for i in range(len(colors)): self.add_goal(objs=[ell_blocks[i]], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(fixtures[i])], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(colors)) self.lang_goals.append(self.lang_template.format(color=colors[i])) # Add square path marked by small blocks. path_block_size = (0.02, 0.02, 0.02) path_block_urdf = 'block/small.urdf' path_block_color = utils.COLORS['gray'] for _ in range(16): path_block_pose = self.get_random_pose(env, path_block_size) env.add_object(path_block_urdf, path_block_pose, color=path_block_color)``` END" " ""color-ordered-insertion-with-blocking-boxes"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-ordered-insertion-with-blocking-boxes"" in a python code block. ### "," color-ordered-insertion-with-blocking-boxes: {'task-name': 'color-ordered-insertion-with-blocking-boxes', 'task-description': 'There are four differently-colored ell objects (red, blue, green, yellow) and a corresponding set of color-coded fixtures. In between the ell objects and the fixtures, there are four spheres positioned randomly, creating a barrier that the robot must navigate around. The task involves picking up each ell object and inserting it into the matching color fixture in a specific order: from left to right, insert red, blue, green, and finally yellow, without knocking over any of the spheres.', 'assets-used': ['insertion/ell.urdf', 'insertion/fixture.urdf', 'sphere/sphere-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorOrderedInsertionWithBlockingBoxes(Task): """"""Pick up four differently-colored ell objects and insert them into the matching color fixture in a specific order, without knocking over any of the spheres."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""insert the {color} ell into the matching fixture"" self.task_completed_desc = ""done inserting ells."" self.additional_reset() def reset(self, env): super().reset(env) # Ell colors. colors = ['red', 'blue', 'green', 'yellow'] # Add fixtures. fixture_size = (0.12, 0.12, 0.12) fixture_urdf = 'insertion/fixture.urdf' fixture_poses = [] for i in range(4): fixture_pose = self.get_random_pose(env, fixture_size) env.add_object(fixture_urdf, fixture_pose, color=utils.COLORS[colors[i]], category='fixed') fixture_poses.append(fixture_pose) # Add ells. ell_size = (0.04, 0.04, 0.04) ell_urdf = 'insertion/ell.urdf' ells = [] for i in range(4): ell_pose = self.get_random_pose(env, ell_size) ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[colors[i]]) ells.append(ell_id) # Add spheres. sphere_size = (0.04, 0.04, 0.04) sphere_urdf = 'sphere/sphere-template.urdf' for _ in range(4): sphere_pose = self.get_random_pose(env, sphere_size) env.add_object(sphere_urdf, sphere_pose) # Goal: each ell is inserted into the matching color fixture in a specific order. for i in range(4): self.add_goal(objs=[ells[i]], matches=np.ones((1, 1)), targ_poses=[fixture_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-coordinated-box-ball-matching"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-box-ball-matching"" in a python code block. ### "," color-coordinated-box-ball-matching: {'task-name': 'color-coordinated-box-ball-matching', 'task-description': 'On the tabletop, there are four boxes of different colors (red, blue, green, and yellow) and four balls of corresponding colors. The task is to pick up each ball and place it inside the box of the same color, however, the boxes are placed in a straight line with a row of small blocks acting as a barrier between the boxes and the balls. The challenge lies in the precise placement, color matching, and the navigation around the barrier without knocking over any small blocks.', 'assets-used': ['box/box-template.urdf', 'ball/ball-template.urdf', 'block/small.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedBoxBallMatching(Task): """"""Pick up each ball and place it inside the box of the same color, navigate around the barrier without knocking over any small blocks."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""put the {color} ball in the {color} box"" self.task_completed_desc = ""done placing balls in boxes."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors for the boxes and balls colors = ['red', 'blue', 'green', 'yellow'] # Add boxes. box_size = (0.05, 0.05, 0.05) box_urdf = 'box/box-template.urdf' box_poses = [] for color in colors: box_pose = self.get_random_pose(env, box_size) env.add_object(box_urdf, box_pose, color=color, category='fixed') box_poses.append(box_pose) # Add balls. balls = [] ball_size = (0.02, 0.02, 0.02) ball_urdf = 'ball/ball-template.urdf' for color in colors: ball_pose = self.get_random_pose(env, ball_size) ball_id = env.add_object(ball_urdf, ball_pose, color=color) balls.append(ball_id) # Add small blocks as barriers. barrier_size = (0.01, 0.01, 0.01) barrier_urdf = 'block/small.urdf' for _ in range(10): barrier_pose = self.get_random_pose(env, barrier_size) env.add_object(barrier_urdf, barrier_pose, category='fixed') # Goal: each ball is in the box of the same color. for i in range(len(balls)): self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[box_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(balls)) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-coordinated-pallet-pyramid"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-pallet-pyramid"" in a python code block. ### "," color-coordinated-pallet-pyramid: {'task-name': 'color-coordinated-pallet-pyramid', 'task-description': 'On a tabletop, there are three pallets and nine blocks of three different colors (red, blue, green). Each color has three blocks and the blocks are scattered randomly on the table. The task is to pick up the blocks and stack them on the pallets to form a pyramid shape. Each pyramid should contain blocks of the same color with two blocks on the base and one block on top. The pallets with the pyramids should be arranged in a straight line in the following color order: red, blue, green from left to right. The challenge lies in the color coordination, precise stacking and the arrangement of the pallets.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedPalletPyramid(Task): """"""Arrange blocks of the same color on pallets to form a pyramid and arrange the pallets in a specific color order."""""" def __init__(self): super().__init__() self.max_steps = 15 self.lang_template = ""arrange the blocks on the pallets to form a pyramid of the same color and arrange the pallets in the order red, blue, green"" self.task_completed_desc = ""done arranging blocks on pallets."" self.additional_reset() def reset(self, env): super().reset(env) # Add pallets. # x, y, z dimensions for the asset size pallet_size = (0.15, 0.15, 0.015) pallet_urdf = 'pallet/pallet.urdf' pallet_poses = [] for _ in range(3): pallet_pose = self.get_random_pose(env, pallet_size) env.add_object(pallet_urdf, pallet_pose, category='fixed') pallet_poses.append(pallet_pose) # Block colors. colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green']] # Add blocks. # x, y, z dimensions for the asset size blocks = [] block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' for i in range(9): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=colors[i//3]) blocks.append(block_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.03), (0, 0, 0.03), (0, 0.05, 0.03)] targs = [(utils.apply(pallet_poses[i//3], j), pallet_poses[i//3][1]) for i, j in enumerate(place_pos*3)] # Goal: blocks are stacked in a pyramid on each pallet. for i in range(3): self.add_goal(objs=blocks[i*3:(i+1)*3], matches=np.ones((3, 3)), targ_poses=targs[i*3:(i+1)*3], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]*3) self.lang_goals.append(self.lang_template)``` END" " ""color-coordinated-ball-insertion-in-boxes"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-ball-insertion-in-boxes"" in a python code block. ### "," color-coordinated-ball-insertion-in-boxes: {'task-name': 'color-coordinated-ball-insertion-in-boxes', 'task-description': 'Pick up four balls of different colors (red, blue, green, and yellow) and insert them into four separate boxes of matching colors. The boxes are located inside corners of a square structure and the task requires precise insertion, color coordination, and careful navigation around the square structure.', 'assets-used': ['ball/ball-template.urdf', 'box/box-template.urdf', 'square/square-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedBallInsertion(Task): """"""Pick up four balls of different colors (red, blue, green, and yellow) and insert them into four separate boxes of matching colors."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""put the {color} ball in the {color} box"" self.task_completed_desc = ""done inserting balls into boxes."" self.additional_reset() def reset(self, env): super().reset(env) # Define the colors for the balls and boxes colors = ['red', 'blue', 'green', 'yellow'] # Add boxes. # x, y, z dimensions for the asset size box_size = (0.12, 0.12, 0.12) box_urdf = 'box/box-template.urdf' boxes = [] for color in colors: box_pose = self.get_random_pose(env, box_size) box_id = env.add_object(box_urdf, box_pose, color=utils.COLORS[color]) boxes.append(box_id) # Add balls. # x, y, z dimensions for the asset size ball_size = (0.04, 0.04, 0.04) ball_urdf = 'ball/ball-template.urdf' balls = [] for color in colors: ball_pose = self.get_random_pose(env, ball_size) ball_id = env.add_object(ball_urdf, ball_pose, color=utils.COLORS[color]) balls.append(ball_id) # Goal: each ball is in a box of the same color. for i in range(len(balls)): self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(boxes[i])], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(balls)) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""cylinder-balancing-and-placement"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""cylinder-balancing-and-placement"" in a python code block. ### "," cylinder-balancing-and-placement: {'task-name': 'cylinder-balancing-and-placement', 'task-description': 'On a table, there are three differently colored cylinders (red, green, and blue) and three square zones of matching colors. The task involves picking up each cylinder and balancing it on its end at the center of the corresponding colored zone, in the sequence of red, green, and blue from left to right. The task is challenging due to precise balancing required in placing the cylinders, color matching, and sequence following.', 'assets-used': ['cylinder/cylinder-template.urdf', 'zone/zone.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class CylinderBalancingAndPlacement(Task): """"""Pick up each cylinder and balance it on its end at the center of the corresponding colored zone."""""" def __init__(self): super().__init__() self.max_steps = 15 self.lang_template = ""balance the {color} cylinder in the {color} zone"" self.task_completed_desc = ""done balancing and placing cylinders."" self.colors = ['red', 'green', 'blue'] self.additional_reset() def reset(self, env): super().reset(env) # Add zones. zone_size = (0.12, 0.12, 0) zone_urdf = 'zone/zone.urdf' zone_poses = [] for color in self.colors: zone_pose = self.get_random_pose(env, zone_size) env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[color]) zone_poses.append(zone_pose) # Add cylinders. cylinder_size = (0.04, 0.04, 0.12) cylinder_urdf = 'cylinder/cylinder-template.urdf' cylinders = [] for color in self.colors: cylinder_pose = self.get_random_pose(env, cylinder_size) cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=utils.COLORS[color]) cylinders.append(cylinder_id) # Goal: each cylinder is balanced in the corresponding colored zone. for i in range(len(cylinders)): self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[zone_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/3) self.lang_goals.append(self.lang_template.format(color=self.colors[i]))``` END" " ""align-spheres-in-boxes"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""align-spheres-in-boxes"" in a python code block. ### "," align-spheres-in-boxes: {'task-name': 'align-spheres-in-boxes', 'task-description': 'There are four different colored boxes (red, blue, green, and yellow) and four spheres of corresponding colors on the table. The task is to pick up each sphere and place it into the box of the same color. However, there are small blocks scattered randomly on the table, which the robot has to navigate without knocking them over. The challenge lies in the precise placement of the spheres, color matching, and navigation around the blocks.', 'assets-used': ['box/box-template.urdf', 'sphere/sphere-template.urdf', 'block/small.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class AlignSpheresInBoxes(Task): """"""Pick up each sphere and place it into the box of the same color. Navigate around the blocks."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""put the {color} sphere in the {color} box"" self.task_completed_desc = ""done aligning spheres in boxes."" self.additional_reset() def reset(self, env): super().reset(env) # Add boxes. # x, y, z dimensions for the asset size box_size = (0.12, 0.12, 0.12) box_urdf = 'box/box-template.urdf' box_poses = [] box_colors = ['red', 'blue', 'green', 'yellow'] for color in box_colors: box_pose = self.get_random_pose(env, box_size) env.add_object(box_urdf, box_pose, category='fixed', color=utils.COLORS[color]) box_poses.append(box_pose) # Add spheres. # x, y, z dimensions for the asset size spheres = [] sphere_size = (0.04, 0.04, 0.04) sphere_urdf = 'sphere/sphere-template.urdf' for color in box_colors: sphere_pose = self.get_random_pose(env, sphere_size) sphere_id = env.add_object(sphere_urdf, sphere_pose, color=utils.COLORS[color]) spheres.append(sphere_id) # Add blocks. # x, y, z dimensions for the asset size blocks = [] block_size = (0.04, 0.04, 0.04) block_urdf = 'block/small.urdf' for _ in range(10): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose) blocks.append(block_id) # Goal: each sphere is in a box of the same color. for i in range(len(spheres)): self.add_goal(objs=[spheres[i]], matches=np.ones((1, 1)), targ_poses=[box_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(spheres)) self.lang_goals.append(self.lang_template.format(color=box_colors[i]))``` END" " ""color-coordinated-sphere-and-cylinder-assembly"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-sphere-and-cylinder-assembly"" in a python code block. ### "," color-coordinated-sphere-and-cylinder-assembly: {'task-name': 'color-coordinated-sphere-and-cylinder-assembly', 'task-description': 'The robot starts with four spheres of different colors (red, blue, green, yellow) and four cylinders of matching colors. The task is to pick up each sphere and place it on top of the cylinder of the same color, forming four sphere-and-cylinder pairs. However, the challenge here is to do this in a specific color sequence - red, blue, green, and finally yellow.', 'assets-used': ['sphere/sphere-template.urdf', 'cylinder/cylinder-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedSphereAndCylinderAssembly(Task): """"""Pick up each sphere and place it on top of the cylinder of the same color, in a specific color sequence."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""place the {color} sphere on the {color} cylinder"" self.task_completed_desc = ""done placing spheres on cylinders."" self.colors = ['red', 'blue', 'green', 'yellow'] self.color_sequence = ['red', 'blue', 'green', 'yellow'] def reset(self, env): super().reset(env) # Add spheres and cylinders. sphere_size = (0.05, 0.05, 0.05) cylinder_size = (0.05, 0.05, 0.1) sphere_template = 'sphere/sphere-template.urdf' cylinder_template = 'cylinder/cylinder-template.urdf' # Add spheres and cylinders of each color. for color in self.colors: sphere_pose = self.get_random_pose(env, sphere_size) cylinder_pose = self.get_random_pose(env, cylinder_size) sphere_id = env.add_object(sphere_template, sphere_pose, color=color) cylinder_id = env.add_object(cylinder_template, cylinder_pose, color=color) # Goal: each sphere is on top of the cylinder of the same color. self.add_goal(objs=[sphere_id], matches=np.ones((1, 1)), targ_poses=[cylinder_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(self.lang_template.format(color=color)) # The task is completed in a specific color sequence. self.color_sequence = ['red', 'blue', 'green', 'yellow']``` END" " ""color-coordinated-cylinder-bowl-sorting"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-cylinder-bowl-sorting"" in a python code block. ### "," color-coordinated-cylinder-bowl-sorting: {'task-name': 'color-coordinated-cylinder-bowl-sorting', 'task-description': 'There are four different cylinders (red, blue, green, yellow) and four different bowls (red, blue, green, yellow). The task involves picking up each cylinder and placing it in the bowl of the same color. The challenge lies in the precise manipulation of the cylinders and color-coordination.', 'assets-used': ['cylinder/cylinder-template.urdf', 'bowl/bowl.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedCylinderBowlSorting(Task): """"""Pick up each cylinder and place it in the bowl of the same color."""""" def __init__(self): super().__init__() self.max_steps = 4 self.lang_template = ""put the {color} cylinder in the {color} bowl"" self.task_completed_desc = ""done sorting cylinders."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors colors = ['red', 'blue', 'green', 'yellow'] # Add bowls. # x, y, z dimensions for the asset size bowl_size = (0.12, 0.12, 0) bowl_urdf = 'bowl/bowl.urdf' bowl_poses = [] for color in colors: bowl_pose = self.get_random_pose(env, bowl_size) env.add_object(bowl_urdf, bowl_pose, color=utils.COLORS[color], category='fixed') bowl_poses.append(bowl_pose) # Add cylinders. # x, y, z dimensions for the asset size cylinders = [] cylinder_size = (0.04, 0.04, 0.04) cylinder_urdf = 'cylinder/cylinder-template.urdf' for color in colors: cylinder_pose = self.get_random_pose(env, cylinder_size) cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=utils.COLORS[color]) cylinders.append(cylinder_id) # Goal: each cylinder is in the bowl of the same color. for i in range(len(colors)): self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[bowl_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(colors)) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""sequential-block-insertion"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""sequential-block-insertion"" in a python code block. ### "," sequential-block-insertion: {'task-name': 'sequential-block-insertion', 'task-description': 'There are four blocks of different colors (red, blue, green, yellow) and four fixtures of matching colors. The task involves picking up each block and inserting it into the fixture of the same color, in the specific sequence of red, blue, green, and yellow. However, the challenge lies in the fact that the blocks and fixtures are initially arranged in a mixed order, demanding careful navigation, precise insertion, color matching, and sequence following.', 'assets-used': ['insertion/fixture.urdf', 'block/block.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class SequentialBlockInsertion(Task): """"""Pick up blocks of different colors and insert them into the fixture of the same color in a specific sequence."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""insert the {color} block into the {color} fixture"" self.task_completed_desc = ""done inserting blocks."" self.additional_reset() def reset(self, env): super().reset(env) # Define the sequence of colors colors = ['red', 'blue', 'green', 'yellow'] # Add fixtures. # x, y, z dimensions for the asset size fixture_size = (0.12, 0.12, 0) fixture_urdf = 'insertion/fixture.urdf' fixtures = [] for color in colors: fixture_pose = self.get_random_pose(env, fixture_size) fixture_id = env.add_object(fixture_urdf, fixture_pose, color=utils.COLORS[color], category='fixed') fixtures.append(fixture_id) # Add blocks. # x, y, z dimensions for the asset size block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' blocks = [] for color in colors: block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color]) blocks.append(block_id) # Goal: each block is in the fixture of the same color. for i in range(len(blocks)): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(fixtures[i])], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(blocks)) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""sequential-insertion-and-stacking"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""sequential-insertion-and-stacking"" in a python code block. ### "," sequential-insertion-and-stacking: {'task-name': 'sequential-insertion-and-stacking', 'task-description': 'The tabletop contains three fixtures and three ell-shaped blocks of different colors - red, blue, and green. The task is to first pick up and insert each ell block into the corresponding colored fixture in the sequence of red, blue, and green. After successful insertion, the robot must pick up the three blocks again from the fixtures and stack them in a corner of the tabletop in the same color sequence - red at the bottom, blue in the middle, and green on top.', 'assets-used': ['insertion/ell.urdf', 'insertion/fixture.urdf', 'corner/corner-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class SequentialInsertionAndStacking(Task): """"""Pick up and insert each ell block into the corresponding colored fixture in the sequence of red, blue, and green. After successful insertion, pick up the three blocks again from the fixtures and stack them in a corner of the tabletop in the same color sequence - red at the bottom, blue in the middle, and green on top."""""" def __init__(self): super().__init__() self.max_steps = 15 self.lang_template = ""insert the {color} ell block into the {color} fixture and then stack them in the corner"" self.task_completed_desc = ""done inserting and stacking."" self.additional_reset() def reset(self, env): super().reset(env) # Add fixtures. fixture_size = (0.12, 0.12, 0) fixture_urdf = 'insertion/fixture.urdf' fixture_poses = [] colors = ['red', 'blue', 'green'] for color in colors: fixture_pose = self.get_random_pose(env, fixture_size) env.add_object(fixture_urdf, fixture_pose, category='fixed', color=utils.COLORS[color]) fixture_poses.append(fixture_pose) # Add ell blocks. ell_size = (0.04, 0.04, 0.04) ell_urdf = 'insertion/ell.urdf' ells = [] for color in colors: ell_pose = self.get_random_pose(env, ell_size) ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[color]) ells.append(ell_id) # Goal: each ell block is in the corresponding colored fixture. for i in range(3): self.add_goal(objs=[ells[i]], matches=np.ones((1, 1)), targ_poses=[fixture_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/3) self.lang_goals.append(self.lang_template.format(color=colors[i])) # Add corner. corner_size = (0.12, 0.12, 0) corner_pose = self.get_random_pose(env, corner_size) corner_urdf = 'corner/corner-template.urdf' env.add_object(corner_urdf, corner_pose, category='fixed') # Goal: ell blocks are stacked in the corner in the color sequence - red at the bottom, blue in the middle, and green on top. stack_poses = [(0, 0, 0.04), (0, 0, 0.08), (0, 0, 0.12)] targs = [(utils.apply(corner_pose, i), corner_pose[1]) for i in stack_poses] self.add_goal(objs=ells, matches=np.ones((3, 3)), targ_poses=targs, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/3) self.lang_goals.append(""stack the ell blocks in the corner in the color sequence - red at the bottom, blue in the middle, and green on top"")``` END" " ""color-coordinated-block-shifting"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-block-shifting"" in a python code block. ### "," color-coordinated-block-shifting: {'task-name': 'color-coordinated-block-shifting', 'task-description': 'On a tabletop, there are three zones marked in three different colors (red, blue, and green) and nine blocks of matching colors (three red, three blue, and three green). Each zone initially contains three blocks of a single color, but the colors of the blocks and zones do not match. The task involves picking up each block and precisely placing it in the zone of the same color. However, there are a few small blocks randomly scattered in the path between the zones. The robot has to strategically navigate around these blocks without knocking them over while transporting the blocks to the corresponding zones. The challenge lies in the precise navigation, placement of the blocks, color matching while avoiding the blocks.', 'assets-used': ['zone/zone.urdf', 'block/block.urdf', 'block/small.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCoordinatedBlockShifting(Task): """"""Pick up each block and precisely place it in the zone of the same color."""""" def __init__(self): super().__init__() self.max_steps = 15 self.lang_template = ""move the {color} blocks to the {color} zone"" self.task_completed_desc = ""done moving blocks."" self.additional_reset() def reset(self, env): super().reset(env) # Add zones. zone_size = (0.12, 0.12, 0) zone_urdf = 'zone/zone.urdf' zone_colors = ['red', 'blue', 'green'] zone_poses = [] for color in zone_colors: zone_pose = self.get_random_pose(env, zone_size) env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[color]) zone_poses.append(zone_pose) # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'stacking/block.urdf' blocks = [] for color in zone_colors: for _ in range(3): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color]) blocks.append(block_id) # Add small blocks as obstacles. small_block_size = (0.02, 0.02, 0.02) small_block_urdf = 'stacking/small_block.urdf' for _ in range(5): small_block_pose = self.get_random_pose(env, small_block_size) env.add_object(small_block_urdf, small_block_pose) # Goal: each block is in the zone of the same color. for i in range(9): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[zone_poses[i//3]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/9) self.lang_goals.append(self.lang_template.format(color=zone_colors[i//3]))``` END" " ""color-coordinated-cylinder-placement-on-pallet"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-cylinder-placement-on-pallet"" in a python code block. ### "," color-coordinated-cylinder-placement-on-pallet: {'task-name': 'color-coordinated-cylinder-placement-on-pallet', 'task-description': 'On a tabletop, there are four corners marked in four different colors (red, blue, green, and yellow) and four cylinders of matching colors. Also, there is a pallet on the tabletop with four colored zones matching with the colors of the corners and cylinders. Initially, each cylinder is located at a corner, but not corresponding to the color of the corner. The task is to pick up each cylinder and place it on the pallet zone of the same color. However, this must be done in a specific sequence - red first, then blue, green, and finally yellow. The challenge lies in precise placement, color matching, and following the correct sequence.', 'assets-used': ['corner/corner-template.urdf', 'cylinder/cylinder-template.urdf', 'pallet/pallet.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedCylinderPlacement(Task): """"""Pick up each cylinder and place it on the pallet zone of the same color in a specific sequence."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""place the {color} cylinder in the {color} zone on the pallet"" self.task_completed_desc = ""done placing cylinders."" self.additional_reset() def reset(self, env): super().reset(env) # Add pallet. pallet_size = (0.3, 0.3, 0.01) pallet_pose = self.get_random_pose(env, pallet_size) pallet_urdf = 'pallet/pallet.urdf' env.add_object(pallet_urdf, pallet_pose, 'fixed') # Define colors and their sequence. colors = ['red', 'blue', 'green', 'yellow'] color_sequence = [utils.COLORS[color] for color in colors] # Add cylinders. cylinder_size = (0.02, 0.02, 0.08) cylinder_urdf = 'cylinder/cylinder-template.urdf' cylinders = [] for i, color in enumerate(color_sequence): cylinder_pose = self.get_random_pose(env, cylinder_size) cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=color) cylinders.append(cylinder_id) # Define zones on the pallet for each color. zone_poses = [utils.apply(pallet_pose, (0.1 * i - 0.15, 0.1 * j - 0.15, 0)) for i in range(2) for j in range(2)] # Add goals for each color in the sequence. for i, color in enumerate(colors): self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[zone_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4) self.lang_goals.append(self.lang_template.format(color=color))``` END" " ""guided-block-path"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""guided-block-path"" in a python code block. ### "," guided-block-path: {'task-name': 'guided-block-path', 'task-description': 'On the tabletop, there are four colored blocks (red, blue, green, and yellow) and four lines of the corresponding colors. The task is to pick up each block and move it along the line of the same color from start to end. The challenge lies in precise navigation along the line, color coordination, and block manipulation.', 'assets-used': ['block/block.urdf', 'line/line-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class GuidedBlockPath(Task): """"""Pick up each block and move it along the line of the same color from start to end."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""move the {color} block along the {color} line from start to end"" self.task_completed_desc = ""done moving blocks."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and corresponding names colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow']] color_names = ['red', 'blue', 'green', 'yellow'] # Add lines and blocks. # x, y, z dimensions for the asset size line_size = (0.3, 0.01, 0.01) block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' line_urdf = 'line/line-template.urdf' blocks = [] lines = [] for i in range(4): # Add line line_pose = self.get_random_pose(env, line_size) env.add_object(line_urdf, line_pose, color=colors[i], category='fixed') lines.append(line_pose) # Add block block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=colors[i]) blocks.append(block_id) # Add goal self.add_goal(objs=[block_id], matches=np.ones((1, 1)), targ_poses=[line_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(self.lang_template.format(color=color_names[i]))``` END" " ""color-ordered-insertion-with-obstacles"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-ordered-insertion-with-obstacles"" in a python code block. ### "," color-ordered-insertion-with-obstacles: {'task-name': 'color-ordered-insertion-with-obstacles', 'task-description': 'On a tabletop, there are four colored ell-shaped blocks (red, blue, green, and yellow) and four fixtures of matching colors, with a line of small blocks serving as barriers, and they are arranged in a straight line. The task is to pick up each ell block, navigate around the small blocks, and insert it into the fixture of the same color in a specific sequence from left to right, starting with red, followed by blue, then green, and finally yellow. The challenges include precise navigation, color coordination, sequence following, and obstacle avoidance.', 'assets-used': ['insertion/ell.urdf', 'insertion/fixture.urdf', 'block/small.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorOrderedInsertionWithObstacles(Task): """"""Pick up each ell block, navigate around the small blocks, and insert it into the fixture of the same color in a specific sequence from left to right, starting with red, followed by blue, then green, and finally yellow."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""insert the {color} ell block into the {color} fixture"" self.task_completed_desc = ""done inserting ell blocks."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and their order colors = ['red', 'blue', 'green', 'yellow'] # Add ell blocks and fixtures. for color in colors: # Add ell block ell_size = (0.04, 0.04, 0.04) # x, y, z dimensions for the ell block size ell_pose = self.get_random_pose(env, ell_size) ell_urdf = 'insertion/ell.urdf' ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[color]) # Add fixture fixture_size = (0.05, 0.05, 0.05) # x, y, z dimensions for the fixture size fixture_pose = self.get_random_pose(env, fixture_size) fixture_urdf = 'insertion/fixture.urdf' fixture_id = env.add_object(fixture_urdf, fixture_pose, color=utils.COLORS[color]) # Add goal: ell block is inserted into the fixture of the same color self.add_goal(objs=[ell_id], matches=np.ones((1, 1)), targ_poses=[fixture_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(self.lang_template.format(color=color)) # Add small blocks as obstacles. n_obstacles = 10 obstacle_size = (0.02, 0.02, 0.02) # x, y, z dimensions for the obstacle size obstacle_urdf = 'block/small.urdf' for _ in range(n_obstacles): obstacle_pose = self.get_random_pose(env, obstacle_size) env.add_object(obstacle_urdf, obstacle_pose)``` END" " ""color-matched-block-transfer"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-matched-block-transfer"" in a python code block. ### "," color-matched-block-transfer: {'task-name': 'color-matched-block-transfer', 'task-description': 'On a tabletop, there are four containers and four blocks of different colors (red, blue, green, and yellow). Each block is inside a container, but not corresponding to the color of the container. The task is to pick up each block and place it in the container of the same color, in the specific sequence of red, blue, green and yellow from left to right. The task is challenging due to the precise placement, color matching and sequence following.', 'assets-used': ['block/block.urdf', 'container/container-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorMatchedBlockTransfer(Task): """"""Pick up each block and place it in the container of the same color, in the specific sequence of red, blue, green and yellow from left to right."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""place the {color} block in the {color} container"" self.task_completed_desc = ""done transferring blocks."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and their sequence colors = ['red', 'blue', 'green', 'yellow'] color_sequence = np.array(colors) # Add containers. container_size = (0.12, 0.12, 0.12) container_urdf = 'container/container-template.urdf' container_poses = [] for color in color_sequence: container_pose = self.get_random_pose(env, container_size) env.add_object(container_urdf, container_pose, color=utils.COLORS[color], category='fixed') container_poses.append(container_pose) # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' blocks = [] for color in color_sequence: block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color]) blocks.append(block_id) # Goal: each block is in the container of the same color. for i in range(len(blocks)): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[container_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(blocks)) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""mixed-color-block-barrier-insertion"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""mixed-color-block-barrier-insertion"" in a python code block. ### "," mixed-color-block-barrier-insertion: {'task-name': 'mixed-color-block-barrier-insertion', 'task-description': 'There are four different colored blocks (red, blue, green, and yellow), and four fixtures in corresponding colors. Two barriers, each made of three blocks (orange, purple, and brown), are placed in between the blocks and fixtures, forming a path that the robot must navigate. The task involves picking up each colored block, navigating the barriers, and inserting each block into the fixture of the same color. The fixtures are arranged in a sequence from left to right: red, blue, green, and yellow, providing a challenge in precise navigation, color coordination, and insertion.', 'assets-used': ['block/block.urdf', 'insertion/fixture.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class MixedColorBlockBarrierInsertion(Task): """"""Pick up each colored block, navigate the barriers, and insert each block into the fixture of the same color."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""insert the {color} block into the {color} fixture"" self.task_completed_desc = ""done inserting blocks."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors for blocks and fixtures colors = ['red', 'blue', 'green', 'yellow'] # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' blocks = [] for color in colors: block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color]) blocks.append(block_id) # Add fixtures. fixture_size = (0.06, 0.06, 0.06) fixture_urdf = 'insertion/fixture.urdf' fixtures = [] for color in colors: fixture_pose = self.get_random_pose(env, fixture_size) fixture_id = env.add_object(fixture_urdf, fixture_pose, color=utils.COLORS[color]) fixtures.append(fixture_id) # Add barriers. barrier_size = (0.12, 0.04, 0.04) barrier_colors = ['orange', 'purple', 'brown'] for _ in range(2): for color in barrier_colors: barrier_pose = self.get_random_pose(env, barrier_size) env.add_object(block_urdf, barrier_pose, color=utils.COLORS[color]) # Goal: each block is inserted into the fixture of the same color. for i in range(len(blocks)): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(fixtures[i])], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(blocks)) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""ball-in-bowl-obstacle-course"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""ball-in-bowl-obstacle-course"" in a python code block. ### "," ball-in-bowl-obstacle-course: {'task-name': 'ball-in-bowl-obstacle-course', 'task-description': 'With the tabletop setup consisting of a maze of small blocks, the task requires the robot to pick up four balls of different colors (red, blue, green, yellow) and place each of them into the corresponding colored bowls strategically positioned at different corners of the maze, without knocking over any blocks, demanding careful navigation and color coordination.', 'assets-used': ['ball/ball-template.urdf', 'block/small.urdf', 'bowl/bowl.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class BallInBowlObstacleCourse(Task): """"""Navigate through a maze of blocks, pick up balls of different colors and place them in the corresponding colored bowls."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""navigate through the maze and place the {color} ball in the {color} bowl"" self.task_completed_desc = ""done placing balls in bowls."" self.additional_reset() def reset(self, env): super().reset(env) # Add blocks to form a maze. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/small.urdf' for _ in range(10): block_pose = self.get_random_pose(env, block_size) env.add_object(block_urdf, block_pose, category='fixed') # Add balls of different colors. ball_size = (0.04, 0.04, 0.04) ball_urdf = 'ball/ball-template.urdf' colors = ['red', 'blue', 'green', 'yellow'] balls = [] for color in colors: ball_pose = self.get_random_pose(env, ball_size) ball_id = env.add_object(ball_urdf, ball_pose, color=color) balls.append(ball_id) # Add bowls of different colors at different corners of the maze. bowl_size = (0.12, 0.12, 0) bowl_urdf = 'bowl/bowl.urdf' bowls = [] for color in colors: bowl_pose = self.get_random_pose(env, bowl_size) bowl_id = env.add_object(bowl_urdf, bowl_pose, color=color, category='fixed') bowls.append(bowl_id) # Goal: each ball is in the bowl of the same color. for i in range(len(balls)): self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(bowls[i])], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(balls)) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-coordinated-bowl-ball-pyramid"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-bowl-ball-pyramid"" in a python code block. ### "," color-coordinated-bowl-ball-pyramid: {'task-name': 'color-coordinated-bowl-ball-pyramid', 'task-description': 'On a tabletop, there are four bowls and four balls of different colors (red, blue, green, and yellow). The task is to pick up each ball and stack them in the shape of a pyramid inside the bowl of the same color, in the specific sequence of red at the bottom, blue and green in the middle, and yellow at the top. The challenge lies in the precise placement, color matching, and pyramid formation.', 'assets-used': ['bowl/bowl.urdf', 'ball/ball.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCoordinatedBowlBallPyramid(Task): """"""Pick up each ball and stack them in the shape of a pyramid inside the bowl of the same color."""""" def __init__(self): super().__init__() self.max_steps = 12 self.lang_template = ""stack the balls in the shape of a pyramid inside the bowl of the same color"" self.task_completed_desc = ""done stacking balls in bowls."" self.additional_reset() def reset(self, env): super().reset(env) # Add bowls. # x, y, z dimensions for the asset size bowl_size = (0.12, 0.12, 0) bowl_urdf = 'bowl/bowl.urdf' bowl_colors = ['red', 'blue', 'green', 'yellow'] bowl_poses = [] for color in bowl_colors: bowl_pose = self.get_random_pose(env, bowl_size) env.add_object(bowl_urdf, bowl_pose, category='fixed', color=utils.COLORS[color]) bowl_poses.append(bowl_pose) # Add balls. # x, y, z dimensions for the asset size balls = [] ball_size = (0.04, 0.04, 0.04) ball_urdf = 'ball/ball.urdf' for color in bowl_colors: ball_pose = self.get_random_pose(env, ball_size) ball_id = env.add_object(ball_urdf, ball_pose, color=utils.COLORS[color]) balls.append(ball_id) # Goal: each ball is in the bowl of the same color. self.add_goal(objs=balls, matches=np.eye(4), targ_poses=bowl_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1) self.lang_goals.append(self.lang_template)``` END" " ""color-coordinated-arch-construction"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-arch-construction"" in a python code block. ### "," color-coordinated-arch-construction: {'task-name': 'color-coordinated-arch-construction', 'task-description': 'The task is to construct an arch using six blocks: three red and three blue. The blocks are initially placed in a container. The robot needs to pick each block and place it on a pallet in the following arrangement: place two red blocks in parallel on the pallet, then place a blue block on top of the red blocks to form an arch. Repeat the process with the remaining blocks, placing them on top of the first arch to form a second layer. The task is challenging due to the need for precise placement of the blocks and maintaining the balance of the structure.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf', 'container/container-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCoordinatedArchConstruction(Task): """"""Construct an arch using six blocks: three red and three blue."""""" def __init__(self): super().__init__() self.max_steps = 6 self.lang_template = ""construct an arch using six blocks: three red and three blue"" self.task_completed_desc = ""done constructing arch."" self.additional_reset() def reset(self, env): super().reset(env) # Add pallet. pallet_size = (0.15, 0.15, 0.005) pallet_urdf = 'pallet/pallet.urdf' pallet_pose = self.get_random_pose(env, pallet_size) env.add_object(pallet_urdf, pallet_pose, category='fixed') # Block colors. colors = [utils.COLORS['red'], utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['red'], utils.COLORS['red'], utils.COLORS['blue']] # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' blocks = [] for i in range(6): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=colors[i]) blocks.append(block_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.02), (0, 0.05, 0.02), (0, 0, 0.06), (0, -0.05, 0.08), (0, 0.05, 0.08), (0, 0, 0.12)] targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos] # Goal: blocks are stacked in an arch (bottom row: red, red, blue). self.add_goal(objs=blocks[:3], matches=np.ones((3, 3)), targ_poses=targs[:3], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]*3) self.lang_goals.append(self.lang_template) # Goal: blocks are stacked in an arch (top row: red, red, blue). self.add_goal(objs=blocks[3:], matches=np.ones((3, 3)), targ_poses=targs[3:], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]*3) self.lang_goals.append(self.lang_template)``` END" " ""color-coordinated-zone-arrangement"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-zone-arrangement"" in a python code block. ### "," color-coordinated-zone-arrangement: {'task-name': 'color-coordinated-zone-arrangement', 'task-description': 'On the tabletop, there are nine blocks of three different colors (three red, three blue, and three green) and three pallets of matching colors (one red, one blue, one green). The task is to pick up each block and place it on the pallet of the same color, arranging the blocks on each pallet in a line. However, there are a few small blocks randomly scattered on the tabletop, which the robot has to navigate around without knocking them over while transporting the blocks to the corresponding pallets. The challenge lies in the precise navigation, placement of the blocks, color matching, and maintaining the balance on the pallets.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf', 'block/small.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCoordinatedZoneArrangement(Task): """"""Pick up blocks of different colors and place them on the pallets of the same color."""""" def __init__(self): super().__init__() self.max_steps = 15 self.lang_template = ""place the {color} blocks on the {color} pallet"" self.task_completed_desc = ""done arranging blocks on pallets."" self.additional_reset() def reset(self, env): super().reset(env) # Add pallets. # x, y, z dimensions for the asset size pallet_size = (0.12, 0.12, 0.02) pallet_urdf = 'pallet/pallet.urdf' pallet_colors = ['red', 'blue', 'green'] pallet_poses = [] for color in pallet_colors: pallet_pose = self.get_random_pose(env, pallet_size) env.add_object(pallet_urdf, pallet_pose, category='fixed', color=utils.COLORS[color]) pallet_poses.append(pallet_pose) # Add blocks. # x, y, z dimensions for the asset size blocks = [] block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' for color in pallet_colors: for _ in range(3): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color]) blocks.append(block_id) # Add small blocks as obstacles. small_block_size = (0.02, 0.02, 0.02) small_block_urdf = 'block/small.urdf' for _ in range(5): small_block_pose = self.get_random_pose(env, small_block_size) env.add_object(small_block_urdf, small_block_pose) # Goal: each block is on the pallet of the same color. for i in range(9): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[pallet_poses[i // 3]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 9) self.lang_goals.append(self.lang_template.format(color=pallet_colors[i // 3]))``` END" " ""color-coordinated-cylinder-stand-assembly"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-cylinder-stand-assembly"" in a python code block. ### "," color-coordinated-cylinder-stand-assembly: {'task-name': 'color-coordinated-cylinder-stand-assembly', 'task-description': 'The robot starts with four cylinders of different colors (red, blue, green, yellow) and four stands of matching colors. The task is to pick up each cylinder and place it on top of the stand of the same color, forming four cylinder-and-stand pairs. However, the challenge here is to do this in a specific color sequence - green, yellow, blue, and finally red, while also ensuring that the cylinders do not topple over.', 'assets-used': ['cylinder/cylinder-template.urdf', 'stacking/stand.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedCylinderStandAssembly(Task): """"""Pick up each cylinder and place it on top of the stand of the same color, in a specific color sequence."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""place the {color} cylinder on the {color} stand"" self.task_completed_desc = ""done placing cylinders on stands."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and their sequence colors = ['green', 'yellow', 'blue', 'red'] color_sequence = [utils.COLORS[color] for color in colors] # Add stands. stand_size = (0.04, 0.04, 0.04) stand_urdf = 'stacking/stand.urdf' stand_poses = [] for i in range(4): stand_pose = self.get_random_pose(env, stand_size) env.add_object(stand_urdf, stand_pose, color=color_sequence[i], category='fixed') stand_poses.append(stand_pose) # Add cylinders. cylinder_size = (0.04, 0.04, 0.04) cylinder_urdf = 'cylinder/cylinder-template.urdf' cylinders = [] for i in range(4): cylinder_pose = self.get_random_pose(env, cylinder_size) cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=color_sequence[i]) cylinders.append(cylinder_id) # Goal: each cylinder is on the stand of the same color, in the specified color sequence. for i in range(4): self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[stand_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-coordinated-cylinder-stand-in-line"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-cylinder-stand-in-line"" in a python code block. ### "," color-coordinated-cylinder-stand-in-line: {'task-name': 'color-coordinated-cylinder-stand-in-line', 'task-description': 'There are four stands of different colors (red, blue, green, yellow) and four cylinders of matching colors. The task is to pick up each cylinder and place it on top of the stand of the same color, forming four cylinder-and-stand pairs. However, the challenge here is to do this in a specific color sequence - red, blue, green, and finally yellow, and then line them up in a straight line from left to right according to the same color sequence.', 'assets-used': ['cylinder/cylinder-template.urdf', 'stacking/stand.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedCylinderStandInLine(Task): """"""Pick up each cylinder and place it on top of the stand of the same color, forming four cylinder-and-stand pairs. However, the challenge here is to do this in a specific color sequence - red, blue, green, and finally yellow, and then line them up in a straight line from left to right according to the same color sequence."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""place the {color} cylinder on the {color} stand"" self.task_completed_desc = ""done placing cylinders on stands."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and their sequence colors = ['red', 'blue', 'green', 'yellow'] color_sequence = [utils.COLORS[color] for color in colors] # Add stands and cylinders stand_size = (0.04, 0.04, 0.04) cylinder_size = (0.04, 0.04, 0.04) stand_urdf = 'stacking/stand.urdf' cylinder_urdf = 'cylinder/cylinder-template.urdf' stands = [] cylinders = [] for i in range(4): # Add stand stand_pose = self.get_random_pose(env, stand_size) stand_id = env.add_object(stand_urdf, stand_pose, color=color_sequence[i]) stands.append(stand_id) # Add cylinder cylinder_pose = self.get_random_pose(env, cylinder_size) cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=color_sequence[i]) cylinders.append(cylinder_id) # Goal: each cylinder is on the stand of the same color, in the color sequence for i in range(4): self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[stand_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-coordinated-pyramid-construction"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-pyramid-construction"" in a python code block. ### "," color-coordinated-pyramid-construction: {'task-name': 'color-coordinated-pyramid-construction', 'task-description': 'On a tabletop, there are six blocks in two colors (three red and three blue). The task involves picking up these blocks and constructing a pyramid with two levels on a stand: the first level should consist of three blocks (two red blocks and one blue block), and the second level should be formed by stacking the remaining three blocks (two blue blocks and one red block) on top of the first level. The challenge lies in the precise placement, color coordination, and maintaining the balance of the pyramid.', 'assets-used': ['stacking/block.urdf', 'stacking/stand.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedPyramidConstruction(Task): """"""Construct a pyramid with two levels on a stand: the first level should consist of three blocks (two red blocks and one blue block), and the second level should be formed by stacking the remaining three blocks (two blue blocks and one red block) on top of the first level."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""construct a pyramid with two levels on a stand: the first level should consist of three blocks (two red blocks and one blue block), and the second level should be formed by stacking the remaining three blocks (two blue blocks and one red block) on top of the first level."" self.task_completed_desc = ""done constructing pyramid."" self.additional_reset() def reset(self, env): super().reset(env) # Add stand. stand_size = (0.15, 0.15, 0.005) stand_pose = self.get_random_pose(env, stand_size) env.add_object('stacking/stand.urdf', stand_pose, 'fixed') # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'stacking/block.urdf' blocks = [] colors = [utils.COLORS['red'], utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['blue'], utils.COLORS['blue'], utils.COLORS['red']] for i in range(6): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=colors[i]) blocks.append(block_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.03), (0, 0, 0.03), (0, 0.05, 0.03), (0, -0.025, 0.08), (0, 0.025, 0.08), (0, 0, 0.13)] targs = [(utils.apply(stand_pose, i), stand_pose[1]) for i in place_pos] # Goal: blocks are stacked in a pyramid (bottom row: red, red, blue). self.add_goal(objs=blocks[:3], matches=np.ones((3, 3)), targ_poses=targs[:3], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]*3) # Goal: blocks are stacked in a pyramid (top row: blue, blue, red). self.add_goal(objs=blocks[3:], matches=np.ones((3, 3)), targ_poses=targs[3:], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]*3)``` END" " ""color-coordinated-ball-stacking"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-ball-stacking"" in a python code block. ### "," color-coordinated-ball-stacking: {'task-name': 'color-coordinated-ball-stacking', 'task-description': 'There are four balls of different colors (red, blue, green, yellow), and four containers of matching colors on the table. The task is to pick up each ball and stack it on top of the corresponding colored container. However, the stacking should be done in a specific color sequence - blue at the bottom, followed by yellow, then green, and finally red at the top. This task enforces challenging skills due to the precision required for stacking the balls, color coordination, and sequencing.', 'assets-used': ['ball/ball-template.urdf', 'container/container-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCoordinatedBallStacking(Task): """"""Stack balls on top of the corresponding colored containers in a specific color sequence."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""stack the balls on top of the corresponding colored containers in the sequence blue, yellow, green, red"" self.task_completed_desc = ""done stacking balls."" self.additional_reset() def reset(self, env): super().reset(env) # Define the color sequence color_sequence = ['blue', 'yellow', 'green', 'red'] # Add containers. container_size = (0.12, 0.12, 0.12) container_urdf = 'container/container-template.urdf' container_poses = [] containers = [] for color in color_sequence: container_pose = self.get_random_pose(env, container_size) container_id = env.add_object(container_urdf, container_pose, color=utils.COLORS[color]) container_poses.append(container_pose) containers.append(container_id) # Add balls. ball_size = (0.04, 0.04, 0.04) ball_urdf = 'ball/ball-template.urdf' balls = [] for color in color_sequence: ball_pose = self.get_random_pose(env, ball_size) ball_id = env.add_object(ball_urdf, ball_pose, color=utils.COLORS[color]) balls.append(ball_id) # Goal: each ball is stacked on top of the corresponding colored container in the color sequence. for i in range(len(balls)): self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[container_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(balls)) self.lang_goals.append(self.lang_template.format(obj=color_sequence[i])) # Add distractors. n_distractors = 0 while n_distractors < 6: is_ball = np.random.rand() > 0.5 urdf = ball_urdf if is_ball else container_urdf size = ball_size if is_ball else container_size pose = self.get_random_pose(env, obj_size=size) color = np.random.choice(list(utils.COLORS.keys())) obj_id = env.add_object(urdf, pose, color=utils.COLORS[color]) n_distractors += 1``` END" " ""color-coded-blocks-on-corner"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coded-blocks-on-corner"" in a python code block. ### "," color-coded-blocks-on-corner: {'task-name': 'color-coded-blocks-on-corner', 'task-description': 'On a tabletop, there are four blocks of different colors (red, blue, green, and yellow) and a corner structure. The task involves picking up each block and placing it in the corner structure in a specific color sequence: from left to right, place red, blue, green, and finally yellow. The blocks must be arranged such that they form a straight line along the corner. The challenge lies in the precise placement, color coordination, and maintaining the balance of the blocks along the corner.', 'assets-used': ['block/block.urdf', 'corner/corner-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCodedBlocksOnCorner(Task): """"""Pick up blocks of different colors and place them in a corner structure in a specific color sequence."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""place the blocks in the corner in the sequence red, blue, green, yellow"" self.task_completed_desc = ""done placing blocks in the corner."" self.additional_reset() def reset(self, env): super().reset(env) # Add corner structure. corner_size = (0.15, 0.15, 0.05) corner_pose = self.get_random_pose(env, corner_size) corner_urdf = 'corner/corner-template.urdf' env.add_object(corner_urdf, corner_pose, 'fixed') # Block colors. colors = [ utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow'] ] # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' blocks = [] for i in range(4): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=colors[i]) blocks.append(block_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.03), (0, 0, 0.03), (0, 0.05, 0.03), (0, 0, 0.08)] targs = [(utils.apply(corner_pose, i), corner_pose[1]) for i in place_pos] # Goal: blocks are placed in the corner in the sequence red, blue, green, yellow. for i in range(4): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[targs[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4) self.lang_goals.append(self.lang_template.format(blocks=""the red, blue, green, yellow blocks""))``` END" " ""insertion-in-color-sequenced-zones"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""insertion-in-color-sequenced-zones"" in a python code block. ### "," insertion-in-color-sequenced-zones: {'task-name': 'insertion-in-color-sequenced-zones', 'task-description': 'On the table, there are four differently-colored insertion ell objects (red, blue, green, yellow) and four zones on the tabletop marked in the same colors. Initially, each ell is placed in a zone but not corresponding to the color of the zone. The task is to pick up each ell and place it in the zone of the same color, in the specific sequence of red, blue, green, and yellow from left to right, requiring careful navigation, precise placement, color matching, and sequence following.', 'assets-used': ['insertion/ell.urdf', 'zone/zone.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class InsertionInColorSequencedZones(Task): """"""Pick up each ell and place it in the zone of the same color, in the specific sequence of red, blue, green, and yellow from left to right."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""place the {color} ell in the {color} zone"" self.task_completed_desc = ""done placing ells in color sequenced zones."" self.additional_reset() def reset(self, env): super().reset(env) # Ell colors. colors = ['red', 'blue', 'green', 'yellow'] # Add zones. zone_size = (0.12, 0.12, 0) zone_urdf = 'zone/zone.urdf' zone_poses = [] for i in range(4): zone_pose = self.get_random_pose(env, zone_size) env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[colors[i]]) zone_poses.append(zone_pose) # Add ells. ell_size = (0.04, 0.04, 0.04) ell_urdf = 'insertion/ell.urdf' ells = [] for i in range(4): ell_pose = self.get_random_pose(env, ell_size) ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[colors[i]]) ells.append(ell_id) # Goal: each ell is in the zone of the same color. for i in range(4): self.add_goal(objs=[ells[i]], matches=np.ones((1, 1)), targ_poses=[zone_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""precise-block-placement-in-container"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""precise-block-placement-in-container"" in a python code block. ### "," precise-block-placement-in-container: {'task-name': 'precise-block-placement-in-container', 'task-description': 'The tabletop has a row of four colored containers (red, blue, green, yellow), and twelve blocks of matching colors (three of each color). The task involves picking up each color of blocks and placing them in the container of the same color in a specific orientation: one block standing upright, one block lying flat, and one block on its side. The challenge lies in the precise placement and orientation of blocks within the confined space of the containers, while also maintaining color coordination.', 'assets-used': ['block/block.urdf', 'container/container-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class PreciseBlockPlacementInContainer(Task): """"""Pick up each color of blocks and place them in the container of the same color in a specific orientation."""""" def __init__(self): super().__init__() self.max_steps = 12 self.lang_template = ""place the {color} blocks in the {color} container"" self.task_completed_desc = ""done placing blocks in containers."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors for blocks and containers colors = ['red', 'blue', 'green', 'yellow'] # Add containers. container_size = (0.12, 0.12, 0.12) container_urdf = 'container/container-template.urdf' container_poses = [] for color in colors: container_pose = self.get_random_pose(env, container_size) env.add_object(container_urdf, container_pose, category='fixed', color=utils.COLORS[color]) container_poses.append(container_pose) # Add blocks. blocks = [] block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' for color in colors: for _ in range(3): # three blocks of each color block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color]) blocks.append(block_id) # Goal: each block is in a container of the same color. for i in range(len(blocks)): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[container_poses[i//3]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/12) self.lang_goals.append(self.lang_template.format(color=colors[i//3]))``` END" " ""color-coordinated-bowl-stacking"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-bowl-stacking"" in a python code block. ### "," color-coordinated-bowl-stacking: {'task-name': 'color-coordinated-bowl-stacking', 'task-description': 'There are four bowls and four blocks of different colors (red, blue, green, and yellow) on the table. The task is to pick up each block and place it into the bowl of the same color. Following this, the robot must stack the bowls from largest to smallest (from bottom to top) in the sequence of red, blue, green, and yellow. The challenge lies in not only the precise placement and color coordination, but also in the delicate stacking of the bowls without toppling them over.', 'assets-used': ['bowl/bowl.urdf', 'block/block.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCoordinatedBowlStacking(Task): """"""Pick up each block and place it into the bowl of the same color. Then stack the bowls from largest to smallest (from bottom to top) in the sequence of red, blue, green, and yellow."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""put each block in the bowl of the same color and stack the bowls from largest to smallest in the sequence of red, blue, green, and yellow"" self.task_completed_desc = ""done stacking bowls."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors colors = ['red', 'blue', 'green', 'yellow'] # Add bowls and blocks of each color bowl_size = (0.12, 0.12, 0) block_size = (0.04, 0.04, 0.04) bowl_urdf = 'bowl/bowl.urdf' block_urdf = 'block/block.urdf' bowls = [] blocks = [] for color in colors: # Add bowl bowl_pose = self.get_random_pose(env, bowl_size) bowl_id = env.add_object(bowl_urdf, bowl_pose, color=utils.COLORS[color]) bowls.append(bowl_id) # Add block block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color]) blocks.append(block_id) # Goal: each block is in the bowl of the same color for i in range(len(blocks)): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(bowls[i])], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / len(blocks)) # Goal: bowls are stacked in the sequence of red, blue, green, and yellow stack_poses = [(0, 0, 0.06), (0, 0, 0.12), (0, 0, 0.18), (0, 0, 0.24)] for i in range(len(bowls)): self.add_goal(objs=[bowls[i]], matches=np.ones((1, 1)), targ_poses=[utils.apply(bowl_pose, stack_poses[i])], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / len(bowls)) self.lang_goals.append(self.lang_template)``` END" " ""color-coordinated-zone-stacking"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-zone-stacking"" in a python code block. ### "," color-coordinated-zone-stacking: {'task-name': 'color-coordinated-zone-stacking', 'task-description': 'On the tabletop, there are three zones and nine blocks of three different colors (red, blue, green). Each color has three blocks and the blocks are scattered randomly on the table. The task is to pick up the blocks and stack them in the zones to form a pyramid shape. Each pyramid should contain blocks of the same color with two blocks on the base and one block on top. The zones with the pyramids should be arranged in a straight line in the following color order: red, blue, green from left to right. The challenge lies in the color coordination, precise stacking and the arrangement of the zones.', 'assets-used': ['block/block.urdf', 'zone/zone.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedZoneStacking(Task): """"""Pick up blocks of different colors and stack them in zones to form a pyramid."""""" def __init__(self): super().__init__() self.max_steps = 15 self.lang_template = ""stack the blocks in the zones to form a pyramid"" self.task_completed_desc = ""done stacking blocks."" self.additional_reset() def reset(self, env): super().reset(env) # Add zones. zone_size = (0.12, 0.12, 0) zone_urdf = 'zone/zone.urdf' zone_poses = [] for _ in range(3): zone_pose = self.get_random_pose(env, zone_size) env.add_object(zone_urdf, zone_pose, 'fixed') zone_poses.append(zone_pose) # Block colors. colors = [ utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'] ] # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' blocks = [] for i in range(9): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=colors[i//3]) blocks.append(block_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.03), (0, 0, 0.03), (0, 0.05, 0.03), (0, -0.025, 0.08), (0, 0.025, 0.08), (0, 0, 0.13)] targs = [(utils.apply(zone_poses[i//3], place_pos[i%3]), zone_poses[i//3][1]) for i in range(9)] # Goal: blocks are stacked in a pyramid in each zone. for i in range(3): self.add_goal(objs=blocks[i*3:(i+1)*3], matches=np.ones((3, 3)), targ_poses=targs[i*3:(i+1)*3], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]*3) self.lang_goals.append(self.lang_template.format(blocks=""the red, blue and green blocks"", row=""bottom""))``` END" " ""color-cued-ball-insertion"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-cued-ball-insertion"" in a python code block. ### "," color-cued-ball-insertion: {'task-name': 'color-cued-ball-insertion', 'task-description': 'The task area has four different colored bowls (red, blue, green, yellow) and four spheres of corresponding colors. Initially, the spheres are not in their color-matching bowls. The task is to pick up each sphere and place it in the bowl of the same color. However, the bowls are situated inside separate corners of a square structure marked by small blocks. This necessitates precise navigation around the square structure, careful picking and placing of spheres, color matching, and maintaining the balance of the bowls.', 'assets-used': ['bowl/bowl.urdf', 'sphere/sphere.urdf', 'block/small.urdf', 'square/square-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCuedBallInsertion(Task): """"""Pick up each sphere and place it in the bowl of the same color."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""put the {color} ball in the {color} bowl"" self.task_completed_desc = ""done placing balls in bowls."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors colors = ['red', 'blue', 'green', 'yellow'] # Add bowls and spheres. bowl_size = (0.12, 0.12, 0) sphere_size = (0.04, 0.04, 0.04) bowl_urdf = 'bowl/bowl.urdf' sphere_urdf = 'sphere/sphere.urdf' bowls = [] spheres = [] for color in colors: # Add bowl bowl_pose = self.get_random_pose(env, bowl_size) bowl_id = env.add_object(bowl_urdf, bowl_pose, color=utils.COLORS[color], category='fixed') bowls.append(bowl_id) # Add sphere sphere_pose = self.get_random_pose(env, sphere_size) sphere_id = env.add_object(sphere_urdf, sphere_pose, color=utils.COLORS[color]) spheres.append(sphere_id) # Add goal self.add_goal(objs=[sphere_id], matches=np.ones((1, 1)), targ_poses=[bowl_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(self.lang_template.format(color=color)) # Add blocks as obstacles block_size = (0.04, 0.04, 0.04) block_urdf = 'block/small.urdf' for _ in range(4): block_pose = self.get_random_pose(env, block_size) env.add_object(block_urdf, block_pose, category='fixed')``` END" " ""color-coordinated-insertion-through-box-barrier"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-insertion-through-box-barrier"" in a python code block. ### "," color-coordinated-insertion-through-box-barrier: {'task-name': 'color-coordinated-insertion-through-box-barrier', 'task-description': ""On a tabletop, there are four differently colored ell objects (red, blue, green, and yellow) and a corresponding set of color-coded fixtures. Placed in between the ell objects and the fixtures, there are two rows of boxes forming an 'L' shaped barrier. The task involves picking up each ell object and inserting it into the matching color fixture in a specific order: from left to right, insert red, blue, green, and then yellow, without knocking over any of the boxes. The challenge lies in precise navigation through the box barrier, precise insertion, color matching, and sequence following."", 'assets-used': ['insertion/ell.urdf', 'insertion/fixture.urdf', 'box/box-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCoordinatedInsertionThroughBoxBarrier(Task): """"""Pick up each ell object and insert it into the matching color fixture in a specific order: from left to right, insert red, blue, green, and then yellow, without knocking over any of the boxes."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""insert the {color} ell into the matching fixture"" self.task_completed_desc = ""done inserting ells."" self.additional_reset() def reset(self, env): super().reset(env) # Ell colors. colors = [ utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow'] ] # Add ell objects and fixtures. ell_size = (0.04, 0.04, 0.04) ell_urdf = 'insertion/ell.urdf' fixture_urdf = 'insertion/fixture.urdf' ells = [] fixtures = [] for i in range(4): ell_pose = self.get_random_pose(env, ell_size) ell_id = env.add_object(ell_urdf, ell_pose, color=colors[i]) ells.append(ell_id) fixture_pose = self.get_random_pose(env, ell_size) fixture_id = env.add_object(fixture_urdf, fixture_pose, color=colors[i]) fixtures.append(fixture_id) # Add boxes to form 'L' shaped barrier. box_size = (0.04, 0.04, 0.04) box_urdf = 'box/box-template.urdf' for _ in range(10): box_pose = self.get_random_pose(env, box_size) env.add_object(box_urdf, box_pose, category='fixed') # Goal: each ell is inserted into the matching color fixture in a specific order. for i in range(4): self.add_goal(objs=[ells[i]], matches=np.ones((1, 1)), targ_poses=[fixture_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-coordinated-insertion-and-stacking"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-insertion-and-stacking"" in a python code block. ### "," color-coordinated-insertion-and-stacking: {'task-name': 'color-coordinated-insertion-and-stacking', 'task-description': 'On the tabletop, there are four differently colored ell-shaped objects (red, blue, green, yellow) and four fixtures of corresponding colors. The task is to pick up each ell object and insert it into the fixture of the same color. Additionally, there are four blocks of matching colors. The robot has to stack these blocks on top of the fixtures, maintaining the color coordination. However, the tabletop is marked by a square path delineated by small blocks, within which the ell objects, blocks, and fixtures are placed randomly. This necessitates precise navigation within the square path, color coordination, stacking and insertion skills.', 'assets-used': ['insertion/ell.urdf', 'insertion/fixture.urdf', 'block/block.urdf', 'block/small.urdf', 'square/square-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCoordinatedInsertionAndStacking(Task): """"""Pick up each ell object and insert it into the fixture of the same color. Then stack blocks of matching colors on top of the fixtures."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""insert the {color} ell into the {color} fixture and stack the {color} block on top"" self.task_completed_desc = ""done inserting and stacking."" self.additional_reset() def reset(self, env): super().reset(env) # Add square path. square_size = (0.3, 0.3, 0.01) square_pose = self.get_random_pose(env, square_size) square_urdf = 'square/square-template.urdf' env.add_object(square_urdf, square_pose, 'fixed') # Ell and fixture colors. colors = ['red', 'blue', 'green', 'yellow'] # Add ells and fixtures. ell_size = (0.04, 0.04, 0.04) fixture_size = (0.05, 0.05, 0.05) ell_urdf = 'insertion/ell.urdf' fixture_urdf = 'insertion/fixture.urdf' ells = [] fixtures = [] for color in colors: ell_pose = self.get_random_pose(env, ell_size) fixture_pose = self.get_random_pose(env, fixture_size) ell_id = env.add_object(ell_urdf, ell_pose, color=color) fixture_id = env.add_object(fixture_urdf, fixture_pose, color=color) ells.append(ell_id) fixtures.append(fixture_id) # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' blocks = [] for color in colors: block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=color) blocks.append(block_id) # Goal: each ell is inserted into the fixture of the same color and the block of the same color is stacked on top. for i in range(4): self.add_goal(objs=[ells[i]], matches=np.ones((1, 1)), targ_poses=[fixture_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4) self.lang_goals.append(self.lang_template.format(color=colors[i])) self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[fixture_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-coordinated-cylinder-ball-match"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-cylinder-ball-match"" in a python code block. ### "," color-coordinated-cylinder-ball-match: {'task-name': 'color-coordinated-cylinder-ball-match', 'task-description': 'On the tabletop, there are four cylinders of different colors (red, blue, green, and yellow) and four balls of corresponding colors. The task is to pick up each ball and place it on top of the cylinder of the same color without the ball rolling off. However, there are small blocks scattered randomly on the table that the robot has to navigate around without knocking them over. The challenge lies in the precise placement of the balls on top of the cylinders, color matching, and navigation around the blocks.', 'assets-used': ['cylinder/cylinder-template.urdf', 'ball/ball-template.urdf', 'block/small.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCoordinatedCylinderBallMatch(Task): """"""Pick up each ball and place it on top of the cylinder of the same color."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""place the {color} ball on the {color} cylinder"" self.task_completed_desc = ""done placing balls on cylinders."" self.additional_reset() def reset(self, env): super().reset(env) # Add cylinders. # x, y, z dimensions for the asset size cylinder_size = (0.04, 0.04, 0.1) cylinder_urdf = 'cylinder/cylinder-template.urdf' cylinder_colors = ['red', 'blue', 'green', 'yellow'] cylinder_poses = [] cylinders = [] for color in cylinder_colors: cylinder_pose = self.get_random_pose(env, cylinder_size) cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=color) cylinder_poses.append(cylinder_pose) cylinders.append(cylinder_id) # Add balls. # x, y, z dimensions for the asset size ball_size = (0.04, 0.04, 0.04) ball_urdf = 'ball/ball-template.urdf' balls = [] for color in cylinder_colors: ball_pose = self.get_random_pose(env, ball_size) ball_id = env.add_object(ball_urdf, ball_pose, color=color) balls.append(ball_id) # Add blocks as obstacles. # x, y, z dimensions for the asset size block_size = (0.04, 0.04, 0.04) block_urdf = 'block/small.urdf' for _ in range(5): block_pose = self.get_random_pose(env, block_size) env.add_object(block_urdf, block_pose) # Goal: each ball is on top of the cylinder of the same color. for i in range(len(balls)): self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[cylinder_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(balls)) self.lang_goals.append(self.lang_template.format(color=cylinder_colors[i]))``` END" " ""multi-level-insertion-and-zone-matching"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""multi-level-insertion-and-zone-matching"" in a python code block. ### "," multi-level-insertion-and-zone-matching: {'task-name': 'multi-level-insertion-and-zone-matching', 'task-description': 'There are three levels of zones marked on the tabletop - the first level is red, second is blue, and third is green. On each level, there are large, medium, and small ell-shaped objects in corresponding colors. The task is to pick up each ell object from its current position and insert it into the corresponding colored zone on the same level, but in a specific order - large, medium, and small. The challenge lies in the precise control of insertion, color coordination, and the multi-level structure of the environment.', 'assets-used': ['zone/zone.urdf', 'insertion/ell.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class MultiLevelInsertionAndZoneMatching(Task): """"""Pick up ell objects from their current position and insert them into the corresponding colored zone on the same level, in a specific order - large, medium, and small."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""insert the {size} {color} ell into the {color} zone on the same level"" self.task_completed_desc = ""done inserting."" self.additional_reset() def reset(self, env): super().reset(env) # Add zones. zone_sizes = [(0.12, 0.12, 0), (0.12, 0.12, 0.05), (0.12, 0.12, 0.1)] zone_urdf = 'zone/zone.urdf' zone_poses = [] zone_colors = ['red', 'blue', 'green'] for i in range(3): zone_pose = self.get_random_pose(env, zone_sizes[i]) env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[zone_colors[i]]) zone_poses.append(zone_pose) # Add ell objects. ell_sizes = [(0.08, 0.08, 0.02), (0.06, 0.06, 0.015), (0.04, 0.04, 0.01)] ell_urdf = 'insertion/ell.urdf' ells = [] for i in range(3): for j in range(3): ell_pose = self.get_random_pose(env, ell_sizes[j]) ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[zone_colors[i]]) ells.append(ell_id) # Goal: each ell object is in the corresponding colored zone on the same level. for i in range(9): self.add_goal(objs=[ells[i]], matches=np.ones((1, 1)), targ_poses=[zone_poses[i//3]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/9) self.lang_goals.append(self.lang_template.format(size=['large', 'medium', 'small'][i%3], color=zone_colors[i//3]))``` END" " ""multi-color-block-sequence-insertion"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""multi-color-block-sequence-insertion"" in a python code block. ### "," multi-color-block-sequence-insertion: {'task-name': 'multi-color-block-sequence-insertion', 'task-description': 'On the tabletop, there are five blocks of different colors (red, blue, green, yellow, and orange) and five fixtures of matching colors. However, the fixtures are arranged in a mixed sequence of colors. The task involves picking up each block and inserting it into the fixture of the same color, but in a specific sequence - first red, then blue, next green, followed by yellow, and finally orange. The fixtures can be inserted only in the specified sequence and the robot cannot proceed to the next color without correctly inserting the current one. The task is challenging due to the precision required in inserting the blocks, the color coordination, and following the sequence.', 'assets-used': ['block/block.urdf', 'insertion/fixture.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class MultiColorBlockSequenceInsertion(Task): """"""Pick up blocks of different colors and insert them into the fixture of the same color in a specific sequence."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""insert the {color} block into the {color} fixture"" self.task_completed_desc = ""done inserting blocks."" self.additional_reset() def reset(self, env): super().reset(env) # Define the color sequence color_sequence = ['red', 'blue', 'green', 'yellow', 'orange'] # Add fixtures. fixture_size = (0.04, 0.04, 0.04) fixture_urdf = 'insertion/fixture.urdf' fixtures = [] for color in color_sequence: fixture_pose = self.get_random_pose(env, fixture_size) fixture_id = env.add_object(fixture_urdf, fixture_pose, color=utils.COLORS[color]) fixtures.append(fixture_id) # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' blocks = [] for color in color_sequence: block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color]) blocks.append(block_id) # Goal: each block is inserted into the fixture of the same color in the specified sequence. for i in range(len(blocks)): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(fixtures[i])], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(blocks)) self.lang_goals.append(self.lang_template.format(color=color_sequence[i]))``` END" " ""ball-tower-in-zones"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""ball-tower-in-zones"" in a python code block. ### "," ball-tower-in-zones: {'task-name': 'ball-tower-in-zones', 'task-description': 'On the table, there are three spheres and three cylindrical stands of different colors (red, blue, green). The task starts with each sphere not corresponding to the stand of the same color. The task is to pick up each sphere and stack it on top of the stand of the same color while maintaining the balance. However, the stacking should be done in a specific color sequence - blue at the bottom, followed by green, and finally red at the top. The spheres and stands are each placed within separate zones, adding a challenge in precise navigation and placement.', 'assets-used': ['sphere/sphere.urdf', 'zone/zone.urdf', 'stacking/stand.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class BallTowerInZones(Task): """"""Pick up each sphere and stack it on top of the stand of the same color while maintaining the balance. However, the stacking should be done in a specific color sequence - blue at the bottom, followed by green, and finally red at the top. The spheres and stands are each placed within separate zones."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""stack the {color} sphere on the {color} stand"" self.task_completed_desc = ""done stacking spheres."" self.additional_reset() def reset(self, env): super().reset(env) # Add zones. zone_size = (0.12, 0.12, 0) zone_urdf = 'zone/zone.urdf' zone_poses = [] for _ in range(3): zone_pose = self.get_random_pose(env, zone_size) env.add_object(zone_urdf, zone_pose, 'fixed') zone_poses.append(zone_pose) # Sphere and stand colors. colors = [ utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['red'] ] # Add spheres and stands. sphere_size = (0.04, 0.04, 0.04) sphere_urdf = 'sphere/sphere.urdf' stand_size = (0.05, 0.05, 0.05) stand_urdf = 'stacking/stand.urdf' spheres = [] stands = [] for i in range(3): sphere_pose = self.get_random_pose(env, sphere_size) sphere_id = env.add_object(sphere_urdf, sphere_pose, color=colors[i]) spheres.append(sphere_id) stand_pose = self.get_random_pose(env, stand_size) stand_id = env.add_object(stand_urdf, stand_pose, color=colors[i]) stands.append(stand_id) # Goal: each sphere is stacked on the stand of the same color in the correct zone. for i in range(3): self.add_goal(objs=[spheres[i]], matches=np.ones((1, 1)), targ_poses=[zone_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 3) self.lang_goals.append(self.lang_template.format(color=colors[i])) # Add distractors. n_distractors = 0 while n_distractors < 6: is_sphere = np.random.rand() > 0.5 urdf = sphere_urdf if is_sphere else stand_urdf size = sphere_size if is_sphere else stand_size pose = self.get_random_pose(env, obj_size=size) color = colors[n_distractors % len(colors)] obj_id = env.add_object(urdf, pose, color=color) n_distractors += 1``` END" " ""color-coordinated-container-pyramid"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-container-pyramid"" in a python code block. ### "," color-coordinated-container-pyramid: {'task-name': 'color-coordinated-container-pyramid', 'task-description': 'On a tabletop, there are six containers and six blocks of different colors (red, blue, green, yellow, orange, and purple). The task is to pick up each block and place it into the container of the same color, then stack these containers to form a pyramid with three levels. The first level should consist of four containers: red, blue, green, and yellow (from left to right). The second level should be constructed by placing the orange and purple containers on top of the red and blue containers respectively. The top level should be formed by placing the red container onto the orange container. The challenge lies in the precise placement, color coordination, and maintaining the balance of the pyramid.', 'assets-used': ['block/block.urdf', 'container/container-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedContainerPyramid(Task): """"""Pick up each block and place it into the container of the same color, then stack these containers to form a pyramid."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""build a pyramid with the containers by placing the blocks of the same color into them"" self.task_completed_desc = ""done building pyramid."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors for blocks and containers colors = ['red', 'blue', 'green', 'yellow', 'orange', 'purple'] # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' blocks = [] for color in colors: block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color]) blocks.append(block_id) # Add containers. container_size = (0.12, 0.12, 0.06) container_urdf = 'container/container-template.urdf' containers = [] for color in colors: container_pose = self.get_random_pose(env, container_size) container_id = env.add_object(container_urdf, container_pose, color=utils.COLORS[color]) containers.append(container_id) # Goal: each block is in a container of the same color. for i in range(len(blocks)): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(containers[i])], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / len(blocks)) # Goal: containers are stacked in a pyramid. pyramid_poses = [ (0, -0.06, 0.03), (0, 0, 0.03), (0, 0.06, 0.03), (0, -0.03, 0.09), (0, 0.03, 0.09), (0, 0, 0.15) ] pyramid_poses = [(utils.apply(p.getBasePositionAndOrientation(containers[0]), i), p.getBasePositionAndOrientation(containers[0])[1]) for i in pyramid_poses] self.add_goal(objs=containers, matches=np.ones((len(containers), len(containers))), targ_poses=pyramid_poses, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1) self.lang_goals.append(self.lang_template)``` END" " ""corner-blocks-insertion"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""corner-blocks-insertion"" in a python code block. ### "," corner-blocks-insertion: {'task-name': 'corner-blocks-insertion', 'task-description': 'On the tabletop, there are four different colored ell objects (red, blue, green, yellow) and four fixtures in the corresponding colors. Initially, each ell is placed in the corner of the table. The task is to pick up each ell and insert it into the fixture of the same color. However, there is a square-shaped barrier in the center of the table. The ell objects must be inserted in a specific sequence - red first, then blue, then green, and finally yellow. This task requires careful navigation around the barrier, precise insertion, color coordination, and sequence following.', 'assets-used': ['insertion/ell.urdf', 'insertion/fixture.urdf', 'square/square-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class CornerBlocksInsertion(Task): """"""Pick up ell objects from the corners and insert them into the fixtures of the same color in a specific sequence."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""insert the {color} ell into the {color} fixture"" self.task_completed_desc = ""done inserting."" self.additional_reset() def reset(self, env): super().reset(env) # Ell and fixture colors. colors = ['red', 'blue', 'green', 'yellow'] # Add ell objects and fixtures. ell_size = (0.04, 0.04, 0.04) ell_urdf = 'insertion/ell.urdf' fixture_size = (0.04, 0.04, 0.04) fixture_urdf = 'insertion/fixture.urdf' objs = [] for color in colors: # Add ell object. ell_pose = self.get_random_pose(env, ell_size) ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[color]) objs.append(ell_id) # Add fixture. fixture_pose = self.get_random_pose(env, fixture_size) env.add_object(fixture_urdf, fixture_pose, color=utils.COLORS[color]) # Add square-shaped barrier. barrier_size = (0.1, 0.1, 0.1) barrier_pose = self.get_random_pose(env, barrier_size) barrier_urdf = 'square/square-template.urdf' env.add_object(barrier_urdf, barrier_pose, 'fixed') # Goal: each ell object is inserted into the fixture of the same color in a specific sequence. for i, color in enumerate(colors): self.add_goal(objs=[objs[i]], matches=np.ones((1, 1)), targ_poses=[fixture_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4) self.lang_goals.append(self.lang_template.format(color=color))``` END" " ""color-coordinated-insertion-in-cylinders"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-insertion-in-cylinders"" in a python code block. ### "," color-coordinated-insertion-in-cylinders: {'task-name': 'color-coordinated-insertion-in-cylinders', 'task-description': 'There are four differently-colored ell objects (red, blue, green, yellow) and four cylinders of matching colors. The task involves picking up each ell object and inserting it into the cylinder of the same color in a specific order: from left to right, insert red, blue, green, and finally yellow. The challenge lies in the precise manipulation of the ell objects, the color-coordination required and the ability to correctly orient the cylinders for the insertion.', 'assets-used': ['insertion/ell.urdf', 'cylinder/cylinder-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCoordinatedInsertionInCylinders(Task): """"""Insert four differently-colored ell objects into cylinders of matching colors in a specific order."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""insert the {color} ell into the {color} cylinder"" self.task_completed_desc = ""done inserting ells into cylinders."" self.additional_reset() def reset(self, env): super().reset(env) # Ell and Cylinder colors. colors = ['red', 'blue', 'green', 'yellow'] # Add ells. # x, y, z dimensions for the ell size ell_size = (0.04, 0.04, 0.04) ell_urdf = 'insertion/ell.urdf' ells = [] for color in colors: ell_pose = self.get_random_pose(env, ell_size) ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[color]) ells.append(ell_id) # Add cylinders. # x, y, z dimensions for the cylinder size cylinder_size = (0.05, 0.05, 0.1) cylinder_urdf = 'cylinder/cylinder-template.urdf' cylinders = [] for color in colors: cylinder_pose = self.get_random_pose(env, cylinder_size) cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=utils.COLORS[color]) cylinders.append(cylinder_id) # Goal: each ell is inserted into the cylinder of the same color. for i in range(len(colors)): self.add_goal(objs=[ells[i]], matches=np.ones((1, 1)), targ_poses=[cylinder_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(colors)) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-coordinated-block-transport"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-block-transport"" in a python code block. ### "," color-coordinated-block-transport: {'task-name': 'color-coordinated-block-transport', 'task-description': ""On the tabletop, there are four pallets of different colors (red, blue, green, and yellow), each containing a block of the same color. The task is to pick up each block and transport it to a container of matching color, which is located in a corner surrounded by a line of small blocks, serving as an obstacle. The robot must execute this task without disturbing the small blocks and in a specific color sequence: red first, then blue, green, and finally yellow. The task tests the robot's precise navigation, color coordination, sequence following, and obstacle avoidance capabilities."", 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf', 'container/container-template.urdf', 'block/small.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCoordinatedBlockTransport(Task): """"""Pick up each block and transport it to a container of matching color, which is located in a corner surrounded by a line of small blocks, serving as an obstacle. The robot must execute this task without disturbing the small blocks and in a specific color sequence: red first, then blue, green, and finally yellow."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""transport the {color} block to the {color} container"" self.task_completed_desc = ""done transporting blocks."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and their sequence colors = ['red', 'blue', 'green', 'yellow'] # Add containers of different colors. container_size = (0.1, 0.1, 0.1) container_urdf = 'container/container-template.urdf' containers = [] for color in colors: container_pose = self.get_random_pose(env, container_size) container_id = env.add_object(container_urdf, container_pose, color=utils.COLORS[color]) containers.append(container_id) # Add blocks of different colors. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' blocks = [] for color in colors: block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color]) blocks.append(block_id) # Add small blocks as obstacles. small_block_size = (0.02, 0.02, 0.02) small_block_urdf = 'block/small.urdf' for _ in range(10): small_block_pose = self.get_random_pose(env, small_block_size) env.add_object(small_block_urdf, small_block_pose) # Goal: each block is in a container of the same color. for i in range(len(blocks)): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(containers[i])], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(blocks)) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-cued-ball-corner-sorting"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-cued-ball-corner-sorting"" in a python code block. ### "," color-cued-ball-corner-sorting: {'task-name': 'color-cued-ball-corner-sorting', 'task-description': 'On a tabletop, there are four different colored balls (red, blue, green, yellow) and four corners marked with corresponding colors using the corner template. The task involves picking up each ball and precisely placing it in the corner of the same color. However, there is a rectangular zone in the middle of the table marked by small blocks. The robot has to strategically navigate around this zone without touching the blocks while transporting the balls to the corresponding corners. The challenge lies in the precise navigation, placement of the balls, and color matching while avoiding the blocks.', 'assets-used': ['ball/ball-template.urdf', 'corner/corner-template.urdf', 'block/block_for_anchors.urdf', 'zone/zone.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCuedBallCornerSorting(Task): """"""Pick up each colored ball and place it in the corner of the same color while avoiding a zone marked by small blocks."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""place the {color} ball in the {color} corner"" self.task_completed_desc = ""done sorting balls."" self.additional_reset() def reset(self, env): super().reset(env) # Add corners. corner_size = (0.05, 0.05, 0.05) corner_urdf = 'corner/corner-template.urdf' corner_colors = ['red', 'blue', 'green', 'yellow'] corner_poses = [] for color in corner_colors: corner_pose = self.get_random_pose(env, corner_size) env.add_object(corner_urdf, corner_pose, color=color, category='fixed') corner_poses.append(corner_pose) # Add balls. balls = [] ball_size = (0.04, 0.04, 0.04) ball_urdf = 'ball/ball-template.urdf' for color in corner_colors: ball_pose = self.get_random_pose(env, ball_size) ball_id = env.add_object(ball_urdf, ball_pose, color=color) balls.append(ball_id) # Add zone. zone_size = (0.2, 0.2, 0.05) zone_pose = self.get_random_pose(env, zone_size) zone_urdf = 'zone/zone.urdf' env.add_object(zone_urdf, zone_pose, 'fixed') # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block_for_anchors.urdf' for _ in range(4): block_pose = self.get_random_pose(env, block_size) env.add_object(block_urdf, block_pose) # Goal: each ball is in the corner of the same color. for i in range(4): self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[corner_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(self.lang_template.format(color=corner_colors[i]))``` END" " ""color-coordinated-insertion-and-corner-pyramid"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-insertion-and-corner-pyramid"" in a python code block. ### "," color-coordinated-insertion-and-corner-pyramid: {'task-name': 'color-coordinated-insertion-and-corner-pyramid', 'task-description': 'On a tabletop, there are four colored ell-shaped blocks (red, blue, green, and yellow) and four fixtures of corresponding colors. The task is to first pick up each ell block and insert it into the fixture of the same color in a specific sequence - red first, then blue, then green, and finally yellow. After the successful insertion, the robot must pick up the four blocks again from the fixtures and stack them in a corner-structured pyramid with red at the bottom, blue in the middle, green on the third level, and yellow on top.', 'assets-used': ['insertion/ell.urdf', 'insertion/fixture.urdf', 'corner/corner-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCoordinatedInsertionAndCornerPyramid(Task): """"""Pick up each ell block and insert it into the fixture of the same color in a specific sequence - red first, then blue, then green, and finally yellow. After the successful insertion, the robot must pick up the four blocks again from the fixtures and stack them in a corner-structured pyramid with red at the bottom, blue in the middle, green on the third level, and yellow on top."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""insert the {color} block into the {color} fixture and then stack them in a corner-structured pyramid in the order of red, blue, green, and yellow"" self.task_completed_desc = ""done inserting and stacking."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and corresponding names colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow']] color_names = ['red', 'blue', 'green', 'yellow'] # Add fixtures and blocks. fixture_size = (0.04, 0.04, 0.04) block_size = (0.04, 0.04, 0.04) fixture_urdf = 'insertion/fixture.urdf' block_urdf = 'insertion/ell.urdf' fixtures = [] blocks = [] for i in range(4): # Add fixture fixture_pose = self.get_random_pose(env, fixture_size) fixture_id = env.add_object(fixture_urdf, fixture_pose, color=colors[i]) fixtures.append(fixture_id) # Add block block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=colors[i]) blocks.append(block_id) # Goal: each block is inserted into the fixture of the same color in the order of red, blue, green, yellow. for i in range(4): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[fixture_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4) self.lang_goals.append(self.lang_template.format(color=color_names[i])) # Goal: blocks are stacked in a corner-structured pyramid in the order of red, blue, green, yellow. corner_template = 'corner/corner-template.urdf' corner_size = (0.12, 0.12, 0.12) corner_pose = self.get_random_pose(env, corner_size) env.add_object(corner_template, corner_pose, 'fixed') # Associate placement locations for goals. place_pos = [(0, -0.05, 0.03), (0, 0, 0.03), (0, 0.05, 0.03), (0, 0, 0.08)] targs = [(utils.apply(corner_pose, i), corner_pose[1]) for i in place_pos] for i in range(4): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[targs[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4) self.lang_goals.append(self.lang_template.format(color=color_names[i]))``` END" " ""color-coordinated-sphere-and-cylinder-stack"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-sphere-and-cylinder-stack"" in a python code block. ### "," color-coordinated-sphere-and-cylinder-stack: {'task-name': 'color-coordinated-sphere-and-cylinder-stack', 'task-description': 'On the tabletop, there are four differently colored spheres (red, blue, green, and yellow) and four cylinders of the same colors. The task involves picking up each cylinder and stacking it on top of the sphere of the same color. However, the stacking should be done in a specific color sequence - blue at the bottom, followed by yellow, then green, and finally red at the top. This task enforces challenging skills due to the precision required for stacking the cylinders on top of spheres, color coordination, and sequencing.', 'assets-used': ['sphere/sphere-template.urdf', 'cylinder/cylinder-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedSphereAndCylinderStack(Task): """"""Stack cylinders on top of spheres of the same color in a specific color sequence."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""stack the {color} cylinder on top of the {color} sphere"" self.task_completed_desc = ""done stacking."" self.additional_reset() def reset(self, env): super().reset(env) # Define the color sequence color_sequence = ['blue', 'yellow', 'green', 'red'] # Add spheres and cylinders of each color sphere_urdf = 'sphere/sphere-template.urdf' cylinder_urdf = 'cylinder/cylinder-template.urdf' sphere_size = (0.05, 0.05, 0.05) cylinder_size = (0.05, 0.05, 0.1) objects = [] for color in color_sequence: # Add sphere sphere_pose = self.get_random_pose(env, sphere_size) sphere_id = env.add_object(sphere_urdf, sphere_pose, color=utils.COLORS[color]) objects.append(sphere_id) # Add cylinder cylinder_pose = self.get_random_pose(env, cylinder_size) cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=utils.COLORS[color]) objects.append(cylinder_id) # Goal: each cylinder is stacked on top of the sphere of the same color for i in range(0, len(objects), 2): sphere_id = objects[i] cylinder_id = objects[i+1] self.add_goal(objs=[cylinder_id], matches=np.ones((1, 1)), targ_poses=[sphere_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(self.lang_template.format(color=color_sequence[i//2]))``` END" " ""color-coordinated-blocks-in-cylindrical-maze"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-blocks-in-cylindrical-maze"" in a python code block. ### "," color-coordinated-blocks-in-cylindrical-maze: {'task-name': 'color-coordinated-blocks-in-cylindrical-maze', 'task-description': 'There are six differently colored blocks (red, blue, green, yellow, orange, and purple) and six cylindrical containers of matching colors arranged to form a maze-like structure. The task is to pick up each block and place it into the cylindrical container of the same color. The challenge lies in the precise navigation through the maze-like structure, correct color matching, and accurate placement of the blocks into the cylindrical containers.', 'assets-used': ['block/block.urdf', 'cylinder/cylinder-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedBlocksInCylindricalMaze(Task): """"""Navigate through a maze-like structure and place colored blocks into matching colored cylindrical containers."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""place the {color} block in the {color} cylinder"" self.task_completed_desc = ""done placing blocks in cylinders."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors for blocks and cylinders colors = ['red', 'blue', 'green', 'yellow', 'orange', 'purple'] # Add blocks. # x, y, z dimensions for the asset size block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' blocks = [] for color in colors: block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=color) blocks.append(block_id) # Add cylinders. # x, y, z dimensions for the asset size cylinder_size = (0.05, 0.05, 0.1) cylinder_urdf = 'cylinder/cylinder-template.urdf' cylinders = [] for color in colors: cylinder_pose = self.get_random_pose(env, cylinder_size) cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=color) cylinders.append(cylinder_id) # Goal: each block is in a cylinder of the same color. for i in range(len(blocks)): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[cylinder_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / len(blocks)) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-coordinated-cylinder-relay"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-cylinder-relay"" in a python code block. ### "," color-coordinated-cylinder-relay: {'task-name': 'color-coordinated-cylinder-relay', 'task-description': 'On the tabletop, there are four cylinders of different colors (red, blue, green, yellow) placed at one end and four zones of matching colors at the other end, with a square outline and small blocks serving as barriers between the cylinders and zones. The task is to pick up each cylinder and navigate it through the barriers to reach and place it in the zone of the same color. The task must be done in a specific sequence - red first, then blue, then green, and finally yellow. This task is challenging due to the requirement for precise navigation and placement, color coordination, and sequence following.', 'assets-used': ['cylinder/cylinder-template.urdf', 'zone/zone.urdf', 'square/square-template.urdf', 'block/small.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedCylinderRelay(Task): """"""Pick up each cylinder and navigate it through the barriers to reach and place it in the zone of the same color."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""move the {color} cylinder to the {color} zone"" self.task_completed_desc = ""done moving cylinders."" self.colors = ['red', 'blue', 'green', 'yellow'] self.color_order = {'red': 0, 'blue': 1, 'green': 2, 'yellow': 3} self.additional_reset() def reset(self, env): super().reset(env) # Add zones. zone_size = (0.12, 0.12, 0) zone_urdf = 'zone/zone.urdf' zone_poses = [] for color in self.colors: zone_pose = self.get_random_pose(env, zone_size) env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[color]) zone_poses.append(zone_pose) # Add cylinders. cylinder_size = (0.04, 0.04, 0.04) cylinder_urdf = 'cylinder/cylinder-template.urdf' cylinders = [] for color in self.colors: cylinder_pose = self.get_random_pose(env, cylinder_size) cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=utils.COLORS[color]) cylinders.append(cylinder_id) # Add barriers. barrier_size = (0.02, 0.02, 0.02) barrier_urdf = 'block/small.urdf' for _ in range(10): barrier_pose = self.get_random_pose(env, barrier_size) env.add_object(barrier_urdf, barrier_pose, 'fixed') # Goal: each cylinder is in the zone of the same color. for i in range(len(cylinders)): self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[zone_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(cylinders)) self.lang_goals.append(self.lang_template.format(color=self.colors[i])) def get_reward(self, obs, action=None): reward, terminate = super().get_reward(obs, action) if terminate: # Check if cylinders are in the correct order in their zones. object_positions = obs['object_positions'] object_colors = obs['object_colors'] zone_positions = obs['zone_positions'] zone_colors = obs['zone_colors'] for i in range(len(object_positions)): if object_colors[i] != zone_colors[i]: return 0, False if self.color_order[object_colors[i]] != i: return 0, False return reward, terminate``` END" " ""color-coordinated-cylinder-maze"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-cylinder-maze"" in a python code block. ### "," color-coordinated-cylinder-maze: {'task-name': 'color-coordinated-cylinder-maze', 'task-description': 'On the tabletop, there is a maze-like structure created by small blocks and within this maze, there are four differently colored cylinders (red, blue, green, yellow). The robot needs to pick up each cylinder and place it outside of the maze into four separate zones of matching colors. The task is challenging due to the precise navigation required within the maze, the color coordination of cylinders and zones, and the careful extraction of cylinders from the maze.', 'assets-used': ['block/small.urdf', 'cylinder/cylinder-template.urdf', 'zone/zone.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedCylinderMaze(Task): """"""Navigate through a maze, pick up colored cylinders and place them in matching colored zones."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""navigate through the maze, pick up the {color} cylinder and place it in the {color} zone"" self.task_completed_desc = ""done navigating and placing cylinders."" self.additional_reset() def reset(self, env): super().reset(env) # Add maze blocks. block_urdf = 'block/small.urdf' block_size = (0.04, 0.04, 0.04) for _ in range(20): block_pose = self.get_random_pose(env, block_size) env.add_object(block_urdf, block_pose, category='fixed') # Add colored cylinders. cylinder_urdf = 'cylinder/cylinder-template.urdf' cylinder_size = (0.04, 0.04, 0.04) colors = ['red', 'blue', 'green', 'yellow'] cylinders = [] for color in colors: cylinder_pose = self.get_random_pose(env, cylinder_size) cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=color) cylinders.append(cylinder_id) # Add colored zones. zone_urdf = 'zone/zone.urdf' zone_size = (0.12, 0.12, 0) zones = [] for color in colors: zone_pose = self.get_random_pose(env, zone_size) zone_id = env.add_object(zone_urdf, zone_pose, color=color, category='fixed') zones.append(zone_id) # Goal: each colored cylinder is in the matching colored zone. for i in range(len(cylinders)): self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[zone_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / len(cylinders)) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""insertion-path-obstacle-course"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""insertion-path-obstacle-course"" in a python code block. ### "," insertion-path-obstacle-course: {'task-name': 'insertion-path-obstacle-course', 'task-description': 'On the tabletop, there are four colored ell-shaped blocks (red, blue, green, and yellow) and four fixtures of matching colors. However, a line of small blocks forms a path that the robot must navigate along to insert each ell block into the fixture of the same color. The robot must move each ell block along the marked path to reach the fixture. The order for the insertion should be red, blue, green, and finally yellow from left to right. The task is challenging due to the precision required for insertion, the careful navigation along the path, and the color coordination.', 'assets-used': ['block/small.urdf', 'insertion/ell.urdf', 'insertion/fixture.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class InsertionPathObstacleCourse(Task): """"""Navigate a robot along a path to insert colored ell blocks into matching fixtures."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""move the {color} ell block along the path and insert it into the {color} fixture"" self.task_completed_desc = ""done inserting ell blocks."" self.additional_reset() def reset(self, env): super().reset(env) # Ell block and fixture colors. colors = ['red', 'blue', 'green', 'yellow'] # Add ell blocks and fixtures. ell_size = (0.04, 0.04, 0.04) ell_urdf = 'insertion/ell.urdf' fixture_size = (0.04, 0.04, 0.04) fixture_urdf = 'insertion/fixture.urdf' ell_blocks = [] fixtures = [] for color in colors: # Add ell block ell_pose = self.get_random_pose(env, ell_size) ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[color]) ell_blocks.append(ell_id) # Add fixture fixture_pose = self.get_random_pose(env, fixture_size) fixture_id = env.add_object(fixture_urdf, fixture_pose, color=utils.COLORS[color]) fixtures.append(fixture_id) # Add small blocks to form a path small_block_size = (0.02, 0.02, 0.02) small_block_urdf = 'block/small.urdf' for _ in range(10): small_block_pose = self.get_random_pose(env, small_block_size) env.add_object(small_block_urdf, small_block_pose) # Goal: each ell block is inserted into the fixture of the same color. for i in range(len(colors)): self.add_goal(objs=[ell_blocks[i]], matches=np.ones((1, 1)), targ_poses=[fixture_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(colors)) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-coordinated-sphere-and-bowl-match"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-sphere-and-bowl-match"" in a python code block. ### "," color-coordinated-sphere-and-bowl-match: {'task-name': 'color-coordinated-sphere-and-bowl-match', 'task-description': 'On a tabletop, there are four bowls and four spheres of different sizes and colors (red, blue, green, and yellow). The task is to pick up each sphere and place it into the bowl of the same color. The challenge lies in the precision necessary for placement, the color coordination, and the size disparity between the spheres and bowls.', 'assets-used': ['sphere/sphere-template.urdf', 'bowl/bowl.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCoordinatedSphereAndBowlMatch(Task): """"""Pick up each sphere and place it into the bowl of the same color."""""" def __init__(self): super().__init__() self.max_steps = 4 self.lang_template = ""place the {color} sphere in the {color} bowl"" self.task_completed_desc = ""done placing spheres in bowls."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors colors = ['red', 'blue', 'green', 'yellow'] # Add bowls and spheres. # x, y, z dimensions for the asset size bowl_size = (0.12, 0.12, 0) sphere_size = (0.04, 0.04, 0.04) bowl_urdf = 'bowl/bowl.urdf' sphere_urdf = 'sphere/sphere-template.urdf' objs = [] for color in colors: # Add bowl bowl_pose = self.get_random_pose(env, obj_size=bowl_size) bowl_id = env.add_object(bowl_urdf, bowl_pose, color=utils.COLORS[color], category='fixed') # Add sphere sphere_pose = self.get_random_pose(env, obj_size=sphere_size) sphere_id = env.add_object(sphere_urdf, sphere_pose, color=utils.COLORS[color]) objs.append((sphere_id, bowl_id)) # Add goal self.add_goal(objs=[sphere_id], matches=np.ones((1, 1)), targ_poses=[bowl_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4) self.lang_goals.append(self.lang_template.format(color=color))``` END" " ""color-coordinated-pallet-insertion"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-pallet-insertion"" in a python code block. ### "," color-coordinated-pallet-insertion: {'task-name': 'color-coordinated-pallet-insertion', 'task-description': 'On the tabletop, there are four pallets and four ell objects of different colors (red, blue, green, yellow). Each color has one pallet and one ell object. The task is to pick up each ell object and insert it into the pallet of the same color. However, the pallets and the ell objects are initially positioned on opposite sides of a barrier formed by a line of small blocks. The robot needs to transport the ell objects over the barrier and insert them into the corresponding pallets without knocking over any blocks. The challenge lies in the precise navigation, the insertion of the ell objects into the pallets, and color matching.', 'assets-used': ['pallet/pallet.urdf', 'insertion/ell.urdf', 'block/small.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCoordinatedPalletInsertion(Task): """"""Pick up each ell object and insert it into the pallet of the same color."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""insert the {color} ell into the {color} pallet"" self.task_completed_desc = ""done inserting ells into pallets."" self.additional_reset() def reset(self, env): super().reset(env) # Colors for the ell objects and pallets colors = ['red', 'blue', 'green', 'yellow'] # Add pallets. # x, y, z dimensions for the asset size pallet_size = (0.12, 0.12, 0.02) pallet_urdf = 'pallet/pallet.urdf' pallet_poses = [] for color in colors: pallet_pose = self.get_random_pose(env, pallet_size) env.add_object(pallet_urdf, pallet_pose, category='fixed', color=utils.COLORS[color]) pallet_poses.append(pallet_pose) # Add ell objects. # x, y, z dimensions for the asset size ell_size = (0.04, 0.04, 0.04) ell_urdf = 'insertion/ell.urdf' ells = [] for color in colors: ell_pose = self.get_random_pose(env, ell_size) ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[color]) ells.append(ell_id) # Add barrier of small blocks. # x, y, z dimensions for the asset size block_size = (0.02, 0.02, 0.02) block_urdf = 'block/small.urdf' for _ in range(10): block_pose = self.get_random_pose(env, block_size) env.add_object(block_urdf, block_pose, category='fixed') # Goal: each ell object is in the pallet of the same color. for i in range(len(ells)): self.add_goal(objs=[ells[i]], matches=np.ones((1, 1)), targ_poses=[pallet_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(ells)) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-coordinated-insertion-and-stack"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-insertion-and-stack"" in a python code block. ### "," color-coordinated-insertion-and-stack: {'task-name': 'color-coordinated-insertion-and-stack', 'task-description': 'The task begins with four colored ell-shaped blocks (red, blue, green, yellow) and four fixtures of corresponding colors. The robot must pick up each ell block and insert it into the fixture of the same color in a specific sequence - red first, then blue, then green, and finally yellow. After successful insertion, the robot must pick up the four blocks again from the fixtures and stack them in a pallet to form a pyramid with red at the bottom, blue in the middle, green on the third level, and yellow on top.', 'assets-used': ['insertion/ell.urdf', 'insertion/fixture.urdf', 'pallet/pallet.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorCoordinatedInsertionAndStack(Task): """"""Insert colored ell blocks into fixtures and then stack them in a pallet to form a pyramid."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""insert the {color} ell block into the fixture and then stack it on the pallet"" self.task_completed_desc = ""done inserting and stacking."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and their sequence colors = ['red', 'blue', 'green', 'yellow'] # Add fixtures. fixture_size = (0.1, 0.1, 0.1) fixture_urdf = 'insertion/fixture.urdf' fixture_poses = [] for i in range(4): fixture_pose = self.get_random_pose(env, fixture_size) env.add_object(fixture_urdf, fixture_pose, color=utils.COLORS[colors[i]], category='fixed') fixture_poses.append(fixture_pose) # Add ell blocks. ell_size = (0.08, 0.08, 0.02) ell_urdf = 'insertion/ell.urdf' ells = [] for i in range(4): ell_pose = self.get_random_pose(env, ell_size) ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[colors[i]]) ells.append(ell_id) # Add pallet. pallet_size = (0.15, 0.15, 0.02) pallet_pose = self.get_random_pose(env, pallet_size) env.add_object('pallet/pallet.urdf', pallet_pose, 'fixed') # Goal: each ell block is inserted into the fixture of the same color and then stacked on the pallet. for i in range(4): self.add_goal(objs=[ells[i]], matches=np.ones((1, 1)), targ_poses=[fixture_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4) self.lang_goals.append(self.lang_template.format(color=colors[i])) # After insertion, stack the blocks on the pallet in the color sequence. stack_poses = [(0, 0, 0.02), (0, 0, 0.06), (0, 0, 0.10), (0, 0, 0.14)] targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in stack_poses] for i in range(4): self.add_goal(objs=[ells[i]], matches=np.ones((1, 1)), targ_poses=[targs[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 4)``` END" " ""cylinder-ring-stack"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""cylinder-ring-stack"" in a python code block. ### "," cylinder-ring-stack: {'task-name': 'cylinder-ring-stack', 'task-description': 'On the tabletop, there are four differently colored cylinders (red, blue, green, yellow) and four blocks of matching colors. The task involves picking up each block and stacking it on top of the corresponding colored cylinder. However, each cylinder and block pair should be stacked inside a differently colored container (color sequence: red cylinder and block in blue container, blue in green, green in yellow, and yellow in red). The task offers challenges in multi-object manipulation, color coordination, and precise stacking in a confined space.', 'assets-used': ['cylinder/cylinder-template.urdf', 'block/block.urdf', 'container/container-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class CylinderRingStack(Task): """"""Pick up each block and stack it on top of the corresponding colored cylinder. Each cylinder and block pair should be stacked inside a differently colored container."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""stack the {color} block on the {color} cylinder in the {container_color} container"" self.task_completed_desc = ""done stacking."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors for cylinders, blocks and containers colors = ['red', 'blue', 'green', 'yellow'] container_colors = ['blue', 'green', 'yellow', 'red'] # Add cylinders. cylinder_size = (0.04, 0.04, 0.04) cylinder_urdf = 'cylinder/cylinder-template.urdf' cylinders = [] for i in range(4): cylinder_pose = self.get_random_pose(env, cylinder_size) cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=utils.COLORS[colors[i]]) cylinders.append(cylinder_id) # Add blocks. block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' blocks = [] for i in range(4): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[colors[i]]) blocks.append(block_id) # Add containers. container_size = (0.12, 0.12, 0.12) container_urdf = 'container/container-template.urdf' containers = [] for i in range(4): container_pose = self.get_random_pose(env, container_size) container_id = env.add_object(container_urdf, container_pose, color=utils.COLORS[container_colors[i]]) containers.append(container_id) # Goal: each block is stacked on the corresponding colored cylinder inside a differently colored container. for i in range(4): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[cylinder_pose], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/4) self.lang_goals.append(self.lang_template.format(color=colors[i], container_color=container_colors[i]))``` END" " ""color-coordinated-sphere-on-pallet-pyramid"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-sphere-on-pallet-pyramid"" in a python code block. ### "," color-coordinated-sphere-on-pallet-pyramid: {'task-name': 'color-coordinated-sphere-on-pallet-pyramid', 'task-description': 'On the tabletop, there are three pallets and nine blocks of three different colors (red, blue, green). Each color has three blocks and the blocks are scattered randomly on the table. The task is to pick up the blocks and stack them on the pallets to form a pyramid shape. Each pyramid should contain blocks of the same color with two blocks on the base and one block on top. Additionally, there are three spheres of matching colors (red, blue, green). The task is to pick up each sphere and place it on top of the corresponding colored pyramid. The pallets with the pyramids and spheres should be arranged in a straight line in the following color order: red, blue, green from left to right. The challenge lies in the color coordination, precise stacking, and the arrangement of the pallets.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf', 'sphere/sphere.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCoordinatedSphereOnPalletPyramid(Task): """"""Build a pyramid of colored blocks on pallets and place a matching colored sphere on top."""""" def __init__(self): super().__init__() self.max_steps = 15 self.lang_template = ""build a pyramid of {color} blocks on the pallet and place the {color} sphere on top"" self.task_completed_desc = ""done building color-coordinated pyramids."" self.additional_reset() def reset(self, env): super().reset(env) # Pallets and Blocks pallet_size = (0.15, 0.15, 0.01) block_size = (0.04, 0.04, 0.04) pallet_urdf = 'pallet/pallet.urdf' block_urdf = 'block/block.urdf' # Colors for blocks and spheres colors = ['red', 'blue', 'green'] color_objects = {} # Add pallets and blocks for color in colors: # Add pallet pallet_pose = self.get_random_pose(env, pallet_size) env.add_object(pallet_urdf, pallet_pose, category='fixed') # Add blocks block_ids = [] for _ in range(3): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color]) block_ids.append(block_id) color_objects[color] = {'pallet': pallet_pose, 'blocks': block_ids} # Spheres sphere_size = (0.04, 0.04, 0.04) sphere_urdf = 'sphere/sphere.urdf' # Add spheres for color in colors: sphere_pose = self.get_random_pose(env, sphere_size) sphere_id = env.add_object(sphere_urdf, sphere_pose, color=utils.COLORS[color]) color_objects[color]['sphere'] = sphere_id # Goals for color in colors: # Goal: blocks are stacked in a pyramid on the pallet block_poses = [(0, -0.02, 0.02), (0, 0.02, 0.02), (0, 0, 0.06)] targs = [(utils.apply(color_objects[color]['pallet'], i), color_objects[color]['pallet'][1]) for i in block_poses] self.add_goal(objs=color_objects[color]['blocks'], matches=np.ones((3, 3)), targ_poses=targs, replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]*3) # Goal: sphere is placed on top of the pyramid sphere_pose = (0, 0, 0.1) targ = (utils.apply(color_objects[color]['pallet'], sphere_pose), color_objects[color]['pallet'][1]) self.add_goal(objs=[color_objects[color]['sphere']], matches=np.ones((1, 1)), targ_poses=[targ], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]) self.lang_goals.append(self.lang_template.format(color=color))``` END" " ""color-coordinated-stacked-block-bowls"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-coordinated-stacked-block-bowls"" in a python code block. ### "," color-coordinated-stacked-block-bowls: {'task-name': 'color-coordinated-stacked-block-bowls', 'task-description': 'There are three bowls and nine blocks of three different colors (red, blue, green) on the tabletop. Each color has three blocks. The task is to pick up these blocks and stack them inside the bowls in the shape of a pyramid. Each bowl should contain blocks of the same color with two blocks at the base and one block on top. The bowls with the pyramids should be arranged in a straight line in the following color order: red, blue, and green from left to right. The challenge lies in the color coordination, precise stacking, and the arrangement of the bowls.', 'assets-used': ['bowl/bowl.urdf', 'block/block.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p class ColorCoordinatedStackedBlockBowls(Task): """"""Stack blocks of the same color in bowls in the shape of a pyramid and arrange the bowls in a color sequence"""""" def __init__(self): super().__init__() self.max_steps = 15 self.lang_template = ""stack the {color} blocks in the {color} bowl in the shape of a pyramid"" self.task_completed_desc = ""done stacking blocks in bowls."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors for blocks and bowls colors = ['red', 'blue', 'green'] # Add bowls. # x, y, z dimensions for the asset size bowl_size = (0.12, 0.12, 0) bowl_urdf = 'bowl/bowl.urdf' bowl_poses = [] for i in range(3): bowl_pose = self.get_random_pose(env, bowl_size) env.add_object(bowl_urdf, bowl_pose, category='fixed', color=utils.COLORS[colors[i]]) bowl_poses.append(bowl_pose) # Add blocks. # x, y, z dimensions for the asset size blocks = [] block_size = (0.04, 0.04, 0.04) block_urdf = 'stacking/block.urdf' for i in range(9): block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[colors[i//3]]) blocks.append(block_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.03), (0, 0, 0.03), (0, 0.05, 0.03), (0, -0.025, 0.08), (0, 0.025, 0.08), (0, 0, 0.13)] targs = [(utils.apply(bowl_poses[i//3], place_pos[i%3]), bowl_poses[i//3][1]) for i in range(9)] # Goal: blocks are stacked in a pyramid in each bowl for i in range(9): self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[targs[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 9) self.lang_goals.append(self.lang_template.format(color=colors[i//3]))``` END" " ""color-sequenced-sphere-placement"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-sequenced-sphere-placement"" in a python code block. ### "," color-sequenced-sphere-placement: {'task-name': 'color-sequenced-sphere-placement', 'task-description': 'On the tabletop, there are four spheres of different colors (red, blue, green, and yellow) and four colored squares of matching colors. The task involves picking up each sphere and precisely placing it in the center of the square of the same color. However, the spheres must be placed in a specific sequence - red first, then blue, then green, and finally yellow. The task is challenging due to the need for precise placement, color coordination, and sequence following.', 'assets-used': ['sphere/sphere.urdf', 'square/square-template.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorSequencedSpherePlacement(Task): """"""Pick up spheres of different colors and place them in the center of the square of the same color in a specific sequence."""""" def __init__(self): super().__init__() self.max_steps = 20 self.lang_template = ""place the {color} sphere in the {color} square"" self.task_completed_desc = ""done placing spheres."" self.additional_reset() def reset(self, env): super().reset(env) # Define colors and their sequence colors = ['red', 'blue', 'green', 'yellow'] # Add squares of different colors square_size = (0.1, 0.1, 0.005) square_urdf = 'square/square-template.urdf' square_poses = [] for color in colors: square_pose = self.get_random_pose(env, square_size) env.add_object(square_urdf, square_pose, 'fixed', color=color) square_poses.append(square_pose) # Add spheres of different colors sphere_size = (0.04, 0.04, 0.04) sphere_urdf = 'sphere/sphere.urdf' spheres = [] for color in colors: sphere_pose = self.get_random_pose(env, sphere_size) sphere_id = env.add_object(sphere_urdf, sphere_pose, color=color) spheres.append(sphere_id) # Goal: each sphere is in the square of the same color, in the correct sequence for i in range(len(colors)): self.add_goal(objs=[spheres[i]], matches=np.ones((1, 1)), targ_poses=[square_poses[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1/len(colors)) self.lang_goals.append(self.lang_template.format(color=colors[i]))``` END" " ""color-sequence-loading-pallet"". Format the answer in a python dictionary with keys ""task-name"", ""task-description"", and ""assets-used"". Then write the pybullet simulation code for the task ""color-sequence-loading-pallet"" in a python code block. ### "," color-sequence-loading-pallet: {'task-name': 'color-sequence-loading-pallet', 'task-description': 'On a tabletop, there are ten blocks of five different colors (two red, two blue, two green, two yellow, and two orange), and a pallet. The task is to pick up one block of each color and place them onto the pallet in a specific sequence: red, blue, green, yellow, and finally orange. Next, pick up the remaining blocks and stack them on top of the corresponding color in the same sequence. The challenge lies in the precise placement of the blocks and maintaining the load balance on the pallet.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf']}``` ###Implementation: ```python import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils class ColorSequenceLoadingPallet(Task): """"""Pick up blocks of different colors and place them onto the pallet in a specific sequence."""""" def __init__(self): super().__init__() self.max_steps = 10 self.lang_template = ""place the blocks onto the pallet in the sequence: red, blue, green, yellow, orange"" self.task_completed_desc = ""done placing blocks in sequence."" self.additional_reset() def reset(self, env): super().reset(env) # Add pallet. # x, y, z dimensions for the asset size pallet_size = (0.15, 0.15, 0.01) pallet_pose = self.get_random_pose(env, pallet_size) pallet_urdf = 'pallet/pallet.urdf' env.add_object(pallet_urdf, pallet_pose, 'fixed') # Block colors. colors = [ utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow'], utils.COLORS['orange'] ] # Add blocks. # x, y, z dimensions for the asset size block_size = (0.04, 0.04, 0.04) block_urdf = 'block/block.urdf' objs = [] for i in range(10): # two blocks of each color block_pose = self.get_random_pose(env, block_size) block_id = env.add_object(block_urdf, block_pose, color=colors[i//2]) objs.append(block_id) # Associate placement locations for goals. place_pos = [(0, -0.05, 0.03), (0, 0, 0.03), (0, 0.05, 0.03), (0, -0.025, 0.08), (0, 0.025, 0.08), (0, 0, 0.13)] targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos] # Goal: blocks are placed on the pallet in the sequence: red, blue, green, yellow, orange. for i in range(5): self.add_goal(objs=[objs[i]], matches=np.ones((1, 1)), targ_poses=[targs[i]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 5) self.lang_goals.append(self.lang_template.format(color=colors[i])) # Goal: remaining blocks are stacked on top of the corresponding color in the same sequence. for i in range(5, 10): self.add_goal(objs=[objs[i]], matches=np.ones((1, 1)), targ_poses=[targs[i-5]], replace=False, rotations=True, metric='pose', params=None, step_max_reward=1 / 5) self.lang_goals.append(self.lang_template.format(color=colors[i-5]))``` END"