Add side grasp for wide cups and recalibrate the new fingers' grasp point
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -645,7 +645,7 @@ def make_pick(i, seed):
|
||||
"stall_gap": rng.choice(STALL_GAPS), "err_seed": rng.randrange(1 << 30)}
|
||||
|
||||
|
||||
def pick_at(x, y, top, grip=80.0, gap=0.10, height=110.0, variant="table", stall_gap=0.10, err_seed=0, chair=None):
|
||||
def pick_at(x, y, top, grip=76.0, gap=0.10, height=110.0, variant="table", stall_gap=0.10, err_seed=0, chair=None):
|
||||
"""A fixed pick scene: the cup seen at (x, y) mm in the arm frame (waist at the front, calibrated arm base) with its
|
||||
top at `top`, on a 0.7 x 1.0 m table whose near edge faces the base centre `gap` m before the cup."""
|
||||
yaw, org = CALIB["arm_yaw_in_base_deg"], np.asarray(CALIB["arm_xy_in_base_m"])
|
||||
|
||||
+6
-5
@@ -107,7 +107,7 @@ for yaw in (-60.0, 10.0, 95.0):
|
||||
|
||||
# ---------- fake base, arm, gripper and camera ----------
|
||||
calls = []
|
||||
CUP = {"name": "apple", "colour": "red", "x": -150.0, "y": 600.0, "top_mm": -260.0, "width_mm": 76.0,
|
||||
CUP = {"name": "apple", "colour": "red", "x": -150.0, "y": 600.0, "top_mm": -260.0, "width_mm": 72.0,
|
||||
"seen": 8, "spread": 1.0}
|
||||
hand = {"holding": False, "closed": False}
|
||||
base = {"pose": (0.0, 0.0, 0.0), "polls": 0, "on_poll": None}
|
||||
@@ -518,7 +518,7 @@ skills.reachable_pick = width_check
|
||||
reset()
|
||||
fetch.CALIB_FILE.write_text(json.dumps({"arm_yaw_in_base_deg": -86.2}))
|
||||
wide_far = {**CUP, "name": "cup", "x": -69.0, "y": 1142.0, "width_mm": 98.0}
|
||||
wide_near = {**wide_far, "x": -100.0, "y": 600.0, "width_mm": 79.0}
|
||||
wide_near = {**wide_far, "x": -100.0, "y": 600.0, "width_mm": 72.0} # 80 with SEEN_UNDER_MM: fits from above
|
||||
skills.find = lambda name, colour=None, seen=None: wide_near if any(c[0] == "joy" for c in calls) else wide_far
|
||||
st = run(fetch.start, {**ok, "object": "cup", "source": "here", "dest": "here"})
|
||||
assert st["status"] == "holding" and any("measure it again up close" in l or "closer first" in l for l in st["log"]), \
|
||||
@@ -528,8 +528,8 @@ hand.update(holding=False, closed=False)
|
||||
reset()
|
||||
skills.find = lambda name, colour=None, seen=None: {**wide_near, "width_mm": 95.0}
|
||||
st = run(fetch.start, {**ok, "object": "cup", "source": "here", "dest": "here"})
|
||||
assert st["status"] == "failed" and "too big" in st["log"][-1], st["log"]
|
||||
skills.find, skills.reachable_pick = real_find, real_reach
|
||||
assert st["status"] == "failed" and "too wide for my hand, also lower down" in st["log"][-1], st["log"] # no
|
||||
skills.find, skills.reachable_pick = real_find, real_reach # narrower part measured lower down either
|
||||
skills.reachable_pick = fake_reachable
|
||||
|
||||
# ---------- put it on a named thing: an orange chair too low for the arm -> said why; one at table height -> on it ----
|
||||
@@ -601,7 +601,8 @@ assert fetch.lift_for(-703.0) is None and fetch.lift_for(-1060.0) is None # a
|
||||
# ---------- a turn that would take the arm into something is not made ----------
|
||||
reset()
|
||||
fetch.CALIB_FILE.write_text(json.dumps({"arm_yaw_in_base_deg": -86.2}))
|
||||
room["clear"] = lambda x, y: 0.05 if math.hypot(x, y) > 0.2 else 1.0 # free at the base centre, a wall around it
|
||||
room["clear"] = lambda x, y: 0.05 if math.hypot(x, y) > 0.1 else 1.0 # free at the fake flange (the base
|
||||
# centre), the hand 0.19 m off it in a wall
|
||||
calls.clear()
|
||||
assert fetch._turn(30) is False and not any(c[0] == "go_point" for c in calls), calls
|
||||
room["clear"] = lambda x, y: 1.0
|
||||
|
||||
@@ -158,7 +158,7 @@ def cups():
|
||||
x, y = arm_xy_of(c["map"])
|
||||
if visible(x, y) and low_view(x, y, room["z"] + 145.0 / 2):
|
||||
out.append({"name": "cup", "colour": "white", "x": x, "y": y, "top_mm": room["z"] + 145.0,
|
||||
"height_mm": 145.0, "width_mm": 80.0, "seen": 8, "spread": 1.0, "id": c["id"]})
|
||||
"height_mm": 145.0, "width_mm": 72.0, "seen": 8, "spread": 1.0, "id": c["id"]})
|
||||
return out
|
||||
|
||||
|
||||
|
||||
@@ -23,13 +23,15 @@ MUST = { # name: (scene, cam
|
||||
"18:40 turned -30": (at(260, 722, -186), 0.0),
|
||||
"18:40 turned -30, nearer": (at(300, 621, -191), 0.0),
|
||||
"18:45 straight ahead": (at(-99, 738, -181), 0.0),
|
||||
"far edge on a low table (-450)": (at(262, 774, -330, height=120), 0.0),
|
||||
"sweep 54: low table -432": (ps.make_pick(54, 1), 1.0),
|
||||
"sweep 189: low table -440": (ps.make_pick(189, 1), 1.0),
|
||||
}
|
||||
PHYSICAL = {"18:13 behind a chair": (at(-141, 869, -186, stall_gap=0.25, chair=0.3), 0.0),
|
||||
# out of reach where the camera sees it
|
||||
"far edge on a low table (-450)": (at(262, 774, -330, height=120), 0.0),
|
||||
"sweep 534: behind a chair, low table": (ps.make_pick(534, 1), 1.0)} # was picked turned -30 once
|
||||
OPEN = {}
|
||||
# low tables at the lift's end: a stand off the x = -100 line (fetch.pick_goal tries only that line) would see and reach
|
||||
# the cup, a 5-10 mm deep window
|
||||
OPEN = {"sweep 54: low table -432": (ps.make_pick(54, 1), 1.0),
|
||||
"sweep 189: low table -440": (ps.make_pick(189, 1), 1.0)}
|
||||
|
||||
bad = []
|
||||
for group, scenes in (("must", MUST), ("physical", PHYSICAL), ("open", OPEN)):
|
||||
|
||||
+23
-19
@@ -45,23 +45,25 @@ skills._joints = lambda: list(LOOK)
|
||||
lines = []
|
||||
fetch.log = skills.log = arm_route.log = lambda *a: lines.append(" ".join(str(x) for x in a))
|
||||
cup = lambda x, y, top=-260.0: {"name": "cup", "colour": "grey", "x": float(x), "y": float(y), "top_mm": top,
|
||||
"width_mm": 76.0, "seen": 8, "spread": 1.0}
|
||||
"width_mm": 72.0, "seen": 8, "spread": 1.0}
|
||||
reach = lambda o: skills.reachable_pick(o, accept=fetch._carry_ok)
|
||||
trusted = lambda o: skills.reachable_pick(o, accept=fetch._carry_ok, max_yaw=skills.TRUSTED_YAW_DEG) # fetch's first try
|
||||
|
||||
plan = reach(cup(-96, 598)) # picked live 2026-10-2x 15:39 (J5 +20, no turn)
|
||||
assert plan and abs(skills.yaw_of(plan[0][1][1])) < 1, plan
|
||||
plan = reach(cup(-96, 598)) # picked live 2026-10-2x 15:39 (J5 +20, no turn): now
|
||||
assert plan and round(skills.yaw_of(plan[0][1][1])) == -15, plan # no IK at the grasp unturned there; -15 is trusted
|
||||
for xy in ((-171, 697), (-395, 629), (-480, 652)): # refused live from where it stood: still out of reach
|
||||
assert reach(cup(*xy)) is None, xy # of the arm alone at waist 0 (base moved then)
|
||||
|
||||
# 2026-10-26 18:40 at lift 0: (260, 722) top -186 was planned turned -30 deg, J5 +26 (missed live, as every turn
|
||||
# over 15 deg): offline the same; within the trusted turns there is none from here (the waist or the base first)
|
||||
# over 15 deg). Offline now -30 has no IK at the grasp there: turned -45, J5 +12; within the trusted turns there is
|
||||
# none from here (the waist or the base first)
|
||||
plan = reach(cup(260, 722, -186))
|
||||
assert plan and round(skills.yaw_of(plan[0][1][1])) == -30 and 20 < plan[1][4] < 30, plan
|
||||
assert plan and round(skills.yaw_of(plan[0][1][1])) == -45 and 10 < plan[1][4] < 20, plan
|
||||
assert skills.reachable_pick(cup(260, 722, -186), accept=fetch._carry_ok, max_yaw=skills.TRUSTED_YAW_DEG) is None
|
||||
|
||||
# 17:57 / 18:45: (-104, 694) and (-99, 738) top -186: every straight line to carry refused (a joint jumps); straight up
|
||||
# and one joint move to carry takes the cup there instead (upright, clear of the head)
|
||||
# 17:57 / 18:45: (-104, 694) and (-99, 738) top -186: every straight line to carry refused live (a joint jumps).
|
||||
# With the camera's error fixed both are past the arm's reach from here at this height (it ends near y 660 straight
|
||||
# ahead): a waist turn or the base first (LIVE below)
|
||||
def line_ok(w, ja): # the straight line alone (fetch._carry_ok also takes carry_up)
|
||||
try:
|
||||
fetch._line_rows(kinematics.pose(motion.poses()["carry"]), "to carry", start=(w[0][1], ja))
|
||||
@@ -71,14 +73,14 @@ def line_ok(w, ja): # the straight line
|
||||
for seen in ((-104, 694), (-99, 738)): # seen live before the camera's error was fixed
|
||||
xy = np.add(seen, skills.objects.ROUND_FIX_MM)
|
||||
assert skills.reachable_pick(cup(*xy, -186), accept=line_ok) is None, xy
|
||||
plan = skills.reachable_pick(cup(*xy, -186), accept=lambda w, ja: skills.carry_up(w[0][1], ja) is not None)
|
||||
assert plan, xy
|
||||
via, carry = skills.carry_up(plan[0][0][1], plan[1])
|
||||
assert via[2] > plan[0][0][1][2] and np.allclose(kinematics.pose(carry)[:3], kinematics.pose(motion.poses()["carry"])[:3], atol=0.1)
|
||||
# the live (-104, 694) is (-92, 689) with the camera fixed: 9 mm past the trusted-turn edge; just inside it
|
||||
plan = skills.reachable_pick(cup(-92, 680, -186), accept=lambda w, ja: skills.carry_up(w[0][1], ja) is not None,
|
||||
assert not list(skills.pick_options(cup(*xy, -186), list(LOOK), skills.TRUSTED_YAW_DEG)), xy
|
||||
# just inside the trusted reach: straight up and one joint move to carry takes the cup there too (upright, clear of
|
||||
# the head)
|
||||
plan = skills.reachable_pick(cup(-92, 640, -186), accept=lambda w, ja: skills.carry_up(w[0][1], ja) is not None,
|
||||
max_yaw=skills.TRUSTED_YAW_DEG)
|
||||
assert plan and abs(skills.yaw_of(plan[0][1][1])) <= 15.5, plan
|
||||
via, carry = skills.carry_up(plan[0][0][1], plan[1])
|
||||
assert via[2] > plan[0][0][1][2] and np.allclose(kinematics.pose(carry)[:3], kinematics.pose(motion.poses()["carry"])[:3], atol=0.1)
|
||||
|
||||
# a held IK answer with J4 one turn round (the same pose) is not a joint-limit or flip refusal
|
||||
real_ask = skills._ask
|
||||
@@ -114,8 +116,8 @@ assert np.isclose(np.hypot(*(np.subtract((t["x"], t["y"]), C))), np.hypot(*(np.s
|
||||
assert t["x"] > o["x"] # waist left: a thing on the left comes ahead
|
||||
assert np.allclose([fetch.turned(t, -30.0)[k] for k in "xy"], [o[k] for k in "xy"])
|
||||
|
||||
for r, b in ((600, 60), (600, -60), (550, 90), (600, -100), (720, 7), (720, 25)): # beside it and the live ones
|
||||
# (the live 730 mm one is 1 cm past the trusted reach since the grasp point was fixed, 2026-10-27)
|
||||
for r, b in ((600, 60), (600, -60), (550, 90), (600, -100), (660, 7), (660, 25)): # beside it and near the edge
|
||||
# (the trusted reach round the column ends near 670 mm: the live 730 mm ones are past it)
|
||||
o = around(r, b)
|
||||
assert trusted(o) is None, (r, b) # not from here ...
|
||||
turns = fetch.waist_for(o)
|
||||
@@ -127,10 +129,10 @@ for r, b in ((1000, 0), (950, 40)): # too far for any wa
|
||||
assert all(trusted(fetch.turned(o, d)) is None for d in fetch.waist_for(o)), (r, b)
|
||||
# the live cases of 2026-10-26 with trusted turns only: from here, after a waist turn, or the base moves (none)
|
||||
LIVE = (((262, 774, -189), "base"), ((267, 763, -188), "base"), ((260, 722, -186), "base"), # missed at -45 / -30
|
||||
((300, 621, -191), "waist"), ((-99, 738, -181), "waist"), # missed at -30 / carry line jumped at -30
|
||||
((300, 621, -191), "base"), ((-99, 738, -181), "base"), # missed at -30 / carry line jumped at -30
|
||||
((-141, 869, -186), "base"), ((-117, 960, -186), "base"), # across the table / far
|
||||
((-104, 694, -186), "waist"), ((-73, 588, -186), "here"), ((-96, 598, -260), "here")) # carried / picked
|
||||
# (694: picked from here live; at the trusted-turn edge since the grasp point was fixed, a small waist turn first)
|
||||
# (the trusted reach round the column ends near 670 mm: 621 and 738, ~756 mm from it, need the base; 694 a waist turn)
|
||||
for (x, y, top), how in LIVE: # seen before the camera's error was fixed
|
||||
o = cup(x + skills.objects.ROUND_FIX_MM[0], y + skills.objects.ROUND_FIX_MM[1], top)
|
||||
got = "here" if trusted(o) else "waist" if any(trusted(fetch.turned(o, d)) for d in fetch.waist_for(o)) else "base"
|
||||
@@ -186,8 +188,10 @@ assert fetch._waist_reach(task, scene["cup"], None) is None and any(c[0] == "wai
|
||||
skills._held.clear()
|
||||
skills._held.update(top_mm=-300.0, yaw=0.0, tips=False, below=40.0)
|
||||
opts = list(skills.place_options(200.0, 500.0, -300.0, list(LOOK)))
|
||||
assert opts and all(w[0][0] == "above place (straight)" for w, _ in opts), [w[0][0] for w, _ in opts]
|
||||
way, ja = opts[0]
|
||||
# (one joint move there keeps the cup within MAX_TILT_DEG too: it comes first, the straight lines after it)
|
||||
straight = [(w, ja) for w, ja in opts if w[0][0] == "above place (straight)"]
|
||||
assert straight and all(w[0][0] in ("above place", "above place (straight)") for w, _ in opts), [w[0][0] for w, _ in opts]
|
||||
way, ja = straight[0]
|
||||
assert np.allclose(kinematics.pose(ja)[:3], way[0][1][:3], atol=0.05)
|
||||
moved = []
|
||||
real_lin, real_jm, real_place = skills.motion.move_linear, skills.motion.move_joints, skills._do_place
|
||||
|
||||
+71
-10
@@ -8,7 +8,7 @@ from manipulation import skills
|
||||
head_cam.head_centre = lambda: np.array([-92.97, -19.87, 356.12]) # the head's turning centre (head_cam fit 2026-10-19;
|
||||
# its file stays on the Thor)
|
||||
|
||||
cup = {"name": "cup", "colour": "white", "x": -126.5, "y": 613.0, "top_mm": -261.0, "width_mm": 76.0}
|
||||
cup = {"name": "cup", "colour": "white", "x": -126.5, "y": 613.0, "top_mm": -261.0, "width_mm": 72.0}
|
||||
R = calib.rpy_matrix(*skills.GRASP_RPY)
|
||||
g = np.array([cup["x"], cup["y"], cup["top_mm"] - 40])
|
||||
|
||||
@@ -61,11 +61,11 @@ assert skills.grasp_height({**cup, "height_mm": 80.0}) == cup["top_mm"] - skills
|
||||
ball = {"name": "orange", "colour": "orange", "x": -126.5, "y": 613.0, "top_mm": -250.0, "width_mm": 150.0 - 8,
|
||||
"height_mm": 150.0} # (too wide for the hand, geometry only)
|
||||
assert skills.grasp_height(ball) == -325.0 # equator 75 mm up, tips 65 mm up
|
||||
apple = {**ball, "name": "apple", "width_mm": 76.0, "height_mm": 80.0}
|
||||
apple = {**ball, "name": "apple", "width_mm": 72.0, "height_mm": 80.0}
|
||||
z = skills.grasp_height(apple)
|
||||
bottom = apple["top_mm"] - 80.0
|
||||
assert z - skills.TIP_MM >= bottom + skills.TIP_CLEAR_MM - 1e-9 and z > bottom + 40.0, z # raised over the equator
|
||||
assert np.isclose(skills.grasp_height({**apple, "height_mm": None}), skills.grasp_height({**apple, "height_mm": 84.0}))
|
||||
assert np.isclose(skills.grasp_height({**apple, "height_mm": None}), skills.grasp_height({**apple, "height_mm": 80.0}))
|
||||
try: # too low: the tips would hit the table
|
||||
skills.grasp_height({**apple, "height_mm": 60.0})
|
||||
raise AssertionError("a 60 mm high apple planned")
|
||||
@@ -140,7 +140,7 @@ skills._ask = ik_at({15, 30})
|
||||
assert skills.reachable_pick(cup, start, max_yaw=skills.TRUSTED_YAW_DEG) is None
|
||||
real_find, real_guarded, real_home = skills.find, skills._guarded, skills.home_joints
|
||||
skills.home_joints = lambda: start
|
||||
skills.find = lambda name, colour=None, seen=None: dict(cup, colour="grey", width_mm=74)
|
||||
skills.find = lambda name, colour=None, seen=None: dict(cup, colour="grey", width_mm=72)
|
||||
skills._guarded = lambda *a: (_ for _ in ()).throw(AssertionError("picked at an untrusted turn"))
|
||||
try:
|
||||
skills.pick("cup")
|
||||
@@ -184,11 +184,6 @@ skills._held.update(tips=True)
|
||||
d = skills.plan_place(-200, 600, thin["top_mm"])[1][1] # put down held the same way
|
||||
assert np.allclose(np.array(d[:3]) + R @ (skills.GRASP_OFFSET + skills.TIPS_OFFSET), [-200, 600, g[2] + 3])
|
||||
skills._held.clear()
|
||||
# the owner's taught tips grasp of the spray can (grasp_tips_teach.json): the same flange within a few mm, 2 deg
|
||||
t = skills.TIPS_TEACH
|
||||
can = np.add(t["can_seen"][:2], skills.objects.ROUND_FIX_MM) # seen before the camera's error was fixed
|
||||
f = skills.flange_for(*can, t["grasp_point_code"][2], skills.yaw_of(t["flange"]), tips=True)
|
||||
assert np.linalg.norm(np.subtract(f[:3], t["flange"][:3])) < 10, f
|
||||
|
||||
# ---------- frames after a move: wait for one written after it ended, never longer than FRESH_WAIT_S ----------
|
||||
import tempfile
|
||||
@@ -324,7 +319,7 @@ for bad, words in (({"body_mm": 50.0}, ("too small", "작아서")),
|
||||
frames_ = [{"age_s": 0.1, "objects": [{"name": "bottle", "box": BOX, "colour": "blue", "position_mm": [-195, 600, -280],
|
||||
"top_mm": -150, "width_mm": 63, "height_mm": 250},
|
||||
{"name": "cup", "box": BOX, "colour": "white", "position_mm": [0, 600, -350],
|
||||
"top_mm": -310, "width_mm": 76, "height_mm": 90}]}] * 2
|
||||
"top_mm": -310, "width_mm": 72, "height_mm": 90}]}] * 2
|
||||
skills.camview.want = lambda name: None
|
||||
skills.fresh = lambda path, camera, after=0.0: None
|
||||
skills.objects.latest = lambda camera=objects.CAMERA: frames_[0]
|
||||
@@ -367,3 +362,69 @@ assert skills.on_table([(-100.0, 700.0)], -400.0) == [(-100.0, 700.0)] # w
|
||||
assert skills.on_table([(-100.0, 620.0)], -400.0) == [] # its near ring point 5 mm off the edge
|
||||
assert skills.on_table([(-100.0, 700.0)]) == [(-100.0, 700.0)] # table height not given
|
||||
print("skills on_table ok")
|
||||
|
||||
# ---------- side grasp: a cup too wide at the top for the hooks to come down over it, narrower lower down ----------
|
||||
top = cup["top_mm"]
|
||||
wide = {**cup, "width_mm": 90.0, "height_mm": 120.0, # 98 the fingers would meet: over MAX_WIDTH
|
||||
"profile": [(top - 10.0 * i, 88.0 if i < 4 else 72.0) for i in range(12)]} # 96 at the rim, 80 from 40 mm down
|
||||
assert skills.side(wide) and not skills.side(cup)
|
||||
d = skills.tips_dir()
|
||||
assert np.isclose(np.linalg.norm(d), 1.0) and d[1] > 0.5 # the tips point away from the robot
|
||||
z = skills.side_height(wide)
|
||||
assert z == top - 65.0, z # nearest SIDE_AT of its 120 mm (50 mm up, top - 70) where the band is all 72
|
||||
short = {**wide, "top_mm": top - 50.0, "height_mm": 70.0, # a 70 mm cup on the same table
|
||||
"profile": [(top - 50.0 - 10.0 * i, 88.0 if i < 2 else 74.0) for i in range(7)]}
|
||||
assert skills.side_height(short) == top - 50.0 - 45.0 # 25 mm up: the hooks' bottom 17 over it
|
||||
way = skills.plan_pick(wide)
|
||||
assert [n for n, _ in way] == ["above", "side", "grasp", "lift"], way
|
||||
p = dict(way)
|
||||
assert np.isclose(p["side"][2], p["grasp"][2]) and p["side"][3:] == p["grasp"][3:] # in level at the grasp height
|
||||
back = skills.side_back(wide)
|
||||
assert np.isclose(back, 98.0 / 2 + np.linalg.norm(skills.TIPS_OFFSET) + skills.SIDE_CLEAR_MM)
|
||||
assert np.allclose(np.subtract(p["grasp"][:2], p["side"][:2]), d * back) # it goes in along the tips' direction
|
||||
assert np.allclose(np.subtract(p["above"][:3], p["side"][:3]), [0, 0, skills.clear_above(top - z)])
|
||||
g = np.array(p["grasp"][:3]) + calib.rpy_matrix(*p["grasp"][3:]) @ skills.GRASP_OFFSET
|
||||
assert np.allclose(g, [wide["x"], wide["y"], z]) # the hooks' point on the cup axis
|
||||
assert [n for n, _ in skills.plan_pick(cup)] == ["above", "grasp", "lift"] # a cup whose top fits: from above, as before
|
||||
for bad in ([(top - 10.0 * i, 88.0) for i in range(12)], # wide all the way down
|
||||
[(top - 10.0 * i, 88.0 if i < 10 else 72.0) for i in range(12)], # narrow only where the hooks hit the table
|
||||
None): # its widths down its height not measured
|
||||
try:
|
||||
skills.plan_pick({**wide, "profile": bad})
|
||||
raise AssertionError(f"side grasp planned for {bad}")
|
||||
except skills.SkillError as e:
|
||||
assert e.args == skills.reason(skills.WIDE, "cup"), e.args
|
||||
# picked from the side: the open hand backs out sideways before it goes up, also after a miss
|
||||
lines_, opened = [], []
|
||||
skills._line = lambda name, pose: lines_.append((name, pose))
|
||||
skills.gripper.open_ = lambda: (opened.append(len(lines_)), {"ai": [150.0]})[1]
|
||||
skills.gripper.close = lambda: {"ai": [3500.0], "holding": True, "object_in_front": False}
|
||||
skills.gripper.state = lambda: {"ai": [3500.0], "holding": True}
|
||||
skills._back_home = lambda: None
|
||||
skills._held.clear()
|
||||
skills._do_pick(wide, way, READY)
|
||||
assert [n for n, _ in lines_] == ["side", "grasp", "lift"] and np.isclose(skills._held["back"], back)
|
||||
assert np.isclose(skills._held["below"], top - z)
|
||||
put = skills.plan_place(-200, 600, top)
|
||||
assert [n for n, _ in put] == ["above place", "place", "release back", "release up"], put
|
||||
q = dict(put)
|
||||
assert np.isclose(q["release back"][2], q["place"][2])
|
||||
assert np.allclose(np.subtract(q["place"][:2], q["release back"][:2]), d * back)
|
||||
assert np.allclose(np.subtract(q["release up"][:3], q["release back"][:3]), [0, 0, skills.clear_above(top - z)])
|
||||
lines_.clear()
|
||||
skills._do_place(put)
|
||||
assert [n for n, _ in lines_] == ["above place", "place", "release back", "release up"] and opened[-1] == 2
|
||||
assert [n for n, _ in skills.plan_place(-200, 600, top, back=0.0)][-2:] == ["place", "release up"] # from above: as before
|
||||
lines_.clear()
|
||||
skills.gripper.close = lambda: {"ai": [4150.0], "holding": False, "object_in_front": False}
|
||||
skills.motion.tcp = lambda: p["grasp"]
|
||||
skills.motion.move_linear = lambda **k: lines_.append(("up", k.get("delta")))
|
||||
try:
|
||||
skills._do_pick(wide, way, READY)
|
||||
raise AssertionError("a miss went on")
|
||||
except skills.SkillError:
|
||||
pass
|
||||
assert [n for n, _ in lines_] == ["side", "grasp", "out sideways", "up"], lines_
|
||||
assert np.allclose(np.subtract(p["grasp"][:2], lines_[2][1][:2]), d * back)
|
||||
skills._held.clear()
|
||||
print("skills side grasp ok")
|
||||
|
||||
Reference in New Issue
Block a user