Prompt:
 "color-cued-ball-insertion". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "color-cued-ball-insertion" in a python code block.
###

Response:
 color-cued-ball-insertion: {'task-name': 'color-cued-ball-insertion', 'task-description': 'The task area has four different colored bowls (red, blue, green, yellow) and four spheres of corresponding colors. Initially, the spheres are not in their color-matching bowls. The task is to pick up each sphere and place it in the bowl of the same color. However, the bowls are situated inside separate corners of a square structure marked by small blocks. This necessitates precise navigation around the square structure, careful picking and placing of spheres, color matching, and maintaining the balance of the bowls.', 'assets-used': ['bowl/bowl.urdf', 'sphere/sphere.urdf', 'block/small.urdf', 'square/square-template.urdf']}```

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

class ColorCuedBallInsertion(Task):
    """Pick up each sphere and place it in the bowl of the same color."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "put the {color} ball in the {color} bowl"
        self.task_completed_desc = "done placing balls in bowls."
        self.additional_reset()

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

        # Define colors
        colors = ['red', 'blue', 'green', 'yellow']

        # Add bowls and spheres.
        bowl_size = (0.12, 0.12, 0)
        sphere_size = (0.04, 0.04, 0.04)
        bowl_urdf = 'bowl/bowl.urdf'
        sphere_urdf = 'sphere/sphere.urdf'
        bowls = []
        spheres = []

        for color in colors:
            # Add bowl
            bowl_pose = self.get_random_pose(env, bowl_size)
            bowl_id = env.add_object(bowl_urdf, bowl_pose, color=utils.COLORS[color], category='fixed')
            bowls.append(bowl_id)

            # Add sphere
            sphere_pose = self.get_random_pose(env, sphere_size)
            sphere_id = env.add_object(sphere_urdf, sphere_pose, color=utils.COLORS[color])
            spheres.append(sphere_id)

            # Add goal
            self.add_goal(objs=[sphere_id], matches=np.ones((1, 1)), targ_poses=[bowl_pose], replace=False,
                          rotations=True, metric='pose', params=None, step_max_reward=1/4)
            self.lang_goals.append(self.lang_template.format(color=color))

        # Add blocks as obstacles
        block_size = (0.04, 0.04, 0.04)
        block_urdf = 'block/small.urdf'
        for _ in range(4):
            block_pose = self.get_random_pose(env, block_size)
            env.add_object(block_urdf, block_pose, category='fixed')```
 END


Prompt:
 "color-coordinated-insertion-through-box-barrier". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "color-coordinated-insertion-through-box-barrier" in a python code block.
###

Response:
 color-coordinated-insertion-through-box-barrier: {'task-name': 'color-coordinated-insertion-through-box-barrier', 'task-description': "On a tabletop, there are four differently colored ell objects (red, blue, green, and yellow) and a corresponding set of color-coded fixtures. Placed in between the ell objects and the fixtures, there are two rows of boxes forming an 'L' shaped barrier. The task involves picking up each ell object and inserting it into the matching color fixture in a specific order: from left to right, insert red, blue, green, and then yellow, without knocking over any of the boxes. The challenge lies in precise navigation through the box barrier, precise insertion, color matching, and sequence following.", 'assets-used': ['insertion/ell.urdf', 'insertion/fixture.urdf', 'box/box-template.urdf']}```

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

class ColorCoordinatedInsertionThroughBoxBarrier(Task):
    """Pick up each ell object and insert it into the matching color fixture in a specific order: from left to right, insert red, blue, green, and then yellow, without knocking over any of the boxes."""

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

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

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

        # Add ell objects and fixtures.
        ell_size = (0.04, 0.04, 0.04)
        ell_urdf = 'insertion/ell.urdf'
        fixture_urdf = 'insertion/fixture.urdf'
        ells = []
        fixtures = []
        for i in range(4):
            ell_pose = self.get_random_pose(env, ell_size)
            ell_id = env.add_object(ell_urdf, ell_pose, color=colors[i])
            ells.append(ell_id)

            fixture_pose = self.get_random_pose(env, ell_size)
            fixture_id = env.add_object(fixture_urdf, fixture_pose, color=colors[i])
            fixtures.append(fixture_id)

        # Add boxes to form 'L' shaped barrier.
        box_size = (0.04, 0.04, 0.04)
        box_urdf = 'box/box-template.urdf'
        for _ in range(10):
            box_pose = self.get_random_pose(env, box_size)
            env.add_object(box_urdf, box_pose, category='fixed')

        # Goal: each ell is inserted into the matching color fixture in a specific order.
        for i in range(4):
            self.add_goal(objs=[ells[i]], matches=np.ones((1, 1)), targ_poses=[fixture_pose], replace=False,
                    rotations=True, metric='pose', params=None, step_max_reward=1 / 4)
            self.lang_goals.append(self.lang_template.format(color=colors[i]))```
 END


Prompt:
 "color-coordinated-insertion-and-stacking". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "color-coordinated-insertion-and-stacking" in a python code block.
###

Response:
 color-coordinated-insertion-and-stacking: {'task-name': 'color-coordinated-insertion-and-stacking', 'task-description': 'On the tabletop, there are four differently colored ell-shaped objects (red, blue, green, yellow) and four fixtures of corresponding colors. The task is to pick up each ell object and insert it into the fixture of the same color. Additionally, there are four blocks of matching colors. The robot has to stack these blocks on top of the fixtures, maintaining the color coordination. However, the tabletop is marked by a square path delineated by small blocks, within which the ell objects, blocks, and fixtures are placed randomly. This necessitates precise navigation within the square path, color coordination, stacking and insertion skills.', 'assets-used': ['insertion/ell.urdf', 'insertion/fixture.urdf', 'block/block.urdf', 'block/small.urdf', 'square/square-template.urdf']}```

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

class ColorCoordinatedInsertionAndStacking(Task):
    """Pick up each ell object and insert it into the fixture of the same color.
    Then stack blocks of matching colors on top of the fixtures."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "insert the {color} ell into the {color} fixture and stack the {color} block on top"
        self.task_completed_desc = "done inserting and stacking."
        self.additional_reset()

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

        # Add square path.
        square_size = (0.3, 0.3, 0.01)
        square_pose = self.get_random_pose(env, square_size)
        square_urdf = 'square/square-template.urdf'
        env.add_object(square_urdf, square_pose, 'fixed')

        # Ell and fixture colors.
        colors = ['red', 'blue', 'green', 'yellow']

        # Add ells and fixtures.
        ell_size = (0.04, 0.04, 0.04)
        fixture_size = (0.05, 0.05, 0.05)
        ell_urdf = 'insertion/ell.urdf'
        fixture_urdf = 'insertion/fixture.urdf'

        ells = []
        fixtures = []
        for color in colors:
            ell_pose = self.get_random_pose(env, ell_size)
            fixture_pose = self.get_random_pose(env, fixture_size)
            ell_id = env.add_object(ell_urdf, ell_pose, color=color)
            fixture_id = env.add_object(fixture_urdf, fixture_pose, color=color)
            ells.append(ell_id)
            fixtures.append(fixture_id)

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

        # Goal: each ell is inserted into the fixture of the same color and the block of the same color is stacked on top.
        for i in range(4):
            self.add_goal(objs=[ells[i]], matches=np.ones((1, 1)), targ_poses=[fixture_pose], replace=False,
                    rotations=True, metric='pose', params=None, step_max_reward=1 / 4)
            self.lang_goals.append(self.lang_template.format(color=colors[i]))

            self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[fixture_pose], replace=False,
                    rotations=True, metric='pose', params=None, step_max_reward=1 / 4)
            self.lang_goals.append(self.lang_template.format(color=colors[i]))```
 END


Prompt:
 "color-coordinated-cylinder-ball-match". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "color-coordinated-cylinder-ball-match" in a python code block.
###

