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.

=========
Now write the pybullet simulation code for the task "align-box-corner" in python code block starting with ```python.

###

Response:
 align-box-corner: {'assets-used': ['box/box-template.urdf', 'corner/corner-template.urdf'], 'task-description': 'pick up the randomly sized box and align one of its corners to the L-shaped marker on the tabletop..', 'task-name': 'align-box-corner'}

###

Implementation:
  ```python
import os
import numpy as np
from cliport.tasks.task import Task
from cliport.utils import utils

class AlignBoxCorner(Task):
    """Pick up the randomly sized box and align one of its corners to the L-shaped marker on the tabletop."""

    def __init__(self):
        super().__init__()
        self.max_steps = 3
        self.lang_template = "align the brown box with the green corner"
        self.task_completed_desc = "done with alignment"
        self.additional_reset()

    def reset(self, env):
        super().reset(env)

        # Generate randomly shaped box.
        box_size = self.get_random_size(0.05, 0.15, 0.05, 0.15, 0.01, 0.06)

        # Add corner.
        dimx = (box_size[0] / 2 - 0.025 + 0.0025, box_size[0] / 2 + 0.0025)
        dimy = (box_size[1] / 2 + 0.0025, box_size[1] / 2 - 0.025 + 0.0025)
        corner_template = 'corner/corner-template.urdf'
        replace = {'DIMX': dimx, 'DIMY': dimy}

        # IMPORTANT: REPLACE THE TEMPLATE URDF
        corner_urdf = self.fill_template(corner_template, replace)
        corner_size = (box_size[0], box_size[1], 0)
        corner_pose = self.get_random_pose(env, corner_size)
        env.add_object(corner_urdf, corner_pose, 'fixed')

        # Add possible placing poses.
        theta = utils.quatXYZW_to_eulerXYZ(corner_pose[1])[2]
        fip_rot = utils.eulerXYZ_to_quatXYZW((0, 0, theta + np.pi))
        pose1 = (corner_pose[0], fip_rot)
        alt_x = (box_size[0] / 2) - (box_size[1] / 2)
        alt_y = (box_size[1] / 2) - (box_size[0] / 2)
        alt_pos = (alt_x, alt_y, 0)
        alt_rot0 = utils.eulerXYZ_to_quatXYZW((0, 0, np.pi / 2))
        alt_rot1 = utils.eulerXYZ_to_quatXYZW((0, 0, 3 * np.pi / 2))
        pose2 = utils.multiply(corner_pose, (alt_pos, alt_rot0))
        pose3 = utils.multiply(corner_pose, (alt_pos, alt_rot1))

        # Add box.
        box_template = 'box/box-template.urdf'

        # IMPORTANT: REPLACE THE TEMPLATE URDF
        box_urdf = self.fill_template(box_template, {'DIM': np.float32(box_size)})
        box_pose = self.get_random_pose(env, box_size)
        box_id = env.add_object(box_urdf, box_pose)
        self.color_random_brown(box_id)

        # Goal: box is aligned with corner (1 of 4 possible poses).
        self.add_goal(objs=[box_id], matches=np.int32([[1, 1, 1, 1]]), targ_poses=[corner_pose, pose1, pose2, pose3], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1, symmetries=[2 * np.pi])
        self.lang_goals.append(self.lang_template)
<|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.

=========
Now write the pybullet simulation code for the task "align-rope" in python code block starting with ```python.

###

Response:
 align-rope: {'assets-used': ['square/square-template.urdf'], 'task-description': 'manipulate a deformable rope to connect its end-points between two corners of a 3-sided square.', 'task-name': 'align-rope'}

###

Implementation:
  ```python
import os

import numpy as np
from cliport.tasks import primitives
from cliport.tasks.task import Task
from cliport.utils import utils

import random
import pybullet as p

class AlignRope(Task):
    """Manipulate a deformable rope to connect its end-points between two
    corners of a 3-sided square."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "align the rope from {direction}"
        self.task_completed_desc = "done aligning the rope."
        self.additional_reset()

    def reset(self, env):
        super().reset(env)

        n_parts = 20
        radius = 0.005
        length = 2 * radius * n_parts * np.sqrt(2)

        # Add 3-sided square.
        square_size = (length, length, 0)
        square_pose = self.get_random_pose(env, square_size)
        square_template = 'square/square-template.urdf'
        replace = {'DIM': (length,), 'HALF': (np.float32(length) / 2 - 0.005,)}

        # IMPORTANT: REPLACE THE TEMPLATE URDF
        urdf = self.fill_template(square_template, replace)
        env.add_object(urdf, square_pose, 'fixed')

        # Get four corner points of square.
        corner0 = ( length / 2,  length / 2, 0.001)
        corner1 = (-length / 2,  length / 2, 0.001)
        corner2 = ( length / 2, -length / 2, 0.001)
        corner3 = (-length / 2, -length / 2, 0.001)

        corner0 = utils.apply(square_pose, corner0)
        corner1 = utils.apply(square_pose, corner1)
        corner2 = utils.apply(square_pose, corner2)
        corner3 = utils.apply(square_pose, corner3)

        # Four possible alignment tasks.
        task_descs = [
            ((corner0, corner1), "front left tip to front right tip"),
            ((corner0, corner2), "front right tip to back right corner"),
            ((corner1, corner3), "front left tip to back left corner"),
            ((corner3, corner2), "back right corner to back left corner")
        ]
        chosen_task = np.random.choice(len(task_descs), 1)[0]
        (corner_0, corner_1), direction = task_descs[chosen_task]

        # IMPORTANT: use `make_ropes` to add cable (series of articulated small blocks).
        objects, targets, matches = self.make_ropes(env, corners=(corner_0, corner_1))
        self.add_goal(objs=objects, matches=matches, targ_poses=targets, replace=False,
                rotations=False, metric='pose', params=None, step_max_reward=1.)
        self.lang_goals += [self.lang_template.format(direction=direction)] * len(self.goals)

        # wait for the scene to settle down
        for i in range(480):
            p.stepSimulation()<|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.

=========
Now write the pybullet simulation code for the task "assembling-kits" in python code block starting with ```python.

###

Response:
 assembling-kits: {'assets-used': ['kitting/kit.urdf', 'kitting/object-template.urdf'], 'task-description': 'pick up different objects and arrange them on a board marked with corresponding silhouettes.', 'task-name': 'assembling-kits'}

###

Implementation:
  ```python
import os

import numpy as np
from cliport.tasks.task import Task
from cliport.utils import utils

class AssemblingKits(Task):
    """pick up different objects and arrange them on a board marked with corresponding silhouettes."""

    def __init__(self):
        super().__init__()
        self.max_steps = 10
        self.homogeneous = False

        self.lang_template = "put all the blocks inside the holes they fit in"
        self.task_completed_desc = "done assembling blocks."
        self.additional_reset()

    def reset(self, env):
        super().reset(env)

        # Add kit.
        kit_size = (0.28, 0.2, 0.005)
        kit_urdf = 'kitting/kit.urdf'
        kit_pose = self.get_random_pose(env, kit_size)
        env.add_object(kit_urdf, kit_pose, 'fixed')

        n_objects = 5
        obj_shapes = self.get_kitting_shapes(n_objects)
        colors = [
            utils.COLORS['purple'], utils.COLORS['blue'], utils.COLORS['green'],
            utils.COLORS['yellow'], utils.COLORS['red']
        ]

        # Build kit.
        targets = []
        targ_pos = [[-0.09, 0.045, 0.0014], [0, 0.045, 0.0014],
                    [0.09, 0.045, 0.0014], [-0.045, -0.045, 0.0014],
                    [0.045, -0.045, 0.0014]]
        template = 'kitting/object-template.urdf'

        for i in range(n_objects):
            shape = os.path.join(self.assets_root, 'kitting',
                                 f'{obj_shapes[i]:02d}.obj')
            scale = [0.003, 0.003, 0.0001]  # .0005
            pos = utils.apply(kit_pose, targ_pos[i])
            theta = np.random.rand() * 2 * np.pi
            rot = utils.eulerXYZ_to_quatXYZW((0, 0, theta))
            replace = {'FNAME': (shape,), 'SCALE': scale, 'COLOR': [0.2, 0.2, 0.2]}

            # IMPORTANT: REPLACE THE TEMPLATE URDF
            urdf = self.fill_template(template, replace)
            env.add_object(urdf, (pos, rot), 'fixed')
            targets.append((pos, rot))

        # Add objects.
        objects, matches = self.make_kitting_objects(env, targets=targets, obj_shapes=obj_shapes, n_objects=n_objects, colors=colors)
        matches = np.int32(matches)
        self.add_goal(objs=objects, matches=matches, targ_poses=targets, replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1)
        self.lang_goals.append(self.lang_template)
<|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.

=========
Now write the pybullet simulation code for the task "manipulating-rope" in python code block starting with ```python.

###

Response:
 manipulating-rope: {'assets-used': ['square/square-template.urdf'], 'task-description': 'rearrange a deformable rope such that it connects the two endpoints of a 3-sided square.', 'task-name': 'manipulating-rope'}

###

Implementation:
  ```python
import os

import numpy as np
from cliport.tasks import primitives
from cliport.tasks.task import Task
from cliport.utils import utils

import pybullet as p

class ManipulatingRope(Task):
    """rearrange a deformable rope such that it connects the two endpoints of a 3-sided square."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "manipulate the rope to complete the square"
        self.task_completed_desc = "done manipulating the rope."
        self.additional_reset()

    def reset(self, env):
        super().reset(env)

        n_parts = 20
        radius = 0.005
        length = 2 * radius * n_parts * np.sqrt(2)

        # Add 3-sided square.
        square_size = (length, length, 0)
        square_pose = self.get_random_pose(env, square_size)
        square_template = 'square/square-template.urdf'

        # IMPORTANT: REPLACE THE TEMPLATE URDF  with `fill_template`
        replace = {'DIM': (length,), 'HALF': (np.float32(length) / 2 - 0.005,)}
        urdf = self.fill_template(square_template, replace)
        env.add_object(urdf, square_pose, 'fixed')

        # compute corners
        corner0 = (length / 2, length / 2, 0.001)
        corner1 = (-length / 2, length / 2, 0.001)
        corner_0 = utils.apply(square_pose, corner0)
        corner_1 = utils.apply(square_pose, corner1)

        # IMPORTANT: use `make_ropes` to add cable (series of articulated small blocks).
        objects, targets, matches = self.make_ropes(env, corners=(corner_0, corner_1))
        self.add_goal(objs=objects, matches=matches, targ_poses=targets, replace=False,
                rotations=False, metric='pose', params=None, step_max_reward=1.)
        self.lang_goals.append(self.lang_template)

        for i in range(480):
            p.stepSimulation()
