| """Drop a ring over a standing post (RLBench put_ring_on_peg / classic peg-and-ring). |
| |
| Inverse of peg insertion: the hole is in the *held* object and the fixture is the obstacle. The |
| ring has to clear the post's tip before it can descend, so the carry has to go high and the |
| alignment has to be good to within the ring's radial clearance. |
| """ |
| from ..registry import register_task |
| from ..envs import YamTaskEnv |
| from ..solvers import insert |
| from .. import conditions as C |
|
|
|
|
| @register_task("ring_post") |
| class RingPostTask(YamTaskEnv): |
| title = "PUT THE RING OVER THE POST" |
| tags = ["precision", "insertion", "alignment"] |
| instruction = {"default": "Put the ring over the post."} |
|
|
| |
| |
| |
| rw_objects = {"rw_ring": "custom_ring/base0.usd:1.0:0.05"} |
| |
| |
| ring_xy = (0.03, 0.05) |
| spawn_jitter = (0.020, 0.015) |
| post_xy = (-0.04, -0.16) |
| post_radius = 0.011 |
| post_height = 0.13 |
| post_color = (0.10, 0.35, 0.95) |
| |
| |
| gripper_effort, gripper_damping = 84, 92 |
|
|
| def _load_scene(self): |
| self.scene.build_post({"name": "post", "xy": self.post_xy, "radius": self.post_radius, |
| "height": self.post_height, "base_radius": 0.050, |
| "color": self.post_color, "xy_jitter": (0.012, 0.012)}) |
| self._placed = [self.scene.place_object( |
| {"name": "rw_ring", "xy": self.ring_xy, "xy_jitter": self.spawn_jitter})] |
|
|
| def solve(self): |
| |
| return insert.solve(self, obj="rw_ring", target="post", grasp_top=None, max_gap=0.085) |
|
|
| def evaluate(self): |
| return self.check( |
| C.labelled("ring centred on the post", |
| C.object_moved_to("rw_ring", "post", tol=self.post_radius+0.020)), |
| C.labelled("ring slid down the post rather than hanging on the tip", |
| C.object_settled_on("rw_ring", "post", max_dz=0.035))) |
|
|