File size: 1,252 Bytes
7399b6f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | """Pick a RoboTwin cup and place it in a box (thin-walled vessel: gentle clamp)."""
from ..registry import register_task
from ..envs import YamTaskEnv
from ..solvers import pick_place
from .. import conditions as C
@register_task("cup_box")
class CupBoxTask(YamTaskEnv):
title = "ROBOTWIN CUP -> BOX"
tags = ["pick-place", "robotwin-asset"]
instruction = {"default": "Put the cup in the box."}
cup_spawn = (-0.03, 0.10)
cup_spawn_jitter = (0.02, 0.015)
box_xy = (-0.02, -0.26)
# a thin-walled cup gets crushed through above ~50 and drops out of the jaws
gripper_effort, gripper_damping = 40, 60
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": "rw_cup", "xy": self.cup_spawn, "xy_jitter": self.cup_spawn_jitter})]
def solve(self):
return pick_place.solve(self, obj="rw_cup", target="box", max_gap=0.035)
def evaluate(self):
return self.check(C.labelled("cup in box", C.object_in_region("rw_cup", "box")),
C.labelled("cup lifted", C.object_lifted("rw_cup", 0.05)))
|