<|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.

=========
Now write the pybullet simulation code for the task "packing-boxes" in python code block starting with ```python.

###

Response:
 packing-boxes: {'assets-used': ['container/container-template.urdf', 'box/box-template.urdf'], 'task-description': 'pick up randomly sized boxes and place them tightly into a container.', 'task-name': 'packing-boxes'}

###

Implementation:
  ```python
import os

import numpy as np
from cliport.tasks.task import Task
from cliport.utils import utils

import pybullet as p

class PackingBoxes(Task):
    """pick up randomly sized boxes and place them tightly into a container."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "pack all the boxes inside the brown box"
        self.task_completed_desc = "done packing boxes."

        self.zone_bounds = np.array([[0.25, 0.75], [-0.5, 0.5], [0, 0.08]])
        self.additional_reset()

    def reset(self, env):
        super().reset(env)

        # Add container box.
        zone_size = self.get_random_size(0.05, 0.3, 0.05, 0.3, 0.05, 0.05)
        zone_pose = self.get_random_pose(env, zone_size)
        container_template = 'container/container-template.urdf'
        replace = {'DIM': zone_size, 'HALF': (zone_size[0] / 2, zone_size[1] / 2, zone_size[2] / 2)}

        # IMPORTANT: REPLACE THE TEMPLATE URDF
        container_urdf = self.fill_template(container_template, replace)
        env.add_object(container_urdf, zone_pose, 'fixed')

        margin = 0.01
        min_object_dim = 0.05
        bboxes = []

        # Split container space with KD trees.
        stack_size = np.array(zone_size)
        stack_size[0] -= 0.01
        stack_size[1] -= 0.01
        root_size = (0.01, 0.01, 0) + tuple(stack_size)
        root = utils.TreeNode(None, [], bbox=np.array(root_size))
        utils.KDTree(root, min_object_dim, margin, bboxes)

        colors = [utils.COLORS[c] for c in utils.COLORS if c != 'brown']

        # Add objects in container.
        object_ids = []
        bboxes = np.array(bboxes)
        object_template = 'box/box-template.urdf'

        # Compute object points that are needed for zone
        for bbox in bboxes:
            size = bbox[3:] - bbox[:3]
            position = size / 2. + bbox[:3]
            position[0] += -zone_size[0] / 2
            position[1] += -zone_size[1] / 2
            pose = (position, (0, 0, 0, 1))
            pose = utils.multiply(zone_pose, pose)

            # IMPORTANT: REPLACE THE TEMPLATE URDF
            urdf = self.fill_template(object_template, {'DIM': size})
            icolor = np.random.choice(range(len(colors)), 1).squeeze()
            box_id = env.add_object(urdf, pose, color=colors[icolor])
            object_ids.append(box_id)

        # Randomly select object in box and save ground truth pose.
        object_volumes = []
        true_poses = []

        for object_id in object_ids:
            true_pose = p.getBasePositionAndOrientation(object_id)
            object_size = p.getVisualShapeData(object_id)[0][3]
            object_volumes.append(np.prod(np.array(object_size) * 100))
            pose = self.get_random_pose(env, object_size)
            p.resetBasePositionAndOrientation(object_id, pose[0], pose[1])
            true_poses.append(true_pose)

        self.add_goal(objs=object_ids, matches=np.eye(len(object_ids)), targ_poses=true_poses, replace=False,
                rotations=True, metric='zone', params=[(zone_pose, zone_size)], step_max_reward=1)

        self.lang_goals.append(self.lang_template)
<|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.

=========
Now write the pybullet simulation code for the task "palletizing-boxes" in python code block starting with ```python.

###

Response:
 palletizing-boxes: {'assets-used': ['pallet/pallet.urdf', 'box/box-template.urdf'], 'task-description': 'pick up homogeneous fixed-sized boxes and stack them in transposed layers on the pallet.', 'task-name': 'palletizing-boxes'}

###

Implementation:
  ```python
import os
import numpy as np
from cliport.tasks.task import Task
from cliport.utils import utils
import pybullet as p

class PalletizingBoxes(Task):
    """Pick up homogeneous fixed-sized boxes and stack them in transposed layers on the pallet."""

    def __init__(self):
        super().__init__()
        self.max_steps = 30
        self.lang_template = "stack all the boxes on the pallet"
        self.task_completed_desc = "done stacking boxes."
        self.additional_reset()

    def reset(self, env):
        super().reset(env)

        # Add pallet.
        zone_size = (0.3, 0.25, 0.25)
        zone_urdf = 'pallet/pallet.urdf'
        rotation = utils.eulerXYZ_to_quatXYZW((0, 0, 0))
        zone_pose = ((0.5, 0.25, 0.02), rotation)
        env.add_object(zone_urdf, zone_pose, 'fixed')

        # Add stack of boxes on pallet.
        margin = 0.01
        object_ids = []

        # x, y, z dimensions for the asset size
        stack_size = (0.19, 0.19, 0.19)
        box_template = 'box/box-template.urdf'
        stack_dim = np.int32([2, 3, 3])

        box_size = (stack_size - (stack_dim - 1) * margin) / stack_dim
        for z in range(stack_dim[2]):

            # Transpose every layer.
            stack_dim[0], stack_dim[1] = stack_dim[1], stack_dim[0]
            box_size[0], box_size[1] = box_size[1], box_size[0]

            # IMPORTANT: Compute object points and store as a dictionary for the `goal`
            for y in range(stack_dim[1]):
                for x in range(stack_dim[0]):
                    position = list((x + 0.5, y + 0.5, z + 0.5) * box_size)
                    position[0] += x * margin - stack_size[0] / 2
                    position[1] += y * margin - stack_size[1] / 2
                    position[2] += z * margin + 0.03
                    pose = (position, (0, 0, 0, 1))
                    pose = utils.multiply(zone_pose, pose)

                    # IMPORTANT: REPLACE THE TEMPLATE URDF
                    urdf = self.fill_template(box_template, {'DIM': box_size})
                    box_id = env.add_object(urdf, pose)
                    object_ids.append(box_id)
                    self.color_random_brown(box_id)

        # Randomly select top box on pallet and save ground truth pose.
        targets = []
        self.steps = []
        boxes = object_ids[:] # make copy
        while boxes:
            _, height, object_mask = self.get_true_image(env)
            top = np.argwhere(height > (np.max(height) - 0.03))
            rpixel = top[int(np.floor(np.random.random() * len(top)))]  # y, x
            box_id = int(object_mask[rpixel[0], rpixel[1]])
            if box_id in boxes:
                position, rotation = p.getBasePositionAndOrientation(box_id)
                rposition = np.float32(position) + np.float32([0, -10, 0])
                p.resetBasePositionAndOrientation(box_id, rposition, rotation)
                self.steps.append(box_id)
                targets.append((position, rotation))
                boxes.remove(box_id)

        self.steps.reverse()  # Time-reversed depalletizing.
        self.add_goal(objs=object_ids, matches=np.eye(len(object_ids)), targ_poses=targets, replace=False,
                rotations=True, metric='zone', params=[(zone_pose, zone_size)], step_max_reward=1)
        self.lang_goals.append(self.lang_template)

        self.spawn_box()

    def reward(self):
        reward, info = super().reward()
        self.spawn_box()
        return reward, info<|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.

=========
Now write the pybullet simulation code for the task "place-red-in-green" in python code block starting with ```python.

###

Response:
 place-red-in-green: {'assets-used': ['bowl/bowl.urdf', 'stacking/block.urdf'], 'task-description': 'pick up the red blocks and place them into the green bowls amidst other objects.', 'task-name': 'place-red-in-green'}

###

Implementation:
  ```python
import numpy as np
from cliport.tasks.task import Task
from cliport.utils import utils
import pybullet as p

class PlaceRedInGreen(Task):
    """pick up the red blocks and place them into the green bowls amidst other objects."""

    def __init__(self):
        super().__init__()
        self.max_steps = 10
        self.lang_template = "put the red blocks in a green bowl"
        self.task_completed_desc = "done placing blocks in bowls."
        self.additional_reset()

    def reset(self, env):
        super().reset(env)
        n_bowls = np.random.randint(1, 4)
        n_blocks = np.random.randint(1, n_bowls + 1)

        # Add bowls.
        # x, y, z dimensions for the asset size
        bowl_size = (0.12, 0.12, 0)
        bowl_urdf = 'bowl/bowl.urdf'
        bowl_poses = []
        for _ in range(n_bowls):
            bowl_pose = self.get_random_pose(env, obj_size=bowl_size)
            env.add_object(urdf=bowl_urdf, pose=bowl_pose, category='fixed')
            bowl_poses.append(bowl_pose)

        # Add blocks.
        # x, y, z dimensions for the asset size
        blocks = []
        block_size = (0.04, 0.04, 0.04)
        block_urdf = 'stacking/block.urdf'
        for _ in range(n_blocks):
            block_pose = self.get_random_pose(env, obj_size=block_size)
            block_id = env.add_object(block_urdf, block_pose)
            blocks.append(block_id)

        # Goal: each red block is in a different green bowl.
        self.add_goal(objs=blocks, matches=np.ones((len(blocks), len(bowl_poses))), targ_poses=bowl_poses, replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1)
        self.lang_goals.append(self.lang_template)

        # Colors of distractor objects.
        bowl_colors = [utils.COLORS[c] for c in utils.COLORS if c != 'green']
        block_colors = [utils.COLORS[c] for c in utils.COLORS if c != 'red']

        # Add distractors.
        n_distractors = 0
        while n_distractors < 6:
            is_block = np.random.rand() > 0.5
            urdf = block_urdf if is_block else bowl_urdf
            size = block_size if is_block else bowl_size
            colors = block_colors if is_block else bowl_colors
            pose = self.get_random_pose(env, obj_size=size)
            color = colors[n_distractors % len(colors)]

            obj_id = env.add_object(urdf, pose, color=color)
            n_distractors += 1
<|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.

=========
Now write the pybullet simulation code for the task "stack-block-pyramid" in python code block starting with ```python.

###

Response:
 stack-block-pyramid: {'assets-used': ['stacking/stand.urdf', 'stacking/block.urdf'], 'task-description': 'sequentially stack 6 blocks into a pyramid of 3-2-1 with rainbow colored ordering.', 'task-name': 'stack-block-pyramid'}

###

Implementation:
  ```python
import numpy as np
from cliport.tasks.task import Task
from cliport.utils import utils
import pybullet as p

class StackBlockPyramid(Task):
    """Build a pyramid of colored blocks in a color sequence"""

    def __init__(self):
        super().__init__()
        self.max_steps = 12
        self.lang_template = "make the {row} row with {blocks}"
        self.task_completed_desc = "done stacking block pyramid."
        self.additional_reset()

    def reset(self, env):
        super().reset(env)

        # Add base.
        base_size = (0.05, 0.15, 0.005)
        base_urdf = 'stacking/stand.urdf'
        base_pose = self.get_random_pose(env, base_size)
        env.add_object(base_urdf, base_pose, category='fixed')

        # Block colors.
        colors = [
            utils.COLORS['purple'], utils.COLORS['blue'], utils.COLORS['green'],
            utils.COLORS['yellow'], utils.COLORS['orange'], utils.COLORS['red']
        ]

        # Add blocks.
        block_size = (0.04, 0.04, 0.04)
        block_urdf = 'stacking/block.urdf'

        objs = []
        for i in range(6):
            block_pose = self.get_random_pose(env, block_size)
            block_id = env.add_object(block_urdf, block_pose, color=colors[i])
            objs.append(block_id)

        # IMPORTANT Associate placement locations for goals.
        place_pos = [(0, -0.05, 0.03), (0, 0, 0.03),
                     (0, 0.05, 0.03), (0, -0.025, 0.08),
                     (0, 0.025, 0.08), (0, 0, 0.13)]
        targs = [(utils.apply(base_pose, i), base_pose[1]) for i in place_pos]

        # Goal: blocks are stacked in a pyramid (bottom row: green, blue, purple).
        self.add_goal(objs=objs[:3], matches=np.ones((3, 3)), targ_poses=targs[:3], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]*3)
        self.lang_goals.append(self.lang_template.format(blocks="the green, blue and purple blocks",
                                                         row="bottom"))

        # Goal: blocks are stacked in a pyramid (middle row: yellow, orange).
        self.add_goal(objs=objs[3:5], matches=np.ones((2, 2)), targ_poses=targs[3:5], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]*2)
        self.lang_goals.append(self.lang_template.format(blocks="the yellow and orange blocks",
                                                         row="middle"))

        # Goal: blocks are stacked in a pyramid (top row: red).
        self.add_goal(objs=objs[5:], matches=np.ones((1, 1)), targ_poses=targs[5:], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1 / 6, symmetries=[np.pi/2]*1)
        self.lang_goals.append(self.lang_template.format(blocks="the red block",
                                                         row="top"))
<|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.

=========
Now write the pybullet simulation code for the task "sweeping-piles" in python code block starting with ```python.

###

Response:
 sweeping-piles: {'assets-used': ['zone/zone.urdf', 'block/small.urdf'], 'task-description': 'push piles of small objects into a target goal zone marked on the tabletop.', 'task-name': 'sweeping-piles'}

###

Implementation:
  ```python
import numpy as np
from cliport.tasks import primitives
from cliport.tasks.grippers import Spatula
from cliport.tasks.task import Task
from cliport.utils import utils

class SweepingPiles(Task):
    """Push piles of small objects into a target goal zone marked on the tabletop."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "push the pile of blocks into the green square"
        self.task_completed_desc = "done sweeping."
        self.primitive = primitives.push
        self.ee = Spatula
        self.additional_reset()

    def reset(self, env):
        super().reset(env)

        # Add goal zone.
        zone_size = (0.12, 0.12, 0)
        zone_pose = self.get_random_pose(env, zone_size)
        env.add_object('zone/zone.urdf', zone_pose, 'fixed')

        # Add pile of small blocks with `make_piles` function
        obj_ids = self.make_piles(env)

        # Add goal
        self.add_goal(objs=obj_ids, matches=np.ones((50, 1)), targ_poses=[zone_pose], replace=True,
                rotations=False, metric='zone', params=[(zone_pose, zone_size)], step_max_reward=1)
        self.lang_goals.append(self.lang_template)<|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.

