| """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) |
| |
| 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))) |
|
|