Response:
 color-coordinated-cylinder-ball-match: {'task-name': 'color-coordinated-cylinder-ball-match', 'task-description': 'On the tabletop, there are four cylinders of different colors (red, blue, green, and yellow) and four balls of corresponding colors. The task is to pick up each ball and place it on top of the cylinder of the same color without the ball rolling off. However, there are small blocks scattered randomly on the table that the robot has to navigate around without knocking them over. The challenge lies in the precise placement of the balls on top of the cylinders, color matching, and navigation around the blocks.', 'assets-used': ['cylinder/cylinder-template.urdf', 'ball/ball-template.urdf', 'block/small.urdf']}```

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

class ColorCoordinatedCylinderBallMatch(Task):
    """Pick up each ball and place it on top of the cylinder of the same color."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "place the {color} ball on the {color} cylinder"
        self.task_completed_desc = "done placing balls on cylinders."
        self.additional_reset()

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

        # Add cylinders.
        # x, y, z dimensions for the asset size
        cylinder_size = (0.04, 0.04, 0.1)
        cylinder_urdf = 'cylinder/cylinder-template.urdf'
        cylinder_colors = ['red', 'blue', 'green', 'yellow']
        cylinder_poses = []
        cylinders = []
        for color in cylinder_colors:
            cylinder_pose = self.get_random_pose(env, cylinder_size)
            cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=color)
            cylinder_poses.append(cylinder_pose)
            cylinders.append(cylinder_id)

        # Add balls.
        # x, y, z dimensions for the asset size
        ball_size = (0.04, 0.04, 0.04)
        ball_urdf = 'ball/ball-template.urdf'
        balls = []
        for color in cylinder_colors:
            ball_pose = self.get_random_pose(env, ball_size)
            ball_id = env.add_object(ball_urdf, ball_pose, color=color)
            balls.append(ball_id)

        # Add blocks as obstacles.
        # x, y, z dimensions for the asset size
        block_size = (0.04, 0.04, 0.04)
        block_urdf = 'block/small.urdf'
        for _ in range(5):
            block_pose = self.get_random_pose(env, block_size)
            env.add_object(block_urdf, block_pose)

        # Goal: each ball is on top of the cylinder of the same color.
        for i in range(len(balls)):
            self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[cylinder_poses[i]], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1/len(balls))
            self.lang_goals.append(self.lang_template.format(color=cylinder_colors[i]))```
 END


Prompt:
 "multi-level-insertion-and-zone-matching". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "multi-level-insertion-and-zone-matching" in a python code block.
###

Response:
 multi-level-insertion-and-zone-matching: {'task-name': 'multi-level-insertion-and-zone-matching', 'task-description': 'There are three levels of zones marked on the tabletop - the first level is red, second is blue, and third is green. On each level, there are large, medium, and small ell-shaped objects in corresponding colors. The task is to pick up each ell object from its current position and insert it into the corresponding colored zone on the same level, but in a specific order - large, medium, and small. The challenge lies in the precise control of insertion, color coordination, and the multi-level structure of the environment.', 'assets-used': ['zone/zone.urdf', 'insertion/ell.urdf']}```

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

class MultiLevelInsertionAndZoneMatching(Task):
    """Pick up ell objects from their current position and insert them into the corresponding colored zone on the same level, in a specific order - large, medium, and small."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "insert the {size} {color} ell into the {color} zone on the same level"
        self.task_completed_desc = "done inserting."
        self.additional_reset()

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

        # Add zones.
        zone_sizes = [(0.12, 0.12, 0), (0.12, 0.12, 0.05), (0.12, 0.12, 0.1)]
        zone_urdf = 'zone/zone.urdf'
        zone_poses = []
        zone_colors = ['red', 'blue', 'green']
        for i in range(3):
            zone_pose = self.get_random_pose(env, zone_sizes[i])
            env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[zone_colors[i]])
            zone_poses.append(zone_pose)

        # Add ell objects.
        ell_sizes = [(0.08, 0.08, 0.02), (0.06, 0.06, 0.015), (0.04, 0.04, 0.01)]
        ell_urdf = 'insertion/ell.urdf'
        ells = []
        for i in range(3):
            for j in range(3):
                ell_pose = self.get_random_pose(env, ell_sizes[j])
                ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[zone_colors[i]])
                ells.append(ell_id)

        # Goal: each ell object is in the corresponding colored zone on the same level.
        for i in range(9):
            self.add_goal(objs=[ells[i]], matches=np.ones((1, 1)), targ_poses=[zone_poses[i//3]], replace=False,
                    rotations=True, metric='pose', params=None, step_max_reward=1/9)
            self.lang_goals.append(self.lang_template.format(size=['large', 'medium', 'small'][i%3], color=zone_colors[i//3]))```
 END


Prompt:
 "multi-color-block-sequence-insertion". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "multi-color-block-sequence-insertion" in a python code block.
###

Response:
 multi-color-block-sequence-insertion: {'task-name': 'multi-color-block-sequence-insertion', 'task-description': 'On the tabletop, there are five blocks of different colors (red, blue, green, yellow, and orange) and five fixtures of matching colors. However, the fixtures are arranged in a mixed sequence of colors. The task involves picking up each block and inserting it into the fixture of the same color, but in a specific sequence - first red, then blue, next green, followed by yellow, and finally orange. The fixtures can be inserted only in the specified sequence and the robot cannot proceed to the next color without correctly inserting the current one. The task is challenging due to the precision required in inserting the blocks, the color coordination, and following the sequence.', 'assets-used': ['block/block.urdf', 'insertion/fixture.urdf']}```

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

class MultiColorBlockSequenceInsertion(Task):
    """Pick up blocks of different colors and insert them into the fixture of the same color in a specific sequence."""

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

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

        # Define the color sequence
        color_sequence = ['red', 'blue', 'green', 'yellow', 'orange']

        # Add fixtures.
        fixture_size = (0.04, 0.04, 0.04)
        fixture_urdf = 'insertion/fixture.urdf'
        fixtures = []
        for color in color_sequence:
            fixture_pose = self.get_random_pose(env, fixture_size)
            fixture_id = env.add_object(fixture_urdf, fixture_pose, color=utils.COLORS[color])
            fixtures.append(fixture_id)

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

        # Goal: each block is inserted into the fixture of the same color in the specified sequence.
        for i in range(len(blocks)):
            self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(fixtures[i])], replace=False,
                    rotations=True, metric='pose', params=None, step_max_reward=1/len(blocks))
            self.lang_goals.append(self.lang_template.format(color=color_sequence[i]))```
 END


Prompt:
 "ball-tower-in-zones". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "ball-tower-in-zones" in a python code block.
###

Response:
 ball-tower-in-zones: {'task-name': 'ball-tower-in-zones', 'task-description': 'On the table, there are three spheres and three cylindrical stands of different colors (red, blue, green). The task starts with each sphere not corresponding to the stand of the same color. The task is to pick up each sphere and stack it on top of the stand of the same color while maintaining the balance. However, the stacking should be done in a specific color sequence - blue at the bottom, followed by green, and finally red at the top. The spheres and stands are each placed within separate zones, adding a challenge in precise navigation and placement.', 'assets-used': ['sphere/sphere.urdf', 'zone/zone.urdf', 'stacking/stand.urdf']}```

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

class BallTowerInZones(Task):
    """Pick up each sphere and stack it on top of the stand of the same color while maintaining the balance.
    However, the stacking should be done in a specific color sequence - blue at the bottom, followed by green,
    and finally red at the top. The spheres and stands are each placed within separate zones."""

    def __init__(self):
        super().__init__()
        self.max_steps = 10
        self.lang_template = "stack the {color} sphere on the {color} stand"
        self.task_completed_desc = "done stacking spheres."
        self.additional_reset()

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

        # Add zones.
        zone_size = (0.12, 0.12, 0)
        zone_urdf = 'zone/zone.urdf'
        zone_poses = []
        for _ in range(3):
            zone_pose = self.get_random_pose(env, zone_size)
            env.add_object(zone_urdf, zone_pose, 'fixed')
            zone_poses.append(zone_pose)

        # Sphere and stand colors.
        colors = [
            utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['red']
        ]

        # Add spheres and stands.
        sphere_size = (0.04, 0.04, 0.04)
        sphere_urdf = 'sphere/sphere.urdf'
        stand_size = (0.05, 0.05, 0.05)
        stand_urdf = 'stacking/stand.urdf'

        spheres = []
        stands = []
        for i in range(3):
            sphere_pose = self.get_random_pose(env, sphere_size)
            sphere_id = env.add_object(sphere_urdf, sphere_pose, color=colors[i])
            spheres.append(sphere_id)

            stand_pose = self.get_random_pose(env, stand_size)
            stand_id = env.add_object(stand_urdf, stand_pose, color=colors[i])
            stands.append(stand_id)

        # Goal: each sphere is stacked on the stand of the same color in the correct zone.
        for i in range(3):
            self.add_goal(objs=[spheres[i]], matches=np.ones((1, 1)), targ_poses=[zone_poses[i]], replace=False,
                    rotations=True, metric='pose', params=None, step_max_reward=1 / 3)
            self.lang_goals.append(self.lang_template.format(color=colors[i]))

        # Add distractors.
        n_distractors = 0
        while n_distractors < 6:
            is_sphere = np.random.rand() > 0.5
            urdf = sphere_urdf if is_sphere else stand_urdf
            size = sphere_size if is_sphere else stand_size
            pose = self.get_random_pose(env, obj_size=size)
            color = colors[n_distractors % len(colors)]

            obj_id = env.add_object(urdf, pose, color=color)
            n_distractors += 1```
 END