=========
Now write the pybullet simulation code for the task "build-wheel" in python code block starting with ```python.

###

Response:
 build-wheel: {'task-name': 'build-wheel', 'task-description': 'Construct a wheel using blocks and a sphere. First, position eight blocks in a circular layout on the tabletop. Each block should be touching its two neighbors and colored in alternating red and blue. Then place a green sphere in the center of the circular layout, completing the wheel.', 'assets-used': ['block/block.urdf', 'sphere/sphere.urdf']}

###

Implementation:
  ```python
import numpy as np
import os
import pybullet as p
import random
from cliport.tasks import primitives
from cliport.tasks.grippers import Spatula
from cliport.tasks.task import Task
from cliport.utils import utils
import numpy as np
from cliport.tasks.task import Task
from cliport.utils import utils

class BuildWheel(Task):
    """Construct a wheel using blocks and a sphere."""

    def __init__(self):
        super().__init__()
        self.max_steps = 10
        self.lang_template = "Construct a wheel using blocks and a sphere. First, position eight blocks in a circular layout on the tabletop. Each block should be touching its two neighbors and colored in alternating red and blue. Then place a green sphere in the center of the circular layout, completing the wheel."
        self.task_completed_desc = "done building wheel."
        self.additional_reset()

    def reset(self, env):
        super().reset(env)

        # Add blocks.
        block_size = (0.04, 0.04, 0.04)
        block_urdf = 'block/block.urdf'
        block_colors = [utils.COLORS['red'], utils.COLORS['blue']]
        blocks = []
        for i in range(8):
            block_pose = self.get_random_pose(env, block_size)
            block_id = env.add_object(block_urdf, block_pose, color=block_colors[i % 2])
            blocks.append(block_id)

        # Add sphere.
        sphere_size = (0.04, 0.04, 0.04)
        sphere_urdf = 'sphere/sphere.urdf'
        sphere_color = utils.COLORS['green']
        sphere_pose = ((0.5, 0.0, 0.0), (0,0,0,1)) # fixed pose
        sphere_id = env.add_object(sphere_urdf, sphere_pose, color=sphere_color)

        # Goal: blocks are arranged in a circle and sphere is in the center.
        circle_radius = 0.1
        circle_center = (0, 0, block_size[2] / 2)
        angles = np.linspace(0, 2 * np.pi, 8, endpoint=False)
        block_poses = [(circle_center[0] + circle_radius * np.cos(angle),
                        circle_center[1] + circle_radius * np.sin(angle),
                        circle_center[2]) for angle in angles]
        block_poses = [(utils.apply(sphere_pose, pos), sphere_pose[1]) for pos in block_poses]
        self.add_goal(objs=blocks, matches=np.ones((8, 8)), targ_poses=block_poses, replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=8 / 9)

        # Goal: sphere is in the center of the blocks.
        self.add_goal(objs=[sphere_id], matches=np.ones((1, 1)), targ_poses=[sphere_pose], replace=False,
                rotations=False, metric='pose', params=None, step_max_reward=1 / 9)

        self.lang_goals.append(self.lang_template)
<|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.

=========
Now write the pybullet simulation code for the task "push-piles-into-letter" in python code block starting with ```python.

###

Response:
 push-piles-into-letter: {'task-name': 'push-piles-into-letter', 'task-description': 'Push piles of small objects into a target goal zone shaped in some letters.', 'assets-used': ['kitting/kit.urdf', 'kitting/object-template-nocollision.urdf']}

###

Implementation:
  ```python
import numpy as np
import os
import pybullet as p
import random
from cliport.tasks import primitives
from cliport.tasks.grippers import Spatula
from cliport.tasks.task import Task
from cliport.utils import utils
import numpy as np
from cliport.tasks.task import Task
from cliport.utils import utils

class BuildWheel(Task):
    """Construct a wheel using blocks and a sphere."""

    def __init__(self):
        super().__init__()
        self.max_steps = 10
        self.lang_template = "Construct a wheel using blocks and a sphere. First, position eight blocks in a circular layout on the tabletop. Each block should be touching its two neighbors and colored in alternating red and blue. Then place a green sphere in the center of the circular layout, completing the wheel."
        self.task_completed_desc = "done building wheel."
        self.additional_reset()

    def reset(self, env):
        super().reset(env)

        # Add blocks.
        block_size = (0.04, 0.04, 0.04)
        block_urdf = 'block/block.urdf'
        block_colors = [utils.COLORS['red'], utils.COLORS['blue']]
        blocks = []
        for i in range(8):
            block_pose = self.get_random_pose(env, block_size)
            block_id = env.add_object(block_urdf, block_pose, color=block_colors[i % 2])
            blocks.append(block_id)

        # Add sphere.
        sphere_size = (0.04, 0.04, 0.04)
        sphere_urdf = 'sphere/sphere.urdf'
        sphere_color = utils.COLORS['green']
        sphere_pose = ((0.5, 0.0, 0.0), (0,0,0,1)) # fixed pose
        sphere_id = env.add_object(sphere_urdf, sphere_pose, color=sphere_color)

        # Goal: blocks are arranged in a circle and sphere is in the center.
        circle_radius = 0.1
        circle_center = (0, 0, block_size[2] / 2)
        angles = np.linspace(0, 2 * np.pi, 8, endpoint=False)
        block_poses = [(circle_center[0] + circle_radius * np.cos(angle),
                        circle_center[1] + circle_radius * np.sin(angle),
                        circle_center[2]) for angle in angles]
        block_poses = [(utils.apply(sphere_pose, pos), sphere_pose[1]) for pos in block_poses]
        self.add_goal(objs=blocks, matches=np.ones((8, 8)), targ_poses=block_poses, replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=8 / 9)

        # Goal: sphere is in the center of the blocks.
        self.add_goal(objs=[sphere_id], matches=np.ones((1, 1)), targ_poses=[sphere_pose], replace=False,
                rotations=False, metric='pose', params=None, step_max_reward=1 / 9)

        self.lang_goals.append(self.lang_template)
