From ae85450b24123649e6bcaf5487b394f7dfb855ab Mon Sep 17 00:00:00 2001 From: Ottohere-Mourn <3311436628@qq.com> Date: Sun, 7 Jun 2026 15:37:35 +0800 Subject: [PATCH] fix: bound x-offset at both top and bottom in PegInsertionSide success condition Fixes #1391 The success condition for peg insertion only checked the lower x bound, allowing the peg to overshoot past the hole and still be considered successfully inserted. Added an upper bound check so the peg head must be within [-0.015, 0.015] along the insertion axis. --- mani_skill/envs/tasks/tabletop/peg_insertion_side.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mani_skill/envs/tasks/tabletop/peg_insertion_side.py b/mani_skill/envs/tasks/tabletop/peg_insertion_side.py index 4f5a15cd0d..7a9897fb0d 100644 --- a/mani_skill/envs/tasks/tabletop/peg_insertion_side.py +++ b/mani_skill/envs/tasks/tabletop/peg_insertion_side.py @@ -270,7 +270,7 @@ def has_peg_inserted(self): # Only head position is used in fact peg_head_pos_at_hole = (self.box_hole_pose.inv() * self.peg_head_pose).p # x-axis is hole direction - x_flag = -0.015 <= peg_head_pos_at_hole[:, 0] + x_flag = (-0.015 <= peg_head_pos_at_hole[:, 0]) & (peg_head_pos_at_hole[:, 0] <= 0.015) y_flag = (-self.box_hole_radii <= peg_head_pos_at_hole[:, 1]) & ( peg_head_pos_at_hole[:, 1] <= self.box_hole_radii )