Prompt:
 "color-coordinated-container-pyramid". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "color-coordinated-container-pyramid" in a python code block.
###

Response:
 color-coordinated-container-pyramid: {'task-name': 'color-coordinated-container-pyramid', 'task-description': 'On a tabletop, there are six containers and six blocks of different colors (red, blue, green, yellow, orange, and purple). The task is to pick up each block and place it into the container of the same color, then stack these containers to form a pyramid with three levels. The first level should consist of four containers: red, blue, green, and yellow (from left to right). The second level should be constructed by placing the orange and purple containers on top of the red and blue containers respectively. The top level should be formed by placing the red container onto the orange container. The challenge lies in the precise placement, color coordination, and maintaining the balance of the pyramid.', 'assets-used': ['block/block.urdf', 'container/container-template.urdf']}```

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

class ColorCoordinatedContainerPyramid(Task):
    """Pick up each block and place it into the container of the same color, then stack these containers to form a pyramid."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "build a pyramid with the containers by placing the blocks of the same color into them"
        self.task_completed_desc = "done building pyramid."
        self.additional_reset()

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

        # Define colors for blocks and containers
        colors = ['red', 'blue', 'green', 'yellow', 'orange', 'purple']

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

        # Add containers.
        container_size = (0.12, 0.12, 0.06)
        container_urdf = 'container/container-template.urdf'
        containers = []
        for color in colors:
            container_pose = self.get_random_pose(env, container_size)
            container_id = env.add_object(container_urdf, container_pose, color=utils.COLORS[color])
            containers.append(container_id)

        # Goal: each block is in a container of the same color.
        for i in range(len(blocks)):
            self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(containers[i])], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1 / len(blocks))

        # Goal: containers are stacked in a pyramid.
        pyramid_poses = [
            (0, -0.06, 0.03), (0, 0, 0.03), (0, 0.06, 0.03), (0, -0.03, 0.09),
            (0, 0.03, 0.09), (0, 0, 0.15)
        ]
        pyramid_poses = [(utils.apply(p.getBasePositionAndOrientation(containers[0]), i), p.getBasePositionAndOrientation(containers[0])[1]) for i in pyramid_poses]
        self.add_goal(objs=containers, matches=np.ones((len(containers), len(containers))), targ_poses=pyramid_poses, replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1)

        self.lang_goals.append(self.lang_template)```
 END


Prompt:
 "corner-blocks-insertion". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "corner-blocks-insertion" in a python code block.
###

Response:
 corner-blocks-insertion: {'task-name': 'corner-blocks-insertion', 'task-description': 'On the tabletop, there are four different colored ell objects (red, blue, green, yellow) and four fixtures in the corresponding colors. Initially, each ell is placed in the corner of the table. The task is to pick up each ell and insert it into the fixture of the same color. However, there is a square-shaped barrier in the center of the table. The ell objects must be inserted in a specific sequence - red first, then blue, then green, and finally yellow. This task requires careful navigation around the barrier, precise insertion, color coordination, and sequence following.', 'assets-used': ['insertion/ell.urdf', 'insertion/fixture.urdf', 'square/square-template.urdf']}```

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

class CornerBlocksInsertion(Task):
    """Pick up ell objects from the corners and insert them into the fixtures of the same color in a specific sequence."""

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

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

        # Ell and fixture colors.
        colors = ['red', 'blue', 'green', 'yellow']

        # Add ell objects and fixtures.
        ell_size = (0.04, 0.04, 0.04)
        ell_urdf = 'insertion/ell.urdf'
        fixture_size = (0.04, 0.04, 0.04)
        fixture_urdf = 'insertion/fixture.urdf'

        objs = []
        for color in colors:
            # Add ell object.
            ell_pose = self.get_random_pose(env, ell_size)
            ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[color])
            objs.append(ell_id)

            # Add fixture.
            fixture_pose = self.get_random_pose(env, fixture_size)
            env.add_object(fixture_urdf, fixture_pose, color=utils.COLORS[color])

        # Add square-shaped barrier.
        barrier_size = (0.1, 0.1, 0.1)
        barrier_pose = self.get_random_pose(env, barrier_size)
        barrier_urdf = 'square/square-template.urdf'
        env.add_object(barrier_urdf, barrier_pose, 'fixed')

        # Goal: each ell object is inserted into the fixture of the same color in a specific sequence.
        for i, color in enumerate(colors):
            self.add_goal(objs=[objs[i]], matches=np.ones((1, 1)), targ_poses=[fixture_pose], replace=False,
                          rotations=True, metric='pose', params=None, step_max_reward=1 / 4)
            self.lang_goals.append(self.lang_template.format(color=color))```
 END


Prompt:
 "color-coordinated-insertion-in-cylinders". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "color-coordinated-insertion-in-cylinders" in a python code block.
###

Response:
 color-coordinated-insertion-in-cylinders: {'task-name': 'color-coordinated-insertion-in-cylinders', 'task-description': 'There are four differently-colored ell objects (red, blue, green, yellow) and four cylinders of matching colors. The task involves picking up each ell object and inserting it into the cylinder of the same color in a specific order: from left to right, insert red, blue, green, and finally yellow. The challenge lies in the precise manipulation of the ell objects, the color-coordination required and the ability to correctly orient the cylinders for the insertion.', 'assets-used': ['insertion/ell.urdf', 'cylinder/cylinder-template.urdf']}```

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

class ColorCoordinatedInsertionInCylinders(Task):
    """Insert four differently-colored ell objects into cylinders of matching colors in a specific order."""

    def __init__(self):
        super().__init__()
        self.max_steps = 10
        self.lang_template = "insert the {color} ell into the {color} cylinder"
        self.task_completed_desc = "done inserting ells into cylinders."
        self.additional_reset()

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

        # Ell and Cylinder colors.
        colors = ['red', 'blue', 'green', 'yellow']

        # Add ells.
        # x, y, z dimensions for the ell size
        ell_size = (0.04, 0.04, 0.04)
        ell_urdf = 'insertion/ell.urdf'
        ells = []
        for color in colors:
            ell_pose = self.get_random_pose(env, ell_size)
            ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[color])
            ells.append(ell_id)

        # Add cylinders.
        # x, y, z dimensions for the cylinder size
        cylinder_size = (0.05, 0.05, 0.1)
        cylinder_urdf = 'cylinder/cylinder-template.urdf'
        cylinders = []
        for color in colors:
            cylinder_pose = self.get_random_pose(env, cylinder_size)
            cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=utils.COLORS[color])
            cylinders.append(cylinder_id)

        # Goal: each ell is inserted into the cylinder of the same color.
        for i in range(len(colors)):
            self.add_goal(objs=[ells[i]], matches=np.ones((1, 1)), targ_poses=[cylinder_pose], replace=False,
                    rotations=True, metric='pose', params=None, step_max_reward=1/len(colors))
            self.lang_goals.append(self.lang_template.format(color=colors[i]))```
 END


Prompt:
 "color-coordinated-block-transport". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "color-coordinated-block-transport" in a python code block.
###