<|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.

=========
Now write the pybullet simulation code for the task "connect-boxes-with-rope" in python code block starting with ```python.

###

Response:
 connect-boxes-with-rope: {'task-name': 'connect-boxes-with-rope', 'task-description': 'Connect two colored blocks with ropes.', 'assets-used': ['block/block.urdf']}

###

Implementation:
  ```python
import numpy as np
import os
import pybullet as p
import random
from cliport.tasks import primitives
from cliport.tasks.grippers import Spatula
from cliport.tasks.task import Task
from cliport.utils import utils
import IPython

class ConnectBoxesWithRope(Task):
    """Connect two colored blocks with ropes."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "connect the {color1} and {color2} blocks with the rope."
        self.task_completed_desc = "done connecting."
        self.additional_reset()
        self.pos_eps = 0.04 # higher tolerance

    def reset(self, env):
        super().reset(env)
        colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']
        blocks = []
        target_colors = np.random.choice(colors, 2, replace=False)
        block_size = (0.04, 0.04, 0.04)
        block_urdf = 'stacking/block.urdf'
        corner_poses = []

        for color in colors:
            block_pose = self.get_random_pose(env, block_size)
            block_id = env.add_object(block_urdf, block_pose, color=color)
            blocks.append(block_id)
            if color in target_colors:
                corner_poses.append(block_pose)

        dist = np.linalg.norm(np.array(corner_poses[0][0])-np.array(corner_poses[1][0]))
        n_parts = int(20 * dist / 0.4)

        # IMPORTANT: use `make_ropes` to add cable (series of articulated small blocks).
        objects, targets, matches = self.make_ropes(env, corners=(corner_poses[0][0], corner_poses[1][0]), n_parts=n_parts)
        self.add_goal(objs=objects, matches=matches, targ_poses=targets, replace=False,
                rotations=False, metric='pose', params=None, step_max_reward=1.)
        self.lang_goals.append(self.lang_template.format(color1=target_colors[0], color2=target_colors[1]))

        # wait for the scene to settle down
        for i in range(600):
            p.stepSimulation()<|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.

=========
Now write the pybullet simulation code for the task "build-car" in python code block starting with ```python.

###

Response:
 build-car: {'task-name': 'build-car', 'task-description': 'Construct a simple car structure using blocks and cylinders.', 'assets-used': ['block/block.urdf', 'ball/ball-template.urdf']}

###

Implementation:
  ```python
import numpy as np
from cliport.tasks.task import Task
from cliport.utils import utils

class BuildCar(Task):
    """Construct a simple car structure using blocks and cylinders."""

    def __init__(self):
        super().__init__()
        self.max_steps = 15
        self.lang_template = "Construct a simple car structure using blocks and cylinders. " \
                             "Firstly, create the base of the car by positioning two red blocks side by side. " \
                             "Then, add the car body by stacking a blue block on top of the base. " \
                             "For the wheels, place a black cylinder on each side of the base blocks."
        self.task_completed_desc = "done building car."
        self.additional_reset()

    def reset(self, env):
        super().reset(env)
        car_pose = ((0.5, 0.0, 0.0), (0,0,0,1))  # fixed pose
        base_length = 0.04
        self.add_corner_anchor_for_pose(env, car_pose)

        # Add base blocks. Use box template so that we can change its size.
        base_size = (0.02, 0.04, 0.02)
        base_block_urdf = "box/box-template.urdf"
        base_block_urdf = self.fill_template(base_block_urdf,  {'DIM': base_size})
        anchor_base_poses = [(utils.apply(car_pose, (base_length / 2,  base_length / 2, 0.001)), car_pose[1]),
                        (utils.apply(car_pose, (-base_length / 2,  base_length / 2, 0.001)), car_pose[1])]
        base_blocks = []

        for idx in range(2):
            base_block_pose = self.get_random_pose(env, base_size)
            base_block_id = env.add_object(base_block_urdf, base_block_pose, color=utils.COLORS['red'])
            base_blocks.append(base_block_id)

        # Add car body block.
        body_size = (0.04, 0.02, 0.02)  # x, y, z dimensions for the asset size
        body_block_urdf = "box/box-template.urdf"
        body_block_urdf = self.fill_template(body_block_urdf,  {'DIM': body_size})
        body_block_pose = self.get_random_pose(env, body_size)
        body_block_id = env.add_object(body_block_urdf, body_block_pose, color=utils.COLORS['blue'])
        anchor_body_poses = [car_pose]

        wheel_length = 0.12
        anchor_wheel_poses = [(utils.apply(car_pose, ( wheel_length / 2,  wheel_length / 2, 0.001)), car_pose[1]),
                              (utils.apply(car_pose, (-wheel_length / 2,  wheel_length / 2, 0.001)), car_pose[1]),
                              (utils.apply(car_pose, ( wheel_length / 2, -wheel_length / 2, 0.001)), car_pose[1]),
                              (utils.apply(car_pose, (-wheel_length / 2, -wheel_length / 2, 0.001)), car_pose[1])]

        # Add wheels.
        wheel_size = (0.02, 0.02, 0.02)  # x, y, z dimensions for the asset size
        wheel_urdf = 'cylinder/cylinder-template.urdf'
        wheel_urdf = self.fill_template(wheel_urdf, {'DIM': wheel_size})

        wheels = []
        for idx in range(4):
            wheel_pose = self.get_random_pose(env, wheel_size)
            wheel_id = env.add_object(wheel_urdf, wheel_pose, color=utils.COLORS['black'])
            wheels.append(wheel_id)

        # Goal: Firstly, create the base of the car by positioning two red blocks side by side.
        self.add_goal(objs=base_blocks,
                      matches=np.ones((2, 2)),
                      targ_poses=anchor_base_poses,
                      replace=False,
                      rotations=True,
                      metric='pose',
                      params=None,
                      step_max_reward=1./3)
        self.lang_goals.append("Firstly, create the base of the car by positioning two red blocks side by side.")

        # Then, add the car body by stacking a blue block on top of the base.
        self.add_goal(objs=[body_block_id],
                      matches=np.ones((1, 1)),
                      targ_poses=anchor_body_poses,
                      replace=False,
                      rotations=True,
                      metric='pose',
                      params=None,
                      step_max_reward=1./3)
        self.lang_goals.append("Then, add the car body by stacking a blue block on top of the base.")

        # For the wheels, place a black cylinder on each side of the base blocks.
        self.add_goal(objs=wheels,
                      matches=np.ones((4, 4)),
                      targ_poses=anchor_wheel_poses,
                      replace=False,
                      rotations=True,
                      metric='pose',
                      params=None,
                      step_max_reward=1./3)
        self.lang_goals.append("For the wheels, place a black cylinder on each side of the base blocks.")

<|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.

=========
Now write the pybullet simulation code for the task "manipulating-two-ropes" in python code block starting with ```python.

###

Response:
 manipulating-two-ropes: {'task-name': 'manipulating-two-ropes', 'task-description': 'rearrange the red and blue deformable ropes such that it connects the two endpoints of a 3-sided square of corresponding color.', 'assets-used': ['square/square-template.urdf']}

###

Implementation:
  ```python
import numpy as np
import os
import pybullet as p
import random

import numpy as np
from cliport.tasks.task import Task
from cliport.utils import utils
from cliport.tasks import primitives
from cliport.tasks.grippers import Spatula

class ManipulatingTwoRopes(Task):
    """rearrange the red and blue deformable ropes such that it connects the two endpoints of a 3-sided square of corresponding color."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "rearrange the {color_name} rope such that it connects the two endpoints of a 3-sided square of corresponding color."
        self.task_completed_desc = "done manipulating two ropes."
        self.additional_reset()

    def reset(self, env):
        super().reset(env)

        n_parts = 20
        radius = 0.005
        length = 2 * radius * n_parts * np.sqrt(2)

        # Add 3-sided square for the red rope.
        color_list = ['red', 'blue']
        for color_name in color_list:
            square_size = (length, length, 0)
            square_pose = self.get_random_pose(env, square_size)
            square_template = 'square/square-template.urdf'

            # IMPORTANT: REPLACE THE TEMPLATE URDF  with `fill_template`
            replace = {'DIM': (length,), 'HALF': (np.float32(length) / 2 - 0.005,)}
            urdf = self.fill_template(square_template, replace)
            env.add_object(urdf, square_pose, 'fixed', color=utils.COLORS[color_name])

            # compute corners
            corner0 = (length / 2, length / 2, 0.001)
            corner1 = (-length / 2, length / 2, 0.001)
            corner_0 = utils.apply(square_pose, corner0)
            corner_1 = utils.apply(square_pose, corner1)

            # IMPORTANT: use `make_ropes` to add cable (series of articulated small blocks).
            objects, targets, matches = self.make_ropes(env, corners=(corner_0, corner_1), color_name=color_name)
            self.add_goal(objs=objects, matches=matches, targ_poses=targets, replace=False,
                    rotations=False, metric='pose', params=None, step_max_reward=1. / len(color_list))

            self.lang_goals.append(self.lang_template.format(color_name=color_name))

        print(f"len of languages: {len(self.lang_goals)} obj:{len(objects)}")
        for i in range(480):
            p.stepSimulation()
<|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.

=========
Now write the pybullet simulation code for the task "insert-sphere-into-container" in python code block starting with ```python.

###

Response:
 insert-sphere-into-container: {'task-name': 'insert-sphere-into-container', 'task-description': 'Pick up a blue sphere and place it into an open container.', 'assets-used': ['sphere/sphere.urdf', 'container/container-template.urdf']}

###

Implementation:
  ```python
import numpy as np
import os
import pybullet as p
import random
from cliport.tasks import primitives
from cliport.tasks.grippers import Spatula
from cliport.tasks.task import Task
from cliport.utils import utils
import numpy as np
from cliport.tasks.task import Task
from cliport.utils import utils

