{"prompt":"align-box-corner\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"align-box-corner\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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'} \n\n###\n\nImplementation: \n ```python\nimport os\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\n\nclass AlignBoxCorner(Task):\n \"\"\"Pick up the randomly sized box and align one of its corners to the L-shaped marker on the tabletop.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 3\n self.lang_template = \"align the brown box with the green corner\"\n self.task_completed_desc = \"done with alignment\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Generate randomly shaped box.\n box_size = self.get_random_size(0.05, 0.15, 0.05, 0.15, 0.01, 0.06)\n\n # Add corner.\n dimx = (box_size[0] \/ 2 - 0.025 + 0.0025, box_size[0] \/ 2 + 0.0025)\n dimy = (box_size[1] \/ 2 + 0.0025, box_size[1] \/ 2 - 0.025 + 0.0025)\n corner_template = 'corner\/corner-template.urdf'\n replace = {'DIMX': dimx, 'DIMY': dimy}\n\n # IMPORTANT: REPLACE THE TEMPLATE URDF\n corner_urdf = self.fill_template(corner_template, replace)\n corner_size = (box_size[0], box_size[1], 0)\n corner_pose = self.get_random_pose(env, corner_size)\n env.add_object(corner_urdf, corner_pose, 'fixed')\n\n # Add possible placing poses.\n theta = utils.quatXYZW_to_eulerXYZ(corner_pose[1])[2]\n fip_rot = utils.eulerXYZ_to_quatXYZW((0, 0, theta + np.pi))\n pose1 = (corner_pose[0], fip_rot)\n alt_x = (box_size[0] \/ 2) - (box_size[1] \/ 2)\n alt_y = (box_size[1] \/ 2) - (box_size[0] \/ 2)\n alt_pos = (alt_x, alt_y, 0)\n alt_rot0 = utils.eulerXYZ_to_quatXYZW((0, 0, np.pi \/ 2))\n alt_rot1 = utils.eulerXYZ_to_quatXYZW((0, 0, 3 * np.pi \/ 2))\n pose2 = utils.multiply(corner_pose, (alt_pos, alt_rot0))\n pose3 = utils.multiply(corner_pose, (alt_pos, alt_rot1))\n\n # Add box.\n box_template = 'box\/box-template.urdf'\n\n # IMPORTANT: REPLACE THE TEMPLATE URDF\n box_urdf = self.fill_template(box_template, {'DIM': np.float32(box_size)})\n box_pose = self.get_random_pose(env, box_size)\n box_id = env.add_object(box_urdf, box_pose)\n self.color_random_brown(box_id)\n\n # Goal: box is aligned with corner (1 of 4 possible poses).\n self.add_goal(objs=[box_id], matches=np.int32([[1, 1, 1, 1]]), targ_poses=[corner_pose, pose1, pose2, pose3], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1, symmetries=[2 * np.pi])\n self.lang_goals.append(self.lang_template)\n<|endoftext|>"} {"prompt":"align-rope\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"align-rope\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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'} \n\n###\n\nImplementation: \n ```python\nimport os\n\nimport numpy as np\nfrom cliport.tasks import primitives\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nimport random\nimport pybullet as p\n\n\nclass AlignRope(Task):\n \"\"\"Manipulate a deformable rope to connect its end-points between two \n corners of a 3-sided square.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"align the rope from {direction}\"\n self.task_completed_desc = \"done aligning the rope.\"\n self.additional_reset()\n\n\n def reset(self, env):\n super().reset(env)\n\n n_parts = 20\n radius = 0.005\n length = 2 * radius * n_parts * np.sqrt(2)\n\n # Add 3-sided square.\n square_size = (length, length, 0)\n square_pose = self.get_random_pose(env, square_size)\n square_template = 'square\/square-template.urdf'\n replace = {'DIM': (length,), 'HALF': (np.float32(length) \/ 2 - 0.005,)}\n\n # IMPORTANT: REPLACE THE TEMPLATE URDF\n urdf = self.fill_template(square_template, replace)\n env.add_object(urdf, square_pose, 'fixed')\n\n # Get four corner points of square.\n corner0 = ( length \/ 2, length \/ 2, 0.001)\n corner1 = (-length \/ 2, length \/ 2, 0.001)\n corner2 = ( length \/ 2, -length \/ 2, 0.001)\n corner3 = (-length \/ 2, -length \/ 2, 0.001)\n\n corner0 = utils.apply(square_pose, corner0)\n corner1 = utils.apply(square_pose, corner1)\n corner2 = utils.apply(square_pose, corner2)\n corner3 = utils.apply(square_pose, corner3)\n \n # Four possible alignment tasks.\n task_descs = [\n ((corner0, corner1), \"front left tip to front right tip\"),\n ((corner0, corner2), \"front right tip to back right corner\"),\n ((corner1, corner3), \"front left tip to back left corner\"),\n ((corner3, corner2), \"back right corner to back left corner\")\n ]\n chosen_task = np.random.choice(len(task_descs), 1)[0]\n (corner_0, corner_1), direction = task_descs[chosen_task]\n\n # IMPORTANT: use `make_ropes` to add cable (series of articulated small blocks).\n objects, targets, matches = self.make_ropes(env, corners=(corner_0, corner_1))\n self.add_goal(objs=objects, matches=matches, targ_poses=targets, replace=False,\n rotations=False, metric='pose', params=None, step_max_reward=1.)\n self.lang_goals += [self.lang_template.format(direction=direction)] * len(self.goals)\n\n # wait for the scene to settle down\n for i in range(480):\n p.stepSimulation()<|endoftext|>"} {"prompt":"assembling-kits\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"assembling-kits\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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'} \n\n###\n\nImplementation: \n ```python\nimport os\n\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\n\nclass AssemblingKits(Task):\n \"\"\"pick up different objects and arrange them on a board marked with corresponding silhouettes.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 10\n self.homogeneous = False\n\n self.lang_template = \"put all the blocks inside the holes they fit in\"\n self.task_completed_desc = \"done assembling blocks.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add kit.\n kit_size = (0.28, 0.2, 0.005)\n kit_urdf = 'kitting\/kit.urdf'\n kit_pose = self.get_random_pose(env, kit_size)\n env.add_object(kit_urdf, kit_pose, 'fixed')\n\n n_objects = 5\n obj_shapes = self.get_kitting_shapes(n_objects)\n colors = [\n utils.COLORS['purple'], utils.COLORS['blue'], utils.COLORS['green'],\n utils.COLORS['yellow'], utils.COLORS['red']\n ]\n\n # Build kit.\n targets = []\n targ_pos = [[-0.09, 0.045, 0.0014], [0, 0.045, 0.0014],\n [0.09, 0.045, 0.0014], [-0.045, -0.045, 0.0014],\n [0.045, -0.045, 0.0014]]\n template = 'kitting\/object-template.urdf'\n\n for i in range(n_objects):\n shape = os.path.join(self.assets_root, 'kitting',\n f'{obj_shapes[i]:02d}.obj')\n scale = [0.003, 0.003, 0.0001] # .0005\n pos = utils.apply(kit_pose, targ_pos[i])\n theta = np.random.rand() * 2 * np.pi\n rot = utils.eulerXYZ_to_quatXYZW((0, 0, theta))\n replace = {'FNAME': (shape,), 'SCALE': scale, 'COLOR': [0.2, 0.2, 0.2]}\n\n # IMPORTANT: REPLACE THE TEMPLATE URDF\n urdf = self.fill_template(template, replace)\n env.add_object(urdf, (pos, rot), 'fixed')\n targets.append((pos, rot))\n\n # Add objects.\n objects, matches = self.make_kitting_objects(env, targets=targets, obj_shapes=obj_shapes, n_objects=n_objects, colors=colors)\n matches = np.int32(matches)\n self.add_goal(objs=objects, matches=matches, targ_poses=targets, replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1)\n self.lang_goals.append(self.lang_template)\n<|endoftext|>"} {"prompt":"manipulating-rope\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"manipulating-rope\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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'} \n\n###\n\nImplementation: \n ```python\nimport os\n\nimport numpy as np\nfrom cliport.tasks import primitives\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nimport pybullet as p\n\n\nclass ManipulatingRope(Task):\n \"\"\"rearrange a deformable rope such that it connects the two endpoints of a 3-sided square.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"manipulate the rope to complete the square\"\n self.task_completed_desc = \"done manipulating the rope.\"\n self.additional_reset()\n\n\n def reset(self, env):\n super().reset(env)\n\n n_parts = 20\n radius = 0.005\n length = 2 * radius * n_parts * np.sqrt(2)\n\n # Add 3-sided square.\n square_size = (length, length, 0)\n square_pose = self.get_random_pose(env, square_size)\n square_template = 'square\/square-template.urdf'\n\n # IMPORTANT: REPLACE THE TEMPLATE URDF with `fill_template`\n replace = {'DIM': (length,), 'HALF': (np.float32(length) \/ 2 - 0.005,)}\n urdf = self.fill_template(square_template, replace)\n env.add_object(urdf, square_pose, 'fixed')\n\n # compute corners\n corner0 = (length \/ 2, length \/ 2, 0.001)\n corner1 = (-length \/ 2, length \/ 2, 0.001)\n corner_0 = utils.apply(square_pose, corner0)\n corner_1 = utils.apply(square_pose, corner1)\n\n # IMPORTANT: use `make_ropes` to add cable (series of articulated small blocks).\n objects, targets, matches = self.make_ropes(env, corners=(corner_0, corner_1))\n self.add_goal(objs=objects, matches=matches, targ_poses=targets, replace=False,\n rotations=False, metric='pose', params=None, step_max_reward=1.)\n self.lang_goals.append(self.lang_template)\n\n for i in range(480):\n p.stepSimulation()\n<|endoftext|>"} {"prompt":"packing-boxes\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"packing-boxes\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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'} \n\n###\n\nImplementation: \n ```python\nimport os\n\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nimport pybullet as p\n\n\nclass PackingBoxes(Task):\n \"\"\"pick up randomly sized boxes and place them tightly into a container.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"pack all the boxes inside the brown box\"\n self.task_completed_desc = \"done packing boxes.\"\n\n self.zone_bounds = np.array([[0.25, 0.75], [-0.5, 0.5], [0, 0.08]])\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add container box.\n zone_size = self.get_random_size(0.05, 0.3, 0.05, 0.3, 0.05, 0.05)\n zone_pose = self.get_random_pose(env, zone_size)\n container_template = 'container\/container-template.urdf'\n replace = {'DIM': zone_size, 'HALF': (zone_size[0] \/ 2, zone_size[1] \/ 2, zone_size[2] \/ 2)}\n\n # IMPORTANT: REPLACE THE TEMPLATE URDF\n container_urdf = self.fill_template(container_template, replace)\n env.add_object(container_urdf, zone_pose, 'fixed')\n\n margin = 0.01\n min_object_dim = 0.05\n bboxes = []\n\n # Split container space with KD trees.\n stack_size = np.array(zone_size)\n stack_size[0] -= 0.01\n stack_size[1] -= 0.01\n root_size = (0.01, 0.01, 0) + tuple(stack_size)\n root = utils.TreeNode(None, [], bbox=np.array(root_size))\n utils.KDTree(root, min_object_dim, margin, bboxes)\n\n colors = [utils.COLORS[c] for c in utils.COLORS if c != 'brown']\n\n # Add objects in container.\n object_ids = []\n bboxes = np.array(bboxes)\n object_template = 'box\/box-template.urdf'\n\n # Compute object points that are needed for zone\n for bbox in bboxes:\n size = bbox[3:] - bbox[:3]\n position = size \/ 2. + bbox[:3]\n position[0] += -zone_size[0] \/ 2\n position[1] += -zone_size[1] \/ 2\n pose = (position, (0, 0, 0, 1))\n pose = utils.multiply(zone_pose, pose)\n\n # IMPORTANT: REPLACE THE TEMPLATE URDF\n urdf = self.fill_template(object_template, {'DIM': size})\n icolor = np.random.choice(range(len(colors)), 1).squeeze()\n box_id = env.add_object(urdf, pose, color=colors[icolor])\n object_ids.append(box_id)\n\n # Randomly select object in box and save ground truth pose.\n object_volumes = []\n true_poses = []\n\n for object_id in object_ids:\n true_pose = p.getBasePositionAndOrientation(object_id)\n object_size = p.getVisualShapeData(object_id)[0][3]\n object_volumes.append(np.prod(np.array(object_size) * 100))\n pose = self.get_random_pose(env, object_size)\n p.resetBasePositionAndOrientation(object_id, pose[0], pose[1])\n true_poses.append(true_pose)\n\n self.add_goal(objs=object_ids, matches=np.eye(len(object_ids)), targ_poses=true_poses, replace=False,\n rotations=True, metric='zone', params=[(zone_pose, zone_size)], step_max_reward=1)\n\n self.lang_goals.append(self.lang_template)\n<|endoftext|>"} {"prompt":"palletizing-boxes\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"palletizing-boxes\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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'} \n\n###\n\nImplementation: \n ```python\nimport os\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport pybullet as p\n\n\nclass PalletizingBoxes(Task):\n \"\"\"Pick up homogeneous fixed-sized boxes and stack them in transposed layers on the pallet.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 30\n self.lang_template = \"stack all the boxes on the pallet\"\n self.task_completed_desc = \"done stacking boxes.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add pallet.\n zone_size = (0.3, 0.25, 0.25)\n zone_urdf = 'pallet\/pallet.urdf'\n rotation = utils.eulerXYZ_to_quatXYZW((0, 0, 0))\n zone_pose = ((0.5, 0.25, 0.02), rotation)\n env.add_object(zone_urdf, zone_pose, 'fixed')\n\n # Add stack of boxes on pallet.\n margin = 0.01\n object_ids = []\n\n # x, y, z dimensions for the asset size\n stack_size = (0.19, 0.19, 0.19)\n box_template = 'box\/box-template.urdf'\n stack_dim = np.int32([2, 3, 3])\n\n box_size = (stack_size - (stack_dim - 1) * margin) \/ stack_dim\n for z in range(stack_dim[2]):\n\n # Transpose every layer.\n stack_dim[0], stack_dim[1] = stack_dim[1], stack_dim[0]\n box_size[0], box_size[1] = box_size[1], box_size[0]\n\n # IMPORTANT: Compute object points and store as a dictionary for the `goal`\n for y in range(stack_dim[1]):\n for x in range(stack_dim[0]):\n position = list((x + 0.5, y + 0.5, z + 0.5) * box_size)\n position[0] += x * margin - stack_size[0] \/ 2\n position[1] += y * margin - stack_size[1] \/ 2\n position[2] += z * margin + 0.03\n pose = (position, (0, 0, 0, 1))\n pose = utils.multiply(zone_pose, pose)\n\n # IMPORTANT: REPLACE THE TEMPLATE URDF\n urdf = self.fill_template(box_template, {'DIM': box_size})\n box_id = env.add_object(urdf, pose)\n object_ids.append(box_id)\n self.color_random_brown(box_id)\n\n # Randomly select top box on pallet and save ground truth pose.\n targets = []\n self.steps = []\n boxes = object_ids[:] # make copy\n while boxes:\n _, height, object_mask = self.get_true_image(env)\n top = np.argwhere(height > (np.max(height) - 0.03))\n rpixel = top[int(np.floor(np.random.random() * len(top)))] # y, x\n box_id = int(object_mask[rpixel[0], rpixel[1]])\n if box_id in boxes:\n position, rotation = p.getBasePositionAndOrientation(box_id)\n rposition = np.float32(position) + np.float32([0, -10, 0])\n p.resetBasePositionAndOrientation(box_id, rposition, rotation)\n self.steps.append(box_id)\n targets.append((position, rotation))\n boxes.remove(box_id)\n\n self.steps.reverse() # Time-reversed depalletizing.\n self.add_goal(objs=object_ids, matches=np.eye(len(object_ids)), targ_poses=targets, replace=False,\n rotations=True, metric='zone', params=[(zone_pose, zone_size)], step_max_reward=1)\n self.lang_goals.append(self.lang_template)\n\n self.spawn_box()\n\n def reward(self):\n reward, info = super().reward()\n self.spawn_box()\n return reward, info<|endoftext|>"} {"prompt":"place-red-in-green\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"place-red-in-green\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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'} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport pybullet as p\n\n\nclass PlaceRedInGreen(Task):\n \"\"\"pick up the red blocks and place them into the green bowls amidst other objects.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 10\n self.lang_template = \"put the red blocks in a green bowl\"\n self.task_completed_desc = \"done placing blocks in bowls.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n n_bowls = np.random.randint(1, 4)\n n_blocks = np.random.randint(1, n_bowls + 1)\n\n # Add bowls.\n # x, y, z dimensions for the asset size\n bowl_size = (0.12, 0.12, 0)\n bowl_urdf = 'bowl\/bowl.urdf'\n bowl_poses = []\n for _ in range(n_bowls):\n bowl_pose = self.get_random_pose(env, obj_size=bowl_size)\n env.add_object(urdf=bowl_urdf, pose=bowl_pose, category='fixed')\n bowl_poses.append(bowl_pose)\n\n # Add blocks.\n # x, y, z dimensions for the asset size\n blocks = []\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'stacking\/block.urdf'\n for _ in range(n_blocks):\n block_pose = self.get_random_pose(env, obj_size=block_size)\n block_id = env.add_object(block_urdf, block_pose)\n blocks.append(block_id)\n\n # Goal: each red block is in a different green bowl.\n self.add_goal(objs=blocks, matches=np.ones((len(blocks), len(bowl_poses))), targ_poses=bowl_poses, replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1)\n self.lang_goals.append(self.lang_template)\n\n # Colors of distractor objects.\n bowl_colors = [utils.COLORS[c] for c in utils.COLORS if c != 'green']\n block_colors = [utils.COLORS[c] for c in utils.COLORS if c != 'red']\n\n # Add distractors.\n n_distractors = 0\n while n_distractors < 6:\n is_block = np.random.rand() > 0.5\n urdf = block_urdf if is_block else bowl_urdf\n size = block_size if is_block else bowl_size\n colors = block_colors if is_block else bowl_colors\n pose = self.get_random_pose(env, obj_size=size)\n color = colors[n_distractors % len(colors)]\n\n obj_id = env.add_object(urdf, pose, color=color)\n n_distractors += 1\n<|endoftext|>"} {"prompt":"stack-block-pyramid\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"stack-block-pyramid\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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'} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport pybullet as p\n\nclass StackBlockPyramid(Task):\n \"\"\"Build a pyramid of colored blocks in a color sequence\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 12\n self.lang_template = \"make the {row} row with {blocks}\"\n self.task_completed_desc = \"done stacking block pyramid.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add base.\n base_size = (0.05, 0.15, 0.005)\n base_urdf = 'stacking\/stand.urdf'\n base_pose = self.get_random_pose(env, base_size)\n env.add_object(base_urdf, base_pose, category='fixed')\n\n # Block colors.\n colors = [\n utils.COLORS['purple'], utils.COLORS['blue'], utils.COLORS['green'],\n utils.COLORS['yellow'], utils.COLORS['orange'], utils.COLORS['red']\n ]\n\n # Add blocks.\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'stacking\/block.urdf'\n\n objs = []\n for i in range(6):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=colors[i])\n objs.append(block_id)\n\n # IMPORTANT Associate placement locations for goals.\n place_pos = [(0, -0.05, 0.03), (0, 0, 0.03),\n (0, 0.05, 0.03), (0, -0.025, 0.08),\n (0, 0.025, 0.08), (0, 0, 0.13)]\n targs = [(utils.apply(base_pose, i), base_pose[1]) for i in place_pos]\n\n # Goal: blocks are stacked in a pyramid (bottom row: green, blue, purple).\n self.add_goal(objs=objs[:3], matches=np.ones((3, 3)), targ_poses=targs[:3], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 2, symmetries=[np.pi\/2]*3)\n self.lang_goals.append(self.lang_template.format(blocks=\"the green, blue and purple blocks\",\n row=\"bottom\"))\n\n # Goal: blocks are stacked in a pyramid (middle row: yellow, orange).\n self.add_goal(objs=objs[3:5], matches=np.ones((2, 2)), targ_poses=targs[3:5], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 3, symmetries=[np.pi\/2]*2)\n self.lang_goals.append(self.lang_template.format(blocks=\"the yellow and orange blocks\",\n row=\"middle\"))\n\n # Goal: blocks are stacked in a pyramid (top row: red).\n self.add_goal(objs=objs[5:], matches=np.ones((1, 1)), targ_poses=targs[5:], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 6, symmetries=[np.pi\/2]*1)\n self.lang_goals.append(self.lang_template.format(blocks=\"the red block\",\n row=\"top\"))\n<|endoftext|>"} {"prompt":"sweeping-piles\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"sweeping-piles\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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'} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\n\nclass SweepingPiles(Task):\n \"\"\"Push piles of small objects into a target goal zone marked on the tabletop.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"push the pile of blocks into the green square\"\n self.task_completed_desc = \"done sweeping.\"\n self.primitive = primitives.push\n self.ee = Spatula\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add goal zone.\n zone_size = (0.12, 0.12, 0)\n zone_pose = self.get_random_pose(env, zone_size)\n env.add_object('zone\/zone.urdf', zone_pose, 'fixed')\n\n # Add pile of small blocks with `make_piles` function\n obj_ids = self.make_piles(env)\n\n # Add goal\n self.add_goal(objs=obj_ids, matches=np.ones((50, 1)), targ_poses=[zone_pose], replace=True,\n rotations=False, metric='zone', params=[(zone_pose, zone_size)], step_max_reward=1)\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"build-wheel\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"build-wheel\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass BuildWheel(Task):\n \"\"\"Construct a wheel using blocks and a sphere.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 10\n 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.\"\n self.task_completed_desc = \"done building wheel.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add blocks.\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n block_colors = [utils.COLORS['red'], utils.COLORS['blue']]\n blocks = []\n for i in range(8):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=block_colors[i % 2])\n blocks.append(block_id)\n\n # Add sphere.\n sphere_size = (0.04, 0.04, 0.04)\n sphere_urdf = 'sphere\/sphere.urdf'\n sphere_color = utils.COLORS['green']\n sphere_pose = ((0.5, 0.0, 0.0), (0,0,0,1)) # fixed pose\n sphere_id = env.add_object(sphere_urdf, sphere_pose, color=sphere_color)\n\n # Goal: blocks are arranged in a circle and sphere is in the center.\n circle_radius = 0.1\n circle_center = (0, 0, block_size[2] \/ 2)\n angles = np.linspace(0, 2 * np.pi, 8, endpoint=False)\n block_poses = [(circle_center[0] + circle_radius * np.cos(angle),\n circle_center[1] + circle_radius * np.sin(angle),\n circle_center[2]) for angle in angles]\n block_poses = [(utils.apply(sphere_pose, pos), sphere_pose[1]) for pos in block_poses]\n self.add_goal(objs=blocks, matches=np.ones((8, 8)), targ_poses=block_poses, replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=8 \/ 9)\n\n # Goal: sphere is in the center of the blocks.\n self.add_goal(objs=[sphere_id], matches=np.ones((1, 1)), targ_poses=[sphere_pose], replace=False,\n rotations=False, metric='pose', params=None, step_max_reward=1 \/ 9)\n\n self.lang_goals.append(self.lang_template)\n<|endoftext|>"} {"prompt":"push-piles-into-letter\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"push-piles-into-letter\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass BuildWheel(Task):\n \"\"\"Construct a wheel using blocks and a sphere.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 10\n 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.\"\n self.task_completed_desc = \"done building wheel.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add blocks.\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n block_colors = [utils.COLORS['red'], utils.COLORS['blue']]\n blocks = []\n for i in range(8):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=block_colors[i % 2])\n blocks.append(block_id)\n\n # Add sphere.\n sphere_size = (0.04, 0.04, 0.04)\n sphere_urdf = 'sphere\/sphere.urdf'\n sphere_color = utils.COLORS['green']\n sphere_pose = ((0.5, 0.0, 0.0), (0,0,0,1)) # fixed pose\n sphere_id = env.add_object(sphere_urdf, sphere_pose, color=sphere_color)\n\n # Goal: blocks are arranged in a circle and sphere is in the center.\n circle_radius = 0.1\n circle_center = (0, 0, block_size[2] \/ 2)\n angles = np.linspace(0, 2 * np.pi, 8, endpoint=False)\n block_poses = [(circle_center[0] + circle_radius * np.cos(angle),\n circle_center[1] + circle_radius * np.sin(angle),\n circle_center[2]) for angle in angles]\n block_poses = [(utils.apply(sphere_pose, pos), sphere_pose[1]) for pos in block_poses]\n self.add_goal(objs=blocks, matches=np.ones((8, 8)), targ_poses=block_poses, replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=8 \/ 9)\n\n # Goal: sphere is in the center of the blocks.\n self.add_goal(objs=[sphere_id], matches=np.ones((1, 1)), targ_poses=[sphere_pose], replace=False,\n rotations=False, metric='pose', params=None, step_max_reward=1 \/ 9)\n\n self.lang_goals.append(self.lang_template)\n<|endoftext|>"} {"prompt":"connect-boxes-with-rope\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"connect-boxes-with-rope\" in python code block starting with ```python. \n\n\n###\n\n","completion":" connect-boxes-with-rope: {'task-name': 'connect-boxes-with-rope', 'task-description': 'Connect two colored blocks with ropes.', 'assets-used': ['block\/block.urdf']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport IPython\n\nclass ConnectBoxesWithRope(Task):\n \"\"\"Connect two colored blocks with ropes.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"connect the {color1} and {color2} blocks with the rope.\"\n self.task_completed_desc = \"done connecting.\"\n self.additional_reset()\n self.pos_eps = 0.04 # higher tolerance\n\n def reset(self, env):\n super().reset(env)\n colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']\n blocks = []\n target_colors = np.random.choice(colors, 2, replace=False)\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'stacking\/block.urdf'\n corner_poses = []\n\n for color in colors:\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=color)\n blocks.append(block_id)\n if color in target_colors:\n corner_poses.append(block_pose)\n\n dist = np.linalg.norm(np.array(corner_poses[0][0])-np.array(corner_poses[1][0])) \n n_parts = int(20 * dist \/ 0.4)\n\n # IMPORTANT: use `make_ropes` to add cable (series of articulated small blocks).\n objects, targets, matches = self.make_ropes(env, corners=(corner_poses[0][0], corner_poses[1][0]), n_parts=n_parts)\n self.add_goal(objs=objects, matches=matches, targ_poses=targets, replace=False,\n rotations=False, metric='pose', params=None, step_max_reward=1.)\n self.lang_goals.append(self.lang_template.format(color1=target_colors[0], color2=target_colors[1]))\n\n # wait for the scene to settle down\n for i in range(600):\n p.stepSimulation()<|endoftext|>"} {"prompt":"build-car\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"build-car\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass BuildCar(Task):\n \"\"\"Construct a simple car structure using blocks and cylinders.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 15\n self.lang_template = \"Construct a simple car structure using blocks and cylinders. \" \\\n \"Firstly, create the base of the car by positioning two red blocks side by side. \" \\\n \"Then, add the car body by stacking a blue block on top of the base. \" \\\n \"For the wheels, place a black cylinder on each side of the base blocks.\"\n self.task_completed_desc = \"done building car.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n car_pose = ((0.5, 0.0, 0.0), (0,0,0,1)) # fixed pose\n base_length = 0.04\n self.add_corner_anchor_for_pose(env, car_pose)\n\n # Add base blocks. Use box template so that we can change its size.\n base_size = (0.02, 0.04, 0.02)\n base_block_urdf = \"box\/box-template.urdf\"\n base_block_urdf = self.fill_template(base_block_urdf, {'DIM': base_size})\n anchor_base_poses = [(utils.apply(car_pose, (base_length \/ 2, base_length \/ 2, 0.001)), car_pose[1]),\n (utils.apply(car_pose, (-base_length \/ 2, base_length \/ 2, 0.001)), car_pose[1])]\n base_blocks = []\n \n for idx in range(2):\n base_block_pose = self.get_random_pose(env, base_size)\n base_block_id = env.add_object(base_block_urdf, base_block_pose, color=utils.COLORS['red'])\n base_blocks.append(base_block_id)\n\n # Add car body block.\n body_size = (0.04, 0.02, 0.02) # x, y, z dimensions for the asset size\n body_block_urdf = \"box\/box-template.urdf\"\n body_block_urdf = self.fill_template(body_block_urdf, {'DIM': body_size})\n body_block_pose = self.get_random_pose(env, body_size)\n body_block_id = env.add_object(body_block_urdf, body_block_pose, color=utils.COLORS['blue'])\n anchor_body_poses = [car_pose]\n\n wheel_length = 0.12\n anchor_wheel_poses = [(utils.apply(car_pose, ( wheel_length \/ 2, wheel_length \/ 2, 0.001)), car_pose[1]),\n (utils.apply(car_pose, (-wheel_length \/ 2, wheel_length \/ 2, 0.001)), car_pose[1]),\n (utils.apply(car_pose, ( wheel_length \/ 2, -wheel_length \/ 2, 0.001)), car_pose[1]),\n (utils.apply(car_pose, (-wheel_length \/ 2, -wheel_length \/ 2, 0.001)), car_pose[1])]\n\n # Add wheels.\n wheel_size = (0.02, 0.02, 0.02) # x, y, z dimensions for the asset size\n wheel_urdf = 'cylinder\/cylinder-template.urdf'\n wheel_urdf = self.fill_template(wheel_urdf, {'DIM': wheel_size})\n\n wheels = []\n for idx in range(4):\n wheel_pose = self.get_random_pose(env, wheel_size)\n wheel_id = env.add_object(wheel_urdf, wheel_pose, color=utils.COLORS['black'])\n wheels.append(wheel_id)\n\n # Goal: Firstly, create the base of the car by positioning two red blocks side by side.\n self.add_goal(objs=base_blocks,\n matches=np.ones((2, 2)),\n targ_poses=anchor_base_poses,\n replace=False,\n rotations=True,\n metric='pose',\n params=None,\n step_max_reward=1.\/3)\n self.lang_goals.append(\"Firstly, create the base of the car by positioning two red blocks side by side.\")\n\n # Then, add the car body by stacking a blue block on top of the base.\n self.add_goal(objs=[body_block_id],\n matches=np.ones((1, 1)),\n targ_poses=anchor_body_poses,\n replace=False,\n rotations=True,\n metric='pose',\n params=None,\n step_max_reward=1.\/3)\n self.lang_goals.append(\"Then, add the car body by stacking a blue block on top of the base.\")\n\n # For the wheels, place a black cylinder on each side of the base blocks.\n self.add_goal(objs=wheels,\n matches=np.ones((4, 4)),\n targ_poses=anchor_wheel_poses,\n replace=False,\n rotations=True,\n metric='pose',\n params=None,\n step_max_reward=1.\/3)\n self.lang_goals.append(\"For the wheels, place a black cylinder on each side of the base blocks.\")\n\n<|endoftext|>"} {"prompt":"manipulating-two-ropes\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"manipulating-two-ropes\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\n\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\n\nclass ManipulatingTwoRopes(Task):\n \"\"\"rearrange the red and blue deformable ropes such that it connects the two endpoints of a 3-sided square of corresponding color.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"rearrange the {color_name} rope such that it connects the two endpoints of a 3-sided square of corresponding color.\"\n self.task_completed_desc = \"done manipulating two ropes.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n n_parts = 20\n radius = 0.005\n length = 2 * radius * n_parts * np.sqrt(2)\n\n # Add 3-sided square for the red rope.\n color_list = ['red', 'blue']\n for color_name in color_list:\n square_size = (length, length, 0)\n square_pose = self.get_random_pose(env, square_size)\n square_template = 'square\/square-template.urdf'\n\n # IMPORTANT: REPLACE THE TEMPLATE URDF with `fill_template`\n replace = {'DIM': (length,), 'HALF': (np.float32(length) \/ 2 - 0.005,)}\n urdf = self.fill_template(square_template, replace)\n env.add_object(urdf, square_pose, 'fixed', color=utils.COLORS[color_name])\n\n # compute corners\n corner0 = (length \/ 2, length \/ 2, 0.001)\n corner1 = (-length \/ 2, length \/ 2, 0.001)\n corner_0 = utils.apply(square_pose, corner0)\n corner_1 = utils.apply(square_pose, corner1)\n\n # IMPORTANT: use `make_ropes` to add cable (series of articulated small blocks).\n objects, targets, matches = self.make_ropes(env, corners=(corner_0, corner_1), color_name=color_name)\n self.add_goal(objs=objects, matches=matches, targ_poses=targets, replace=False,\n rotations=False, metric='pose', params=None, step_max_reward=1. \/ len(color_list))\n\n self.lang_goals.append(self.lang_template.format(color_name=color_name))\n\n print(f\"len of languages: {len(self.lang_goals)} obj:{len(objects)}\")\n for i in range(480):\n p.stepSimulation()\n<|endoftext|>"} {"prompt":"insert-sphere-into-container\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"insert-sphere-into-container\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass InsertSphereIntoContainer(Task):\n \"\"\"Pick up a blue sphere and place it into an open container.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 10\n self.lang_template = \"pick up a blue sphere and place it into an open container\"\n self.task_completed_desc = \"done inserting sphere into container.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add container.\n # x, y, z dimensions for the asset size\n container_size = (0.1, 0.1, 0.1)\n container_pose = self.get_random_pose(env, container_size)\n container_template = 'container\/container-template.urdf'\n replace = {'DIM': container_size, 'HALF': (container_size[0] \/ 2, container_size[1] \/ 2, container_size[2] \/ 2)}\n # IMPORTANT: REPLACE THE TEMPLATE URDF with `fill_template`\n container_urdf = self.fill_template(container_template, replace)\n container_id = env.add_object(container_urdf, container_pose, 'fixed')\n\n # Add sphere.\n # x, y, z dimensions for the asset size\n sphere_size = (0.04, 0.04, 0.04)\n sphere_pose = self.get_random_pose(env, sphere_size)\n sphere_urdf = 'sphere\/sphere.urdf'\n sphere_id = env.add_object(sphere_urdf, sphere_pose, color=utils.COLORS['blue'])\n\n # Goal: the blue sphere is in the container.\n self.add_goal(objs=[sphere_id], matches=np.ones((1, 1)), targ_poses=[container_pose], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1)\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"insert-cylinder-in-container\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"insert-cylinder-in-container\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass InsertSphereIntoContainer(Task):\n \"\"\"Pick up a blue sphere and place it into an open container.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 10\n self.lang_template = \"pick up a blue sphere and place it into an open container\"\n self.task_completed_desc = \"done inserting sphere into container.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add container.\n # x, y, z dimensions for the asset size\n container_size = (0.1, 0.1, 0.1)\n container_pose = self.get_random_pose(env, container_size)\n container_template = 'container\/container-template.urdf'\n replace = {'DIM': container_size, 'HALF': (container_size[0] \/ 2, container_size[1] \/ 2, container_size[2] \/ 2)}\n # IMPORTANT: REPLACE THE TEMPLATE URDF with `fill_template`\n container_urdf = self.fill_template(container_template, replace)\n container_id = env.add_object(container_urdf, container_pose, 'fixed')\n\n # Add sphere.\n # x, y, z dimensions for the asset size\n sphere_size = (0.04, 0.04, 0.04)\n sphere_pose = self.get_random_pose(env, sphere_size)\n sphere_urdf = 'sphere\/sphere.urdf'\n sphere_id = env.add_object(sphere_urdf, sphere_pose, color=utils.COLORS['blue'])\n\n # Goal: the blue sphere is in the container.\n self.add_goal(objs=[sphere_id], matches=np.ones((1, 1)), targ_poses=[container_pose], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1)\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"build-bridge\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"build-bridge\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass BuildBridge(Task):\n \"\"\"Construct a bridge using two yellow blocks and three blue blocks.\n Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between.\n Then, place the blue block horizontally on top of the yellow blocks.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"build a bridge using four yellow blocks and one long blue block\"\n self.task_completed_desc = \"done building bridge.\"\n\n def reset(self, env):\n super().reset(env)\n\n # Add yellow blocks.\n base_length = 0.04\n base_size = (base_length, base_length, base_length)\n base_block_urdf = \"box\/box-template.urdf\"\n bridge_pose = ((0.5, 0.0, 0.0), (0, 0, 0, 1)) # fixed pose\n self.add_corner_anchor_for_pose(env, bridge_pose)\n\n base_block_urdf = self.fill_template(base_block_urdf, {'DIM': base_size})\n anchor_base_poses = [(utils.apply(bridge_pose, (- 3 * base_length \/ 2, 0, 0.001)), bridge_pose[1]),\n (utils.apply(bridge_pose, ( 3 * base_length \/ 2, 0, 0.001)), bridge_pose[1]),\n (utils.apply(bridge_pose, (- 3 * base_length \/ 2, 0, 0.041)), bridge_pose[1]),\n (utils.apply(bridge_pose, ( 3 * base_length \/ 2, 0, 0.041)), bridge_pose[1])]\n base_blocks = []\n\n for idx in range(4):\n base_block_pose = self.get_random_pose(env, base_size)\n base_block_id = env.add_object(base_block_urdf, base_block_pose, color=utils.COLORS['yellow'])\n base_blocks.append(base_block_id)\n\n # Add car body block.\n body_size = (0.12, 0.04, 0.02) # x, y, z dimensions for the asset size\n body_block_urdf = \"box\/box-template.urdf\"\n body_block_urdf = self.fill_template(body_block_urdf, {'DIM': body_size})\n body_block_pose = self.get_random_pose(env, body_size)\n body_block_id = env.add_object(body_block_urdf, body_block_pose, color=utils.COLORS['blue'])\n anchor_body_poses = [bridge_pose]\n\n # Goal: Firstly, create the base of the car by positioning two red blocks side by side.\n self.add_goal(objs=base_blocks[:2],\n matches=np.ones((2, 2)),\n targ_poses=anchor_base_poses,\n replace=False,\n rotations=True,\n metric='pose',\n params=None,\n step_max_reward=1.\/4)\n\n self.add_goal(objs=base_blocks[2:],\n matches=np.ones((2, 2)),\n targ_poses=anchor_base_poses,\n replace=False,\n rotations=True,\n metric='pose',\n params=None,\n step_max_reward=1.\/2)\n 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.\")\n\n # Then, add the car body by stacking a blue block on top of the base.\n self.add_goal(objs=[body_block_id],\n matches=np.ones((1, 1)),\n targ_poses=anchor_body_poses,\n replace=False,\n rotations=True,\n metric='pose',\n params=None,\n step_max_reward=1.\/4)\n self.lang_goals.append(\"Then, place the blue block horizontally on top of the yellow blocks.\")\n<|endoftext|>"} {"prompt":"insert-ell-in-fixture\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"insert-ell-in-fixture\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass BuildBridge(Task):\n \"\"\"Construct a bridge using two yellow blocks and three blue blocks.\n Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between.\n Then, place the blue block horizontally on top of the yellow blocks.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"build a bridge using four yellow blocks and one long blue block\"\n self.task_completed_desc = \"done building bridge.\"\n\n def reset(self, env):\n super().reset(env)\n\n # Add yellow blocks.\n base_length = 0.04\n base_size = (base_length, base_length, base_length)\n base_block_urdf = \"box\/box-template.urdf\"\n bridge_pose = ((0.5, 0.0, 0.0), (0, 0, 0, 1)) # fixed pose\n self.add_corner_anchor_for_pose(env, bridge_pose)\n\n base_block_urdf = self.fill_template(base_block_urdf, {'DIM': base_size})\n anchor_base_poses = [(utils.apply(bridge_pose, (- 3 * base_length \/ 2, 0, 0.001)), bridge_pose[1]),\n (utils.apply(bridge_pose, ( 3 * base_length \/ 2, 0, 0.001)), bridge_pose[1]),\n (utils.apply(bridge_pose, (- 3 * base_length \/ 2, 0, 0.041)), bridge_pose[1]),\n (utils.apply(bridge_pose, ( 3 * base_length \/ 2, 0, 0.041)), bridge_pose[1])]\n base_blocks = []\n\n for idx in range(4):\n base_block_pose = self.get_random_pose(env, base_size)\n base_block_id = env.add_object(base_block_urdf, base_block_pose, color=utils.COLORS['yellow'])\n base_blocks.append(base_block_id)\n\n # Add car body block.\n body_size = (0.12, 0.04, 0.02) # x, y, z dimensions for the asset size\n body_block_urdf = \"box\/box-template.urdf\"\n body_block_urdf = self.fill_template(body_block_urdf, {'DIM': body_size})\n body_block_pose = self.get_random_pose(env, body_size)\n body_block_id = env.add_object(body_block_urdf, body_block_pose, color=utils.COLORS['blue'])\n anchor_body_poses = [bridge_pose]\n\n # Goal: Firstly, create the base of the car by positioning two red blocks side by side.\n self.add_goal(objs=base_blocks[:2],\n matches=np.ones((2, 2)),\n targ_poses=anchor_base_poses,\n replace=False,\n rotations=True,\n metric='pose',\n params=None,\n step_max_reward=1.\/4)\n\n self.add_goal(objs=base_blocks[2:],\n matches=np.ones((2, 2)),\n targ_poses=anchor_base_poses,\n replace=False,\n rotations=True,\n metric='pose',\n params=None,\n step_max_reward=1.\/2)\n 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.\")\n\n # Then, add the car body by stacking a blue block on top of the base.\n self.add_goal(objs=[body_block_id],\n matches=np.ones((1, 1)),\n targ_poses=anchor_body_poses,\n replace=False,\n rotations=True,\n metric='pose',\n params=None,\n step_max_reward=1.\/4)\n self.lang_goals.append(\"Then, place the blue block horizontally on top of the yellow blocks.\")\n<|endoftext|>"} {"prompt":"build-block-tower-on-pallet\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"build-block-tower-on-pallet\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass BuildBridge(Task):\n \"\"\"Construct a bridge using two yellow blocks and three blue blocks.\n Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between.\n Then, place the blue block horizontally on top of the yellow blocks.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"build a bridge using four yellow blocks and one long blue block\"\n self.task_completed_desc = \"done building bridge.\"\n\n def reset(self, env):\n super().reset(env)\n\n # Add yellow blocks.\n base_length = 0.04\n base_size = (base_length, base_length, base_length)\n base_block_urdf = \"box\/box-template.urdf\"\n bridge_pose = ((0.5, 0.0, 0.0), (0, 0, 0, 1)) # fixed pose\n self.add_corner_anchor_for_pose(env, bridge_pose)\n\n base_block_urdf = self.fill_template(base_block_urdf, {'DIM': base_size})\n anchor_base_poses = [(utils.apply(bridge_pose, (- 3 * base_length \/ 2, 0, 0.001)), bridge_pose[1]),\n (utils.apply(bridge_pose, ( 3 * base_length \/ 2, 0, 0.001)), bridge_pose[1]),\n (utils.apply(bridge_pose, (- 3 * base_length \/ 2, 0, 0.041)), bridge_pose[1]),\n (utils.apply(bridge_pose, ( 3 * base_length \/ 2, 0, 0.041)), bridge_pose[1])]\n base_blocks = []\n\n for idx in range(4):\n base_block_pose = self.get_random_pose(env, base_size)\n base_block_id = env.add_object(base_block_urdf, base_block_pose, color=utils.COLORS['yellow'])\n base_blocks.append(base_block_id)\n\n # Add car body block.\n body_size = (0.12, 0.04, 0.02) # x, y, z dimensions for the asset size\n body_block_urdf = \"box\/box-template.urdf\"\n body_block_urdf = self.fill_template(body_block_urdf, {'DIM': body_size})\n body_block_pose = self.get_random_pose(env, body_size)\n body_block_id = env.add_object(body_block_urdf, body_block_pose, color=utils.COLORS['blue'])\n anchor_body_poses = [bridge_pose]\n\n # Goal: Firstly, create the base of the car by positioning two red blocks side by side.\n self.add_goal(objs=base_blocks[:2],\n matches=np.ones((2, 2)),\n targ_poses=anchor_base_poses,\n replace=False,\n rotations=True,\n metric='pose',\n params=None,\n step_max_reward=1.\/4)\n\n self.add_goal(objs=base_blocks[2:],\n matches=np.ones((2, 2)),\n targ_poses=anchor_base_poses,\n replace=False,\n rotations=True,\n metric='pose',\n params=None,\n step_max_reward=1.\/2)\n 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.\")\n\n # Then, add the car body by stacking a blue block on top of the base.\n self.add_goal(objs=[body_block_id],\n matches=np.ones((1, 1)),\n targ_poses=anchor_body_poses,\n replace=False,\n rotations=True,\n metric='pose',\n params=None,\n step_max_reward=1.\/4)\n self.lang_goals.append(\"Then, place the blue block horizontally on top of the yellow blocks.\")\n<|endoftext|>"} {"prompt":"color-coordinated-tower\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-coordinated-tower\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass BuildBridge(Task):\n \"\"\"Construct a bridge using two yellow blocks and three blue blocks.\n Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between.\n Then, place the blue block horizontally on top of the yellow blocks.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"build a bridge using four yellow blocks and one long blue block\"\n self.task_completed_desc = \"done building bridge.\"\n\n def reset(self, env):\n super().reset(env)\n\n # Add yellow blocks.\n base_length = 0.04\n base_size = (base_length, base_length, base_length)\n base_block_urdf = \"box\/box-template.urdf\"\n bridge_pose = ((0.5, 0.0, 0.0), (0, 0, 0, 1)) # fixed pose\n self.add_corner_anchor_for_pose(env, bridge_pose)\n\n base_block_urdf = self.fill_template(base_block_urdf, {'DIM': base_size})\n anchor_base_poses = [(utils.apply(bridge_pose, (- 3 * base_length \/ 2, 0, 0.001)), bridge_pose[1]),\n (utils.apply(bridge_pose, ( 3 * base_length \/ 2, 0, 0.001)), bridge_pose[1]),\n (utils.apply(bridge_pose, (- 3 * base_length \/ 2, 0, 0.041)), bridge_pose[1]),\n (utils.apply(bridge_pose, ( 3 * base_length \/ 2, 0, 0.041)), bridge_pose[1])]\n base_blocks = []\n\n for idx in range(4):\n base_block_pose = self.get_random_pose(env, base_size)\n base_block_id = env.add_object(base_block_urdf, base_block_pose, color=utils.COLORS['yellow'])\n base_blocks.append(base_block_id)\n\n # Add car body block.\n body_size = (0.12, 0.04, 0.02) # x, y, z dimensions for the asset size\n body_block_urdf = \"box\/box-template.urdf\"\n body_block_urdf = self.fill_template(body_block_urdf, {'DIM': body_size})\n body_block_pose = self.get_random_pose(env, body_size)\n body_block_id = env.add_object(body_block_urdf, body_block_pose, color=utils.COLORS['blue'])\n anchor_body_poses = [bridge_pose]\n\n # Goal: Firstly, create the base of the car by positioning two red blocks side by side.\n self.add_goal(objs=base_blocks[:2],\n matches=np.ones((2, 2)),\n targ_poses=anchor_base_poses,\n replace=False,\n rotations=True,\n metric='pose',\n params=None,\n step_max_reward=1.\/4)\n\n self.add_goal(objs=base_blocks[2:],\n matches=np.ones((2, 2)),\n targ_poses=anchor_base_poses,\n replace=False,\n rotations=True,\n metric='pose',\n params=None,\n step_max_reward=1.\/2)\n 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.\")\n\n # Then, add the car body by stacking a blue block on top of the base.\n self.add_goal(objs=[body_block_id],\n matches=np.ones((1, 1)),\n targ_poses=anchor_body_poses,\n replace=False,\n rotations=True,\n metric='pose',\n params=None,\n step_max_reward=1.\/4)\n self.lang_goals.append(\"Then, place the blue block horizontally on top of the yellow blocks.\")\n<|endoftext|>"} {"prompt":"stack-blocks-in-container\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"stack-blocks-in-container\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass StackBlocksInContainer(Task):\n \"\"\"Pick up five blocks of different colors (red, blue, green, yellow, and orange) \n and stack them in a container in a specific sequence. \n The bottom of the stack should start with a red block followed by a blue, \n green, yellow and finally an orange block at the top.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 15\n self.lang_template = \"stack the blocks in the container in the following order: {order}\"\n self.task_completed_desc = \"done stacking blocks in container.\"\n self.order = ['red', 'blue', 'green', 'yellow', 'orange']\n self.colors = [utils.COLORS[color] for color in self.order]\n\n def reset(self, env):\n super().reset(env)\n\n # Add container.\n container_size = (0.15, 0.15, 0.15) # x, y, z dimensions for the container size\n container_pose = self.get_random_pose(env, container_size)\n container_urdf = 'container\/container-template.urdf'\n replace = {'DIM': container_size, 'HALF': (container_size[0] \/ 2, container_size[1] \/ 2, container_size[2] \/ 2)}\n container_urdf = self.fill_template(container_urdf, replace)\n env.add_object(container_urdf, container_pose, 'fixed')\n\n # Add blocks.\n block_size = (0.04, 0.04, 0.04) # x, y, z dimensions for the block size\n block_urdf = 'block\/block.urdf'\n blocks = []\n for color in self.colors:\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=color)\n blocks.append(block_id)\n\n # Goal: each block is stacked in the container in the specified order.\n for i in range(len(blocks)):\n self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[container_pose], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ len(blocks))\n \n self.lang_goals.append(self.lang_template.format(order=', '.join(self.order)))<|endoftext|>"} {"prompt":"insert-blocks-into-fixture\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"insert-blocks-into-fixture\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass InsertBlocksIntoFixture(Task):\n \"\"\"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.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"insert the {color} block into the fixture\"\n self.task_completed_desc = \"done inserting blocks into fixture.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add fixture.\n # x, y, z dimensions for the asset size\n fixture_size = (0.15, 0.15, 0.05)\n fixture_pose = self.get_random_pose(env, fixture_size)\n fixture_urdf = 'insertion\/fixture.urdf'\n env.add_object(fixture_urdf, fixture_pose, 'fixed')\n\n anchor_base_poses = [fixture_pose,\n (utils.apply(fixture_pose, (0.04, 0, 0.001)), fixture_pose[1]),\n (utils.apply(fixture_pose, (0, 0.04, 0.001)), fixture_pose[1])]\n\n # Add blocks.\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n block_colors = ['red', 'blue', 'green']\n blocks = []\n for color in block_colors:\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=color)\n blocks.append(block_id)\n\n # Goal: each block is inserted into the fixture in the order of red, blue, green, yellow.\n for i, block in enumerate(blocks):\n self.add_goal(objs=[block], matches=np.ones((1, 1)), targ_poses=[anchor_base_poses[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/4)\n self.lang_goals.append(self.lang_template.format(color=block_colors[i]))\n<|endoftext|>"} {"prompt":"color-coordinated-block-tower\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-coordinated-block-tower\" in python code block starting with ```python. \n\n\n###\n\n","completion":" color-coordinated-block-tower: {'task-name': 'color-coordinated-block-tower', 'task-description': '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.', 'assets-used': ['block\/block.urdf', 'pallet\/pallet.urdf']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColorCoordinatedBlockTower(Task):\n \"\"\"Stack four blocks on a pallet in the following order from bottom to top: \n two blue blocks side by side, one red block centered on the blue blocks, \n and one green block on top of the red block.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 10\n 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.\"\n self.task_completed_desc = \"done stacking blocks.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add pallet.\n # x, y, z dimensions for the asset size\n pallet_size = (0.15, 0.15, 0.015)\n pallet_urdf = 'pallet\/pallet.urdf'\n pallet_pose = self.get_random_pose(env, pallet_size)\n env.add_object(pallet_urdf, pallet_pose, 'fixed')\n\n # Add blocks.\n # x, y, z dimensions for the asset size\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n block_colors = [utils.COLORS['blue'], utils.COLORS['blue'], utils.COLORS['red'], utils.COLORS['green']]\n blocks = []\n for i in range(4):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=block_colors[i])\n blocks.append(block_id)\n\n # Associate placement locations for goals.\n place_pos = [(0, -0.02, 0.02), (0, 0.02, 0.02), (0, 0, 0.06), (0, 0, 0.10)]\n targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos]\n\n # Goal: two blue blocks are placed side by side on the pallet.\n # Break the language prompt step-by-step\n self.add_goal(objs=blocks[:2], matches=np.ones((2, 2)), targ_poses=targs[:2], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 3, symmetries=[np.pi\/2]*2)\n self.lang_goals.append(\"place two blue blocks side by side on the pallet\")\n\n # Goal: one red block is placed centered on the blue blocks.\n self.add_goal(objs=blocks[2:3], matches=np.ones((1, 1)), targ_poses=targs[2:3], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 3, symmetries=[np.pi\/2])\n self.lang_goals.append(\"place one red block centered on the blue blocks\")\n\n # Goal: one green block is placed on top of the red block.\n self.add_goal(objs=blocks[3:], matches=np.ones((1, 1)), targ_poses=targs[3:], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 3, symmetries=[np.pi\/2])\n self.lang_goals.append(\"place one green block on top of the red block\")<|endoftext|>"} {"prompt":"color-structured-block-tower\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-structured-block-tower\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColorStructuredBlockTower(Task):\n \"\"\"Construct a tower using six blocks: two red, two blue, and two green. \n The tower should be built in the order of a red block at the base, \n followed by a blue, then green, then red, blue and green at the top.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"construct a tower using six blocks: two red, two blue, and two green. \" \\\n \"The tower should be built in the order of a red block at the base, \" \\\n \"followed by a blue, then green, then red, blue and green at the top.\"\n self.task_completed_desc = \"done building color-structured block tower.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define block colors and sizes\n colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green']] * 2\n block_size = (0.04, 0.04, 0.04)\n\n # Add blocks\n block_urdf = 'block\/block.urdf'\n blocks = []\n for i in range(6):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=colors[i])\n blocks.append(block_id)\n\n # Define target poses for the blocks in the tower\n base_pose = self.get_random_pose(env, block_size)\n targ_poses = [base_pose]\n for i in range(1, 6):\n targ_poses.append((np.array(base_pose[0]) + np.array([0, 0, i * block_size[2]]), base_pose[1]))\n\n # Add goals\n for i in range(6):\n self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[targ_poses[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/6, symmetries=[np.pi\/2])\n\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"stack-color-coordinated-blocks\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"stack-color-coordinated-blocks\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass StackColorCoordinatedBlocks(Task):\n \"\"\"Pick up six blocks of different colors (red, blue, green, yellow, orange, and purple) \n and stack them on a pallet in two separate stacks. The first stack should be red at the bottom, \n blue in the middle, and green at top. The second stack should be yellow at the bottom, \n orange in the middle, and purple at the top.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"stack the blocks on the pallet in two separate stacks. \" \\\n \"The first stack should be red at the bottom, blue in the middle, \" \\\n \"and green at top. The second stack should be yellow at the bottom, \" \\\n \"orange in the middle, and purple at the top.\"\n self.task_completed_desc = \"done stacking color-coordinated blocks.\"\n\n def reset(self, env):\n super().reset(env)\n\n # Add pallet.\n # x, y, z dimensions for the asset size\n pallet_size = (0.15, 0.15, 0.01)\n pallet_urdf = 'pallet\/pallet.urdf'\n pallet_pose = self.get_random_pose(env, pallet_size)\n env.add_object(pallet_urdf, pallet_pose, 'fixed')\n\n # Block colors.\n colors = [\n utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'],\n utils.COLORS['yellow'], utils.COLORS['orange'], utils.COLORS['purple']\n ]\n\n # Add blocks.\n # x, y, z dimensions for the asset size\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'box\/box-template.urdf'\n blocks = []\n for i in range(6):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=colors[i])\n blocks.append(block_id)\n\n # Associate placement locations for goals.\n place_pos = [(0, -0.05, 0.02), (0, 0, 0.02), (0, 0.05, 0.02), \n (0, -0.05, 0.06), (0, 0, 0.06), (0, 0.05, 0.06)]\n targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos]\n\n # Goal: blocks are stacked on the pallet in two separate stacks.\n # First stack: red at the bottom, blue in the middle, and green at top.\n self.add_goal(objs=blocks[:3], matches=np.ones((3, 3)), targ_poses=targs[:3], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 2, symmetries=[np.pi\/2]*3)\n\n # Second stack: yellow at the bottom, orange in the middle, and purple at the top.\n self.add_goal(objs=blocks[3:], matches=np.ones((3, 3)), targ_poses=targs[3:], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 2, symmetries=[np.pi\/2]*3)\n\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"assemble-single-car\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"assemble-single-car\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass AssembleSingleCar(Task):\n \"\"\"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.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 10\n 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\"\n self.task_completed_desc = \"done assembling the car.\"\n\n def reset(self, env):\n super().reset(env)\n\n # Add car body (large blue box).\n body_size = (0.1, 0.05, 0.02) # x, y, z dimensions\n body_pose = self.get_random_pose(env, body_size)\n body_urdf = 'box\/box-template.urdf'\n body_color = utils.COLORS['blue']\n body_id = env.add_object(body_urdf, body_pose, color=body_color)\n\n # Add car roof (smaller red box).\n roof_size = (0.08, 0.04, 0.02) # x, y, z dimensions\n roof_pose = self.get_random_pose(env, roof_size)\n roof_urdf = 'box\/box-template.urdf'\n roof_color = utils.COLORS['red']\n roof_id = env.add_object(roof_urdf, roof_pose, color=roof_color)\n\n # Add car wheels (two tiny green boxes).\n wheel_size = (0.02, 0.02, 0.01) # x, y, z dimensions\n wheel_urdf = 'box\/box-template.urdf'\n wheel_color = utils.COLORS['green']\n wheel_ids = []\n \n for _ in range(2):\n wheel_pose = self.get_random_pose(env, wheel_size)\n wheel_id = env.add_object(wheel_urdf, wheel_pose, color=wheel_color)\n wheel_ids.append(wheel_id)\n\n # Goal: assemble the car by placing the roof on the body and the wheels on the sides.\n # The target poses are calculated based on the body pose.\n roof_targ_pose = (body_pose[0] + np.array([0, 0, body_size[2] + roof_size[2]\/2]), body_pose[1])\n wheel_targ_poses = [(body_pose[0] + np.array([0, body_size[1]\/2 + wheel_size[1]\/2, -body_size[2]\/2]), body_pose[1]),\n (body_pose[0] + np.array([0, -body_size[1]\/2 - wheel_size[1]\/2, -body_size[2]\/2]), body_pose[1])]\n\n # Add the goals.\n self.add_goal(objs=[roof_id], matches=np.ones((1, 1)), targ_poses=[roof_targ_pose], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/3)\n self.add_goal(objs=wheel_ids, matches=np.ones((2, 2)), targ_poses=wheel_targ_poses, replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=2\/3)\n\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"sort-and-stack-clr-blocks\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"sort-and-stack-clr-blocks\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass SortAndStackClrBlocks(Task):\n \"\"\"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.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 10\n self.lang_template = \"sort and stack the blocks in the order of green, blue, red, and yellow\"\n self.task_completed_desc = \"done sorting and stacking blocks.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add pallet.\n # x, y, z dimensions for the asset size\n pallet_size = (0.15, 0.15, 0.01)\n pallet_urdf = 'pallet\/pallet.urdf'\n pallet_pose = self.get_random_pose(env, pallet_size)\n env.add_object(pallet_urdf, pallet_pose, 'fixed')\n\n # Block colors.\n colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow']]\n\n # Add blocks.\n # x, y, z dimensions for the asset size\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n blocks = []\n for i in range(4):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=colors[i])\n blocks.append(block_id)\n\n # Associate placement locations for goals.\n 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)]\n targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos]\n\n # Goal: blocks are sorted into separate corners of the pallet.\n self.add_goal(objs=blocks, matches=np.eye(4), targ_poses=targs, replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=0.5, symmetries=[np.pi\/2]*4)\n self.lang_goals.append(self.lang_template)\n\n # Associate stacking locations for goals.\n stack_pos = [(0, 0, 0.02), (0, 0, 0.06), (0, 0, 0.10), (0, 0, 0.14)]\n targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in stack_pos]\n\n # Goal: blocks are stacked on top of the pallet in the order of green, blue, red, and yellow.\n self.add_goal(objs=blocks, matches=np.eye(4), targ_poses=targs, replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=0.5, symmetries=[np.pi\/2]*4)\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"create-pyramid-blocks-and-container\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"create-pyramid-blocks-and-container\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass CreatePyramidBlocksAndContainer(Task):\n \"\"\"Create a pyramid structure using six blocks of three different colors (two red, two green, and two blue) inside a container.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"Create a pyramid structure using six blocks of three different colors (two red, two green, and two blue) inside a container.\"\n self.task_completed_desc = \"done creating pyramid.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add container.\n # x, y, z dimensions for the asset size\n container_size = (0.3, 0.3, 0.1)\n container_pose = self.get_random_pose(env, container_size)\n container_urdf = 'container\/container-template.urdf'\n replace = {'DIM': container_size, 'HALF': (container_size[0] \/ 2, container_size[1] \/ 2, container_size[2] \/ 2)}\n container_urdf = self.fill_template(container_urdf, replace)\n env.add_object(container_urdf, container_pose, 'fixed')\n\n # Add blocks.\n # x, y, z dimensions for the asset size\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n block_colors = [utils.COLORS['red'], utils.COLORS['red'], utils.COLORS['green'], utils.COLORS['green'], utils.COLORS['blue'], utils.COLORS['blue']]\n blocks = []\n for i in range(6):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=block_colors[i])\n blocks.append(block_id)\n\n # Associate placement locations for goals.\n 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)]\n targs = [(utils.apply(container_pose, i), container_pose[1]) for i in place_pos]\n\n # Goal: blocks are stacked in a pyramid (bottom row: green, green, blue).\n self.add_goal(objs=blocks[2:5], matches=np.ones((3, 3)), targ_poses=targs[:3], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 3, symmetries=[np.pi\/2]*3)\n self.lang_goals.append(self.lang_template.format(blocks=\"the green and blue blocks\",\n row=\"bottom\"))\n\n # Goal: blocks are stacked in a pyramid (middle row: red, red).\n self.add_goal(objs=blocks[:2], matches=np.ones((2, 2)), targ_poses=targs[3:5], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 3, symmetries=[np.pi\/2]*2)\n self.lang_goals.append(self.lang_template.format(blocks=\"the red blocks\",\n row=\"middle\"))\n\n # Goal: blocks are stacked in a pyramid (top row: blue).\n self.add_goal(objs=blocks[5:], matches=np.ones((1, 1)), targ_poses=targs[5:], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 3, symmetries=[np.pi\/2])\n self.lang_goals.append(self.lang_template.format(blocks=\"the blue block\",\n row=\"top\"))<|endoftext|>"} {"prompt":"Four-corner-pyramid-challenge\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"Four-corner-pyramid-challenge\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport pybullet as p\n\nclass FourCornerPyramidChallenge(Task):\n \"\"\"Construct a pyramid of blocks in each zone with a specific color sequence.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"build a pyramid of blocks in each zone with the sequence red, blue, green, and yellow from bottom to top\"\n self.task_completed_desc = \"done building pyramids.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add zones.\n zone_size = (0.12, 0.12, 0)\n zone_urdf = 'zone\/zone.urdf'\n zone_poses = []\n for _ in range(4):\n zone_pose = self.get_random_pose(env, zone_size)\n env.add_object(zone_urdf, zone_pose, 'fixed')\n zone_poses.append(zone_pose)\n\n # Block colors.\n colors = [\n utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow']\n ]\n\n # Add blocks.\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n blocks = []\n for i in range(4):\n for _ in range(4):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=colors[i])\n blocks.append(block_id)\n\n # Associate placement locations for goals.\n place_pos = [(0, -0.05, 0.03), (0, 0, 0.03),\n (0, 0.05, 0.03), (0, -0.025, 0.08),\n (0, 0.025, 0.08), (0, 0, 0.13)]\n targs = [(utils.apply(zone_pose, i), zone_pose[1]) for i in place_pos for zone_pose in zone_poses]\n\n # Goal: blocks are stacked in a pyramid in each zone.\n for i in range(4):\n 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,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 4, symmetries=[np.pi\/2]*4)\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"colorful-block-tower-on-cylinder-base\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"colorful-block-tower-on-cylinder-base\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColorfulBlockTowerOnCylinderBase(Task):\n \"\"\"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.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 10\n 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.\"\n self.task_completed_desc = \"done building the tower.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add cylindrical base.\n # x, y, z dimensions for the asset size\n base_size = (0.05, 0.05, 0.05)\n base_urdf = 'cylinder\/cylinder-template.urdf'\n base_pose = self.get_random_pose(env, base_size)\n base_id = env.add_object(base_urdf, base_pose, 'fixed')\n\n # Block colors.\n colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow']]\n\n # Add blocks.\n # x, y, z dimensions for the asset size\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n\n objs = []\n for i in range(4):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=colors[i])\n objs.append(block_id)\n\n # Associate placement locations for goals.\n place_pos = [(0, 0, 0.05), (0, 0, 0.09), (0, 0, 0.13), (0, 0, 0.17)]\n targs = [(utils.apply(base_pose, i), base_pose[1]) for i in place_pos]\n\n # Goal: blocks are stacked on the cylindrical base in the order red, blue, green, yellow from bottom to top.\n for i in range(4):\n self.add_goal(objs=[objs[i]], matches=np.ones((1, 1)), targ_poses=[targs[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 4, symmetries=[np.pi\/2])\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"align-cylinders-in-square\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"align-cylinders-in-square\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass AlignCylindersInSquare(Task):\n \"\"\"Arrange four cylinders of different colors (red, blue, green, yellow) \n on the corners of a square facing the center. The square is outlined by \n four zones of matching colors at each corner. The red cylinder should be \n placed at the red zone and facing the center of the square, and same for \n the remaining colors.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"arrange the {color} cylinder at the {color} corner of the square\"\n self.task_completed_desc = \"done arranging cylinders.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors and corresponding zones\n colors = ['red', 'blue', 'green', 'yellow']\n zones = ['zone-red', 'zone-blue', 'zone-green', 'zone-yellow']\n\n # Add zones at the corners of a square\n zone_size = (0.05, 0.05, 0.005)\n zone_urdf = 'zone\/zone.urdf'\n zone_poses = []\n for i in range(4):\n zone_pose = self.get_random_pose(env, zone_size)\n env.add_object(zone_urdf, zone_pose, 'fixed')\n zone_poses.append(zone_pose)\n\n # Add cylinders of different colors\n cylinder_size = (0.02, 0.02, 0.08)\n cylinder_urdf = 'cylinder\/cylinder-template.urdf'\n cylinders = []\n for i in range(4):\n cylinder_pose = self.get_random_pose(env, cylinder_size)\n color = utils.COLORS[colors[i]]\n cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=color)\n cylinders.append(cylinder_id)\n\n # Goal: each cylinder is in a different zone of the same color\n for i in range(4):\n self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[zone_poses[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/4)\n self.lang_goals.append(self.lang_template.format(color=colors[i]))<|endoftext|>"} {"prompt":"construct-corner-blocks\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"construct-corner-blocks\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ConstructCornerBlocks(Task):\n \"\"\"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.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n 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.\"\n self.task_completed_desc = \"done constructing corner blocks.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add corner.\n corner_size = (0.15, 0.15, 0.05)\n corner_urdf = 'corner\/corner-template.urdf'\n corner_pose = self.get_random_pose(env, corner_size)\n env.add_object(corner_urdf, corner_pose, 'fixed')\n\n # Add blocks.\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n block_colors = [utils.COLORS['red'], utils.COLORS['red'], utils.COLORS['green'], utils.COLORS['blue']]\n blocks = []\n for i in range(4):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=block_colors[i])\n blocks.append(block_id)\n\n # Associate placement locations for goals.\n place_pos = [(0, -0.05, 0.02), (0, 0.05, 0.02), (0, 0, 0.06), (0, 0, 0.10)]\n targs = [(utils.apply(corner_pose, i), corner_pose[1]) for i in place_pos]\n\n # Goal: blocks are stacked in a corner (bottom row: two red blocks).\n self.add_goal(objs=blocks[:2], matches=np.ones((2, 2)), targ_poses=targs[:2], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 2, symmetries=[np.pi\/2]*2)\n\n # Goal: blocks are stacked in a corner (middle row: one green block).\n self.add_goal(objs=blocks[2:3], matches=np.ones((1, 1)), targ_poses=targs[2:3], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 3, symmetries=[np.pi\/2]*1)\n\n # Goal: blocks are stacked in a corner (top row: one blue block).\n self.add_goal(objs=blocks[3:], matches=np.ones((1, 1)), targ_poses=targs[3:], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 4, symmetries=[np.pi\/2]*1)<|endoftext|>"} {"prompt":"corner-sort-cylinders\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"corner-sort-cylinders\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass CornerSortCylinders(Task):\n \"\"\"Pick up cylinders of four different colors (red, blue, green, yellow) and place them into four corners accordingly marked on the tabletop.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"place the {color} cylinder in the {color} corner\"\n self.task_completed_desc = \"done sorting cylinders.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors\n colors = ['red', 'blue', 'green', 'yellow']\n\n # Add corners\n corner_size = (0.04, 0.04, 0.04) # x, y, z dimensions for the asset size\n corner_template = 'corner\/corner-template.urdf'\n corner_poses = []\n for color in colors:\n replace = {'DIM': corner_size, 'HALF': (corner_size[0] \/ 2, corner_size[1] \/ 2, corner_size[2] \/ 2), 'COLOR': utils.COLORS[color]}\n corner_urdf = self.fill_template(corner_template, replace)\n corner_pose = self.get_random_pose(env, corner_size)\n env.add_object(corner_urdf, corner_pose, 'fixed')\n corner_poses.append(corner_pose)\n\n # Add cylinders\n cylinder_size = (0.02, 0.02, 0.06) # x, y, z dimensions for the asset size\n cylinder_template = 'cylinder\/cylinder-template.urdf'\n cylinders = []\n for color in colors:\n replace = {'DIM': cylinder_size, 'HALF': (cylinder_size[0] \/ 2, cylinder_size[1] \/ 2, cylinder_size[2] \/ 2), 'COLOR': utils.COLORS[color]}\n cylinder_urdf = self.fill_template(cylinder_template, replace)\n cylinder_pose = self.get_random_pose(env, cylinder_size)\n cylinder_id = env.add_object(cylinder_urdf, cylinder_pose)\n cylinders.append(cylinder_id)\n\n # Add goals\n for i in range(len(cylinders)):\n self.add_goal(objs=[cylinders[i]], matches=np.int32([[1]]), targ_poses=[corner_poses[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ len(cylinders))\n self.lang_goals.append(self.lang_template.format(color=colors[i]))<|endoftext|>"} {"prompt":"sorting-blocks-into-pallets\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"sorting-blocks-into-pallets\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass SortingBlocksIntoPallets(Task):\n \"\"\"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.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"put the {color} block into the {color} pallet\"\n self.task_completed_desc = \"done sorting blocks into pallets.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add pallets.\n # x, y, z dimensions for the asset size\n pallet_size = (0.12, 0.12, 0.02)\n pallet_urdf = 'pallet\/pallet.urdf'\n pallet_poses = []\n pallet_colors = ['red', 'blue', 'green', 'yellow']\n for color in pallet_colors:\n pallet_pose = self.get_random_pose(env, pallet_size)\n env.add_object(pallet_urdf, pallet_pose, 'fixed', color=utils.COLORS[color])\n pallet_poses.append(pallet_pose)\n\n # Add blocks.\n # x, y, z dimensions for the asset size\n blocks = []\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n for color in pallet_colors:\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color])\n blocks.append(block_id)\n\n # Goal: each block is in a different pallet of matching color.\n for i in range(len(blocks)):\n self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[pallet_poses[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/len(blocks))\n self.lang_goals.append(self.lang_template.format(color=pallet_colors[i]))<|endoftext|>"} {"prompt":"sort-and-assemble-block-castle\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"sort-and-assemble-block-castle\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass SortAndAssembleBlockCastle(Task):\n \"\"\"Sort blocks by color and assemble them into a castle-like structure.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 50\n self.lang_template = \"sort the blocks by color and assemble them into a castle\"\n self.task_completed_desc = \"done sorting and assembling.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add zones.\n zone_size = (0.12, 0.12, 0)\n zone_urdf = 'zone\/zone.urdf'\n zone_poses = []\n for _ in range(3):\n zone_pose = self.get_random_pose(env, zone_size)\n env.add_object(zone_urdf, zone_pose, 'fixed')\n zone_poses.append(zone_pose)\n\n # Add blocks.\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n block_colors = [utils.COLORS['red'], utils.COLORS['green'], utils.COLORS['blue']]\n blocks = []\n for color in block_colors:\n for _ in range(4):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=color)\n blocks.append(block_id)\n\n # Goal: each block is in a different zone based on color.\n for i in range(12):\n self.add_goal(objs=[blocks[i]], matches=np.ones((1, 3)), targ_poses=zone_poses, replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/12)\n\n # Goal: blocks are stacked in a pyramid in each zone.\n for i in range(3):\n zone_blocks = blocks[i*4:(i+1)*4]\n place_pos = [(0, -0.02, 0.02), (0, 0.02, 0.02),\n (0, 0, 0.06), (0, 0, 0.10)]\n targs = [(utils.apply(zone_poses[i], pos), zone_poses[i][1]) for pos in place_pos]\n for j in range(4):\n self.add_goal(objs=[zone_blocks[j]], matches=np.ones((1, 1)), targ_poses=[targs[j]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/12)\n\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"vertical-insertion-blocks\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"vertical-insertion-blocks\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport pybullet as p\n\nclass VerticalInsertionBlocks(Task):\n \"\"\"Pick up four color specific blocks and insert each block into four differently colored stands set upright on the tabletop.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"insert the {color} block into the {color} stand\"\n self.task_completed_desc = \"done inserting blocks into stands.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors for blocks and stands\n colors = ['red', 'blue', 'green', 'yellow']\n\n # Add stands.\n # x, y, z dimensions for the asset size\n stand_size = (0.04, 0.04, 0.1)\n stand_urdf = 'stacking\/stand.urdf'\n stands = []\n for color in colors:\n stand_pose = self.get_random_pose(env, stand_size)\n stand_id = env.add_object(stand_urdf, stand_pose, color=utils.COLORS[color], category='fixed')\n stands.append(stand_id)\n\n # Add blocks.\n # x, y, z dimensions for the asset size\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'stacking\/block.urdf'\n blocks = []\n for color in colors:\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color])\n blocks.append(block_id)\n\n # Goal: each block is inserted into the stand of the same color.\n for i in range(len(blocks)):\n self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(stands[i])], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/len(blocks))\n self.lang_goals.append(self.lang_template.format(color=colors[i]))<|endoftext|>"} {"prompt":"color-coordinated-sphere-insertion\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-coordinated-sphere-insertion\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColorCoordinatedSphereInsertion(Task):\n \"\"\"Insert each sphere into the bowl of the same color.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"insert each sphere into the bowl of the same color\"\n self.task_completed_desc = \"done inserting spheres into bowls.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors and corresponding names\n colors = ['red', 'blue', 'green', 'yellow']\n color_values = [utils.COLORS[color] for color in colors]\n\n # Add bowls.\n # x, y, z dimensions for the asset size\n bowl_size = (0.12, 0.12, 0.02)\n bowl_urdf = 'bowl\/bowl.urdf'\n bowl_poses = []\n for i in range(4):\n bowl_pose = self.get_random_pose(env, bowl_size)\n env.add_object(bowl_urdf, bowl_pose, 'fixed', color=color_values[i])\n bowl_poses.append(bowl_pose)\n\n # Add spheres.\n # x, y, z dimensions for the asset size\n sphere_size = (0.04, 0.04, 0.04)\n sphere_template = 'sphere\/sphere-template.urdf'\n spheres = []\n for i in range(4):\n sphere_pose = self.get_random_pose(env, sphere_size)\n replace = {'DIM': sphere_size, 'HALF': (sphere_size[0] \/ 2, sphere_size[1] \/ 2, sphere_size[2] \/ 2)}\n sphere_urdf = self.fill_template(sphere_template, replace)\n sphere_id = env.add_object(sphere_urdf, sphere_pose, color=color_values[i])\n spheres.append(sphere_id)\n\n # Goal: each sphere is in a bowl of the same color.\n for i in range(4):\n self.add_goal(objs=[spheres[i]], matches=np.ones((1, 1)), targ_poses=[bowl_poses[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/4)\n self.lang_goals.append(f\"insert the {colors[i]} sphere into the {colors[i]} bowl\")<|endoftext|>"} {"prompt":"block-pyramid-with-limited-space\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"block-pyramid-with-limited-space\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass BlockPyramidWithLimitedSpace(Task):\n \"\"\"Sort blocks according to color into three zones on the tabletop and construct a pyramid in each zone.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 50\n self.lang_template = \"sort the blocks according to color into three zones and construct a pyramid in each zone\"\n self.task_completed_desc = \"done sorting and constructing pyramids.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add zones.\n zone_size = (0.12, 0.12, 0)\n zone_urdf = 'zone\/zone.urdf'\n zone_poses = []\n for _ in range(3):\n zone_pose = self.get_random_pose(env, zone_size)\n env.add_object(zone_urdf, zone_pose, 'fixed')\n zone_poses.append(zone_pose)\n\n # Block colors.\n colors = [\n utils.COLORS['red'], utils.COLORS['green'], utils.COLORS['blue'], utils.COLORS['yellow']\n ]\n\n # Add blocks.\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n blocks = []\n for color in colors:\n for _ in range(3):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=color)\n blocks.append(block_id)\n\n # Associate placement locations for goals.\n place_pos = [(0, -0.05, 0.03), (0, 0, 0.03),\n (0, 0.05, 0.03), (0, -0.025, 0.08),\n (0, 0.025, 0.08), (0, 0, 0.13)]\n targs = [(utils.apply(zone_pose, i), zone_pose[1]) for zone_pose in zone_poses for i in place_pos]\n\n # Goal: blocks are sorted and stacked in a pyramid in each zone.\n for i in range(3):\n 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,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 3, symmetries=[np.pi\/2]*3)\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"build-cylinder-structure\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"build-cylinder-structure\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass BuildCylinderStructure(Task):\n \"\"\"Construct a structure using four colored cylinders (red, blue, green, yellow) on a square base.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 5\n self.lang_template = \"construct a structure using four colored cylinders on a square base\"\n self.task_completed_desc = \"done building the cylinder structure.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add square base.\n # x, y, z dimensions for the asset size\n base_size = (0.15, 0.15, 0.005)\n base_urdf = 'square\/square-template.urdf'\n base_pose = self.get_random_pose(env, base_size)\n env.add_object(base_urdf, base_pose, category='fixed')\n\n # Cylinder colors.\n colors = [\n utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow']\n ]\n\n # Add cylinders.\n # x, y, z dimensions for the asset size\n cylinder_size = (0.04, 0.04, 0.08)\n cylinder_urdf = 'cylinder\/cylinder-template.urdf'\n\n objs = []\n for i in range(4):\n cylinder_pose = self.get_random_pose(env, cylinder_size)\n cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=colors[i])\n objs.append(cylinder_id)\n\n # Associate placement locations for goals.\n place_pos = [(0, -0.05, 0.04), (0, 0.05, 0.04),\n (0, 0.05, 0.12), (0, -0.05, 0.12)]\n targs = [(utils.apply(base_pose, i), base_pose[1]) for i in place_pos]\n\n # Goal: red and blue cylinders are placed side by side on the base.\n self.add_goal(objs=objs[:2], matches=np.ones((2, 2)), targ_poses=targs[:2], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 2, symmetries=[np.pi\/2]*2)\n self.lang_goals.append(\"place the red and blue cylinders side by side on the base\")\n\n # Goal: green cylinder is placed on top of the blue cylinder.\n self.add_goal(objs=[objs[2]], matches=np.ones((1, 1)), targ_poses=[targs[2]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 2, symmetries=[np.pi\/2])\n self.lang_goals.append(\"place the green cylinder on top of the blue cylinder\")\n\n # Goal: yellow cylinder is placed on top of the red cylinder.\n self.add_goal(objs=[objs[3]], matches=np.ones((1, 1)), targ_poses=[targs[3]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 2, symmetries=[np.pi\/2])\n self.lang_goals.append(\"place the yellow cylinder on top of the red cylinder\")<|endoftext|>"} {"prompt":"insert-blocks-lineup\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"insert-blocks-lineup\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass InsertBlocksLineup(Task):\n \"\"\"Pick up four different color blocks and insert them into the corresponding color fixtures.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"insert the {color} block into the {color} fixture\"\n self.task_completed_desc = \"done inserting blocks.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors for blocks and fixtures\n colors = ['red', 'blue', 'green', 'yellow']\n\n # Add fixtures.\n fixture_size = (0.04, 0.04, 0.04)\n fixture_urdf = 'insertion\/fixture.urdf'\n fixture_poses = []\n for i in range(4):\n fixture_pose = self.get_random_pose(env, fixture_size)\n fixture_id = env.add_object(fixture_urdf, fixture_pose, color=utils.COLORS[colors[i]], category='fixed')\n fixture_poses.append((fixture_pose, fixture_id))\n\n # Add blocks.\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n blocks = []\n for i in range(4):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[colors[i]])\n blocks.append(block_id)\n\n # Add small blocks as barriers.\n small_block_size = (0.02, 0.02, 0.02)\n small_block_urdf = 'block\/small.urdf'\n for _ in range(10):\n small_block_pose = self.get_random_pose(env, small_block_size)\n env.add_object(small_block_urdf, small_block_pose)\n\n # Goal: each block is in the corresponding color fixture.\n for i in range(4):\n self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[fixture_poses[i][0]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/4)\n self.lang_goals.append(self.lang_template.format(color=colors[i]))<|endoftext|>"} {"prompt":"color-specific-container-fill\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-specific-container-fill\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColorSpecificContainerFill(Task):\n \"\"\"Arrange four colored blocks (red, blue, green, and yellow) around a pallet. \n Then, pick up these blocks and place them inside a container marked in the same color. \n The task requires precise placement, color matching, and an understanding of spatial structures.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"put the {color} block in the {color} container\"\n self.task_completed_desc = \"done arranging blocks in containers.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add pallet.\n # x, y, z dimensions for the asset size\n pallet_size = (0.15, 0.15, 0.01)\n pallet_urdf = 'pallet\/pallet.urdf'\n pallet_pose = self.get_random_pose(env, pallet_size)\n env.add_object(pallet_urdf, pallet_pose, 'fixed')\n\n # Define block and container colors.\n colors = ['red', 'blue', 'green', 'yellow']\n\n # Add blocks and containers.\n # x, y, z dimensions for the asset size\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n container_size = (0.12, 0.12, 0.05)\n container_template = 'container\/container-template.urdf'\n blocks = []\n containers = []\n for color in colors:\n # Add block.\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color])\n blocks.append(block_id)\n\n # Add container.\n container_pose = self.get_random_pose(env, container_size)\n replace = {'DIM': container_size, 'HALF': (container_size[0] \/ 2, container_size[1] \/ 2, container_size[2] \/ 2)}\n container_urdf = self.fill_template(container_template, replace)\n container_id = env.add_object(container_urdf, container_pose, 'fixed', color=utils.COLORS[color])\n containers.append(container_id)\n\n # Goal: each block is in a container of the same color.\n for i in range(len(colors)):\n self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(containers[i])], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ len(colors))\n self.lang_goals.append(self.lang_template.format(color=colors[i]))<|endoftext|>"} {"prompt":"multicolor-block-bridge\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"multicolor-block-bridge\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass MulticolorBlockBridge(Task):\n \"\"\"Build a bridge by stacking three red, three blue, and three green blocks on a pallet. \n Arrange in a sequence from left to right: red, blue, and green. \n Then, place three cylinders of corresponding colors on top of the stacked blocks, forming a bridge. \n The cylinders should roll from the top block to the pallet, creating a challenge of precision and control.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n 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.\"\n self.task_completed_desc = \"done building the bridge.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add pallet.\n # x, y, z dimensions for the asset size\n pallet_size = (0.15, 0.15, 0.01)\n pallet_urdf = 'pallet\/pallet.urdf'\n pallet_pose = self.get_random_pose(env, pallet_size)\n env.add_object(pallet_urdf, pallet_pose, 'fixed')\n\n # Add blocks.\n # x, y, z dimensions for the asset size\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n block_colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green']]\n blocks = []\n for i in range(9): # 3 blocks of each color\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=block_colors[i \/\/ 3])\n blocks.append(block_id)\n\n # Add cylinders.\n # x, y, z dimensions for the asset size\n cylinder_size = (0.04, 0.04, 0.04)\n cylinder_template = 'cylinder\/cylinder-template.urdf'\n cylinders = []\n for i in range(3): # 1 cylinder of each color\n cylinder_pose = self.get_random_pose(env, cylinder_size)\n replace = {'DIM': cylinder_size, 'HALF': (cylinder_size[0] \/ 2, cylinder_size[1] \/ 2, cylinder_size[2] \/ 2)}\n cylinder_urdf = self.fill_template(cylinder_template, replace)\n cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=block_colors[i])\n cylinders.append(cylinder_id)\n\n # Associate placement locations for goals.\n place_pos = [(0, -0.05, 0.03), (0, 0, 0.03), (0, 0.05, 0.03)]\n targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos]\n\n # Goal: blocks are stacked on the pallet in the order red, blue, green.\n for i in range(9):\n self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[targs[i \/\/ 3]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 9, symmetries=[np.pi\/2])\n\n # Goal: cylinders are placed on top of the stacked blocks.\n for i in range(3):\n self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[targs[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 3, symmetries=[np.pi\/2])\n\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"pyramid-blocks-assemble\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"pyramid-blocks-assemble\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass PyramidBlocksAssemble(Task):\n \"\"\"Construct a pyramid using nine blocks in a specific color order on a pallet.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 15\n self.lang_template = \"construct a pyramid using nine blocks in a specific color order on a pallet\"\n self.task_completed_desc = \"done constructing pyramid.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add pallet.\n # x, y, z dimensions for the asset size\n pallet_size = (0.35, 0.35, 0.01)\n pallet_urdf = 'pallet\/pallet.urdf'\n pallet_pose = self.get_random_pose(env, pallet_size)\n env.add_object(pallet_urdf, pallet_pose, 'fixed')\n\n # Block colors.\n colors = [\n utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'],\n utils.COLORS['yellow'], utils.COLORS['orange']\n ]\n\n # Add blocks.\n # x, y, z dimensions for the asset size\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n blocks = []\n for _ in range(9):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose)\n blocks.append(block_id)\n\n # Associate placement locations for goals.\n place_pos = [\n (-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),\n (-0.05, 0.05, 0.06), (0.05, 0.05, 0.06), (0, 0.1, 0.06),\n (0, 0.05, 0.1)\n ]\n targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos]\n\n # Goal: blocks are stacked in a pyramid in a specific color order.\n for i in range(9):\n self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[targs[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 9)\n self.lang_goals.append(self.lang_template.format(blocks=\"the blocks\",\n row=\"row\"))<|endoftext|>"} {"prompt":"triangle-block-arrangement\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"triangle-block-arrangement\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass TriangleBlockArrangement(Task):\n \"\"\"Arrange blocks of three different colors (red, green, and blue) in a triangular layout on the tabletop.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 6\n self.lang_template = \"Arrange blocks of three different colors (red, green, and blue) in a triangular layout on the tabletop.\"\n self.task_completed_desc = \"done arranging blocks in a triangle.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add blocks.\n # x, y, z dimensions for the asset size\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n colors = [utils.COLORS['red'], utils.COLORS['green'], utils.COLORS['blue']]\n blocks = []\n for i in range(6):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=colors[i\/\/2])\n blocks.append(block_id)\n\n # Associate placement locations for goals.\n place_pos = [(0, -0.05, 0.02), (0, 0, 0.02),\n (0, 0.05, 0.02), (0, -0.025, 0.06),\n (0, 0.025, 0.06), (0, 0, 0.10)]\n base_pose = self.get_random_pose(env, block_size)\n targs = [(utils.apply(base_pose, i), base_pose[1]) for i in place_pos]\n\n # Goal: blocks are stacked in a triangle (bottom row: red, middle row: green, top row: blue).\n self.add_goal(objs=blocks[:3], matches=np.ones((3, 3)), targ_poses=targs[:3], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 2, symmetries=[np.pi\/2]*3)\n self.lang_goals.append(\"Arrange the red blocks in a row at the base of the triangle.\")\n\n self.add_goal(objs=blocks[3:5], matches=np.ones((2, 2)), targ_poses=targs[3:5], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 3, symmetries=[np.pi\/2]*2)\n self.lang_goals.append(\"Arrange the green blocks in a row above the red blocks.\")\n\n self.add_goal(objs=blocks[5:], matches=np.ones((1, 1)), targ_poses=targs[5:], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 6, symmetries=[np.pi\/2])\n self.lang_goals.append(\"Place the blue block at the top of the triangle.\")<|endoftext|>"} {"prompt":"place-ball-in-elevated-bowl\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"place-ball-in-elevated-bowl\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport pybullet as p\n\nclass PlaceBallInElevatedBowl(Task):\n \"\"\"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.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 10\n self.lang_template = \"place the red ball in the elevated bowl\"\n self.task_completed_desc = \"done placing ball in bowl.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add elevated platform.\n platform_size = (0.3, 0.3, 0.05)\n platform_urdf = 'platform\/platform.urdf'\n platform_pose = self.get_random_pose(env, platform_size)\n env.add_object(platform_urdf, platform_pose, 'fixed')\n\n # Add bowl on the platform.\n bowl_size = (0.12, 0.12, 0)\n bowl_urdf = 'bowl\/bowl.urdf'\n bowl_pose = self.get_random_pose(env, bowl_size)\n bowl_pose[0][2] += platform_size[2] # place the bowl on top of the platform\n bowl_id = env.add_object(bowl_urdf, bowl_pose, 'fixed')\n\n # Add red ball.\n ball_size = (0.04, 0.04, 0.04)\n ball_urdf = 'ball\/ball-template.urdf'\n ball_pose = self.get_random_pose(env, ball_size)\n ball_id = env.add_object(ball_urdf, ball_pose, color=utils.COLORS['red'])\n\n # Add small blocks around the platform.\n block_size = (0.02, 0.02, 0.02)\n block_urdf = 'block\/small.urdf'\n for _ in range(5):\n block_pose = self.get_random_pose(env, block_size)\n env.add_object(block_urdf, block_pose)\n\n # Goal: the red ball is in the bowl.\n self.add_goal(objs=[ball_id], matches=np.ones((1, 1)), targ_poses=[bowl_pose], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1)\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"align-balls-in-colored-zones\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"align-balls-in-colored-zones\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass AlignBallsInColoredZones(Task):\n \"\"\"Align balls of different colors in correspondingly colored zones.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"place the {color} ball in the {color} zone\"\n self.task_completed_desc = \"done aligning balls in colored zones.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors for balls and zones\n colors = ['red', 'blue', 'green', 'yellow', 'orange', 'purple']\n color_names = ['Red', 'Blue', 'Green', 'Yellow', 'Orange', 'Purple']\n\n # Add zones.\n zone_size = (0.12, 0.12, 0)\n zone_urdf = 'zone\/zone.urdf'\n zone_poses = []\n for i in range(6):\n zone_pose = self.get_random_pose(env, zone_size)\n env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[colors[i]])\n zone_poses.append(zone_pose)\n\n # Add balls.\n ball_size = (0.04, 0.04, 0.04)\n ball_urdf = 'ball\/ball-template.urdf'\n balls = []\n for i in range(6):\n ball_pose = self.get_random_pose(env, ball_size)\n replace = {'DIM': ball_size, 'HALF': (ball_size[0] \/ 2, ball_size[1] \/ 2, ball_size[2] \/ 2), 'COLOR': colors[i]}\n ball_urdf = self.fill_template(ball_urdf, replace)\n ball_id = env.add_object(ball_urdf, ball_pose)\n balls.append(ball_id)\n\n # Goal: each ball is in a different colored zone.\n for i in range(6):\n self.add_goal(objs=[balls[i]], matches=np.int32([[1]]), targ_poses=[zone_poses[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 6)\n self.lang_goals.append(self.lang_template.format(color=color_names[i]))<|endoftext|>"} {"prompt":"color-coordinated-cylinder-tower\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-coordinated-cylinder-tower\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColorCoordinatedCylinderTower(Task):\n \"\"\"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.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 10\n 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.\"\n self.task_completed_desc = \"done stacking cylinders.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add base.\n base_size = (0.05, 0.15, 0.005)\n base_urdf = 'stacking\/stand.urdf'\n base_pose = self.get_random_pose(env, base_size)\n env.add_object(base_urdf, base_pose, category='fixed')\n\n # Cylinder colors.\n colors = [utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['red'], utils.COLORS['yellow']]\n\n # Add cylinders.\n cylinder_size = (0.04, 0.04, 0.04)\n cylinder_urdf = 'cylinder\/cylinder-template.urdf'\n\n objs = []\n for i in range(4):\n cylinder_pose = self.get_random_pose(env, cylinder_size)\n cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=colors[i])\n objs.append(cylinder_id)\n\n # Associate placement locations for goals.\n place_pos = [(0, 0, 0.03), (0, 0, 0.08), (0, 0, 0.13), (0, 0, 0.18)]\n targs = [(utils.apply(base_pose, i), base_pose[1]) for i in place_pos]\n\n # Goal: cylinders are stacked in a tower (bottom to top: blue, green, red, yellow).\n for i in range(4):\n self.add_goal(objs=[objs[i]], matches=np.ones((1, 1)), targ_poses=[targs[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 4, symmetries=[np.pi\/2])\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"symmetric-block-bridge-construction\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"symmetric-block-bridge-construction\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport pybullet as p\n\nclass SymmetricBlockBridgeConstruction(Task):\n \"\"\"Create a symmetrical bridge-shaped structure on a stand using eight blocks of two different colors (four red and four blue).\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"create a symmetrical bridge-shaped structure on a stand using eight blocks of two different colors (four red and four blue)\"\n self.task_completed_desc = \"done building the bridge.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add base.\n base_size = (0.05, 0.15, 0.005)\n base_urdf = 'stacking\/stand.urdf'\n base_pose = self.get_random_pose(env, base_size)\n env.add_object(base_urdf, base_pose, category='fixed')\n\n # Block colors.\n colors = [utils.COLORS['red'], utils.COLORS['blue']]\n\n # Add blocks.\n # x, y, z dimensions for the asset size\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'stacking\/block.urdf'\n\n objs = []\n for i in range(8):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=colors[i%2])\n objs.append(block_id)\n\n # Associate placement locations for goals.\n place_pos = [(0, -0.05, 0.03), (0, 0, 0.03),\n (0, 0.05, 0.03), (0, -0.025, 0.08),\n (0, 0.025, 0.08), (0, 0, 0.13),\n (0, -0.025, 0.18), (0, 0.025, 0.18)]\n targs = [(utils.apply(base_pose, i), base_pose[1]) for i in place_pos]\n\n # Goal: blocks are stacked in a bridge (bottom row: red, red).\n self.add_goal(objs=objs[:2], matches=np.ones((2, 2)), targ_poses=targs[:2], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 4, symmetries=[np.pi\/2]*2)\n self.lang_goals.append(self.lang_template)\n\n # Goal: blocks are stacked in a bridge (second row: blue).\n self.add_goal(objs=objs[2:3], matches=np.ones((1, 1)), targ_poses=targs[2:3], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 4, symmetries=[np.pi\/2])\n self.lang_goals.append(self.lang_template)\n\n # Goal: blocks are stacked in a bridge (third row: red).\n self.add_goal(objs=objs[3:4], matches=np.ones((1, 1)), targ_poses=targs[3:4], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 4, symmetries=[np.pi\/2])\n self.lang_goals.append(self.lang_template)\n\n # Goal: blocks are stacked in a bridge (fourth row: blue).\n self.add_goal(objs=objs[4:5], matches=np.ones((1, 1)), targ_poses=targs[4:5], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 4, symmetries=[np.pi\/2])\n self.lang_goals.append(self.lang_template)\n\n # Goal: blocks are stacked in a bridge (fifth row: red).\n self.add_goal(objs=objs[5:6], matches=np.ones((1, 1)), targ_poses=targs[5:6], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 4, symmetries=[np.pi\/2])\n self.lang_goals.append(self.lang_template)\n\n # Goal: blocks are stacked in a bridge (sixth row: blue).\n self.add_goal(objs=objs[6:7], matches=np.ones((1, 1)), targ_poses=targs[6:7], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 4, symmetries=[np.pi\/2])\n self.lang_goals.append(self.lang_template)\n\n # Goal: blocks are stacked in a bridge (top row: red, red).\n self.add_goal(objs=objs[7:], matches=np.ones((1, 1)), targ_poses=targs[7:], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 4, symmetries=[np.pi\/2])\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"sphere-align-stand\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"sphere-align-stand\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass SphereAlignStand(Task):\n \"\"\"Pick up each sphere and place it on the stand of the matching color.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 5\n self.lang_template = \"place the {color} sphere on the {color} stand\"\n self.task_completed_desc = \"done aligning spheres with stands.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors for the spheres and stands\n colors = ['red', 'green', 'blue', 'yellow', 'purple']\n color_names = ['red', 'green', 'blue', 'yellow', 'purple']\n\n # Add stands.\n # x, y, z dimensions for the asset size\n stand_size = (0.05, 0.05, 0.05)\n stand_urdf = 'stacking\/stand.urdf'\n stand_poses = []\n for i in range(5):\n stand_pose = self.get_random_pose(env, stand_size)\n env.add_object(stand_urdf, stand_pose, 'fixed', color=utils.COLORS[colors[i]])\n stand_poses.append(stand_pose)\n\n # Add spheres.\n # x, y, z dimensions for the asset size\n sphere_size = (0.04, 0.04, 0.04)\n sphere_urdf = 'sphere\/sphere.urdf'\n spheres = []\n for i in range(5):\n sphere_pose = self.get_random_pose(env, sphere_size)\n sphere_id = env.add_object(sphere_urdf, sphere_pose, color=utils.COLORS[colors[i]])\n spheres.append(sphere_id)\n\n # Goal: each sphere is on the stand of the matching color.\n for i in range(5):\n self.add_goal(objs=[spheres[i]], matches=np.ones((1, 1)), targ_poses=[stand_poses[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/5)\n self.lang_goals.append(self.lang_template.format(color=color_names[i]))<|endoftext|>"} {"prompt":"construct-colorful-arch\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"construct-colorful-arch\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ConstructColorfulArch(Task):\n \"\"\"Construct an arch using six blocks: three red, and three blue.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"Construct an arch using six blocks: three red, and three blue.\"\n self.task_completed_desc = \"done constructing colorful arch.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add blocks.\n # x, y, z dimensions for the asset size\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'stacking\/block.urdf'\n colors = [utils.COLORS['red'], utils.COLORS['blue']]\n blocks = []\n for i in range(6):\n block_pose = self.get_random_pose(env, block_size)\n color = colors[i \/\/ 3] # First three blocks are red, last three are blue\n block_id = env.add_object(block_urdf, block_pose, color=color)\n blocks.append(block_id)\n\n # Associate placement locations for goals.\n place_pos = [(0, -0.05, 0.02), (0, 0.05, 0.02), # Base layer\n (0, 0, 0.06), # Second layer\n (0, -0.05, 0.10), (0, 0.05, 0.10), # Third layer\n (0, 0, 0.14)] # Top layer\n targs = [(utils.apply(block_pose, i), block_pose[1]) for i in place_pos]\n\n # Goal: blocks are stacked in an arch (bottom layer: red, red).\n self.add_goal(objs=blocks[:2], matches=np.ones((2, 2)), targ_poses=targs[:2], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 3, symmetries=[np.pi\/2]*2)\n self.lang_goals.append(\"Place two red blocks on the tabletop parallel to each other\")\n\n # Goal: blocks are stacked in an arch (second layer: blue).\n self.add_goal(objs=blocks[2:3], matches=np.ones((1, 1)), targ_poses=targs[2:3], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 3, symmetries=[np.pi\/2])\n self.lang_goals.append(\"Place a blue block on top of the red blocks to form a basic arch\")\n\n # Goal: blocks are stacked in an arch (third layer: red, red).\n self.add_goal(objs=blocks[3:5], matches=np.ones((2, 2)), targ_poses=targs[3:5], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 3, symmetries=[np.pi\/2]*2)\n self.lang_goals.append(\"Place a red block on each side of the base arch\")\n\n # Goal: blocks are stacked in an arch (top layer: blue).\n self.add_goal(objs=blocks[5:], matches=np.ones((1, 1)), targ_poses=targs[5:], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 3, symmetries=[np.pi\/2])\n self.lang_goals.append(\"Bridge them with the last blue block\")<|endoftext|>"} {"prompt":"color-sorted-container-stack\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-sorted-container-stack\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColorSortedContainerStack(Task):\n \"\"\"Stack four differently colored blocks (red, blue, green, yellow) inside a container.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"stack the blocks in the container in the order: red, blue, green, then yellow\"\n self.task_completed_desc = \"done stacking blocks.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add container.\n # x, y, z dimensions for the asset size\n container_size = (0.15, 0.15, 0.15)\n container_pose = self.get_random_pose(env, container_size)\n container_urdf = 'container\/container-template.urdf'\n replace = {'DIM': container_size, 'HALF': (container_size[0] \/ 2, container_size[1] \/ 2, container_size[2] \/ 2)}\n container_urdf = self.fill_template(container_urdf, replace)\n env.add_object(container_urdf, container_pose, 'fixed')\n\n # Add blocks.\n # x, y, z dimensions for the asset size\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n block_colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow']]\n blocks = []\n for i in range(4):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=block_colors[i])\n blocks.append(block_id)\n\n # Add bowls.\n # x, y, z dimensions for the asset size\n bowl_size = (0.12, 0.12, 0)\n bowl_urdf = 'bowl\/bowl.urdf'\n for i in range(2):\n bowl_pose = self.get_random_pose(env, bowl_size)\n env.add_object(bowl_urdf, bowl_pose, 'fixed')\n\n # Goal: each block is stacked in the container in the order: red, blue, green, yellow.\n for i in range(4):\n self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[container_pose], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 4)\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"align-spheres-in-colored-zones\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"align-spheres-in-colored-zones\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport pybullet as p\n\nclass AlignSpheresInColoredZones(Task):\n \"\"\"Align spheres of different colors in the matching colored zones.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"place the {color} sphere in the {color} zone\"\n self.task_completed_desc = \"done aligning spheres in colored zones.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors\n colors = ['red', 'blue', 'green', 'yellow']\n color_names = ['red', 'blue', 'green', 'yellow']\n\n # Add zones.\n zone_size = (0.12, 0.12, 0)\n zone_urdf = 'zone\/zone.urdf'\n zone_poses = []\n for color in colors:\n zone_pose = self.get_random_pose(env, zone_size)\n env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[color])\n zone_poses.append(zone_pose)\n\n # Add spheres.\n sphere_size = (0.04, 0.04, 0.04)\n sphere_urdf = 'sphere\/sphere-template.urdf'\n spheres = []\n for i, color in enumerate(colors):\n sphere_pose = self.get_random_pose(env, sphere_size)\n replace = {'DIM': sphere_size, 'HALF': (sphere_size[0] \/ 2, sphere_size[1] \/ 2, sphere_size[2] \/ 2)}\n sphere_urdf = self.fill_template(sphere_urdf, replace)\n sphere_id = env.add_object(sphere_urdf, sphere_pose, color=utils.COLORS[color])\n spheres.append(sphere_id)\n\n # Add goal\n self.add_goal(objs=[sphere_id], matches=np.ones((1, 1)), targ_poses=[zone_poses[i]], replace=False,\n rotations=False, metric='pose', params=None, step_max_reward=1)\n self.lang_goals.append(self.lang_template.format(color=color_names[i]))<|endoftext|>"} {"prompt":"sort-insert-color-coordinated-blocks\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"sort-insert-color-coordinated-blocks\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass SortInsertColorCoordinatedBlocks(Task):\n \"\"\"Sort blocks by their colors and place them into the containers of the matching color.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"sort the blocks by their colors and place them into the containers of the matching color\"\n self.task_completed_desc = \"done sorting and inserting blocks.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add containers.\n container_size = (0.12, 0.12, 0.12)\n container_urdf = 'container\/container-template.urdf'\n container_colors = ['red', 'blue', 'green']\n container_poses = []\n for color in container_colors:\n container_pose = self.get_random_pose(env, container_size)\n env.add_object(container_urdf, container_pose, color=utils.COLORS[color])\n container_poses.append(container_pose)\n\n # Add blocks.\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n block_colors = ['red', 'red', 'blue', 'blue', 'green', 'green']\n blocks = []\n for color in block_colors:\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color])\n blocks.append(block_id)\n\n # Goal: each block is in a container of the same color.\n for i in range(len(blocks)):\n self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[container_poses[i\/\/2]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/len(blocks))\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"color-ordered-insertion\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-ordered-insertion\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColorOrderedInsertion(Task):\n \"\"\"Insert differently-colored ell objects into the matching color fixture in a specific order.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"insert the {color} ell into the matching fixture\"\n self.task_completed_desc = \"done inserting ells.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors and their order\n colors = ['red', 'blue', 'green', 'yellow']\n color_order = {color: i for i, color in enumerate(colors)}\n\n # Add fixtures.\n fixture_size = (0.12, 0.12, 0.02)\n fixture_urdf = 'insertion\/fixture.urdf'\n fixtures = []\n for color in colors:\n fixture_pose = self.get_random_pose(env, fixture_size)\n fixture_id = env.add_object(fixture_urdf, fixture_pose, color=utils.COLORS[color], category='fixed')\n fixtures.append(fixture_id)\n\n # Add ell objects.\n ell_size = (0.04, 0.04, 0.04)\n ell_urdf = 'insertion\/ell.urdf'\n ells = []\n for color in colors:\n ell_pose = self.get_random_pose(env, ell_size)\n ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[color])\n ells.append(ell_id)\n\n # Goal: each ell is inserted into the matching color fixture in the correct order.\n for i, ell in enumerate(ells):\n self.add_goal(objs=[ell], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(fixtures[i])], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ len(ells))\n self.lang_goals.append(self.lang_template.format(color=colors[i]))<|endoftext|>"} {"prompt":"color-coordinated-cylinders-in-boxes\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-coordinated-cylinders-in-boxes\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColorCoordinatedCylindersInBoxes(Task):\n \"\"\"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.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"put the {color} cylinder in the {color} box\"\n self.task_completed_desc = \"done arranging cylinders in boxes.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors and corresponding names\n colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow']]\n color_names = ['red', 'blue', 'green', 'yellow']\n\n # Add boxes.\n box_size = (0.05, 0.05, 0.05) # x, y, z dimensions for the box size\n box_urdf = 'box\/box-template.urdf'\n boxes = []\n for i in range(4):\n box_pose = self.get_random_pose(env, box_size)\n box_id = env.add_object(box_urdf, box_pose, color=colors[i])\n boxes.append(box_id)\n\n # Add cylinders.\n cylinder_size = (0.02, 0.02, 0.05) # x, y, z dimensions for the cylinder size\n cylinder_urdf = 'cylinder\/cylinder-template.urdf'\n cylinders = []\n for i in range(4):\n cylinder_pose = self.get_random_pose(env, cylinder_size)\n cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=colors[i])\n cylinders.append(cylinder_id)\n\n # Goal: each cylinder is in a box of the same color.\n for i in range(4):\n self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[box_pose], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 4)\n self.lang_goals.append(self.lang_template.format(color=color_names[i]))<|endoftext|>"} {"prompt":"color-coordinated-insertion\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-coordinated-insertion\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport pybullet as p\n\nclass ColorCoordinatedInsertion(Task):\n \"\"\"Insert each block into the fixture of the same color, and then place these fixtures onto a pallet.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"insert each block into the fixture of the same color, and then place these fixtures onto a pallet\"\n self.task_completed_desc = \"done with color-coordinated-insertion.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add pallet.\n pallet_size = (0.35, 0.35, 0.01)\n pallet_pose = self.get_random_pose(env, pallet_size)\n pallet_urdf = 'pallet\/pallet.urdf'\n env.add_object(pallet_urdf, pallet_pose, 'fixed')\n\n # Add fixtures and blocks.\n colors = ['red', 'blue', 'green', 'yellow']\n fixtures = []\n blocks = []\n fixture_size = (0.05, 0.05, 0.05)\n block_size = (0.04, 0.04, 0.04)\n fixture_urdf = 'insertion\/fixture.urdf'\n block_urdf = 'block\/block.urdf'\n for color in colors:\n # Add fixture.\n fixture_pose = self.get_random_pose(env, fixture_size)\n fixture_id = env.add_object(fixture_urdf, fixture_pose, color=utils.COLORS[color])\n fixtures.append(fixture_id)\n\n # Add block.\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color])\n blocks.append(block_id)\n\n # Goal: each block is in the fixture of the same color.\n for i in range(len(blocks)):\n self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(fixtures[i])], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ len(blocks))\n\n # Goal: each fixture is on the pallet.\n for i in range(len(fixtures)):\n self.add_goal(objs=[fixtures[i]], matches=np.ones((1, 1)), targ_poses=[pallet_pose], replace=False,\n rotations=True, metric='zone', params=[(pallet_pose, pallet_size)], step_max_reward=1 \/ len(fixtures))\n\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"cylinder-stand-alignment\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"cylinder-stand-alignment\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass CylinderStandAlignment(Task):\n \"\"\"Arrange four colored cylinders (red, blue, green, yellow) in order of their colors on four stands of matching color.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"Arrange the {color} cylinder on the {color} stand\"\n self.task_completed_desc = \"done arranging cylinders.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors and corresponding names\n colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow']]\n color_names = ['red', 'blue', 'green', 'yellow']\n\n # Add cylinders.\n # x, y, z dimensions for the asset size\n cylinder_size = (0.04, 0.04, 0.04)\n cylinder_urdf = 'cylinder\/cylinder-template.urdf'\n cylinders = []\n for i in range(4):\n cylinder_pose = self.get_random_pose(env, cylinder_size)\n replace = {'DIM': cylinder_size, 'HALF': (cylinder_size[0] \/ 2, cylinder_size[1] \/ 2, cylinder_size[2] \/ 2),\n 'COLOR': colors[i]}\n # IMPORTANT: REPLACE THE TEMPLATE URDF\n urdf = self.fill_template(cylinder_urdf, replace)\n cylinder_id = env.add_object(urdf, cylinder_pose)\n cylinders.append(cylinder_id)\n\n # Add stands.\n # x, y, z dimensions for the asset size\n stand_size = (0.05, 0.05, 0.005)\n stand_urdf = 'stacking\/stand.urdf'\n stands = []\n for i in range(4):\n stand_pose = self.get_random_pose(env, stand_size)\n env.add_object(stand_urdf, stand_pose, color=colors[i], category='fixed')\n stands.append(stand_pose)\n\n # Goal: each cylinder is on a stand of the same color.\n for i in range(4):\n self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[stands[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 4)\n self.lang_goals.append(self.lang_template.format(color=color_names[i]))<|endoftext|>"} {"prompt":"color-coordinated-container-sorting\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-coordinated-container-sorting\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColorCoordinatedContainerSorting(Task):\n \"\"\"Sort blocks into containers of the same color in a specific order.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"sort the blocks into the containers of the same color in the specified order\"\n self.task_completed_desc = \"done sorting blocks into containers.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors and their orders in containers\n colors = ['red', 'blue', 'green', 'yellow']\n orders = [\n ['red', 'blue', 'green', 'yellow'],\n ['yellow', 'green', 'blue', 'red'],\n ['green', 'red', 'yellow', 'blue'],\n ['blue', 'yellow', 'red', 'green']\n ]\n\n # Add containers.\n container_size = (0.12, 0.12, 0.02)\n container_urdf = 'container\/container-template.urdf'\n containers = []\n for i in range(4):\n container_pose = self.get_random_pose(env, container_size)\n color = utils.COLORS[colors[i]]\n container_id = env.add_object(container_urdf, container_pose, color=color)\n containers.append(container_id)\n\n # Add blocks.\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n blocks = []\n for i in range(4):\n for _ in range(4):\n block_pose = self.get_random_pose(env, block_size)\n color = utils.COLORS[colors[i]]\n block_id = env.add_object(block_urdf, block_pose, color=color)\n blocks.append(block_id)\n\n # Add goals.\n for i in range(4):\n for j in range(4):\n # Find the block and container of the same color\n block_id = blocks[i*4 + j]\n container_id = containers[i]\n # Define the target pose based on the order in the container\n container_pose = p.getBasePositionAndOrientation(container_id)[0]\n targ_pose = (container_pose[0], container_pose[1], container_pose[2] + block_size[2] * (j + 1))\n self.add_goal(objs=[block_id], matches=np.ones((1, 1)), targ_poses=[targ_pose], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/16)\n\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"color-sorted-block-race\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-sorted-block-race\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColorSortedBlockRace(Task):\n \"\"\"Pick up blocks of two colors and place them in corresponding colored zones in a sequence.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"place the blocks in the corresponding colored zones in sequence\"\n self.task_completed_desc = \"done placing blocks in zones.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add zones.\n zone_size = (0.12, 0.12, 0)\n zone_urdf = 'zone\/zone.urdf'\n zone_colors = ['blue', 'red']\n zone_poses = []\n for color in zone_colors:\n zone_pose = self.get_random_pose(env, zone_size)\n env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[color])\n zone_poses.append(zone_pose)\n\n # Add blocks.\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n block_colors = ['blue', 'red']\n blocks = []\n for color in block_colors:\n for _ in range(3):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color])\n blocks.append(block_id)\n\n # Goal: each block is in the corresponding colored zone.\n for i, block in enumerate(blocks):\n self.add_goal(objs=[block], matches=np.ones((1, 1)), targ_poses=[zone_poses[i\/\/3]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/len(blocks))\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"multi-level-block-construction\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"multi-level-block-construction\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass MultiLevelBlockConstruction(Task):\n \"\"\"Construct a two-level structure on a pallet using four blocks: two red and two blue. \n The lower level should be a rectangle created by placing the red blocks side by side. \n The upper level is made up by placing the blue blocks placed on top of the red blocks \n creating a line aligned perpendicular to the red blocks.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 10\n self.lang_template = \"construct a two-level structure on a pallet using four blocks: two red and two blue\"\n self.task_completed_desc = \"done constructing multi-level block structure.\"\n\n def reset(self, env):\n super().reset(env)\n\n # Add pallet.\n # x, y, z dimensions for the asset size\n pallet_size = (0.15, 0.15, 0.015)\n pallet_urdf = 'pallet\/pallet.urdf'\n pallet_pose = self.get_random_pose(env, pallet_size)\n env.add_object(pallet_urdf, pallet_pose, 'fixed')\n\n # Add blocks.\n # x, y, z dimensions for the asset size\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n block_colors = [utils.COLORS['red'], utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['blue']]\n blocks = []\n for i in range(4):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=block_colors[i])\n blocks.append(block_id)\n\n # Associate placement locations for goals.\n place_pos = [(0, -0.02, 0.02), (0, 0.02, 0.02),\n (0, -0.02, 0.06), (0, 0.02, 0.06)]\n targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos]\n\n # Goal: red blocks are placed side by side on the pallet.\n self.add_goal(objs=blocks[:2], matches=np.ones((2, 2)), targ_poses=targs[:2], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 2, symmetries=[np.pi\/2]*2)\n\n # Goal: blue blocks are stacked on top of the red blocks.\n self.add_goal(objs=blocks[2:], matches=np.ones((2, 2)), targ_poses=targs[2:], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 2, symmetries=[np.pi\/2]*2)<|endoftext|>"} {"prompt":"color-linked-ball-bowl-ordering\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-linked-ball-bowl-ordering\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColorLinkedBallBowlOrdering(Task):\n \"\"\"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.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"place the {color} ball in the {color} bowl\"\n self.task_completed_desc = \"done placing balls in bowls.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors and their order\n colors = ['red', 'blue', 'green', 'yellow']\n\n # Add bowls.\n # x, y, z dimensions for the asset size\n bowl_size = (0.12, 0.12, 0)\n bowl_urdf = 'bowl\/bowl.urdf'\n bowl_poses = []\n for i in range(4):\n bowl_pose = self.get_random_pose(env, bowl_size)\n env.add_object(bowl_urdf, bowl_pose, 'fixed', color=utils.COLORS[colors[i]])\n bowl_poses.append(bowl_pose)\n\n # Add balls.\n # x, y, z dimensions for the asset size\n balls = []\n ball_size = (0.04, 0.04, 0.04)\n ball_urdf = 'ball\/ball.urdf'\n for i in range(4):\n ball_pose = self.get_random_pose(env, ball_size)\n ball_id = env.add_object(ball_urdf, ball_pose, color=utils.COLORS[colors[i]])\n balls.append(ball_id)\n\n # Goal: each ball is in the bowl of the same color.\n for i in range(4):\n self.add_goal(objs=[balls[i]], matches=np.int32([[1]]), targ_poses=[bowl_poses[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 4)\n self.lang_goals.append(self.lang_template.format(color=colors[i]))<|endoftext|>"} {"prompt":"color-blocks-in-cylinder-maze\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-blocks-in-cylinder-maze\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColorBlocksInCylinderMaze(Task):\n \"\"\"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.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"arrange the blocks in the cylinders and stack the green and orange blocks\"\n self.task_completed_desc = \"done arranging blocks in cylinders.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add cylinders.\n cylinder_size = (0.05, 0.05, 0.1)\n cylinder_urdf = 'cylinder\/cylinder-template.urdf'\n cylinder_poses = []\n for _ in range(3):\n cylinder_pose = self.get_random_pose(env, cylinder_size)\n env.add_object(cylinder_urdf, cylinder_pose, 'fixed')\n cylinder_poses.append(cylinder_pose)\n\n # Add blocks.\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n block_colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['yellow'], utils.COLORS['green'], utils.COLORS['orange']]\n blocks = []\n for i in range(5):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=block_colors[i])\n blocks.append(block_id)\n\n # Goal: red, yellow, and blue blocks are in the first, second, and third cylinder respectively.\n self.add_goal(objs=blocks[:3], matches=np.ones((3, 3)), targ_poses=cylinder_poses, replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 2)\n\n # Goal: green and orange blocks are stacked on top of any cylinder.\n self.add_goal(objs=blocks[3:], matches=np.ones((2, 3)), targ_poses=cylinder_poses, replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 2)\n\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"create-pyramid-with-color-coded-ells\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"create-pyramid-with-color-coded-ells\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport pybullet as p\n\nclass CreatePyramidWithColorCodedElls(Task):\n \"\"\"Pick up ell-shaped objects of different colors and stack them onto a pallet in the shape of a pyramid.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"stack the {color} ell on the pyramid\"\n self.task_completed_desc = \"done stacking ell pyramid.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add pallet.\n pallet_size = (0.15, 0.15, 0.01)\n pallet_urdf = 'pallet\/pallet.urdf'\n pallet_pose = self.get_random_pose(env, pallet_size)\n env.add_object(pallet_urdf, pallet_pose, category='fixed')\n\n # Ell colors.\n colors = [\n utils.COLORS['red'], utils.COLORS['blue'], \n utils.COLORS['yellow'], utils.COLORS['green']\n ]\n color_names = ['red', 'blue', 'yellow', 'green']\n\n # Add Ells.\n ell_size = (0.04, 0.04, 0.04)\n ell_urdf = 'insertion\/ell.urdf'\n objs = []\n for i in range(4):\n ell_pose = self.get_random_pose(env, ell_size)\n ell_id = env.add_object(ell_urdf, ell_pose, color=colors[i])\n objs.append(ell_id)\n\n # Associate placement locations for goals.\n place_pos = [(0, -0.05, 0.03), (0, 0, 0.03),\n (0, 0.05, 0.03), (0, 0, 0.08)]\n targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos]\n\n # Goal: Ells are stacked in a pyramid (bottom row: red, middle row: blue, top row: yellow, green).\n for i in range(4):\n self.add_goal(objs=[objs[i]], matches=np.ones((1, 1)), targ_poses=[targs[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 4, symmetries=[np.pi\/2])\n self.lang_goals.append(self.lang_template.format(color=color_names[i]))<|endoftext|>"} {"prompt":"move-piles-along-line\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"move-piles-along-line\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass MovePilesAlongLine(Task):\n \"\"\"Move three piles of small blocks, each pile a different color (red, blue, green), \n along three matching colored lines to three separate zones of the same color using a spatula.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"move the piles of blocks along the lines to the matching colored zones\"\n self.task_completed_desc = \"done moving piles.\"\n self.primitive = primitives.push\n self.ee = Spatula\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add three colored lines.\n line_template = 'line\/line-template.urdf'\n line_colors = ['red', 'blue', 'green']\n line_poses = []\n for color in line_colors:\n line_size = self.get_random_size(0.1, 0.15, 0.1, 0.15, 0.05, 0.05)\n line_pose = self.get_random_pose(env, line_size)\n replace = {'DIM': line_size, 'HALF': (line_size[0] \/ 2, line_size[1] \/ 2, line_size[2] \/ 2), 'COLOR': color}\n line_urdf = self.fill_template(line_template, replace)\n env.add_object(line_urdf, line_pose, 'fixed')\n line_poses.append(line_pose)\n\n # Add three colored zones.\n zone_template = 'zone\/zone.urdf'\n zone_poses = []\n for color in line_colors:\n zone_size = self.get_random_size(0.1, 0.15, 0.1, 0.15, 0.05, 0.05)\n zone_pose = self.get_random_pose(env, zone_size)\n replace = {'DIM': zone_size, 'HALF': (zone_size[0] \/ 2, zone_size[1] \/ 2, zone_size[2] \/ 2), 'COLOR': color}\n zone_urdf = self.fill_template(zone_template, replace)\n env.add_object(zone_urdf, zone_pose, 'fixed')\n zone_poses.append(zone_pose)\n\n # Add three piles of small blocks.\n block_template = 'block\/small.urdf'\n block_colors = ['red', 'blue', 'green']\n block_ids = []\n for color in block_colors:\n block_size = self.get_random_size(0.1, 0.15, 0.1, 0.15, 0.05, 0.05)\n block_pose = self.get_random_pose(env, block_size)\n replace = {'DIM': block_size, 'HALF': (block_size[0] \/ 2, block_size[1] \/ 2, block_size[2] \/ 2), 'COLOR': color}\n block_urdf = self.fill_template(block_template, replace)\n block_id = env.add_object(block_urdf, block_pose)\n block_ids.append(block_id)\n\n # Add goals.\n for i in range(3):\n self.add_goal(objs=[block_ids[i]], matches=np.ones((1, 1)), targ_poses=[zone_poses[i]], replace=False,\n rotations=False, metric='zone', params=[(zone_poses[i], zone_size)], step_max_reward=1\/3)\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"color-ordered-blocks-on-pallet\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-ordered-blocks-on-pallet\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColorOrderedBlocksOnPallet(Task):\n \"\"\"Pick up each colored block and place it onto the pallet in specific color sequence: red, blue, green, yellow, orange, and finally purple.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"place the colored blocks onto the pallet in the following order: red, blue, green, yellow, orange, and purple\"\n self.task_completed_desc = \"done placing blocks on the pallet.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add pallet.\n # x, y, z dimensions for the asset size\n pallet_size = (0.15, 0.15, 0.02)\n pallet_urdf = 'pallet\/pallet.urdf'\n pallet_pose = self.get_random_pose(env, pallet_size)\n env.add_object(pallet_urdf, pallet_pose, 'fixed')\n\n # Block colors.\n colors = [\n utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'],\n utils.COLORS['yellow'], utils.COLORS['orange'], utils.COLORS['purple']\n ]\n\n # Add blocks.\n # x, y, z dimensions for the asset size\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n blocks = []\n for i in range(6):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=colors[i])\n blocks.append(block_id)\n\n # Associate placement locations for goals.\n place_pos = [(0, -0.05, 0.03), (0, 0, 0.03),\n (0, 0.05, 0.03), (0, -0.025, 0.08),\n (0, 0.025, 0.08), (0, 0, 0.13)]\n targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos]\n\n # Goal: blocks are placed on the pallet in the order of red, blue, green, yellow, orange, purple.\n for i in range(6):\n self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[targs[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 6, symmetries=[np.pi\/2])\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"color-ordered-container-arrangement\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-ordered-container-arrangement\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColorOrderedContainerArrangement(Task):\n \"\"\"Arrange six containers with blocks of matching colors in a specific color order.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"arrange the containers in the color order: red, blue, green, yellow, orange, and purple\"\n self.task_completed_desc = \"done arranging containers.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define color order\n color_order = ['red', 'blue', 'green', 'yellow', 'orange', 'purple']\n\n # Add containers and blocks\n container_size = (0.12, 0.12, 0.02)\n block_size = (0.04, 0.04, 0.04)\n container_urdf = 'container\/container-template.urdf'\n block_urdf = 'block\/block.urdf'\n containers = []\n blocks = []\n for color in color_order:\n # Add container\n container_pose = self.get_random_pose(env, container_size)\n container_id = env.add_object(container_urdf, container_pose, color=utils.COLORS[color])\n containers.append(container_id)\n\n # Add block\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color])\n blocks.append(block_id)\n\n # Add subgoal to place block in container\n self.add_goal(objs=[block_id], matches=np.ones((1, 1)), targ_poses=[container_pose], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/6)\n\n # Add final goal to arrange containers in color order\n container_poses = [self.get_random_pose(env, container_size) for _ in color_order]\n self.add_goal(objs=containers, matches=np.eye(len(color_order)), targ_poses=container_poses, replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1)\n\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"multi-level-pyramid-construction\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"multi-level-pyramid-construction\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass MultiLevelPyramidConstruction(Task):\n \"\"\"Construct a two-level pyramid on a pallet using six blocks: three green and three blue.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n 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.\"\n self.task_completed_desc = \"done constructing pyramid.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add pallet.\n pallet_size = (0.35, 0.35, 0.01) # x, y, z dimensions for the pallet size\n pallet_pose = self.get_random_pose(env, pallet_size)\n pallet_urdf = 'pallet\/pallet.urdf'\n env.add_object(pallet_urdf, pallet_pose, 'fixed')\n\n # Add blocks.\n block_size = (0.04, 0.04, 0.04) # x, y, z dimensions for the block size\n block_urdf = 'block\/block.urdf'\n block_colors = [utils.COLORS['green']] * 3 + [utils.COLORS['blue']] * 3 # three green and three blue blocks\n\n blocks = []\n for color in block_colors:\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=color)\n blocks.append(block_id)\n\n # Associate placement locations for goals.\n place_pos = [(0, -0.05, 0.02), (0, 0, 0.02), (0, 0.05, 0.02), # first level\n (0, -0.025, 0.06), (0, 0.025, 0.06), (0, 0, 0.10)] # second level\n targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos]\n\n # Goal: blocks are stacked in a pyramid (first level: green blocks).\n self.add_goal(objs=blocks[:3], matches=np.ones((3, 3)), targ_poses=targs[:3], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 2, symmetries=[np.pi\/2]*3)\n self.lang_goals.append(self.lang_template.format(blocks=\"the green blocks\", row=\"bottom\"))\n\n # Goal: blocks are stacked in a pyramid (second level: blue blocks).\n self.add_goal(objs=blocks[3:], matches=np.ones((3, 3)), targ_poses=targs[3:], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 2, symmetries=[np.pi\/2]*3)\n self.lang_goals.append(self.lang_template.format(blocks=\"the blue blocks\", row=\"top\"))<|endoftext|>"} {"prompt":"align-balls-in-colored-boxes\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"align-balls-in-colored-boxes\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport pybullet as p\n\nclass AlignBallsInColoredBoxes(Task):\n \"\"\"Align balls in colored boxes according to the color and sequence.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"put the {color} ball in the {color} box\"\n self.task_completed_desc = \"done aligning balls in boxes.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors and their sequence\n colors = ['red', 'blue', 'green', 'yellow']\n color_sequence = np.random.permutation(colors)\n\n # Add boxes.\n box_size = (0.12, 0.12, 0.12)\n box_urdf = 'box\/box-template.urdf'\n box_poses = []\n boxes = []\n for i in range(4):\n box_pose = self.get_random_pose(env, box_size)\n box_id = env.add_object(box_urdf, box_pose, color=utils.COLORS[color_sequence[i]])\n boxes.append(box_id)\n box_poses.append(box_pose)\n\n # Add balls.\n ball_size = (0.04, 0.04, 0.04)\n ball_urdf = 'ball\/ball.urdf'\n balls = []\n for i in range(4):\n ball_pose = self.get_random_pose(env, ball_size)\n ball_id = env.add_object(ball_urdf, ball_pose, color=utils.COLORS[colors[i]])\n balls.append(ball_id)\n\n # Goal: each ball is in the box of the same color.\n for i in range(4):\n self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[box_poses[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/4)\n self.lang_goals.append(self.lang_template.format(color=colors[i]))<|endoftext|>"} {"prompt":"color-coordinated-pyramid-in-container\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-coordinated-pyramid-in-container\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColorCoordinatedPyramidInContainer(Task):\n \"\"\"Pick up each color of blocks and place them in the container of the same color in a pyramid formation.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 15\n self.lang_template = \"build a pyramid of {color} blocks in the {color} container\"\n self.task_completed_desc = \"done building color-coordinated pyramids.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors and corresponding names\n colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green']]\n color_names = ['red', 'blue', 'green']\n\n # Add containers.\n container_size = (0.15, 0.15, 0.05)\n container_urdf = 'container\/container-template.urdf'\n container_poses = []\n for color in colors:\n container_pose = self.get_random_pose(env, container_size)\n env.add_object(container_urdf, container_pose, 'fixed', color=color)\n container_poses.append(container_pose)\n\n # Add blocks.\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n blocks = []\n for color in colors:\n for _ in range(3): # 3 blocks of each color\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=color)\n blocks.append(block_id)\n\n # Associate placement locations for goals.\n place_pos = [(0, -0.05, 0.02), (0, 0.05, 0.02), (0, 0, 0.06)]\n targs = [(utils.apply(container_pose, i), container_pose[1]) for i in place_pos for container_pose in container_poses]\n\n # Goal: blocks are stacked in a pyramid in the container of the same color.\n for i, color_name in enumerate(color_names):\n 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,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 3, symmetries=[np.pi\/2]*3)\n self.lang_goals.append(self.lang_template.format(color=color_name))<|endoftext|>"} {"prompt":"colored-balls-sorting-in-corner\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"colored-balls-sorting-in-corner\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColoredBallsSortingInCorner(Task):\n \"\"\"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.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"place the {color} ball in the {color} corner\"\n self.task_completed_desc = \"done sorting balls.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define the colors and their sequence\n colors = ['red', 'blue', 'green', 'yellow']\n\n # Add corners.\n corner_size = (0.12, 0.12, 0)\n corner_urdf = 'corner\/corner-template.urdf'\n corner_poses = []\n for i in range(4):\n corner_pose = self.get_random_pose(env, corner_size)\n env.add_object(corner_urdf, corner_pose, 'fixed', color=utils.COLORS[colors[i]])\n corner_poses.append(corner_pose)\n\n # Add balls.\n ball_size = (0.04, 0.04, 0.04)\n ball_urdf = 'ball\/ball-template.urdf'\n balls = []\n for i in range(4):\n ball_pose = self.get_random_pose(env, ball_size)\n ball_id = env.add_object(ball_urdf, ball_pose, color=utils.COLORS[colors[i]])\n balls.append(ball_id)\n\n # Goal: each ball is in the corner of the same color.\n for i in range(4):\n self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[corner_poses[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/4)\n self.lang_goals.append(self.lang_template.format(color=colors[i]))<|endoftext|>"} {"prompt":"color-coordinated-ball-insertion\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-coordinated-ball-insertion\" in python code block starting with ```python. \n\n\n###\n\n","completion":" color-coordinated-ball-insertion: {'task-name': 'color-coordinated-ball-insertion', 'task-description': 'There are four balls of different colors (red, blue, green, and yellow) and four corresponding color cylinders with an opening on the top. The task is to pick up each ball and insert it into the top of the cylinder of the same color. The cylinders are arranged in a line from left to right in the order of red, blue, green, and yellow. The challenge lies in the precise insertion, color matching, and the order following.', 'assets-used': ['ball\/ball-template.urdf', 'cylinder\/cylinder-template.urdf']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport pybullet as p\n\nclass ColorCoordinatedBallInsertion(Task):\n \"\"\"Insert balls into the cylinders of the same color in the order of red, blue, green, and yellow.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 10\n self.lang_template = \"insert the {color} ball into the {color} cylinder\"\n self.task_completed_desc = \"done inserting balls into cylinders.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors and their order\n colors = ['red', 'blue', 'green', 'yellow']\n\n # Add cylinders.\n # x, y, z dimensions for the asset size\n cylinder_size = (0.05, 0.05, 0.1)\n cylinder_urdf = 'cylinder\/cylinder-template.urdf'\n cylinder_poses = []\n for i in range(4):\n cylinder_pose = self.get_random_pose(env, cylinder_size)\n env.add_object(cylinder_urdf, cylinder_pose, category='fixed', color=utils.COLORS[colors[i]])\n cylinder_poses.append(cylinder_pose)\n\n # Add balls.\n # x, y, z dimensions for the asset size\n balls = []\n ball_size = (0.04, 0.04, 0.04)\n ball_urdf = 'ball\/ball-template.urdf'\n for i in range(4):\n ball_pose = self.get_random_pose(env, ball_size)\n ball_id = env.add_object(ball_urdf, ball_pose, color=utils.COLORS[colors[i]])\n balls.append(ball_id)\n\n # Goal: each ball is in the corresponding color cylinder.\n for i in range(4):\n self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[cylinder_poses[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/4)\n self.lang_goals.append(self.lang_template.format(color=colors[i]))<|endoftext|>"} {"prompt":"color-sequenced-pyramid-packing\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-sequenced-pyramid-packing\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport pybullet as p\n\nclass ColorSequencedPyramidPacking(Task):\n \"\"\"Sort cubes by color into four pallets and stack them in each pallet as a pyramid\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 12\n self.lang_template = \"sort the {color} cubes into the pallet and stack them as a pyramid\"\n self.task_completed_desc = \"done sorting and stacking cubes.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add pallets.\n # x, y, z dimensions for the asset size\n pallet_size = (0.15, 0.15, 0.02)\n pallet_urdf = 'pallet\/pallet.urdf'\n pallet_poses = []\n for _ in range(4):\n pallet_pose = self.get_random_pose(env, pallet_size)\n env.add_object(pallet_urdf, pallet_pose, category='fixed')\n pallet_poses.append(pallet_pose)\n\n # Cube colors.\n colors = [\n utils.COLORS['red'], utils.COLORS['green'], utils.COLORS['blue'], utils.COLORS['yellow']\n ]\n\n # Add cubes.\n # x, y, z dimensions for the asset size\n cube_size = (0.04, 0.04, 0.04)\n cube_urdf = 'block\/block.urdf'\n\n objs = []\n for i in range(12):\n cube_pose = self.get_random_pose(env, cube_size)\n cube_id = env.add_object(cube_urdf, cube_pose, color=colors[i%4])\n objs.append(cube_id)\n\n # Associate placement locations for goals.\n place_pos = [(0, -0.05, 0.03), (0, 0, 0.03),\n (0, 0.05, 0.03), (0, -0.025, 0.08),\n (0, 0.025, 0.08), (0, 0, 0.13)]\n targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos for pallet_pose in pallet_poses]\n\n # Goal: cubes are sorted by color and stacked in a pyramid in each pallet.\n for i in range(4):\n 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,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 4, symmetries=[np.pi\/2]*3)\n self.lang_goals.append(self.lang_template.format(color=list(utils.COLORS.keys())[i]))<|endoftext|>"} {"prompt":"color-block-ball-goal\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-block-ball-goal\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColorBlockBallGoal(Task):\n \"\"\"Pick up each ball and precisely place it in the zone of the same color. Navigate around blocks without knocking them over.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"place the {color} ball in the {color} zone\"\n self.task_completed_desc = \"done placing balls in zones.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add zones.\n zone_size = (0.12, 0.12, 0)\n zone_urdf = 'zone\/zone.urdf'\n zone_colors = ['red', 'blue', 'green', 'yellow']\n zone_poses = []\n for color in zone_colors:\n zone_pose = self.get_random_pose(env, zone_size)\n env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[color])\n zone_poses.append(zone_pose)\n\n # Add balls.\n balls = []\n ball_size = (0.04, 0.04, 0.04)\n ball_urdf = 'ball\/ball-template.urdf'\n for color in zone_colors:\n ball_pose = self.get_random_pose(env, ball_size)\n ball_id = env.add_object(ball_urdf, ball_pose, color=utils.COLORS[color])\n balls.append(ball_id)\n\n # Add blocks.\n blocks = []\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/small.urdf'\n for _ in range(10):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose)\n blocks.append(block_id)\n\n # Goal: each ball is in a zone of the same color.\n for i in range(len(balls)):\n self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[zone_poses[i]], replace=False,\n rotations=False, metric='pose', params=None, step_max_reward=1\/len(balls))\n self.lang_goals.append(self.lang_template.format(color=zone_colors[i]))<|endoftext|>"} {"prompt":"ball-sorting-with-blocks-barrier\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"ball-sorting-with-blocks-barrier\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport pybullet as p\n\nclass BallSortingWithBlocksBarrier(Task):\n \"\"\"Pick up each ball and place it into the zone of the same color, but without knocking over the blocks.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"place the {color} ball in the {color} zone without knocking over the blocks\"\n self.task_completed_desc = \"done sorting balls.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors for the balls and zones\n colors = ['red', 'blue', 'green', 'yellow']\n\n # Add zones and blocks.\n zone_size = (0.12, 0.12, 0)\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/small.urdf'\n zone_urdf = 'zone\/zone.urdf'\n zones = []\n blocks = []\n for color in colors:\n # Add zone of specific color\n zone_pose = self.get_random_pose(env, zone_size)\n env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[color])\n zones.append(zone_pose)\n\n # Add line of blocks of the same color\n for _ in range(5):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color])\n blocks.append(block_id)\n\n # Add balls.\n ball_size = (0.04, 0.04, 0.04)\n ball_urdf = 'ball\/ball-template.urdf'\n balls = []\n for color in colors:\n ball_pose = self.get_random_pose(env, ball_size)\n ball_id = env.add_object(ball_urdf, ball_pose, color=utils.COLORS[color])\n balls.append(ball_id)\n\n # Goal: each ball is in a zone of the same color.\n for i in range(len(balls)):\n self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[zones[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/len(balls))\n self.lang_goals.append(self.lang_template.format(color=colors[i]))<|endoftext|>"} {"prompt":"color-matched-blocks-insertion\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-matched-blocks-insertion\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColorMatchedBlocksInsertion(Task):\n \"\"\"Pick up each block and insert it into the fixture of the same color, in the specific sequence of red, blue, green, and yellow.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 10\n self.lang_template = \"insert the {color} block into the {color} fixture\"\n self.task_completed_desc = \"done inserting blocks into fixtures.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors and their sequence\n colors = ['red', 'blue', 'green', 'yellow']\n color_sequence = np.random.permutation(colors)\n\n # Add fixtures.\n fixture_size = (0.12, 0.12, 0.02)\n fixture_urdf = 'insertion\/fixture.urdf'\n fixture_poses = []\n for i in range(4):\n fixture_pose = self.get_random_pose(env, fixture_size)\n env.add_object(fixture_urdf, fixture_pose, 'fixed', color=utils.COLORS[color_sequence[i]])\n fixture_poses.append(fixture_pose)\n\n # Add blocks.\n blocks = []\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n for i in range(4):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color_sequence[i]])\n blocks.append(block_id)\n\n # Goal: each block is in the fixture of the same color.\n for i in range(4):\n self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[fixture_poses[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/4)\n self.lang_goals.append(self.lang_template.format(color=color_sequence[i]))<|endoftext|>"} {"prompt":"color-coordinated-block-bridge\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-coordinated-block-bridge\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColorCoordinatedBlockBridge(Task):\n \"\"\"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.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"construct a bridge by interleaving three differently colored blocks (red, blue, and green) on a pallet in a specific sequence\"\n self.task_completed_desc = \"done constructing the bridge.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add pallet.\n pallet_size = (0.30, 0.15, 0.02)\n pallet_pose = self.get_random_pose(env, pallet_size)\n env.add_object('pallet\/pallet.urdf', pallet_pose, 'fixed')\n\n # Block colors.\n colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green']]\n\n # Add blocks.\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/block.urdf'\n\n objs = []\n for i in range(9): # 3 sets of 3 colored blocks\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=colors[i % 3])\n objs.append(block_id)\n\n # Associate placement locations for goals.\n place_pos = [(0, -0.05, 0.02), (0, 0, 0.02), (0, 0.05, 0.02), # bottom layer\n (0, -0.05, 0.06), (0, 0, 0.06), (0, 0.05, 0.06), # middle layer\n (0, -0.05, 0.10), (0, 0, 0.10), (0, 0.05, 0.10)] # top layer\n targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos]\n\n # Goal: blocks are stacked in a bridge (bottom layer: red, blue, red).\n self.add_goal(objs=objs[:3], matches=np.ones((3, 3)), targ_poses=targs[:3], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 3, symmetries=[np.pi\/2]*3)\n\n # Goal: blocks are stacked in a bridge (middle layer: green, green, green).\n self.add_goal(objs=objs[3:6], matches=np.ones((3, 3)), targ_poses=targs[3:6], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 3, symmetries=[np.pi\/2]*3)\n\n # Goal: blocks are stacked in a bridge (top layer: red, blue, red).\n self.add_goal(objs=objs[6:], matches=np.ones((3, 3)), targ_poses=targs[6:], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 3, symmetries=[np.pi\/2]*3)<|endoftext|>"} {"prompt":"insert-red-block-into-cylinder\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"insert-red-block-into-cylinder\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport pybullet as p\n\nclass InsertRedBlockIntoCylinder(Task):\n \"\"\"Insert a red block into a cylindrical fixture.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 10\n self.lang_template = \"insert the red block into the cylinder\"\n self.task_completed_desc = \"done inserting block into cylinder.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add cylinder fixture.\n # x, y, z dimensions for the asset size\n fixture_size = (0.12, 0.12, 0.12)\n fixture_urdf = 'insertion\/fixture.urdf'\n fixture_pose = self.get_random_pose(env, fixture_size)\n env.add_object(fixture_urdf, fixture_pose, category='fixed')\n\n # Add red block.\n # x, y, z dimensions for the asset size\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'insertion\/ell.urdf'\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS['red'])\n\n # Goal: the red block is inside the cylindrical fixture.\n self.add_goal(objs=[block_id], matches=np.ones((1, 1)), targ_poses=[fixture_pose], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1)\n self.lang_goals.append(self.lang_template)<|endoftext|>"} {"prompt":"color-sequential-ball-container-sorting\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-sequential-ball-container-sorting\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColorSequentialBallContainerSorting(Task):\n \"\"\"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.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"place the {color} ball in the {color} container\"\n self.task_completed_desc = \"done sorting balls into containers.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors and their sequence\n colors = ['red', 'blue', 'green', 'yellow', 'orange', 'purple']\n color_sequence = np.arange(len(colors))\n\n # Add containers.\n container_size = (0.12, 0.12, 0)\n container_urdf = 'container\/container-template.urdf'\n container_poses = []\n for i in range(len(colors)):\n container_pose = self.get_random_pose(env, container_size)\n env.add_object(container_urdf, container_pose, color=utils.COLORS[colors[i]], category='fixed')\n container_poses.append(container_pose)\n\n # Add balls.\n balls = []\n ball_size = (0.04, 0.04, 0.04)\n ball_urdf = 'ball\/ball-template.urdf'\n for i in range(len(colors)):\n ball_pose = self.get_random_pose(env, ball_size)\n ball_id = env.add_object(ball_urdf, ball_pose, color=utils.COLORS[colors[i]])\n balls.append(ball_id)\n\n # Goal: each ball is in a container of the same color, in the correct sequence.\n for i in range(len(colors)):\n self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[container_poses[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/len(colors))\n self.lang_goals.append(self.lang_template.format(color=colors[i]))<|endoftext|>"} {"prompt":"color-coordinated-cylinder-pyramid\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-coordinated-cylinder-pyramid\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport pybullet as p\n\nclass ColorCoordinatedCylinderPyramid(Task):\n \"\"\"Construct a pyramid on a pallet using four cylinders of different colors (red, blue, green, and yellow).\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 12\n self.lang_template = \"make the {row} row with {cylinder}\"\n self.task_completed_desc = \"done stacking cylinder pyramid.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add pallet.\n pallet_size = (0.15, 0.15, 0.005)\n pallet_urdf = 'pallet\/pallet.urdf'\n pallet_pose = self.get_random_pose(env, pallet_size)\n env.add_object(pallet_urdf, pallet_pose, category='fixed')\n\n # Cylinder colors.\n colors = [\n utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'],\n utils.COLORS['yellow']\n ]\n\n # Add cylinders.\n # x, y, z dimensions for the asset size\n cylinder_size = (0.04, 0.04, 0.04)\n cylinder_urdf = 'cylinder\/cylinder-template.urdf'\n\n cylinders = []\n for i in range(4):\n cylinder_pose = self.get_random_pose(env, cylinder_size)\n cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=colors[i])\n cylinders.append(cylinder_id)\n\n # Associate placement locations for goals.\n place_pos = [(0, -0.05, 0.03), (0, 0.05, 0.03),\n (0, 0, 0.08), (0, 0, 0.13)]\n targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos]\n\n # Goal: cylinders are stacked in a pyramid (bottom row: red, blue).\n self.add_goal(objs=cylinders[:2], matches=np.ones((2, 2)), targ_poses=targs[:2], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 2, symmetries=[np.pi\/2]*2)\n self.lang_goals.append(self.lang_template.format(cylinder=\"the red and blue cylinders\",\n row=\"bottom\"))\n\n # Goal: cylinders are stacked in a pyramid (middle row: green).\n self.add_goal(objs=cylinders[2:3], matches=np.ones((1, 1)), targ_poses=targs[2:3], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 3, symmetries=[np.pi\/2]*1)\n self.lang_goals.append(self.lang_template.format(cylinder=\"the green cylinder\",\n row=\"middle\"))\n\n # Goal: cylinders are stacked in a pyramid (top row: yellow).\n self.add_goal(objs=cylinders[3:], matches=np.ones((1, 1)), targ_poses=targs[3:], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ 4, symmetries=[np.pi\/2]*1)\n self.lang_goals.append(self.lang_template.format(cylinder=\"the yellow cylinder\",\n row=\"top\"))<|endoftext|>"} {"prompt":"cylinder-sorting-with-zone\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"cylinder-sorting-with-zone\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass CylinderSortingWithZone(Task):\n \"\"\"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.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 10\n self.lang_template = \"place the {color} cylinder in the {color} zone\"\n self.task_completed_desc = \"done sorting cylinders.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors and their sequence\n colors = ['red', 'blue', 'green', 'yellow']\n color_sequence = np.arange(len(colors))\n\n # Add zones.\n zone_size = (0.12, 0.12, 0)\n zone_urdf = 'zone\/zone.urdf'\n zone_poses = []\n for i in color_sequence:\n zone_pose = self.get_random_pose(env, zone_size)\n env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[colors[i]])\n zone_poses.append(zone_pose)\n\n # Add cylinders.\n cylinders = []\n cylinder_size = (0.04, 0.04, 0.04)\n cylinder_urdf = 'cylinder\/cylinder-template.urdf'\n for i in color_sequence:\n cylinder_pose = self.get_random_pose(env, cylinder_size)\n cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=utils.COLORS[colors[i]])\n cylinders.append(cylinder_id)\n\n # Goal: each cylinder is in the zone of the same color.\n self.add_goal(objs=cylinders, matches=np.eye(len(cylinders)), targ_poses=zone_poses, replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1)\n for i in color_sequence:\n self.lang_goals.append(self.lang_template.format(color=colors[i]))<|endoftext|>"} {"prompt":"color-coordinated-ball-placement\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-coordinated-ball-placement\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport pybullet as p\n\nclass ColorCoordinatedBallPlacement(Task):\n \"\"\"Pick up each ball and precisely place it in the zone of the same color. \n The robot must place the balls in each zone in a specific order: red, blue, and then green.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 15\n self.lang_template = \"place the {color} ball in the {color} zone\"\n self.task_completed_desc = \"done placing balls in zones.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add zones.\n zone_size = (0.12, 0.12, 0)\n zone_urdf = 'zone\/zone.urdf'\n zone_colors = ['red', 'blue', 'green']\n zone_poses = []\n for color in zone_colors:\n zone_pose = self.get_random_pose(env, zone_size)\n env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[color])\n zone_poses.append(zone_pose)\n\n # Add balls.\n ball_size = (0.04, 0.04, 0.04)\n ball_urdf = 'ball\/ball-template.urdf'\n balls = []\n for color in zone_colors:\n ball_pose = self.get_random_pose(env, ball_size)\n ball_id = env.add_object(ball_urdf, ball_pose, color=utils.COLORS[color])\n balls.append(ball_id)\n\n # Add blocks as obstacles.\n block_size = (0.04, 0.04, 0.04)\n block_urdf = 'block\/small.urdf'\n for _ in range(5):\n block_pose = self.get_random_pose(env, block_size)\n env.add_object(block_urdf, block_pose)\n\n # Goal: each ball is in the zone of the same color.\n for i in range(len(balls)):\n self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[zone_poses[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/3)\n self.lang_goals.append(self.lang_template.format(color=zone_colors[i]))<|endoftext|>"} {"prompt":"sweep-and-sort-blocks\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"sweep-and-sort-blocks\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass SweepAndSortBlocks(Task):\n \"\"\"Sweep a pile of small blocks of different colors (red, blue, green, and yellow) into their corresponding colored zones marked on the tabletop.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"sweep the pile of {color} blocks into the {color} square\"\n self.task_completed_desc = \"done sweeping and sorting.\"\n self.primitive = primitives.push\n self.ee = Spatula\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Add colored zones.\n zone_size = (0.12, 0.12, 0)\n zone_urdf = 'zone\/zone.urdf'\n colors = ['red', 'blue', 'green', 'yellow']\n zone_poses = []\n for color in colors:\n zone_pose = self.get_random_pose(env, zone_size)\n env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[color])\n zone_poses.append(zone_pose)\n\n # Add piles of colored blocks.\n block_urdf = 'block\/small.urdf'\n block_size = (0.04, 0.04, 0.04)\n piles = []\n for color in colors:\n pile = []\n for _ in range(10):\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color])\n pile.append(block_id)\n piles.append(pile)\n\n # Add goals for each color.\n for i, color in enumerate(colors):\n self.add_goal(objs=piles[i], matches=np.ones((10, 1)), targ_poses=[zone_poses[i]], replace=True,\n rotations=False, metric='zone', params=[(zone_poses[i], zone_size)], step_max_reward=1)\n self.lang_goals.append(self.lang_template.format(color=color))<|endoftext|>"} {"prompt":"align-cylinders-in-zones\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"align-cylinders-in-zones\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport pybullet as p\n\nclass AlignCylindersInZones(Task):\n \"\"\"Place four differently colored cylinders each into a matching colored zone. \n The zones are surrounded by small blocks, which the robot needs to move out of the way \n without knocking them out of their respective zones.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 20\n self.lang_template = \"place the {color} cylinder in the {color} zone\"\n self.task_completed_desc = \"done aligning cylinders.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Cylinder colors.\n colors = ['red', 'blue', 'green', 'yellow']\n\n # Add cylinders.\n # x, y, z dimensions for the asset size\n cylinder_size = (0.04, 0.04, 0.04)\n cylinder_urdf = 'cylinder\/cylinder-template.urdf'\n\n cylinders = []\n for i in range(4):\n cylinder_pose = self.get_random_pose(env, cylinder_size)\n cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=utils.COLORS[colors[i]])\n cylinders.append(cylinder_id)\n\n # Add zones.\n # x, y, z dimensions for the asset size\n zone_size = (0.12, 0.12, 0)\n zone_urdf = 'zone\/zone.urdf'\n\n zones = []\n for i in range(4):\n zone_pose = self.get_random_pose(env, zone_size)\n env.add_object(zone_urdf, zone_pose, color=utils.COLORS[colors[i]], category='fixed')\n zones.append(zone_pose)\n\n # Add small blocks around the zones.\n # x, y, z dimensions for the asset size\n block_size = (0.02, 0.02, 0.02)\n block_urdf = 'block\/small.urdf'\n\n for _ in range(16):\n block_pose = self.get_random_pose(env, block_size)\n env.add_object(block_urdf, block_pose)\n\n # Goal: each cylinder is in a matching colored zone.\n for i in range(4):\n self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[zones[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/4)\n self.lang_goals.append(self.lang_template.format(color=colors[i]))<|endoftext|>"} {"prompt":"sphere-container-color-match\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"sphere-container-color-match\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport pybullet as p\n\nclass SphereContainerColorMatch(Task):\n \"\"\"Pick up each sphere and place it into a container of the same color.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 4\n self.lang_template = \"put the {color} sphere in the {color} container\"\n self.task_completed_desc = \"done matching spheres and containers.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors and corresponding names\n colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow']]\n color_names = ['red', 'blue', 'green', 'yellow']\n\n # Add containers.\n container_size = (0.12, 0.12, 0.12)\n container_urdf = 'container\/container-template.urdf'\n containers = []\n for i in range(4):\n container_pose = self.get_random_pose(env, container_size)\n container_id = env.add_object(container_urdf, container_pose, color=colors[i])\n containers.append(container_id)\n\n # Add spheres.\n sphere_size = (0.04, 0.04, 0.04)\n sphere_urdf = 'sphere\/sphere.urdf'\n spheres = []\n for i in range(4):\n sphere_pose = self.get_random_pose(env, sphere_size)\n sphere_id = env.add_object(sphere_urdf, sphere_pose, color=colors[i])\n spheres.append(sphere_id)\n\n # Goal: each sphere is in a container of the same color.\n for i in range(4):\n self.add_goal(objs=[spheres[i]], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(containers[i])], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/4)\n self.lang_goals.append(self.lang_template.format(color=color_names[i]))<|endoftext|>"} {"prompt":"insertion-and-color-sorting\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"insertion-and-color-sorting\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass InsertionAndColorSorting(Task):\n \"\"\"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.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 10\n self.lang_template = \"insert the {color} block into the {color} fixture and arrange the fixtures in color order\"\n self.task_completed_desc = \"done inserting and sorting.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Ell-shaped block colors.\n colors = ['red', 'blue', 'green', 'yellow']\n\n # Add Ell-shaped blocks.\n block_size = (0.04, 0.04, 0.04) # x, y, z dimensions for the block size\n block_urdf = 'insertion\/ell.urdf' # URDF file for Ell-shaped block\n\n blocks = []\n for color in colors:\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose, color=color)\n blocks.append(block_id)\n\n # Add fixtures.\n fixture_size = (0.05, 0.05, 0.05) # x, y, z dimensions for the fixture size\n fixture_urdf = 'insertion\/fixture.urdf' # URDF file for fixture\n\n fixtures = []\n for color in colors:\n fixture_pose = self.get_random_pose(env, fixture_size)\n fixture_id = env.add_object(fixture_urdf, fixture_pose, color=color)\n fixtures.append(fixture_id)\n\n # Goal: each block is inserted into a fixture of the same color.\n for i in range(len(blocks)):\n self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[fixture_pose], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ len(blocks))\n self.lang_goals.append(self.lang_template.format(color=colors[i]))\n\n # Goal: fixtures are arranged in a line in color order.\n line_poses = [self.get_random_pose(env, fixture_size) for _ in range(len(fixtures))]\n line_poses.sort(key=lambda x: x[0]) # sort by x-coordinate to form a line\n for i in range(len(fixtures)):\n self.add_goal(objs=[fixtures[i]], matches=np.ones((1, 1)), targ_poses=[line_poses[i]], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1 \/ len(fixtures))<|endoftext|>"} {"prompt":"color-coordinated-cylinder-stack\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-coordinated-cylinder-stack\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport pybullet as p\n\nclass ColorCoordinatedCylinderStack(Task):\n \"\"\"Stack cylinders on stands of the same color in a specific order.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 10\n self.lang_template = \"stack the cylinders on the stands of the same color in the order red, blue, green, yellow\"\n self.task_completed_desc = \"done stacking cylinders.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Define colors and corresponding names\n colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow']]\n color_names = ['red', 'blue', 'green', 'yellow']\n\n # Add stands.\n # x, y, z dimensions for the asset size\n stand_size = (0.04, 0.04, 0.04)\n stand_urdf = 'stacking\/stand.urdf'\n stands = []\n for i in range(4):\n stand_pose = self.get_random_pose(env, stand_size)\n stand_id = env.add_object(stand_urdf, stand_pose, color=colors[i])\n stands.append(stand_id)\n\n # Add cylinders.\n # x, y, z dimensions for the asset size\n cylinder_size = (0.04, 0.04, 0.04)\n cylinder_urdf = 'cylinder\/cylinder-template.urdf'\n cylinders = []\n for i in range(4):\n cylinder_pose = self.get_random_pose(env, cylinder_size)\n cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=colors[i])\n cylinders.append(cylinder_id)\n\n # Goal: each cylinder is stacked on the stand of the same color in the order red, blue, green, yellow.\n for i in range(4):\n self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[stand_pose], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/4)\n self.lang_goals.append(f\"Place the {color_names[i]} cylinder on the {color_names[i]} stand.\")<|endoftext|>"} {"prompt":"color-coordinated-container-insertion\" in natural languages and format the answer in a python dictionary with keys \"task-name\" and value type string, \"task-description\" (one specific sentence) and value type string, and \"assets-used\" and value type list of strings.\n\n=========\nNow write the pybullet simulation code for the task \"color-coordinated-container-insertion\" in python code block starting with ```python. \n\n\n###\n\n","completion":" 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']} \n\n###\n\nImplementation: \n ```python\nimport numpy as np\nimport os\nimport pybullet as p\nimport random\nfrom cliport.tasks import primitives\nfrom cliport.tasks.grippers import Spatula\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\nimport numpy as np\nfrom cliport.tasks.task import Task\nfrom cliport.utils import utils\n\nclass ColorCoordinatedContainerInsertion(Task):\n \"\"\"Insert ell shaped blocks into the container of the same color in a specific sequence.\"\"\"\n\n def __init__(self):\n super().__init__()\n self.max_steps = 3\n self.lang_template = \"insert the {color} ell block into the {color} container\"\n self.task_completed_desc = \"done inserting ell blocks into containers.\"\n self.additional_reset()\n\n def reset(self, env):\n super().reset(env)\n\n # Ell block and container colors.\n colors = ['red', 'blue', 'green']\n\n # Add ell blocks and containers.\n ell_size = (0.04, 0.04, 0.04)\n ell_urdf = 'insertion\/ell.urdf'\n container_size = (0.12, 0.12, 0)\n container_urdf = 'container\/container-template.urdf'\n\n objs = []\n for color in colors:\n # Add ell block.\n ell_pose = self.get_random_pose(env, ell_size)\n ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[color])\n objs.append(ell_id)\n\n # Add container.\n container_pose = self.get_random_pose(env, container_size)\n env.add_object(container_urdf, container_pose, color=utils.COLORS[color], category='fixed')\n\n # Goal: each ell block is in the container of the same color.\n self.add_goal(objs=[ell_id], matches=np.ones((1, 1)), targ_poses=[container_pose], replace=False,\n rotations=True, metric='pose', params=None, step_max_reward=1\/3)\n self.lang_goals.append(self.lang_template.format(color=color))<|endoftext|>"}