Response:
 color-coordinated-block-transport: {'task-name': 'color-coordinated-block-transport', 'task-description': "On the tabletop, there are four pallets of different colors (red, blue, green, and yellow), each containing a block of the same color. The task is to pick up each block and transport it to a container of matching color, which is located in a corner surrounded by a line of small blocks, serving as an obstacle. The robot must execute this task without disturbing the small blocks and in a specific color sequence: red first, then blue, green, and finally yellow. The task tests the robot's precise navigation, color coordination, sequence following, and obstacle avoidance capabilities.", 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf', 'container/container-template.urdf', 'block/small.urdf']}```

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

class ColorCoordinatedBlockTransport(Task):
    """Pick up each block and transport it to a container of matching color, which is located in a corner surrounded by a line of small blocks, serving as an obstacle. The robot must execute this task without disturbing the small blocks and in a specific color sequence: red first, then blue, green, and finally yellow."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "transport the {color} block to the {color} container"
        self.task_completed_desc = "done transporting blocks."
        self.additional_reset()

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

        # Define colors and their sequence
        colors = ['red', 'blue', 'green', 'yellow']

        # Add containers of different colors.
        container_size = (0.1, 0.1, 0.1)
        container_urdf = 'container/container-template.urdf'
        containers = []
        for color in colors:
            container_pose = self.get_random_pose(env, container_size)
            container_id = env.add_object(container_urdf, container_pose, color=utils.COLORS[color])
            containers.append(container_id)

        # Add blocks of different colors.
        block_size = (0.04, 0.04, 0.04)
        block_urdf = 'block/block.urdf'
        blocks = []
        for color in colors:
            block_pose = self.get_random_pose(env, block_size)
            block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color])
            blocks.append(block_id)

        # Add small blocks as obstacles.
        small_block_size = (0.02, 0.02, 0.02)
        small_block_urdf = 'block/small.urdf'
        for _ in range(10):
            small_block_pose = self.get_random_pose(env, small_block_size)
            env.add_object(small_block_urdf, small_block_pose)

        # Goal: each block is in a container of the same color.
        for i in range(len(blocks)):
            self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[p.getBasePositionAndOrientation(containers[i])], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1/len(blocks))
            self.lang_goals.append(self.lang_template.format(color=colors[i]))```
 END


Prompt:
 "color-cued-ball-corner-sorting". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "color-cued-ball-corner-sorting" in a python code block.
###

Response:
 color-cued-ball-corner-sorting: {'task-name': 'color-cued-ball-corner-sorting', 'task-description': 'On a tabletop, there are four different colored balls (red, blue, green, yellow) and four corners marked with corresponding colors using the corner template. The task involves picking up each ball and precisely placing it in the corner of the same color. However, there is a rectangular zone in the middle of the table marked by small blocks. The robot has to strategically navigate around this zone without touching the blocks while transporting the balls to the corresponding corners. The challenge lies in the precise navigation, placement of the balls, and color matching while avoiding the blocks.', 'assets-used': ['ball/ball-template.urdf', 'corner/corner-template.urdf', 'block/block_for_anchors.urdf', 'zone/zone.urdf']}```

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

class ColorCuedBallCornerSorting(Task):
    """Pick up each colored ball and place it in the corner of the same color while avoiding a zone marked by small blocks."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "place the {color} ball in the {color} corner"
        self.task_completed_desc = "done sorting balls."
        self.additional_reset()

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

        # Add corners.
        corner_size = (0.05, 0.05, 0.05)
        corner_urdf = 'corner/corner-template.urdf'
        corner_colors = ['red', 'blue', 'green', 'yellow']
        corner_poses = []
        for color in corner_colors:
            corner_pose = self.get_random_pose(env, corner_size)
            env.add_object(corner_urdf, corner_pose, color=color, category='fixed')
            corner_poses.append(corner_pose)

        # Add balls.
        balls = []
        ball_size = (0.04, 0.04, 0.04)
        ball_urdf = 'ball/ball-template.urdf'
        for color in corner_colors:
            ball_pose = self.get_random_pose(env, ball_size)
            ball_id = env.add_object(ball_urdf, ball_pose, color=color)
            balls.append(ball_id)

        # Add zone.
        zone_size = (0.2, 0.2, 0.05)
        zone_pose = self.get_random_pose(env, zone_size)
        zone_urdf = 'zone/zone.urdf'
        env.add_object(zone_urdf, zone_pose, 'fixed')

        # Add blocks.
        block_size = (0.04, 0.04, 0.04)
        block_urdf = 'block/block_for_anchors.urdf'
        for _ in range(4):
            block_pose = self.get_random_pose(env, block_size)
            env.add_object(block_urdf, block_pose)

        # Goal: each ball is in the corner of the same color.
        for i in range(4):
            self.add_goal(objs=[balls[i]], matches=np.ones((1, 1)), targ_poses=[corner_poses[i]], replace=False,
                          rotations=True, metric='pose', params=None, step_max_reward=1/4)
            self.lang_goals.append(self.lang_template.format(color=corner_colors[i]))```
 END


Prompt:
 "color-coordinated-insertion-and-corner-pyramid". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "color-coordinated-insertion-and-corner-pyramid" in a python code block.
###

Response:
 color-coordinated-insertion-and-corner-pyramid: {'task-name': 'color-coordinated-insertion-and-corner-pyramid', 'task-description': 'On a tabletop, there are four colored ell-shaped blocks (red, blue, green, and yellow) and four fixtures of corresponding colors. The task is to first pick up each ell block and insert it into the fixture of the same color in a specific sequence - red first, then blue, then green, and finally yellow. After the successful insertion, the robot must pick up the four blocks again from the fixtures and stack them in a corner-structured pyramid with red at the bottom, blue in the middle, green on the third level, and yellow on top.', 'assets-used': ['insertion/ell.urdf', 'insertion/fixture.urdf', 'corner/corner-template.urdf']}```

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

class ColorCoordinatedInsertionAndCornerPyramid(Task):
    """Pick up each ell block and insert it into the fixture of the same color in a specific sequence - red first, then blue, then green, and finally yellow. After the successful insertion, the robot must pick up the four blocks again from the fixtures and stack them in a corner-structured pyramid with red at the bottom, blue in the middle, green on the third level, and yellow on top."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "insert the {color} block into the {color} fixture and then stack them in a corner-structured pyramid in the order of red, blue, green, and yellow"
        self.task_completed_desc = "done inserting and stacking."
        self.additional_reset()

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

        # Define colors and corresponding names
        colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow']]
        color_names = ['red', 'blue', 'green', 'yellow']

        # Add fixtures and blocks.
        fixture_size = (0.04, 0.04, 0.04)
        block_size = (0.04, 0.04, 0.04)
        fixture_urdf = 'insertion/fixture.urdf'
        block_urdf = 'insertion/ell.urdf'

        fixtures = []
        blocks = []
        for i in range(4):
            # Add fixture
            fixture_pose = self.get_random_pose(env, fixture_size)
            fixture_id = env.add_object(fixture_urdf, fixture_pose, color=colors[i])
            fixtures.append(fixture_id)

            # Add block
            block_pose = self.get_random_pose(env, block_size)
            block_id = env.add_object(block_urdf, block_pose, color=colors[i])
            blocks.append(block_id)

        # Goal: each block is inserted into the fixture of the same color in the order of red, blue, green, yellow.
        for i in range(4):
            self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[fixture_pose], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1 / 4)
            self.lang_goals.append(self.lang_template.format(color=color_names[i]))

        # Goal: blocks are stacked in a corner-structured pyramid in the order of red, blue, green, yellow.
        corner_template = 'corner/corner-template.urdf'
        corner_size = (0.12, 0.12, 0.12)
        corner_pose = self.get_random_pose(env, corner_size)
        env.add_object(corner_template, corner_pose, 'fixed')

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

        for i in range(4):
            self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[targs[i]], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1 / 4)
            self.lang_goals.append(self.lang_template.format(color=color_names[i]))```
 END


Prompt:
 "color-coordinated-sphere-and-cylinder-stack". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "color-coordinated-sphere-and-cylinder-stack" in a python code block.
###

Response:
 color-coordinated-sphere-and-cylinder-stack: {'task-name': 'color-coordinated-sphere-and-cylinder-stack', 'task-description': 'On the tabletop, there are four differently colored spheres (red, blue, green, and yellow) and four cylinders of the same colors. The task involves picking up each cylinder and stacking it on top of the sphere of the same color. However, the stacking should be done in a specific color sequence - blue at the bottom, followed by yellow, then green, and finally red at the top. This task enforces challenging skills due to the precision required for stacking the cylinders on top of spheres, color coordination, and sequencing.', 'assets-used': ['sphere/sphere-template.urdf', 'cylinder/cylinder-template.urdf']}```

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

class ColorCoordinatedSphereAndCylinderStack(Task):
    """Stack cylinders on top of spheres of the same color in a specific color sequence."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "stack the {color} cylinder on top of the {color} sphere"
        self.task_completed_desc = "done stacking."
        self.additional_reset()

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

        # Define the color sequence
        color_sequence = ['blue', 'yellow', 'green', 'red']

        # Add spheres and cylinders of each color
        sphere_urdf = 'sphere/sphere-template.urdf'
        cylinder_urdf = 'cylinder/cylinder-template.urdf'
        sphere_size = (0.05, 0.05, 0.05)
        cylinder_size = (0.05, 0.05, 0.1)

        objects = []
        for color in color_sequence:
            # Add sphere
            sphere_pose = self.get_random_pose(env, sphere_size)
            sphere_id = env.add_object(sphere_urdf, sphere_pose, color=utils.COLORS[color])
            objects.append(sphere_id)

            # Add cylinder
            cylinder_pose = self.get_random_pose(env, cylinder_size)
            cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=utils.COLORS[color])
            objects.append(cylinder_id)

        # Goal: each cylinder is stacked on top of the sphere of the same color
        for i in range(0, len(objects), 2):
            sphere_id = objects[i]
            cylinder_id = objects[i+1]
            self.add_goal(objs=[cylinder_id], matches=np.ones((1, 1)), targ_poses=[sphere_pose], replace=False,
                          rotations=True, metric='pose', params=None, step_max_reward=1/4)
            self.lang_goals.append(self.lang_template.format(color=color_sequence[i//2]))```
 END


Prompt:
 "color-coordinated-blocks-in-cylindrical-maze". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "color-coordinated-blocks-in-cylindrical-maze" in a python code block.
###

Response:
 color-coordinated-blocks-in-cylindrical-maze: {'task-name': 'color-coordinated-blocks-in-cylindrical-maze', 'task-description': 'There are six differently colored blocks (red, blue, green, yellow, orange, and purple) and six cylindrical containers of matching colors arranged to form a maze-like structure. The task is to pick up each block and place it into the cylindrical container of the same color. The challenge lies in the precise navigation through the maze-like structure, correct color matching, and accurate placement of the blocks into the cylindrical containers.', 'assets-used': ['block/block.urdf', 'cylinder/cylinder-template.urdf']}```

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

class ColorCoordinatedBlocksInCylindricalMaze(Task):
    """Navigate through a maze-like structure and place colored blocks into matching colored cylindrical containers."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "place the {color} block in the {color} cylinder"
        self.task_completed_desc = "done placing blocks in cylinders."
        self.additional_reset()

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

        # Define colors for blocks and cylinders
        colors = ['red', 'blue', 'green', 'yellow', 'orange', 'purple']

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

        # Add cylinders.
        # x, y, z dimensions for the asset size
        cylinder_size = (0.05, 0.05, 0.1)
        cylinder_urdf = 'cylinder/cylinder-template.urdf'
        cylinders = []
        for color in colors:
            cylinder_pose = self.get_random_pose(env, cylinder_size)
            cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=color)
            cylinders.append(cylinder_id)

        # Goal: each block is in a cylinder of the same color.
        for i in range(len(blocks)):
            self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[cylinder_pose], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1 / len(blocks))
            self.lang_goals.append(self.lang_template.format(color=colors[i]))```
 END


Prompt:
 "color-coordinated-cylinder-relay". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "color-coordinated-cylinder-relay" in a python code block.
###

Response:
 color-coordinated-cylinder-relay: {'task-name': 'color-coordinated-cylinder-relay', 'task-description': 'On the tabletop, there are four cylinders of different colors (red, blue, green, yellow) placed at one end and four zones of matching colors at the other end, with a square outline and small blocks serving as barriers between the cylinders and zones. The task is to pick up each cylinder and navigate it through the barriers to reach and place it in the zone of the same color. The task must be done in a specific sequence - red first, then blue, then green, and finally yellow. This task is challenging due to the requirement for precise navigation and placement, color coordination, and sequence following.', 'assets-used': ['cylinder/cylinder-template.urdf', 'zone/zone.urdf', 'square/square-template.urdf', 'block/small.urdf']}```

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

class ColorCoordinatedCylinderRelay(Task):
    """Pick up each cylinder and navigate it through the barriers to reach and place it in the zone of the same color."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "move the {color} cylinder to the {color} zone"
        self.task_completed_desc = "done moving cylinders."
        self.colors = ['red', 'blue', 'green', 'yellow']
        self.color_order = {'red': 0, 'blue': 1, 'green': 2, 'yellow': 3}
        self.additional_reset()

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

        # Add zones.
        zone_size = (0.12, 0.12, 0)
        zone_urdf = 'zone/zone.urdf'
        zone_poses = []
        for color in self.colors:
            zone_pose = self.get_random_pose(env, zone_size)
            env.add_object(zone_urdf, zone_pose, 'fixed', color=utils.COLORS[color])
            zone_poses.append(zone_pose)

        # Add cylinders.
        cylinder_size = (0.04, 0.04, 0.04)
        cylinder_urdf = 'cylinder/cylinder-template.urdf'
        cylinders = []
        for color in self.colors:
            cylinder_pose = self.get_random_pose(env, cylinder_size)
            cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=utils.COLORS[color])
            cylinders.append(cylinder_id)

        # Add barriers.
        barrier_size = (0.02, 0.02, 0.02)
        barrier_urdf = 'block/small.urdf'
        for _ in range(10):
            barrier_pose = self.get_random_pose(env, barrier_size)
            env.add_object(barrier_urdf, barrier_pose, 'fixed')

        # Goal: each cylinder is in the zone of the same color.
        for i in range(len(cylinders)):
            self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[zone_poses[i]], replace=False,
                          rotations=True, metric='pose', params=None, step_max_reward=1/len(cylinders))
            self.lang_goals.append(self.lang_template.format(color=self.colors[i]))

    def get_reward(self, obs, action=None):
        reward, terminate = super().get_reward(obs, action)
        if terminate:
            # Check if cylinders are in the correct order in their zones.
            object_positions = obs['object_positions']
            object_colors = obs['object_colors']
            zone_positions = obs['zone_positions']
            zone_colors = obs['zone_colors']
            for i in range(len(object_positions)):
                if object_colors[i] != zone_colors[i]:
                    return 0, False
                if self.color_order[object_colors[i]] != i:
                    return 0, False
        return reward, terminate```
 END


Prompt:
 "color-coordinated-cylinder-maze". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "color-coordinated-cylinder-maze" in a python code block.
###

Response:
 color-coordinated-cylinder-maze: {'task-name': 'color-coordinated-cylinder-maze', 'task-description': 'On the tabletop, there is a maze-like structure created by small blocks and within this maze, there are four differently colored cylinders (red, blue, green, yellow). The robot needs to pick up each cylinder and place it outside of the maze into four separate zones of matching colors. The task is challenging due to the precise navigation required within the maze, the color coordination of cylinders and zones, and the careful extraction of cylinders from the maze.', 'assets-used': ['block/small.urdf', 'cylinder/cylinder-template.urdf', 'zone/zone.urdf']}```

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

class ColorCoordinatedCylinderMaze(Task):
    """Navigate through a maze, pick up colored cylinders and place them in matching colored zones."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "navigate through the maze, pick up the {color} cylinder and place it in the {color} zone"
        self.task_completed_desc = "done navigating and placing cylinders."
        self.additional_reset()

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

        # Add maze blocks.
        block_urdf = 'block/small.urdf'
        block_size = (0.04, 0.04, 0.04)
        for _ in range(20):
            block_pose = self.get_random_pose(env, block_size)
            env.add_object(block_urdf, block_pose, category='fixed')

        # Add colored cylinders.
        cylinder_urdf = 'cylinder/cylinder-template.urdf'
        cylinder_size = (0.04, 0.04, 0.04)
        colors = ['red', 'blue', 'green', 'yellow']
        cylinders = []
        for color in colors:
            cylinder_pose = self.get_random_pose(env, cylinder_size)
            cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=color)
            cylinders.append(cylinder_id)

        # Add colored zones.
        zone_urdf = 'zone/zone.urdf'
        zone_size = (0.12, 0.12, 0)
        zones = []
        for color in colors:
            zone_pose = self.get_random_pose(env, zone_size)
            zone_id = env.add_object(zone_urdf, zone_pose, color=color, category='fixed')
            zones.append(zone_id)

        # Goal: each colored cylinder is in the matching colored zone.
        for i in range(len(cylinders)):
            self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[zone_pose], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1 / len(cylinders))
            self.lang_goals.append(self.lang_template.format(color=colors[i]))```
 END


Prompt:
 "insertion-path-obstacle-course". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "insertion-path-obstacle-course" in a python code block.
###

Response:
 insertion-path-obstacle-course: {'task-name': 'insertion-path-obstacle-course', 'task-description': 'On the tabletop, there are four colored ell-shaped blocks (red, blue, green, and yellow) and four fixtures of matching colors. However, a line of small blocks forms a path that the robot must navigate along to insert each ell block into the fixture of the same color. The robot must move each ell block along the marked path to reach the fixture. The order for the insertion should be red, blue, green, and finally yellow from left to right. The task is challenging due to the precision required for insertion, the careful navigation along the path, and the color coordination.', 'assets-used': ['block/small.urdf', 'insertion/ell.urdf', 'insertion/fixture.urdf']}```

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

class InsertionPathObstacleCourse(Task):
    """Navigate a robot along a path to insert colored ell blocks into matching fixtures."""

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

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

        # Ell block and fixture colors.
        colors = ['red', 'blue', 'green', 'yellow']

        # Add ell blocks and fixtures.
        ell_size = (0.04, 0.04, 0.04)
        ell_urdf = 'insertion/ell.urdf'
        fixture_size = (0.04, 0.04, 0.04)
        fixture_urdf = 'insertion/fixture.urdf'

        ell_blocks = []
        fixtures = []
        for color in colors:
            # Add ell block
            ell_pose = self.get_random_pose(env, ell_size)
            ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[color])
            ell_blocks.append(ell_id)

            # Add fixture
            fixture_pose = self.get_random_pose(env, fixture_size)
            fixture_id = env.add_object(fixture_urdf, fixture_pose, color=utils.COLORS[color])
            fixtures.append(fixture_id)

        # Add small blocks to form a path
        small_block_size = (0.02, 0.02, 0.02)
        small_block_urdf = 'block/small.urdf'
        for _ in range(10):
            small_block_pose = self.get_random_pose(env, small_block_size)
            env.add_object(small_block_urdf, small_block_pose)

        # Goal: each ell block is inserted into the fixture of the same color.
        for i in range(len(colors)):
            self.add_goal(objs=[ell_blocks[i]], matches=np.ones((1, 1)), targ_poses=[fixture_pose], replace=False,
                          rotations=True, metric='pose', params=None, step_max_reward=1/len(colors))
            self.lang_goals.append(self.lang_template.format(color=colors[i]))```
 END


Prompt:
 "color-coordinated-sphere-and-bowl-match". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "color-coordinated-sphere-and-bowl-match" in a python code block.
###

Response:
 color-coordinated-sphere-and-bowl-match: {'task-name': 'color-coordinated-sphere-and-bowl-match', 'task-description': 'On a tabletop, there are four bowls and four spheres of different sizes and colors (red, blue, green, and yellow). The task is to pick up each sphere and place it into the bowl of the same color. The challenge lies in the precision necessary for placement, the color coordination, and the size disparity between the spheres and bowls.', 'assets-used': ['sphere/sphere-template.urdf', 'bowl/bowl.urdf']}```

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

class ColorCoordinatedSphereAndBowlMatch(Task):
    """Pick up each sphere and place it into the bowl of the same color."""

    def __init__(self):
        super().__init__()
        self.max_steps = 4
        self.lang_template = "place the {color} sphere in the {color} bowl"
        self.task_completed_desc = "done placing spheres in bowls."
        self.additional_reset()

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

        # Define colors
        colors = ['red', 'blue', 'green', 'yellow']

        # Add bowls and spheres.
        # x, y, z dimensions for the asset size
        bowl_size = (0.12, 0.12, 0)
        sphere_size = (0.04, 0.04, 0.04)
        bowl_urdf = 'bowl/bowl.urdf'
        sphere_urdf = 'sphere/sphere-template.urdf'

        objs = []
        for color in colors:
            # Add bowl
            bowl_pose = self.get_random_pose(env, obj_size=bowl_size)
            bowl_id = env.add_object(bowl_urdf, bowl_pose, color=utils.COLORS[color], category='fixed')

            # Add sphere
            sphere_pose = self.get_random_pose(env, obj_size=sphere_size)
            sphere_id = env.add_object(sphere_urdf, sphere_pose, color=utils.COLORS[color])
            objs.append((sphere_id, bowl_id))

            # Add goal
            self.add_goal(objs=[sphere_id], matches=np.ones((1, 1)), targ_poses=[bowl_pose], replace=False,
                    rotations=True, metric='pose', params=None, step_max_reward=1 / 4)
            self.lang_goals.append(self.lang_template.format(color=color))```
 END


Prompt:
 "color-coordinated-pallet-insertion". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "color-coordinated-pallet-insertion" in a python code block.
###

Response:
 color-coordinated-pallet-insertion: {'task-name': 'color-coordinated-pallet-insertion', 'task-description': 'On the tabletop, there are four pallets and four ell objects of different colors (red, blue, green, yellow). Each color has one pallet and one ell object. The task is to pick up each ell object and insert it into the pallet of the same color. However, the pallets and the ell objects are initially positioned on opposite sides of a barrier formed by a line of small blocks. The robot needs to transport the ell objects over the barrier and insert them into the corresponding pallets without knocking over any blocks. The challenge lies in the precise navigation, the insertion of the ell objects into the pallets, and color matching.', 'assets-used': ['pallet/pallet.urdf', 'insertion/ell.urdf', 'block/small.urdf']}```

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

class ColorCoordinatedPalletInsertion(Task):
    """Pick up each ell object and insert it into the pallet of the same color."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "insert the {color} ell into the {color} pallet"
        self.task_completed_desc = "done inserting ells into pallets."
        self.additional_reset()

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

        # Colors for the ell objects and pallets
        colors = ['red', 'blue', 'green', 'yellow']

        # Add pallets.
        # x, y, z dimensions for the asset size
        pallet_size = (0.12, 0.12, 0.02)
        pallet_urdf = 'pallet/pallet.urdf'
        pallet_poses = []
        for color in colors:
            pallet_pose = self.get_random_pose(env, pallet_size)
            env.add_object(pallet_urdf, pallet_pose, category='fixed', color=utils.COLORS[color])
            pallet_poses.append(pallet_pose)

        # Add ell objects.
        # x, y, z dimensions for the asset size
        ell_size = (0.04, 0.04, 0.04)
        ell_urdf = 'insertion/ell.urdf'
        ells = []
        for color in colors:
            ell_pose = self.get_random_pose(env, ell_size)
            ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[color])
            ells.append(ell_id)

        # Add barrier of small blocks.
        # x, y, z dimensions for the asset size
        block_size = (0.02, 0.02, 0.02)
        block_urdf = 'block/small.urdf'
        for _ in range(10):
            block_pose = self.get_random_pose(env, block_size)
            env.add_object(block_urdf, block_pose, category='fixed')

        # Goal: each ell object is in the pallet of the same color.
        for i in range(len(ells)):
            self.add_goal(objs=[ells[i]], matches=np.ones((1, 1)), targ_poses=[pallet_poses[i]], replace=False,
                rotations=True, metric='pose', params=None, step_max_reward=1/len(ells))
            self.lang_goals.append(self.lang_template.format(color=colors[i]))```
 END


Prompt:
 "color-coordinated-insertion-and-stack". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "color-coordinated-insertion-and-stack" in a python code block.
###

Response:
 color-coordinated-insertion-and-stack: {'task-name': 'color-coordinated-insertion-and-stack', 'task-description': 'The task begins with four colored ell-shaped blocks (red, blue, green, yellow) and four fixtures of corresponding colors. The robot must pick up each ell block and insert it into the fixture of the same color in a specific sequence - red first, then blue, then green, and finally yellow. After successful insertion, the robot must pick up the four blocks again from the fixtures and stack them in a pallet to form a pyramid with red at the bottom, blue in the middle, green on the third level, and yellow on top.', 'assets-used': ['insertion/ell.urdf', 'insertion/fixture.urdf', 'pallet/pallet.urdf']}```

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

class ColorCoordinatedInsertionAndStack(Task):
    """Insert colored ell blocks into fixtures and then stack them in a pallet to form a pyramid."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "insert the {color} ell block into the fixture and then stack it on the pallet"
        self.task_completed_desc = "done inserting and stacking."
        self.additional_reset()

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

        # Define colors and their sequence
        colors = ['red', 'blue', 'green', 'yellow']

        # Add fixtures.
        fixture_size = (0.1, 0.1, 0.1)
        fixture_urdf = 'insertion/fixture.urdf'
        fixture_poses = []
        for i in range(4):
            fixture_pose = self.get_random_pose(env, fixture_size)
            env.add_object(fixture_urdf, fixture_pose, color=utils.COLORS[colors[i]], category='fixed')
            fixture_poses.append(fixture_pose)

        # Add ell blocks.
        ell_size = (0.08, 0.08, 0.02)
        ell_urdf = 'insertion/ell.urdf'
        ells = []
        for i in range(4):
            ell_pose = self.get_random_pose(env, ell_size)
            ell_id = env.add_object(ell_urdf, ell_pose, color=utils.COLORS[colors[i]])
            ells.append(ell_id)

        # Add pallet.
        pallet_size = (0.15, 0.15, 0.02)
        pallet_pose = self.get_random_pose(env, pallet_size)
        env.add_object('pallet/pallet.urdf', pallet_pose, 'fixed')

        # Goal: each ell block is inserted into the fixture of the same color and then stacked on the pallet.
        for i in range(4):
            self.add_goal(objs=[ells[i]], matches=np.ones((1, 1)), targ_poses=[fixture_poses[i]], replace=False,
                          rotations=True, metric='pose', params=None, step_max_reward=1 / 4)
            self.lang_goals.append(self.lang_template.format(color=colors[i]))

        # After insertion, stack the blocks on the pallet in the color sequence.
        stack_poses = [(0, 0, 0.02), (0, 0, 0.06), (0, 0, 0.10), (0, 0, 0.14)]
        targs = [(utils.apply(pallet_pose, i), pallet_pose[1]) for i in stack_poses]
        for i in range(4):
            self.add_goal(objs=[ells[i]], matches=np.ones((1, 1)), targ_poses=[targs[i]], replace=False,
                          rotations=True, metric='pose', params=None, step_max_reward=1 / 4)```
 END


Prompt:
 "cylinder-ring-stack". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "cylinder-ring-stack" in a python code block.
###

Response:
 cylinder-ring-stack: {'task-name': 'cylinder-ring-stack', 'task-description': 'On the tabletop, there are four differently colored cylinders (red, blue, green, yellow) and four blocks of matching colors. The task involves picking up each block and stacking it on top of the corresponding colored cylinder. However, each cylinder and block pair should be stacked inside a differently colored container (color sequence: red cylinder and block in blue container, blue in green, green in yellow, and yellow in red). The task offers challenges in multi-object manipulation, color coordination, and precise stacking in a confined space.', 'assets-used': ['cylinder/cylinder-template.urdf', 'block/block.urdf', 'container/container-template.urdf']}```

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

class CylinderRingStack(Task):
    """Pick up each block and stack it on top of the corresponding colored cylinder.
    Each cylinder and block pair should be stacked inside a differently colored container."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "stack the {color} block on the {color} cylinder in the {container_color} container"
        self.task_completed_desc = "done stacking."
        self.additional_reset()

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

        # Define colors for cylinders, blocks and containers
        colors = ['red', 'blue', 'green', 'yellow']
        container_colors = ['blue', 'green', 'yellow', 'red']

        # Add cylinders.
        cylinder_size = (0.04, 0.04, 0.04)
        cylinder_urdf = 'cylinder/cylinder-template.urdf'
        cylinders = []
        for i in range(4):
            cylinder_pose = self.get_random_pose(env, cylinder_size)
            cylinder_id = env.add_object(cylinder_urdf, cylinder_pose, color=utils.COLORS[colors[i]])
            cylinders.append(cylinder_id)

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

        # Add containers.
        container_size = (0.12, 0.12, 0.12)
        container_urdf = 'container/container-template.urdf'
        containers = []
        for i in range(4):
            container_pose = self.get_random_pose(env, container_size)
            container_id = env.add_object(container_urdf, container_pose, color=utils.COLORS[container_colors[i]])
            containers.append(container_id)

        # Goal: each block is stacked on the corresponding colored cylinder inside a differently colored container.
        for i in range(4):
            self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[cylinder_pose], replace=False,
                          rotations=True, metric='pose', params=None, step_max_reward=1/4)
            self.lang_goals.append(self.lang_template.format(color=colors[i], container_color=container_colors[i]))```
 END


Prompt:
 "color-coordinated-sphere-on-pallet-pyramid". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "color-coordinated-sphere-on-pallet-pyramid" in a python code block.
###

Response:
 color-coordinated-sphere-on-pallet-pyramid: {'task-name': 'color-coordinated-sphere-on-pallet-pyramid', 'task-description': 'On the tabletop, there are three pallets and nine blocks of three different colors (red, blue, green). Each color has three blocks and the blocks are scattered randomly on the table. The task is to pick up the blocks and stack them on the pallets to form a pyramid shape. Each pyramid should contain blocks of the same color with two blocks on the base and one block on top. Additionally, there are three spheres of matching colors (red, blue, green). The task is to pick up each sphere and place it on top of the corresponding colored pyramid. The pallets with the pyramids and spheres should be arranged in a straight line in the following color order: red, blue, green from left to right. The challenge lies in the color coordination, precise stacking, and the arrangement of the pallets.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf', 'sphere/sphere.urdf']}```

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

class ColorCoordinatedSphereOnPalletPyramid(Task):
    """Build a pyramid of colored blocks on pallets and place a matching colored sphere on top."""

    def __init__(self):
        super().__init__()
        self.max_steps = 15
        self.lang_template = "build a pyramid of {color} blocks on the pallet and place the {color} sphere on top"
        self.task_completed_desc = "done building color-coordinated pyramids."
        self.additional_reset()

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

        # Pallets and Blocks
        pallet_size = (0.15, 0.15, 0.01)
        block_size = (0.04, 0.04, 0.04)
        pallet_urdf = 'pallet/pallet.urdf'
        block_urdf = 'block/block.urdf'

        # Colors for blocks and spheres
        colors = ['red', 'blue', 'green']
        color_objects = {}

        # Add pallets and blocks
        for color in colors:
            # Add pallet
            pallet_pose = self.get_random_pose(env, pallet_size)
            env.add_object(pallet_urdf, pallet_pose, category='fixed')

            # Add blocks
            block_ids = []
            for _ in range(3):
                block_pose = self.get_random_pose(env, block_size)
                block_id = env.add_object(block_urdf, block_pose, color=utils.COLORS[color])
                block_ids.append(block_id)

            color_objects[color] = {'pallet': pallet_pose, 'blocks': block_ids}

        # Spheres
        sphere_size = (0.04, 0.04, 0.04)
        sphere_urdf = 'sphere/sphere.urdf'

        # Add spheres
        for color in colors:
            sphere_pose = self.get_random_pose(env, sphere_size)
            sphere_id = env.add_object(sphere_urdf, sphere_pose, color=utils.COLORS[color])
            color_objects[color]['sphere'] = sphere_id

        # Goals
        for color in colors:
            # Goal: blocks are stacked in a pyramid on the pallet
            block_poses = [(0, -0.02, 0.02), (0, 0.02, 0.02), (0, 0, 0.06)]
            targs = [(utils.apply(color_objects[color]['pallet'], i), color_objects[color]['pallet'][1]) for i in block_poses]

            self.add_goal(objs=color_objects[color]['blocks'], matches=np.ones((3, 3)), targ_poses=targs, replace=False,
                    rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2]*3)

            # Goal: sphere is placed on top of the pyramid
            sphere_pose = (0, 0, 0.1)
            targ = (utils.apply(color_objects[color]['pallet'], sphere_pose), color_objects[color]['pallet'][1])

            self.add_goal(objs=[color_objects[color]['sphere']], matches=np.ones((1, 1)), targ_poses=[targ], replace=False,
                    rotations=True, metric='pose', params=None, step_max_reward=1 / 2, symmetries=[np.pi/2])

            self.lang_goals.append(self.lang_template.format(color=color))```
 END


Prompt:
 "color-coordinated-stacked-block-bowls". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "color-coordinated-stacked-block-bowls" in a python code block.
###

Response:
 color-coordinated-stacked-block-bowls: {'task-name': 'color-coordinated-stacked-block-bowls', 'task-description': 'There are three bowls and nine blocks of three different colors (red, blue, green) on the tabletop. Each color has three blocks. The task is to pick up these blocks and stack them inside the bowls in the shape of a pyramid. Each bowl should contain blocks of the same color with two blocks at the base and one block on top. The bowls with the pyramids should be arranged in a straight line in the following color order: red, blue, and green from left to right. The challenge lies in the color coordination, precise stacking, and the arrangement of the bowls.', 'assets-used': ['bowl/bowl.urdf', 'block/block.urdf']}```

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

class ColorCoordinatedStackedBlockBowls(Task):
    """Stack blocks of the same color in bowls in the shape of a pyramid and arrange the bowls in a color sequence"""

    def __init__(self):
        super().__init__()
        self.max_steps = 15
        self.lang_template = "stack the {color} blocks in the {color} bowl in the shape of a pyramid"
        self.task_completed_desc = "done stacking blocks in bowls."
        self.additional_reset()

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

        # Define colors for blocks and bowls
        colors = ['red', 'blue', 'green']

        # Add bowls.
        # x, y, z dimensions for the asset size
        bowl_size = (0.12, 0.12, 0)
        bowl_urdf = 'bowl/bowl.urdf'
        bowl_poses = []
        for i in range(3):
            bowl_pose = self.get_random_pose(env, bowl_size)
            env.add_object(bowl_urdf, bowl_pose, category='fixed', color=utils.COLORS[colors[i]])
            bowl_poses.append(bowl_pose)

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

        # Associate placement locations for goals.
        place_pos = [(0, -0.05, 0.03), (0, 0, 0.03),
                     (0, 0.05, 0.03), (0, -0.025, 0.08),
                     (0, 0.025, 0.08), (0, 0, 0.13)]
        targs = [(utils.apply(bowl_poses[i//3], place_pos[i%3]), bowl_poses[i//3][1]) for i in range(9)]

        # Goal: blocks are stacked in a pyramid in each bowl
        for i in range(9):
            self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[targs[i]], replace=False,
                    rotations=True, metric='pose', params=None, step_max_reward=1 / 9)
            self.lang_goals.append(self.lang_template.format(color=colors[i//3]))```
 END


Prompt:
 "color-sequenced-sphere-placement". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "color-sequenced-sphere-placement" in a python code block.
###

Response:
 color-sequenced-sphere-placement: {'task-name': 'color-sequenced-sphere-placement', 'task-description': 'On the tabletop, there are four spheres of different colors (red, blue, green, and yellow) and four colored squares of matching colors. The task involves picking up each sphere and precisely placing it in the center of the square of the same color. However, the spheres must be placed in a specific sequence - red first, then blue, then green, and finally yellow. The task is challenging due to the need for precise placement, color coordination, and sequence following.', 'assets-used': ['sphere/sphere.urdf', 'square/square-template.urdf']}```

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

class ColorSequencedSpherePlacement(Task):
    """Pick up spheres of different colors and place them in the center of the square of the same color in a specific sequence."""

    def __init__(self):
        super().__init__()
        self.max_steps = 20
        self.lang_template = "place the {color} sphere in the {color} square"
        self.task_completed_desc = "done placing spheres."
        self.additional_reset()

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

        # Define colors and their sequence
        colors = ['red', 'blue', 'green', 'yellow']

        # Add squares of different colors
        square_size = (0.1, 0.1, 0.005)
        square_urdf = 'square/square-template.urdf'
        square_poses = []
        for color in colors:
            square_pose = self.get_random_pose(env, square_size)
            env.add_object(square_urdf, square_pose, 'fixed', color=color)
            square_poses.append(square_pose)

        # Add spheres of different colors
        sphere_size = (0.04, 0.04, 0.04)
        sphere_urdf = 'sphere/sphere.urdf'
        spheres = []
        for color in colors:
            sphere_pose = self.get_random_pose(env, sphere_size)
            sphere_id = env.add_object(sphere_urdf, sphere_pose, color=color)
            spheres.append(sphere_id)

        # Goal: each sphere is in the square of the same color, in the correct sequence
        for i in range(len(colors)):
            self.add_goal(objs=[spheres[i]], matches=np.ones((1, 1)), targ_poses=[square_poses[i]], replace=False,
                          rotations=True, metric='pose', params=None, step_max_reward=1/len(colors))
            self.lang_goals.append(self.lang_template.format(color=colors[i]))```
 END


Prompt:
 "color-sequence-loading-pallet". Format the answer in a python dictionary with keys "task-name", "task-description", and "assets-used". Then write the pybullet simulation code for the task "color-sequence-loading-pallet" in a python code block.
###

Response:
 color-sequence-loading-pallet: {'task-name': 'color-sequence-loading-pallet', 'task-description': 'On a tabletop, there are ten blocks of five different colors (two red, two blue, two green, two yellow, and two orange), and a pallet. The task is to pick up one block of each color and place them onto the pallet in a specific sequence: red, blue, green, yellow, and finally orange. Next, pick up the remaining blocks and stack them on top of the corresponding color in the same sequence. The challenge lies in the precise placement of the blocks and maintaining the load balance on the pallet.', 'assets-used': ['block/block.urdf', 'pallet/pallet.urdf']}```

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

class ColorSequenceLoadingPallet(Task):
    """Pick up blocks of different colors and place them onto the pallet in a specific sequence."""

    def __init__(self):
        super().__init__()
        self.max_steps = 10
        self.lang_template = "place the blocks onto the pallet in the sequence: red, blue, green, yellow, orange"
        self.task_completed_desc = "done placing blocks in sequence."
        self.additional_reset()

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

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

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

        # Add blocks.
        # x, y, z dimensions for the asset size
        block_size = (0.04, 0.04, 0.04)
        block_urdf = 'block/block.urdf'

        objs = []
        for i in range(10):  # two blocks of each color
            block_pose = self.get_random_pose(env, block_size)
            block_id = env.add_object(block_urdf, block_pose, color=colors[i//2])
            objs.append(block_id)

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

        # Goal: blocks are placed on the pallet in the sequence: red, blue, green, yellow, orange.
        for i in range(5):
            self.add_goal(objs=[objs[i]], matches=np.ones((1, 1)), targ_poses=[targs[i]], replace=False,
                          rotations=True, metric='pose', params=None, step_max_reward=1 / 5)
            self.lang_goals.append(self.lang_template.format(color=colors[i]))

        # Goal: remaining blocks are stacked on top of the corresponding color in the same sequence.
        for i in range(5, 10):
            self.add_goal(objs=[objs[i]], matches=np.ones((1, 1)), targ_poses=[targs[i-5]], replace=False,
                          rotations=True, metric='pose', params=None, step_max_reward=1 / 5)
            self.lang_goals.append(self.lang_template.format(color=colors[i-5]))```
 END