class InsertSphereIntoContainer(Task):
    """Pick up a blue sphere and place it into an open container."""

    def __init__(self):
        super().__init__()
        self.max_steps = 10
        self.lang_template = "pick up a blue sphere and place it into an open container"
        self.task_completed_desc = "done inserting sphere into container."
        self.additional_reset()

    def reset(self, env):
        super().reset(env)

        # Add container.
        # x, y, z dimensions for the asset size
        container_size = (0.1, 0.1, 0.1)
        container_pose = self.get_random_pose(env, container_size)
        container_template = 'container/container-template.urdf'
        replace = {'DIM': container_size, 'HALF': (container_size[0] / 2, container_size[1] / 2, container_size[2] / 2)}
        # IMPORTANT: REPLACE THE TEMPLATE URDF with `fill_template`
        container_urdf = self.fill_template(container_template, replace)
        container_id = env.add_object(container_urdf, container_pose, 'fixed')

        # Add sphere.
        # x, y, z dimensions for the asset size
        sphere_size = (0.04, 0.04, 0.04)
        sphere_pose = self.get_random_pose(env, sphere_size)
        sphere_urdf = 'sphere/sphere.urdf'
        sphere_id = env.add_object(sphere_urdf, sphere_pose, color=utils.COLORS['blue'])

        # Goal: the blue sphere is in the container.
        self.add_goal(objs=[sphere_id], matches=np.ones((1, 1)), targ_poses=[container_pose], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1)
        self.lang_goals.append(self.lang_template)<|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.

=========
Now write the pybullet simulation code for the task "insert-cylinder-in-container" in python code block starting with ```python.

###

Response:
 insert-cylinder-in-container: {'task-name': 'insert-cylinder-in-container', 'task-description': 'Pick up a blue cylindrical block and place it into an empty container.', 'assets-used': ['cylinder/cylinder-template.urdf', 'container/container-template.urdf']}

###

Implementation:
  ```python
import numpy as np
import os
import pybullet as p
import random
from cliport.tasks import primitives
from cliport.tasks.grippers import Spatula
from cliport.tasks.task import Task
from cliport.utils import utils
import numpy as np
from cliport.tasks.task import Task
from cliport.utils import utils

class InsertSphereIntoContainer(Task):
    """Pick up a blue sphere and place it into an open container."""

    def __init__(self):
        super().__init__()
        self.max_steps = 10
        self.lang_template = "pick up a blue sphere and place it into an open container"
        self.task_completed_desc = "done inserting sphere into container."
        self.additional_reset()

    def reset(self, env):
        super().reset(env)

        # Add container.
        # x, y, z dimensions for the asset size
        container_size = (0.1, 0.1, 0.1)
        container_pose = self.get_random_pose(env, container_size)
        container_template = 'container/container-template.urdf'
        replace = {'DIM': container_size, 'HALF': (container_size[0] / 2, container_size[1] / 2, container_size[2] / 2)}
        # IMPORTANT: REPLACE THE TEMPLATE URDF with `fill_template`
        container_urdf = self.fill_template(container_template, replace)
        container_id = env.add_object(container_urdf, container_pose, 'fixed')

        # Add sphere.
        # x, y, z dimensions for the asset size
        sphere_size = (0.04, 0.04, 0.04)
        sphere_pose = self.get_random_pose(env, sphere_size)
        sphere_urdf = 'sphere/sphere.urdf'
        sphere_id = env.add_object(sphere_urdf, sphere_pose, color=utils.COLORS['blue'])

        # Goal: the blue sphere is in the container.
        self.add_goal(objs=[sphere_id], matches=np.ones((1, 1)), targ_poses=[container_pose], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1)
        self.lang_goals.append(self.lang_template)<|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.

=========
Now write the pybullet simulation code for the task "build-bridge" in python code block starting with ```python.

###

Response:
 build-bridge: {'task-name': 'build-bridge', 'task-description': 'Construct a bridge using two yellow blocks and three blue blocks. Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between. Then, place the blue block horizontally on top of the yellow blocks.', 'assets-used': ['block/block.urdf', 'ball/ball-template.urdf']}

###

Implementation:
  ```python
import numpy as np
import os
import pybullet as p
import random
from cliport.tasks import primitives
from cliport.tasks.grippers import Spatula
from cliport.tasks.task import Task
from cliport.utils import utils

class BuildBridge(Task):
    """Construct a bridge using two yellow blocks and three blue blocks.
    Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between.
    Then, place the blue block horizontally on top of the yellow blocks."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "build a bridge using four yellow blocks and one long blue block"
        self.task_completed_desc = "done building bridge."

    def reset(self, env):
        super().reset(env)

        # Add yellow blocks.
        base_length = 0.04
        base_size = (base_length, base_length, base_length)
        base_block_urdf = "box/box-template.urdf"
        bridge_pose = ((0.5, 0.0, 0.0), (0, 0, 0, 1))  # fixed pose
        self.add_corner_anchor_for_pose(env, bridge_pose)

        base_block_urdf = self.fill_template(base_block_urdf,  {'DIM': base_size})
        anchor_base_poses = [(utils.apply(bridge_pose, (- 3 * base_length / 2,  0, 0.001)), bridge_pose[1]),
                        (utils.apply(bridge_pose, ( 3 * base_length / 2,  0, 0.001)), bridge_pose[1]),
                        (utils.apply(bridge_pose, (- 3 * base_length / 2,  0, 0.041)), bridge_pose[1]),
                        (utils.apply(bridge_pose, ( 3 * base_length / 2, 0, 0.041)), bridge_pose[1])]
        base_blocks = []

        for idx in range(4):
            base_block_pose = self.get_random_pose(env, base_size)
            base_block_id = env.add_object(base_block_urdf, base_block_pose, color=utils.COLORS['yellow'])
            base_blocks.append(base_block_id)

        # Add car body block.
        body_size = (0.12, 0.04, 0.02)  # x, y, z dimensions for the asset size
        body_block_urdf = "box/box-template.urdf"
        body_block_urdf = self.fill_template(body_block_urdf,  {'DIM': body_size})
        body_block_pose = self.get_random_pose(env, body_size)
        body_block_id = env.add_object(body_block_urdf, body_block_pose, color=utils.COLORS['blue'])
        anchor_body_poses = [bridge_pose]

        # Goal: Firstly, create the base of the car by positioning two red blocks side by side.
        self.add_goal(objs=base_blocks[:2],
                      matches=np.ones((2, 2)),
                      targ_poses=anchor_base_poses,
                      replace=False,
                      rotations=True,
                      metric='pose',
                      params=None,
                      step_max_reward=1./4)

        self.add_goal(objs=base_blocks[2:],
                      matches=np.ones((2, 2)),
                      targ_poses=anchor_base_poses,
                      replace=False,
                      rotations=True,
                      metric='pose',
                      params=None,
                      step_max_reward=1./2)
        self.lang_goals.append("Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between.")

        # Then, add the car body by stacking a blue block on top of the base.
        self.add_goal(objs=[body_block_id],
                      matches=np.ones((1, 1)),
                      targ_poses=anchor_body_poses,
                      replace=False,
                      rotations=True,
                      metric='pose',
                      params=None,
                      step_max_reward=1./4)
        self.lang_goals.append("Then, place the blue block horizontally on top of the yellow blocks.")
<|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.

=========
Now write the pybullet simulation code for the task "insert-ell-in-fixture" in python code block starting with ```python.

###

Response:
 insert-ell-in-fixture: {'task-name': 'insert-ell-in-fixture', 'task-description': 'Pick up an Ell shaped block and insert it into a fixture on the tabletop.', 'assets-used': ['insertion/ell.urdf', 'insertion/fixture.urdf']}

###

Implementation:
  ```python
import numpy as np
import os
import pybullet as p
import random
from cliport.tasks import primitives
from cliport.tasks.grippers import Spatula
from cliport.tasks.task import Task
from cliport.utils import utils

class BuildBridge(Task):
    """Construct a bridge using two yellow blocks and three blue blocks.
    Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between.
    Then, place the blue block horizontally on top of the yellow blocks."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "build a bridge using four yellow blocks and one long blue block"
        self.task_completed_desc = "done building bridge."

    def reset(self, env):
        super().reset(env)

        # Add yellow blocks.
        base_length = 0.04
        base_size = (base_length, base_length, base_length)
        base_block_urdf = "box/box-template.urdf"
        bridge_pose = ((0.5, 0.0, 0.0), (0, 0, 0, 1))  # fixed pose
        self.add_corner_anchor_for_pose(env, bridge_pose)

        base_block_urdf = self.fill_template(base_block_urdf,  {'DIM': base_size})
        anchor_base_poses = [(utils.apply(bridge_pose, (- 3 * base_length / 2,  0, 0.001)), bridge_pose[1]),
                        (utils.apply(bridge_pose, ( 3 * base_length / 2,  0, 0.001)), bridge_pose[1]),
                        (utils.apply(bridge_pose, (- 3 * base_length / 2,  0, 0.041)), bridge_pose[1]),
                        (utils.apply(bridge_pose, ( 3 * base_length / 2, 0, 0.041)), bridge_pose[1])]
        base_blocks = []

        for idx in range(4):
            base_block_pose = self.get_random_pose(env, base_size)
            base_block_id = env.add_object(base_block_urdf, base_block_pose, color=utils.COLORS['yellow'])
            base_blocks.append(base_block_id)

        # Add car body block.
        body_size = (0.12, 0.04, 0.02)  # x, y, z dimensions for the asset size
        body_block_urdf = "box/box-template.urdf"
        body_block_urdf = self.fill_template(body_block_urdf,  {'DIM': body_size})
        body_block_pose = self.get_random_pose(env, body_size)
        body_block_id = env.add_object(body_block_urdf, body_block_pose, color=utils.COLORS['blue'])
        anchor_body_poses = [bridge_pose]

        # Goal: Firstly, create the base of the car by positioning two red blocks side by side.
        self.add_goal(objs=base_blocks[:2],
                      matches=np.ones((2, 2)),
                      targ_poses=anchor_base_poses,
                      replace=False,
                      rotations=True,
                      metric='pose',
                      params=None,
                      step_max_reward=1./4)

        self.add_goal(objs=base_blocks[2:],
                      matches=np.ones((2, 2)),
                      targ_poses=anchor_base_poses,
                      replace=False,
                      rotations=True,
                      metric='pose',
                      params=None,
                      step_max_reward=1./2)
        self.lang_goals.append("Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between.")

        # Then, add the car body by stacking a blue block on top of the base.
        self.add_goal(objs=[body_block_id],
                      matches=np.ones((1, 1)),
                      targ_poses=anchor_body_poses,
                      replace=False,
                      rotations=True,
                      metric='pose',
                      params=None,
                      step_max_reward=1./4)
        self.lang_goals.append("Then, place the blue block horizontally on top of the yellow blocks.")
