mp_yam_code / source /bimanual /yam /tasks /can_box.py
yqi19's picture
YAM bimanual task suite: env, solvers, tasks, converters
7399b6f verified
Raw
History Blame Contribute Delete
1.25 kB
"""Pick a can and place it in a box."""
from ..registry import register_task
from ..envs import YamTaskEnv
from ..solvers import pick_place
from .. import conditions as C
@register_task("can_box")
class CanBoxTask(YamTaskEnv):
title = "CAN -> BOX"
tags = ["pick-place", "primitive-container"]
instruction = {"default": "Put the can in the box."}
can_spawn = (-0.03, 0.10)
can_spawn_jitter = (0.025, 0.015)
# an 11 cm can is released ~6 cm higher than a grape, so the box must sit closer in
# or the carry ends outside the arm's comfortable envelope
box_xy = (-0.02, -0.24)
gripper_effort, gripper_damping = 75, 85
def _load_scene(self):
self.scene.build_box({"name": "box", "xy": self.box_xy, "xy_jitter": (0.02, 0.02),
"span": 0.26, "wall_h": 0.05})
self._placed = [self.scene.place_object(
{"name": "can", "xy": self.can_spawn, "xy_jitter": self.can_spawn_jitter})]
def solve(self):
return pick_place.solve(self, obj="can", target="box")
def evaluate(self):
return self.check(C.labelled("can in box", C.object_in_region("can", "box")),
C.labelled("can lifted", C.object_lifted("can", 0.05)))