File size: 1,418 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 33 34 35 36 | """Pick a grape cluster and place it in a wooden box."""
from ..registry import register_task
from ..envs import YamTaskEnv
from ..solvers import pick_place
from .. import conditions as C
@register_task("grape_box")
class GrapeBoxTask(YamTaskEnv):
title = "GRAPE -> BOX"
tags = ["pick-place", "primitive-container"]
instruction = {"default": "Put the grape in the box.",
"specific": "Pick up the grape cluster and place it inside the wooden box."}
# --- task constants (ManiSkill keeps these as class attrs too) ---
grape_spawn = (-0.03, 0.10)
grape_spawn_jitter = (0.025, 0.015)
box_xy = (-0.02, -0.26)
box_jitter = (0.02, 0.02)
box_span = 0.26
lift_height = 0.16
gripper_effort, gripper_damping = 75, 85
def _load_scene(self):
self.scene.build_box({"name": "box", "xy": self.box_xy, "xy_jitter": self.box_jitter,
"span": self.box_span, "wall_h": 0.05})
self._placed = [self.scene.place_object(
{"name": "grape", "xy": self.grape_spawn, "xy_jitter": self.grape_spawn_jitter})]
def solve(self):
return pick_place.solve(self, obj="grape", target="box", lift=self.lift_height)
def evaluate(self):
return self.check(C.labelled("grape in box", C.object_in_region("grape", "box")),
C.labelled("grape lifted", C.object_lifted("grape", 0.05)))
|