<|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.

=========
Now write the pybullet simulation code for the task "build-block-tower-on-pallet" in python code block starting with ```python.

###

Response:
 build-block-tower-on-pallet: {'task-name': 'build-block-tower-on-pallet', 'task-description': 'Pick up six blocks in two colors (three red and three blue) and stack them in alternating colors on the pallet. The tower should start with a red block at the bottom.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf']}

###

Implementation:
  ```python
import numpy as np
import os
import pybullet as p
import random
from cliport.tasks import primitives
from cliport.tasks.grippers import Spatula
from cliport.tasks.task import Task
from cliport.utils import utils

class BuildBridge(Task):
    """Construct a bridge using two yellow blocks and three blue blocks.
    Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between.
    Then, place the blue block horizontally on top of the yellow blocks."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "build a bridge using four yellow blocks and one long blue block"
        self.task_completed_desc = "done building bridge."

    def reset(self, env):
        super().reset(env)

        # Add yellow blocks.
        base_length = 0.04
        base_size = (base_length, base_length, base_length)
        base_block_urdf = "box/box-template.urdf"
        bridge_pose = ((0.5, 0.0, 0.0), (0, 0, 0, 1))  # fixed pose
        self.add_corner_anchor_for_pose(env, bridge_pose)

        base_block_urdf = self.fill_template(base_block_urdf,  {'DIM': base_size})
        anchor_base_poses = [(utils.apply(bridge_pose, (- 3 * base_length / 2,  0, 0.001)), bridge_pose[1]),
                        (utils.apply(bridge_pose, ( 3 * base_length / 2,  0, 0.001)), bridge_pose[1]),
                        (utils.apply(bridge_pose, (- 3 * base_length / 2,  0, 0.041)), bridge_pose[1]),
                        (utils.apply(bridge_pose, ( 3 * base_length / 2, 0, 0.041)), bridge_pose[1])]
        base_blocks = []

        for idx in range(4):
            base_block_pose = self.get_random_pose(env, base_size)
            base_block_id = env.add_object(base_block_urdf, base_block_pose, color=utils.COLORS['yellow'])
            base_blocks.append(base_block_id)

        # Add car body block.
        body_size = (0.12, 0.04, 0.02)  # x, y, z dimensions for the asset size
        body_block_urdf = "box/box-template.urdf"
        body_block_urdf = self.fill_template(body_block_urdf,  {'DIM': body_size})
        body_block_pose = self.get_random_pose(env, body_size)
        body_block_id = env.add_object(body_block_urdf, body_block_pose, color=utils.COLORS['blue'])
        anchor_body_poses = [bridge_pose]

        # Goal: Firstly, create the base of the car by positioning two red blocks side by side.
        self.add_goal(objs=base_blocks[:2],
                      matches=np.ones((2, 2)),
                      targ_poses=anchor_base_poses,
                      replace=False,
                      rotations=True,
                      metric='pose',
                      params=None,
                      step_max_reward=1./4)

        self.add_goal(objs=base_blocks[2:],
                      matches=np.ones((2, 2)),
                      targ_poses=anchor_base_poses,
                      replace=False,
                      rotations=True,
                      metric='pose',
                      params=None,
                      step_max_reward=1./2)
        self.lang_goals.append("Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between.")

        # Then, add the car body by stacking a blue block on top of the base.
        self.add_goal(objs=[body_block_id],
                      matches=np.ones((1, 1)),
                      targ_poses=anchor_body_poses,
                      replace=False,
                      rotations=True,
                      metric='pose',
                      params=None,
                      step_max_reward=1./4)
        self.lang_goals.append("Then, place the blue block horizontally on top of the yellow blocks.")
<|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.

=========
Now write the pybullet simulation code for the task "color-coordinated-tower" in python code block starting with ```python.

###

Response:
 color-coordinated-tower: {'task-name': 'color-coordinated-tower', 'task-description': 'Pick up blocks of five different colors (red, blue, green, yellow, and orange) and stack them on a pallet in the specific sequence. The bottom of the tower should start with a red block followed by a blue, green, yellow and finally an orange block at the top.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf']}

###

Implementation:
  ```python
import numpy as np
import os
import pybullet as p
import random
from cliport.tasks import primitives
from cliport.tasks.grippers import Spatula
from cliport.tasks.task import Task
from cliport.utils import utils

class BuildBridge(Task):
    """Construct a bridge using two yellow blocks and three blue blocks.
    Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between.
    Then, place the blue block horizontally on top of the yellow blocks."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "build a bridge using four yellow blocks and one long blue block"
        self.task_completed_desc = "done building bridge."

    def reset(self, env):
        super().reset(env)

        # Add yellow blocks.
        base_length = 0.04
        base_size = (base_length, base_length, base_length)
        base_block_urdf = "box/box-template.urdf"
        bridge_pose = ((0.5, 0.0, 0.0), (0, 0, 0, 1))  # fixed pose
        self.add_corner_anchor_for_pose(env, bridge_pose)

        base_block_urdf = self.fill_template(base_block_urdf,  {'DIM': base_size})
        anchor_base_poses = [(utils.apply(bridge_pose, (- 3 * base_length / 2,  0, 0.001)), bridge_pose[1]),
                        (utils.apply(bridge_pose, ( 3 * base_length / 2,  0, 0.001)), bridge_pose[1]),
                        (utils.apply(bridge_pose, (- 3 * base_length / 2,  0, 0.041)), bridge_pose[1]),
                        (utils.apply(bridge_pose, ( 3 * base_length / 2, 0, 0.041)), bridge_pose[1])]
        base_blocks = []

        for idx in range(4):
            base_block_pose = self.get_random_pose(env, base_size)
            base_block_id = env.add_object(base_block_urdf, base_block_pose, color=utils.COLORS['yellow'])
            base_blocks.append(base_block_id)

        # Add car body block.
        body_size = (0.12, 0.04, 0.02)  # x, y, z dimensions for the asset size
        body_block_urdf = "box/box-template.urdf"
        body_block_urdf = self.fill_template(body_block_urdf,  {'DIM': body_size})
        body_block_pose = self.get_random_pose(env, body_size)
        body_block_id = env.add_object(body_block_urdf, body_block_pose, color=utils.COLORS['blue'])
        anchor_body_poses = [bridge_pose]

        # Goal: Firstly, create the base of the car by positioning two red blocks side by side.
        self.add_goal(objs=base_blocks[:2],
                      matches=np.ones((2, 2)),
                      targ_poses=anchor_base_poses,
                      replace=False,
                      rotations=True,
                      metric='pose',
                      params=None,
                      step_max_reward=1./4)

        self.add_goal(objs=base_blocks[2:],
                      matches=np.ones((2, 2)),
                      targ_poses=anchor_base_poses,
                      replace=False,
                      rotations=True,
                      metric='pose',
                      params=None,
                      step_max_reward=1./2)
        self.lang_goals.append("Firstly, place the two yellow blocks on each of the two bases parallel to each other with a fair amount of space in between.")

        # Then, add the car body by stacking a blue block on top of the base.
        self.add_goal(objs=[body_block_id],
                      matches=np.ones((1, 1)),
                      targ_poses=anchor_body_poses,
                      replace=False,
                      rotations=True,
                      metric='pose',
                      params=None,
                      step_max_reward=1./4)
        self.lang_goals.append("Then, place the blue block horizontally on top of the yellow blocks.")
<|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.

=========
Now write the pybullet simulation code for the task "stack-blocks-in-container" in python code block starting with ```python.

###

Response:
 stack-blocks-in-container: {'task-name': 'stack-blocks-in-container', 'task-description': 'Pick up five blocks of different colors (red, blue, green, yellow, and orange) and stack them in a container in a specific sequence. The bottom of the stack should start with a red block followed by a blue, green, yellow and finally an orange block at the top.', 'assets-used': ['block/block.urdf', 'container/container-template.urdf']}

###

Implementation:
  ```python
import numpy as np
import os
import pybullet as p
import random
from cliport.tasks import primitives
from cliport.tasks.grippers import Spatula
from cliport.tasks.task import Task
from cliport.utils import utils
import numpy as np
from cliport.tasks.task import Task
from cliport.utils import utils

class StackBlocksInContainer(Task):
    """Pick up five blocks of different colors (red, blue, green, yellow, and orange)
    and stack them in a container in a specific sequence.
    The bottom of the stack should start with a red block followed by a blue,
    green, yellow and finally an orange block at the top."""

    def __init__(self):
        super().__init__()
        self.max_steps = 15
        self.lang_template = "stack the blocks in the container in the following order: {order}"
        self.task_completed_desc = "done stacking blocks in container."
        self.order = ['red', 'blue', 'green', 'yellow', 'orange']
        self.colors = [utils.COLORS[color] for color in self.order]

    def reset(self, env):
        super().reset(env)

        # Add container.
        container_size = (0.15, 0.15, 0.15)  # x, y, z dimensions for the container size
        container_pose = self.get_random_pose(env, container_size)
        container_urdf = 'container/container-template.urdf'
        replace = {'DIM': container_size, 'HALF': (container_size[0] / 2, container_size[1] / 2, container_size[2] / 2)}
        container_urdf = self.fill_template(container_urdf, replace)
        env.add_object(container_urdf, container_pose, 'fixed')

        # Add blocks.
        block_size = (0.04, 0.04, 0.04)  # x, y, z dimensions for the block size
        block_urdf = 'block/block.urdf'
        blocks = []
        for color in self.colors:
            block_pose = self.get_random_pose(env, block_size)
            block_id = env.add_object(block_urdf, block_pose, color=color)
            blocks.append(block_id)

        # Goal: each block is stacked in the container in the specified order.
        for i in range(len(blocks)):
            self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[container_pose], replace=False,
                          rotations=True, metric='pose', params=None, step_max_reward=1 / len(blocks))

        self.lang_goals.append(self.lang_template.format(order=', '.join(self.order)))<|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.

