{"abstract":"The two-link sub-chain is rotated toward the tip, so the wrist lands off the required centre.","category":"Inverse kinematics solvers","checks":7,"contract":"Input [l1,l2,l3,px,py,phi,elbow]: planar three-link arm, phi is the required tool heading in degrees. Subtract l3 along phi to get the wrist centre, solve the two-link sub-chain (elbow \"up\" gives q2>=0), set q3=phi-q1-q2 and wrap each joint to [-180,180) in degrees rounded to 4 places. A wrist centre outside |l1-l2|..l1+l2 returns \"unreachable\".","contract_signature":"x","evaluation_group":"w2-inverse_kinematics_solvers-three-link-wrist-center","failed_approach":"Mixing the wrist y with the tip x still aims at a point that is neither.","family":"w2-inverse_kinematics_solvers-three-link-wrist-center-shoulder-bearing-reference-point","id":"FA-87896","implementations":{"attempt":{"sha256":"740810aba5dbe1aec790d0d8fbf98107cee40a886d2cfdb9ed6b7e48e8629321","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(x):\n    l1,l2,l3,px,py,phi,elbow=x\n    a=math.radians(phi)\n    wx=px-l3*math.cos(a)\n    wy=py-l3*math.sin(a)\n    r2=wx*wx+wy*wy\n    if r2>(l1+l2)**2+1e-9 or r2<(l1-l2)**2-1e-9: return 'unreachable'\n    c=(r2-l1*l1-l2*l2)/(2*l1*l2)\n    c=max(-1.0,min(1.0,c))\n    s=math.sqrt(1.0-c*c)*(1 if elbow=='up' else -1)\n    q1=math.atan2(wy,px)-math.atan2(l2*s,l1+l2*c)\n    q2=math.atan2(s,c)\n    q3=a-q1-q2\n    out=[]\n    for q in (q1,q2,q3):\n        d=math.degrees(q)\n        d=(d+180.0)%360.0-180.0\n        out.append(round(d,4))\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['tool pointing along x', [[2, 1.5, 0.5, 3, 1, 0, 'up']], [-11.5172, 80.4059, -68.8887]], ['tool pointing up', [[2, 1.5, 0.5, 2, 2, 90, 'down']], [73.7398, -90.0, 106.2602]], ['tool pointing back', [[2, 2, 1, -1, 2, 180, 'up']], [30.0, 120.0, 30.0]], ['tool pointing down', [[2, 1, 0.5, 1.5, -1, -90, 'up']], [-48.0197, 128.6822, -170.6625]], ['wrist just reachable', [[1, 1, 1, 2.5, 0, 0, 'up']], [-41.4096, 82.8192, -41.4096]], ['tip in reach but wrist not', [[1, 1, 1, 2.5, 0, 180, 'up']], 'unreachable'], ['diagonal heading', [[2, 1, 1, 2, 2, 45, 'down']], [74.8541, -114.4698, 84.6157]]], [['tool pointing up', [[2, 1.5, 0.5, 2, 2, 90, 'down']], [73.7398, -90.0, 106.2602]], ['tool pointing back', [[2, 2, 1, -1, 2, 180, 'up']], [30.0, 120.0, 30.0]], ['tip in reach but wrist not', [[1, 1, 1, 2.5, 0, 180, 'up']], 'unreachable'], ['diagonal heading', [[2, 1, 1, 2, 2, 45, 'down']], [74.8541, -114.4698, 84.6157]], ['multi-turn heading', [[2, 1.5, 0.5, 1, 2.5, 405, 'up']], [32.3158, 101.7795, -89.0953]], ['negative heading', [[3, 2, 1, 3, -2, -30, 'down']], [5.9393, -121.0875, 85.1482]], ['third quadrant wrist', [[2, 2, 0.5, -2, -2, 225, 'up']], [170.5989, 108.8023, -54.4011]]], [['tool pointing back', [[2, 2, 1, -1, 2, 180, 'up']], [30.0, 120.0, 30.0]], ['diagonal heading', [[2, 1, 1, 2, 2, 45, 'down']], [74.8541, -114.4698, 84.6157]], ['negative heading', [[3, 2, 1, 3, -2, -30, 'down']], [5.9393, -121.0875, 85.1482]], ['third quadrant wrist', [[2, 2, 0.5, -2, -2, 225, 'up']], [170.5989, 108.8023, -54.4011]], ['zero length tool', [[2, 1, 0, 2, 1, 60, 'up']], [0.0, 90.0, -30.0]], ['heading 150', [[2, 1.5, 1, -1, 2.5, 150, 'down']], [137.8289, -111.8395, 124.0106]], ['wrist in inner hole', [[3, 1, 1, 2.2, 0, 0, 'up']], 'unreachable']], [['tool pointing down', [[2, 1, 0.5, 1.5, -1, -90, 'up']], [-48.0197, 128.6822, -170.6625]], ['multi-turn heading', [[2, 1.5, 0.5, 1, 2.5, 405, 'up']], [32.3158, 101.7795, -89.0953]], ['heading 150', [[2, 1.5, 1, -1, 2.5, 150, 'down']], [137.8289, -111.8395, 124.0106]], ['wrist in inner hole', [[3, 1, 1, 2.2, 0, 0, 'up']], 'unreachable'], ['wrist behind tip beyond reach', [[1, 1, 1, 1.5, 0, 180, 'up']], 'unreachable'], ['wrist stretched', [[2, 1, 1, 4, 0, 0, 'down']], [0.0, 0.0, 0.0]], ['heading -135', [[1.5, 1.5, 0.5, -1.2, -1.7, -135, 'down']], [-64.1702, -115.9708, 45.141]]], [['multi-turn heading', [[2, 1.5, 0.5, 1, 2.5, 405, 'up']], [32.3158, 101.7795, -89.0953]], ['negative heading', [[3, 2, 1, 3, -2, -30, 'down']], [5.9393, -121.0875, 85.1482]], ['wrist stretched', [[2, 1, 1, 4, 0, 0, 'down']], [0.0, 0.0, 0.0]], ['heading -135', [[1.5, 1.5, 0.5, -1.2, -1.7, -135, 'down']], [-64.1702, -115.9708, 45.141]], ['near base with long tool', [[2, 2, 2, 0.5, 0.5, 10, 'up']], [105.7453, 136.645, 127.6097]], ['heading 300', [[2.5, 1.5, 0.8, 1, -3, 300, 'up']], [-111.095, 112.0608, -60.9658]], ['heading -300', [[2.5, 1.5, 0.8, 1, 3, -300, 'down']], [111.095, -112.0608, 60.9658]]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"28794060e6fbf076a7d833aaddda6a6715988d7834c299e5afc9ffd0053382d5","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(x):\n    l1,l2,l3,px,py,phi,elbow=x\n    a=math.radians(phi)\n    wx=px-l3*math.cos(a)\n    wy=py-l3*math.sin(a)\n    r2=wx*wx+wy*wy\n    if r2>(l1+l2)**2+1e-9 or r2<(l1-l2)**2-1e-9: return 'unreachable'\n    c=(r2-l1*l1-l2*l2)/(2*l1*l2)\n    c=max(-1.0,min(1.0,c))\n    s=math.sqrt(1.0-c*c)*(1 if elbow=='up' else -1)\n    q1=math.atan2(py,px)-math.atan2(l2*s,l1+l2*c)\n    q2=math.atan2(s,c)\n    q3=a-q1-q2\n    out=[]\n    for q in (q1,q2,q3):\n        d=math.degrees(q)\n        d=(d+180.0)%360.0-180.0\n        out.append(round(d,4))\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['tool pointing along x', [[2, 1.5, 0.5, 3, 1, 0, 'up']], [-11.5172, 80.4059, -68.8887]], ['tool pointing up', [[2, 1.5, 0.5, 2, 2, 90, 'down']], [73.7398, -90.0, 106.2602]], ['tool pointing back', [[2, 2, 1, -1, 2, 180, 'up']], [30.0, 120.0, 30.0]], ['tool pointing down', [[2, 1, 0.5, 1.5, -1, -90, 'up']], [-48.0197, 128.6822, -170.6625]], ['wrist just reachable', [[1, 1, 1, 2.5, 0, 0, 'up']], [-41.4096, 82.8192, -41.4096]], ['tip in reach but wrist not', [[1, 1, 1, 2.5, 0, 180, 'up']], 'unreachable'], ['diagonal heading', [[2, 1, 1, 2, 2, 45, 'down']], [74.8541, -114.4698, 84.6157]]], [['tool pointing up', [[2, 1.5, 0.5, 2, 2, 90, 'down']], [73.7398, -90.0, 106.2602]], ['tool pointing back', [[2, 2, 1, -1, 2, 180, 'up']], [30.0, 120.0, 30.0]], ['tip in reach but wrist not', [[1, 1, 1, 2.5, 0, 180, 'up']], 'unreachable'], ['diagonal heading', [[2, 1, 1, 2, 2, 45, 'down']], [74.8541, -114.4698, 84.6157]], ['multi-turn heading', [[2, 1.5, 0.5, 1, 2.5, 405, 'up']], [32.3158, 101.7795, -89.0953]], ['negative heading', [[3, 2, 1, 3, -2, -30, 'down']], [5.9393, -121.0875, 85.1482]], ['third quadrant wrist', [[2, 2, 0.5, -2, -2, 225, 'up']], [170.5989, 108.8023, -54.4011]]], [['tool pointing back', [[2, 2, 1, -1, 2, 180, 'up']], [30.0, 120.0, 30.0]], ['diagonal heading', [[2, 1, 1, 2, 2, 45, 'down']], [74.8541, -114.4698, 84.6157]], ['negative heading', [[3, 2, 1, 3, -2, -30, 'down']], [5.9393, -121.0875, 85.1482]], ['third quadrant wrist', [[2, 2, 0.5, -2, -2, 225, 'up']], [170.5989, 108.8023, -54.4011]], ['zero length tool', [[2, 1, 0, 2, 1, 60, 'up']], [0.0, 90.0, -30.0]], ['heading 150', [[2, 1.5, 1, -1, 2.5, 150, 'down']], [137.8289, -111.8395, 124.0106]], ['wrist in inner hole', [[3, 1, 1, 2.2, 0, 0, 'up']], 'unreachable']], [['tool pointing down', [[2, 1, 0.5, 1.5, -1, -90, 'up']], [-48.0197, 128.6822, -170.6625]], ['multi-turn heading', [[2, 1.5, 0.5, 1, 2.5, 405, 'up']], [32.3158, 101.7795, -89.0953]], ['heading 150', [[2, 1.5, 1, -1, 2.5, 150, 'down']], [137.8289, -111.8395, 124.0106]], ['wrist in inner hole', [[3, 1, 1, 2.2, 0, 0, 'up']], 'unreachable'], ['wrist behind tip beyond reach', [[1, 1, 1, 1.5, 0, 180, 'up']], 'unreachable'], ['wrist stretched', [[2, 1, 1, 4, 0, 0, 'down']], [0.0, 0.0, 0.0]], ['heading -135', [[1.5, 1.5, 0.5, -1.2, -1.7, -135, 'down']], [-64.1702, -115.9708, 45.141]]], [['multi-turn heading', [[2, 1.5, 0.5, 1, 2.5, 405, 'up']], [32.3158, 101.7795, -89.0953]], ['negative heading', [[3, 2, 1, 3, -2, -30, 'down']], [5.9393, -121.0875, 85.1482]], ['wrist stretched', [[2, 1, 1, 4, 0, 0, 'down']], [0.0, 0.0, 0.0]], ['heading -135', [[1.5, 1.5, 0.5, -1.2, -1.7, -135, 'down']], [-64.1702, -115.9708, 45.141]], ['near base with long tool', [[2, 2, 2, 0.5, 0.5, 10, 'up']], [105.7453, 136.645, 127.6097]], ['heading 300', [[2.5, 1.5, 0.8, 1, -3, 300, 'up']], [-111.095, 112.0608, -60.9658]], ['heading -300', [[2.5, 1.5, 0.8, 1, 3, -300, 'down']], [111.095, -112.0608, 60.9658]]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"Deterministic planar or low-dimensional teaching model with a stipulated convention; not a general robotics library. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-inverse_kinematics_solvers-three-link-wrist-center-shoulder-bearing-reference-point","generated_at":"2026-09-29T14:51:03.137167+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Inverse kinematics code turns task-space goals into joint commands; a wrong branch, sign, limit or update order sends a real arm to the wrong pose.","root_cause":"q1 uses atan2(py,px) although the sub-chain solves for the wrist centre (wx,wy).","sha256":"73ec3908c935beb918cccf9cb0ef1601c56991521c4930129d3a052c81bbd2b5","title":"Shoulder bearing aims at the tool tip rather than the wrist centre · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":40.276,"exit_code":1,"observations":[{"actual":[-14.8837,80.4059,-65.5223],"check":"tool pointing along x","expected":[-11.5172,80.4059,-68.8887],"passed":false},{"actual":[73.7398,-90.0,106.2602],"check":"tool pointing up","expected":[73.7398,-90.0,106.2602],"passed":true},{"actual":[56.5651,120.0,3.4349],"check":"tool pointing back","expected":[30.0,120.0,30.0],"passed":false},{"actual":[-48.0197,128.6822,-170.6625],"check":"tool pointing down","expected":[-48.0197,128.6822,-170.6625],"passed":true},{"actual":[-41.4096,82.8192,-41.4096],"check":"wrist just reachable","expected":[-41.4096,82.8192,-41.4096],"passed":true},{"actual":"unreachable","check":"tip in reach but wrist not","expected":"unreachable","passed":true},{"actual":[62.7347,-114.4698,96.7351],"check":"diagonal heading","expected":[74.8541,-114.4698,84.6157],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"tool pointing along x\", \"actual\": [-14.8837, 80.4059, -65.5223], \"expected\": [-11.5172, 80.4059, -68.8887], \"passed\": false}, {\"check\": \"tool pointing up\", \"actual\": [73.7398, -90.0, 106.2602], \"expected\": [73.7398, -90.0, 106.2602], \"passed\": true}, {\"check\": \"tool pointing back\", \"actual\": [56.5651, 120.0, 3.4349], \"expected\": [30.0, 120.0, 30.0], \"passed\": false}, {\"check\": \"tool pointing down\", \"actual\": [-48.0197, 128.6822, -170.6625], \"expected\": [-48.0197, 128.6822, -170.6625], \"passed\": true}, {\"check\": \"wrist just reachable\", \"actual\": [-41.4096, 82.8192, -41.4096], \"expected\": [-41.4096, 82.8192, -41.4096], \"passed\": true}, {\"check\": \"tip in reach but wrist not\", \"actual\": \"unreachable\", \"expected\": \"unreachable\", \"passed\": true}, {\"check\": \"diagonal heading\", \"actual\": [62.7347, -114.4698, 96.7351], \"expected\": [74.8541, -114.4698, 84.6157], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":37.744,"exit_code":1,"observations":[{"actual":[-14.8837,80.4059,-65.5223],"check":"tool pointing along x","expected":[-11.5172,80.4059,-68.8887],"passed":false},{"actual":[81.8699,-90.0,98.1301],"check":"tool pointing up","expected":[73.7398,-90.0,106.2602],"passed":false},{"actual":[56.5651,120.0,3.4349],"check":"tool pointing back","expected":[30.0,120.0,30.0],"passed":false},{"actual":[-63.2748,128.6822,-155.4074],"check":"tool pointing down","expected":[-48.0197,128.6822,-170.6625],"passed":false},{"actual":[-41.4096,82.8192,-41.4096],"check":"wrist just reachable","expected":[-41.4096,82.8192,-41.4096],"passed":true},{"actual":"unreachable","check":"tip in reach but wrist not","expected":"unreachable","passed":true},{"actual":[74.8541,-114.4698,84.6157],"check":"diagonal heading","expected":[74.8541,-114.4698,84.6157],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"tool pointing along x\", \"actual\": [-14.8837, 80.4059, -65.5223], \"expected\": [-11.5172, 80.4059, -68.8887], \"passed\": false}, {\"check\": \"tool pointing up\", \"actual\": [81.8699, -90.0, 98.1301], \"expected\": [73.7398, -90.0, 106.2602], \"passed\": false}, {\"check\": \"tool pointing back\", \"actual\": [56.5651, 120.0, 3.4349], \"expected\": [30.0, 120.0, 30.0], \"passed\": false}, {\"check\": \"tool pointing down\", \"actual\": [-63.2748, 128.6822, -155.4074], \"expected\": [-48.0197, 128.6822, -170.6625], \"passed\": false}, {\"check\": \"wrist just reachable\", \"actual\": [-41.4096, 82.8192, -41.4096], \"expected\": [-41.4096, 82.8192, -41.4096], \"passed\": true}, {\"check\": \"tip in reach but wrist not\", \"actual\": \"unreachable\", \"expected\": \"unreachable\", \"passed\": true}, {\"check\": \"diagonal heading\", \"actual\": [74.8541, -114.4698, 84.6157], \"expected\": [74.8541, -114.4698, 84.6157], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}