Prompt:
color-coordinated-cylinder-stack" in natural languages and format the answer in a python dictionary with keys "task-name" and value type string, "task-description" (one specific sentence) and value type string, and "assets-used" and value type list of strings.

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

###

Response:
 color-coordinated-cylinder-stack: {'task-name': 'color-coordinated-cylinder-stack', 'task-description': 'On the tabletop, there are four colored (red, blue, green, yellow) cylinders and four stands of corresponding colors. The task is to pick up each cylinder and stack it onto the stand of the same color - the red one at the bottom, followed by blue, green, and finally the yellow one at the top.', 'assets-used': ['cylinder/cylinder-template.urdf', 'stacking/stand.urdf']}

###

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

class ColorCoordinatedCylinderStack(Task):
    """Stack cylinders on stands of the same color in a specific order."""

    def __init__(self):
        super().__init__()
        self.max_steps = 10
        self.lang_template = "stack the cylinders on the stands of the same color in the order red, blue, green, yellow"
        self.task_completed_desc = "done stacking cylinders."
        self.additional_reset()

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

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

        # Add stands.
        # x, y, z dimensions for the asset size
        stand_size = (0.04, 0.04, 0.04)
        stand_urdf = 'stacking/stand.urdf'
        stands = []
        for i in range(4):
            stand_pose = self.get_random_pose(env, stand_size)
            stand_id = env.add_object(stand_urdf, stand_pose, color=colors[i])
            stands.append(stand_id)

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

        # Goal: each cylinder is stacked on the stand of the same color in the order red, blue, green, yellow.
        for i in range(4):
            self.add_goal(objs=[cylinders[i]], matches=np.ones((1, 1)), targ_poses=[stand_pose], replace=False,
                    rotations=True, metric='pose', params=None, step_max_reward=1/4)
            self.lang_goals.append(f"Place the {color_names[i]} cylinder on the {color_names[i]} stand.")<|endoftext|>


Prompt:
color-coordinated-container-insertion" in natural languages and format the answer in a python dictionary with keys "task-name" and value type string, "task-description" (one specific sentence) and value type string, and "assets-used" and value type list of strings.

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

###

Response:
 color-coordinated-container-insertion: {'task-name': 'color-coordinated-container-insertion', 'task-description': 'There are three containers and three ell shaped blocks of different colors (red, blue, green) on the table top. The task is to pick up the ell shaped blocks and insert each one of them into the container of the same color. However, the ell blocks should be inserted in a specific sequence - red first, then blue, and finally green. This task is challenging due to the precision required for insertion and the need for color coordination and sequencing.', 'assets-used': ['insertion/ell.urdf', 'container/container-template.urdf']}

###

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

class ColorCoordinatedContainerInsertion(Task):
    """Insert ell shaped blocks into the container of the same color in a specific sequence."""

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

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

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

        # Add ell blocks and containers.
        ell_size = (0.04, 0.04, 0.04)
        ell_urdf = 'insertion/ell.urdf'
        container_size = (0.12, 0.12, 0)
        container_urdf = 'container/container-template.urdf'

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

            # Add container.
            container_pose = self.get_random_pose(env, container_size)
            env.add_object(container_urdf, container_pose, color=utils.COLORS[color], category='fixed')

            # Goal: each ell block is in the container of the same color.
            self.add_goal(objs=[ell_id], matches=np.ones((1, 1)), targ_poses=[container_pose], replace=False,
                          rotations=True, metric='pose', params=None, step_max_reward=1/3)
            self.lang_goals.append(self.lang_template.format(color=color))<|endoftext|>