=========
Now write the pybullet simulation code for the task "insert-blocks-into-fixture" in python code block starting with ```python.

###

Response:
 insert-blocks-into-fixture: {'task-name': 'insert-blocks-into-fixture', 'task-description': 'Pick up four colored blocks (red, blue, green, and yellow) and insert them one-by-one into a fixture on the tabletop. The order of insertion starts with the red block, followed by the blue, green, and lastly the yellow block.', 'assets-used': ['block/block.urdf', 'insertion/fixture.urdf']}

###

Implementation:
  ```python
import numpy as np
from cliport.tasks.task import Task
from cliport.utils import utils

class InsertBlocksIntoFixture(Task):
    """Pick up four colored blocks (red, blue, green) and insert them one-by-one into a fixture on the tabletop. The order of insertion starts with the red block, followed by the blue, and green."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "insert the {color} block into the fixture"
        self.task_completed_desc = "done inserting blocks into fixture."
        self.additional_reset()

    def reset(self, env):
        super().reset(env)

        # Add fixture.
        # x, y, z dimensions for the asset size
        fixture_size = (0.15, 0.15, 0.05)
        fixture_pose = self.get_random_pose(env, fixture_size)
        fixture_urdf = 'insertion/fixture.urdf'
        env.add_object(fixture_urdf, fixture_pose, 'fixed')

        anchor_base_poses = [fixture_pose,
                            (utils.apply(fixture_pose, (0.04,  0, 0.001)), fixture_pose[1]),
                            (utils.apply(fixture_pose, (0,  0.04, 0.001)), fixture_pose[1])]

        # Add blocks.
        block_size = (0.04, 0.04, 0.04)
        block_urdf = 'block/block.urdf'
        block_colors = ['red', 'blue', 'green']
        blocks = []
        for color in block_colors:
            block_pose = self.get_random_pose(env, block_size)
            block_id = env.add_object(block_urdf, block_pose, color=color)
            blocks.append(block_id)

        # Goal: each block is inserted into the fixture in the order of red, blue, green, yellow.
        for i, block in enumerate(blocks):
            self.add_goal(objs=[block], matches=np.ones((1, 1)), targ_poses=[anchor_base_poses[i]], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1/4)
            self.lang_goals.append(self.lang_template.format(color=block_colors[i]))
<|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.

=========
Now write the pybullet simulation code for the task "color-coordinated-block-tower" in python code block starting with ```python.

###

Response:
 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']}

###

Implementation:
  ```python
import numpy as np
import os
import pybullet as p
import random
from cliport.tasks import primitives
from cliport.tasks.grippers import Spatula
from cliport.tasks.task import Task
from cliport.utils import utils
import numpy as np
from cliport.tasks.task import Task
from cliport.utils import utils

class ColorCoordinatedBlockTower(Task):
    """Stack four blocks on a pallet in the following order from bottom to top:
    two blue blocks side by side, one red block centered on the blue blocks,
    and one green block on top of the red block."""

    def __init__(self):
        super().__init__()
        self.max_steps = 10
        self.lang_template = "stack four blocks on a pallet in the following order from bottom to top: two blue blocks side by side, one red block centered on the blue blocks, and one green block on top of the red block."
        self.task_completed_desc = "done stacking blocks."
        self.additional_reset()

    def reset(self, env):
        super().reset(env)

        # Add pallet.
        # x, y, z dimensions for the asset size
        pallet_size = (0.15, 0.15, 0.015)
        pallet_urdf = 'pallet/pallet.urdf'
        pallet_pose = self.get_random_pose(env, pallet_size)
        env.add_object(pallet_urdf, pallet_pose, 'fixed')

        # Add blocks.
        # x, y, z dimensions for the asset size
        block_size = (0.04, 0.04, 0.04)
        block_urdf = 'block/block.urdf'
        block_colors = [utils.COLORS['blue'], utils.COLORS['blue'], utils.COLORS['red'], utils.COLORS['green']]
        blocks = []
        for i in range(4):
            block_pose = self.get_random_pose(env, block_size)
            block_id = env.add_object(block_urdf, block_pose, color=block_colors[i])
            blocks.append(block_id)

        # Associate placement locations for goals.
        place_pos = [(0, -0.02, 0.02), (0, 0.02, 0.02), (0, 0, 0.06), (0, 0, 0.10)]
        targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos]

        # Goal: two blue blocks are placed side by side on the pallet.
        # Break the language prompt step-by-step
        self.add_goal(objs=blocks[:2], matches=np.ones((2, 2)), targ_poses=targs[:2], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]*2)
        self.lang_goals.append("place two blue blocks side by side on the pallet")

        # Goal: one red block is placed centered on the blue blocks.
        self.add_goal(objs=blocks[2:3], matches=np.ones((1, 1)), targ_poses=targs[2:3], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2])
        self.lang_goals.append("place one red block centered on the blue blocks")

        # Goal: one green block is placed on top of the red block.
        self.add_goal(objs=blocks[3:], matches=np.ones((1, 1)), targ_poses=targs[3:], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2])
        self.lang_goals.append("place one green block on top of the red block")<|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.

=========
Now write the pybullet simulation code for the task "color-structured-block-tower" in python code block starting with ```python.

###

Response:
 color-structured-block-tower: {'task-name': 'color-structured-block-tower', 'task-description': 'Construct a tower using six blocks: two red, two blue, and two green. The tower should be built in the order of a red block at the base, followed by a blue, then green, then red, blue and green at the top.', 'assets-used': ['block/block.urdf']}

###

Implementation:
  ```python
import numpy as np
import os
import pybullet as p
import random
from cliport.tasks import primitives
from cliport.tasks.grippers import Spatula
from cliport.tasks.task import Task
from cliport.utils import utils
import numpy as np
from cliport.tasks.task import Task
from cliport.utils import utils

class ColorStructuredBlockTower(Task):
    """Construct a tower using six blocks: two red, two blue, and two green.
    The tower should be built in the order of a red block at the base,
    followed by a blue, then green, then red, blue and green at the top."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "construct a tower using six blocks: two red, two blue, and two green. " \
                             "The tower should be built in the order of a red block at the base, " \
                             "followed by a blue, then green, then red, blue and green at the top."
        self.task_completed_desc = "done building color-structured block tower."
        self.additional_reset()

    def reset(self, env):
        super().reset(env)

        # Define block colors and sizes
        colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green']] * 2
        block_size = (0.04, 0.04, 0.04)

        # Add blocks
        block_urdf = 'block/block.urdf'
        blocks = []
        for i in range(6):
            block_pose = self.get_random_pose(env, block_size)
            block_id = env.add_object(block_urdf, block_pose, color=colors[i])
            blocks.append(block_id)

        # Define target poses for the blocks in the tower
        base_pose = self.get_random_pose(env, block_size)
        targ_poses = [base_pose]
        for i in range(1, 6):
            targ_poses.append((np.array(base_pose[0]) + np.array([0, 0, i * block_size[2]]), base_pose[1]))

        # Add goals
        for i in range(6):
            self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[targ_poses[i]], replace=False,
                          rotations=True, metric='pose', params=None, step_max_reward=1/6, symmetries=[np.pi/2])

        self.lang_goals.append(self.lang_template)<|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.

=========
Now write the pybullet simulation code for the task "stack-color-coordinated-blocks" in python code block starting with ```python.

###

Response:
 stack-color-coordinated-blocks: {'task-name': 'stack-color-coordinated-blocks', 'task-description': 'Pick up six blocks of different colors (red, blue, green, yellow, orange, and purple) and stack them on a pallet in two separate stacks. The first stack should be red at the bottom, blue in the middle, and green at top. The second stack should be yellow at the bottom, orange in the middle, and purple at the top.', 'assets-used': ['box/box-template.urdf', 'pallet/pallet.urdf']}

###

Implementation:
  ```python
import numpy as np
import os
import pybullet as p
import random
from cliport.tasks import primitives
from cliport.tasks.grippers import Spatula
from cliport.tasks.task import Task
from cliport.utils import utils
import numpy as np
from cliport.tasks.task import Task
from cliport.utils import utils

