2-Link Inverse Kinematics Calculator
Input target (x, y) coordinates, solve for two joint angles θ₁, θ₂ and determine whether the target is within the reachable workspace, for robot-arm path planning.
📐 計算公式
二連桿逆運動學(本頁程式碼口徑):c₂ = (x²+y²−L₁²−L₂²)÷(2×L₁×L₂);可達時先取 θ₂A = +arccos(c₂)、θ₁A = atan2(y,x) − atan2(L₂ sinθ₂A, L₁+L₂ cosθ₂A),再取 θ₂B = −θ₂A、θ₁B = atan2(y,x) − atan2(L₂ sinθ₂B, L₁+L₂ cosθ₂B),成對輸出肘下/肘上兩組解並轉°。校驗:L₁、L₂ 必須 > 0;兩組解分別用正運動學回代 (L₁cosθ₁+L₂cos(θ₁+θ₂), L₁sinθ₁+L₂sin(θ₁+θ₂)) 檢查殘差;c₂ ∉ [−1,1] 即不可達(可達環帶 |L₁−L₂| ≤ r ≤ L₁+L₂)。θ₂≈0° 或 ±180° 時兩解重合。
平面二連桿逆解,含可達性判定。
📌 計算說明
- cosθ₂=(r²−L₁²−L₂²)/(2L₁L₂),θ₂ = ±arccos(c₂) 對應肘下/肘上兩組解。
- 兩組 θ₁ 必須與各自 θ₂ 配對,不能把一組 θ₁ 和另一組 θ₂ 混搭。
- |L₁−L₂| ≤ √(x²+y²) ≤ L₁+L₂ 才可解。