class StackColorCoordinatedBlocks(Task):
    """Pick up six blocks of different colors (red, blue, green, yellow, orange, and purple)
    and stack them on a pallet in two separate stacks. The first stack should be red at the bottom,
    blue in the middle, and green at top. The second stack should be yellow at the bottom,
    orange in the middle, and purple at the top."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "stack the blocks on the pallet in two separate stacks. " \
                             "The first stack should be red at the bottom, blue in the middle, " \
                             "and green at top. The second stack should be yellow at the bottom, " \
                             "orange in the middle, and purple at the top."
        self.task_completed_desc = "done stacking color-coordinated blocks."

    def reset(self, env):
        super().reset(env)

        # Add pallet.
        # x, y, z dimensions for the asset size
        pallet_size = (0.15, 0.15, 0.01)
        pallet_urdf = 'pallet/pallet.urdf'
        pallet_pose = self.get_random_pose(env, pallet_size)
        env.add_object(pallet_urdf, pallet_pose, 'fixed')

        # Block colors.
        colors = [
            utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'],
            utils.COLORS['yellow'], utils.COLORS['orange'], utils.COLORS['purple']
        ]

        # Add blocks.
        # x, y, z dimensions for the asset size
        block_size = (0.04, 0.04, 0.04)
        block_urdf = 'box/box-template.urdf'
        blocks = []
        for i in range(6):
            block_pose = self.get_random_pose(env, block_size)
            block_id = env.add_object(block_urdf, block_pose, color=colors[i])
            blocks.append(block_id)

        # Associate placement locations for goals.
        place_pos = [(0, -0.05, 0.02), (0, 0, 0.02), (0, 0.05, 0.02),
                     (0, -0.05, 0.06), (0, 0, 0.06), (0, 0.05, 0.06)]
        targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos]

        # Goal: blocks are stacked on the pallet in two separate stacks.
        # First stack: red at the bottom, blue in the middle, and green at top.
        self.add_goal(objs=blocks[:3], matches=np.ones((3, 3)), targ_poses=targs[:3], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]*3)

        # Second stack: yellow at the bottom, orange in the middle, and purple at the top.
        self.add_goal(objs=blocks[3:], matches=np.ones((3, 3)), targ_poses=targs[3:], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]*3)

        self.lang_goals.append(self.lang_template)<|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.

=========
Now write the pybullet simulation code for the task "assemble-single-car" in python code block starting with ```python.

###

Response:
 assemble-single-car: {'task-name': 'assemble-single-car', 'task-description': 'Build a mini car using a large blue box as the body, a smaller red box on top as the roof, and two tiny green boxes on the sides as wheels.', 'assets-used': ['box/box-template.urdf']}

###

Implementation:
  ```python
import numpy as np
import os
import pybullet as p
import random
from cliport.tasks import primitives
from cliport.tasks.grippers import Spatula
from cliport.tasks.task import Task
from cliport.utils import utils
import numpy as np
from cliport.tasks.task import Task
from cliport.utils import utils

class AssembleSingleCar(Task):
    """Assemble a mini car using a large blue box as the body, a smaller red box on top as the roof, and two tiny green boxes on the sides as wheels."""

    def __init__(self):
        super().__init__()
        self.max_steps = 10
        self.lang_template = "build a mini car using a large blue box as the body, a smaller red box on top as the roof, and two tiny green boxes on the sides as wheels"
        self.task_completed_desc = "done assembling the car."

    def reset(self, env):
        super().reset(env)

        # Add car body (large blue box).
        body_size = (0.1, 0.05, 0.02)  # x, y, z dimensions
        body_pose = self.get_random_pose(env, body_size)
        body_urdf = 'box/box-template.urdf'
        body_color = utils.COLORS['blue']
        body_id = env.add_object(body_urdf, body_pose, color=body_color)

        # Add car roof (smaller red box).
        roof_size = (0.08, 0.04, 0.02)  # x, y, z dimensions
        roof_pose = self.get_random_pose(env, roof_size)
        roof_urdf = 'box/box-template.urdf'
        roof_color = utils.COLORS['red']
        roof_id = env.add_object(roof_urdf, roof_pose, color=roof_color)

        # Add car wheels (two tiny green boxes).
        wheel_size = (0.02, 0.02, 0.01)  # x, y, z dimensions
        wheel_urdf = 'box/box-template.urdf'
        wheel_color = utils.COLORS['green']
        wheel_ids = []

        for _ in range(2):
            wheel_pose = self.get_random_pose(env, wheel_size)
            wheel_id = env.add_object(wheel_urdf, wheel_pose, color=wheel_color)
            wheel_ids.append(wheel_id)

        # Goal: assemble the car by placing the roof on the body and the wheels on the sides.
        # The target poses are calculated based on the body pose.
        roof_targ_pose = (body_pose[0] + np.array([0, 0, body_size[2] + roof_size[2]/2]), body_pose[1])
        wheel_targ_poses = [(body_pose[0] + np.array([0, body_size[1]/2 + wheel_size[1]/2, -body_size[2]/2]), body_pose[1]),
                            (body_pose[0] + np.array([0, -body_size[1]/2 - wheel_size[1]/2, -body_size[2]/2]), body_pose[1])]

        # Add the goals.
        self.add_goal(objs=[roof_id], matches=np.ones((1, 1)), targ_poses=[roof_targ_pose], replace=False,
                      rotations=True, metric='pose', params=None, step_max_reward=1/3)
        self.add_goal(objs=wheel_ids, matches=np.ones((2, 2)), targ_poses=wheel_targ_poses, replace=False,
                      rotations=True, metric='pose', params=None, step_max_reward=2/3)

        self.lang_goals.append(self.lang_template)<|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.

=========
Now write the pybullet simulation code for the task "sort-and-stack-clr-blocks" in python code block starting with ```python.

###

Response:
 sort-and-stack-clr-blocks: {'task-name': 'sort-and-stack-clr-blocks', 'task-description': 'Pick up four blocks of different colors (red, blue, green, yellow) and place them into separate corners of a pallet. After sorting, stack them in a specific sequence on top of the pallet. The bottom of the stack should start with a green block followed by a blue, then red, and finally a yellow block at the top.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf']}

###

Implementation:
  ```python
import numpy as np
import os
import pybullet as p
import random
from cliport.tasks import primitives
from cliport.tasks.grippers import Spatula
from cliport.tasks.task import Task
from cliport.utils import utils
import numpy as np
from cliport.tasks.task import Task
from cliport.utils import utils

class SortAndStackClrBlocks(Task):
    """Pick up four blocks of different colors (red, blue, green, yellow) and place them into separate corners of a pallet. After sorting, stack them in a specific sequence on top of the pallet. The bottom of the stack should start with a green block followed by a blue, then red, and finally a yellow block at the top."""

    def __init__(self):
        super().__init__()
        self.max_steps = 10
        self.lang_template = "sort and stack the blocks in the order of green, blue, red, and yellow"
        self.task_completed_desc = "done sorting and stacking blocks."
        self.additional_reset()

    def reset(self, env):
        super().reset(env)

        # Add pallet.
        # x, y, z dimensions for the asset size
        pallet_size = (0.15, 0.15, 0.01)
        pallet_urdf = 'pallet/pallet.urdf'
        pallet_pose = self.get_random_pose(env, pallet_size)
        env.add_object(pallet_urdf, pallet_pose, 'fixed')

        # Block colors.
        colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow']]

        # Add blocks.
        # x, y, z dimensions for the asset size
        block_size = (0.04, 0.04, 0.04)
        block_urdf = 'block/block.urdf'
        blocks = []
        for i in range(4):
            block_pose = self.get_random_pose(env, block_size)
            block_id = env.add_object(block_urdf, block_pose, color=colors[i])
            blocks.append(block_id)

        # Associate placement locations for goals.
        place_pos = [(0.05, 0.05, 0.02), (-0.05, 0.05, 0.02), (-0.05, -0.05, 0.02), (0.05, -0.05, 0.02)]
        targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in place_pos]

        # Goal: blocks are sorted into separate corners of the pallet.
        self.add_goal(objs=blocks, matches=np.eye(4), targ_poses=targs, replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=0.5, symmetries=[np.pi/2]*4)
        self.lang_goals.append(self.lang_template)

        # Associate stacking locations for goals.
        stack_pos = [(0, 0, 0.02), (0, 0, 0.06), (0, 0, 0.10), (0, 0, 0.14)]
        targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in stack_pos]

        # Goal: blocks are stacked on top of the pallet in the order of green, blue, red, and yellow.
        self.add_goal(objs=blocks, matches=np.eye(4), targ_poses=targs, replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=0.5, symmetries=[np.pi/2]*4)
        self.lang_goals.append(self.lang_template)<|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.

=========
Now write the pybullet simulation code for the task "create-pyramid-blocks-and-container" in python code block starting with ```python.

###

Response:
 create-pyramid-blocks-and-container: {'task-name': 'create-pyramid-blocks-and-container', 'task-description': 'Create a pyramid structure using six blocks of three different colors (two red, two green, and two blue) inside a container. The first layer of the pyramid should consist of the two green and one blue block. The second layer should be the two red blocks, and the last block which is the top of the pyramid should be the remaining blue block.', 'assets-used': ['container/container-template.urdf', 'block/block.urdf']}

###

Implementation:
  ```python
import numpy as np
import os
import pybullet as p
import random
from cliport.tasks import primitives
from cliport.tasks.grippers import Spatula
from cliport.tasks.task import Task
from cliport.utils import utils
import numpy as np
from cliport.tasks.task import Task
from cliport.utils import utils

class CreatePyramidBlocksAndContainer(Task):
    """Create a pyramid structure using six blocks of three different colors (two red, two green, and two blue) inside a container."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "Create a pyramid structure using six blocks of three different colors (two red, two green, and two blue) inside a container."
        self.task_completed_desc = "done creating pyramid."
        self.additional_reset()

    def reset(self, env):
        super().reset(env)

        # Add container.
        # x, y, z dimensions for the asset size
        container_size = (0.3, 0.3, 0.1)
        container_pose = self.get_random_pose(env, container_size)
        container_urdf = 'container/container-template.urdf'
        replace = {'DIM': container_size, 'HALF': (container_size[0] / 2, container_size[1] / 2, container_size[2] / 2)}
        container_urdf = self.fill_template(container_urdf, replace)
        env.add_object(container_urdf, container_pose, 'fixed')

        # Add blocks.
        # x, y, z dimensions for the asset size
        block_size = (0.04, 0.04, 0.04)
        block_urdf = 'block/block.urdf'
        block_colors = [utils.COLORS['red'], utils.COLORS['red'], utils.COLORS['green'], utils.COLORS['green'], utils.COLORS['blue'], utils.COLORS['blue']]
        blocks = []
        for i in range(6):
            block_pose = self.get_random_pose(env, block_size)
            block_id = env.add_object(block_urdf, block_pose, color=block_colors[i])
            blocks.append(block_id)

        # Associate placement locations for goals.
        place_pos = [(0, -0.05, 0.03), (0, 0, 0.03), (0, 0.05, 0.03), (0, -0.025, 0.08), (0, 0.025, 0.08), (0, 0, 0.13)]
        targs = [(utils.apply(container_pose, i), container_pose[1]) for i in place_pos]

        # Goal: blocks are stacked in a pyramid (bottom row: green, green, blue).
        self.add_goal(objs=blocks[2:5], matches=np.ones((3, 3)), targ_poses=targs[:3], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]*3)
        self.lang_goals.append(self.lang_template.format(blocks="the green and blue blocks",
                                                         row="bottom"))

        # Goal: blocks are stacked in a pyramid (middle row: red, red).
        self.add_goal(objs=blocks[:2], matches=np.ones((2, 2)), targ_poses=targs[3:5], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2]*2)
        self.lang_goals.append(self.lang_template.format(blocks="the red blocks",
                                                         row="middle"))

        # Goal: blocks are stacked in a pyramid (top row: blue).
        self.add_goal(objs=blocks[5:], matches=np.ones((1, 1)), targ_poses=targs[5:], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1 / 3, symmetries=[np.pi/2])
        self.lang_goals.append(self.lang_template.format(blocks="the blue block",
                                                         row="top"))<|endoftext|>