Status: Draft (2026-10-18), Measured. Numbers were calculated directly on a laptop (Apple M1 Max, macOS 26.5) using Python 3.9.6 and numpy 2.0.2. Times are the median of 7 repetitions (discarding the first), and numerical solution times are the median of 300 successful solves. Raw data and code: working directory
measure/robot-arm-basics/ofarm.py,m04_ik.py,out/m04_ik.json. The example arm is a virtual design from Part 3, and there are no hardware measurements. References were accessed on 2026-10-18. Writing convention: Measured data is the default; unmeasured items are marked as "Unmeasured", and unverified items as "Unverified".
Table of Contents
- 1. Intuition: Multiple Arm Configurations for Grasping a Cup
- 2. Illustration: Same Target, Two Solutions
- 3. Computation
- 4. Measurements
- 5. Limitations
- 6. Conclusion
- References
1. Intuition: Multiple Arm Configurations for Grasping a Cup
When grasping a cup on a desk, you can flare your elbow out to the side or tuck it against your body. The position and orientation of the hand are the same, but the arm configurations differ. Conversely, a cup beyond the edge of the desk cannot be reached in any configuration. All three aspects of inverse kinematics (IK) are encapsulated here:
- There can be multiplesolutions.
- There may be no solutions.
- Even when a solution exists, near certain postures, a tiny movement of the racket requires massive joint motions (singularities).
In a table tennis robot, inverse kinematics must be solved anew for every shot and whenever predictions are updated. It must produce solutions that are fast, always terminate, and do not jerk abruptly from the previous posture.
2. Illustration: Same Target, Two Solutions
3. Computation
3.1 2-Link Arm: Law of Cosines
Letting r be the distance from the shoulder to the target, the two links and r form a triangle. The elbow angle is obtained using the law of cosines.
def ik2(x, y, elbow=+1):
c = (x*x + y*y - L1*L1 - L2*L2) / (2*L1*L2)
if abs(c) > 1:
return None # 닿지 않는 목표
q2 = elbow * acos(c) # +: 팔꿈치 아래, -: 팔꿈치 위
q1 = atan2(y, x) - atan2(L2*sin(q2), L1 + L2*cos(q2))
return q1, q2
acos Since yields two values (±), there are two solutions. If |c| > 1, no triangle can be formed, so no solution exists. The fact that this check takes only a single line is a major advantage of analytical solutions.
3.2 6-Axis Arm: Detaching the Wrist
The example arm in Part 3 has its three wrist axes intersecting at a single point. This allows the six unknowns to be divided into two stages.
- Three position variables. From the racket orientation, compute the wrist center p_c = p − d6·R[:, 2]. Joint 1 is either the top-down direction of p_c, atan2(y_c, x_c), or its opposite (+π). Then joints 2 and 3 reduce to the 2-link problem from Section 3.1, yielding two solutions for elbow-up and elbow-down.
- Three orientation variables. Once joints 1, 2, and 3 are determined, R₀₃ is known, and the remaining rotation to be handled by the wrist is R₃₆ = R₀₃ᵀ·R. This wrist structure has the same form as ZYZ Euler angles, yielding two solutions (wrist flip) given by θ5 = atan2(±√(r13² + r23²), r33).
2 × 2 × 2 = 8 solutionsin total. If θ5 = 0, axes 4 and 6 become collinear, leaving only the sum θ4 + θ6 determined. This is the wrist singularity.
3.3 Numerical Solutions: Newton's Method and Damped Least Squares
Arms whose wrists do not intersect at a point or arms with 7 or more axes lack closed-form solutions or have overly complex ones. In such cases, problems are solved iteratively using only forward kinematics and the Jacobian (Part 5). There are three methods to find the joint change Δq that reduces the posture error e (3 position + 3 orientation components).
유사역행렬(뉴턴-랩슨): Δq = J⁺ e
감쇠 최소제곱(DLS): Δq = Jᵀ (J Jᵀ + λ² I)⁻¹ e ‖J Δq − e‖² + λ²‖Δq‖² 를 최소화
야코비안 전치: Δq = α Jᵀ e, α = ⟨e, J Jᵀ e⟩ / ‖J Jᵀ e‖²
Section 6.2.1 of Modern Robotics covers Newton-Raphson, and Buss's tutorial reviews all three methods together. DLS is also known as Levenberg–Marquardt. Viewed through singular values, DLS modifies the gain for each direction to σ/(σ² + λ²). When σ is larger than λ, it behaves like the pseudoinverse; as σ approaches 0, the gain also goes to 0. This mechanism prevents joint explosion near singularities.
for it in range(max_iter):
e = pose_error(fk_dh(q), T_goal) # 위치 오차 3 + 축-각 방향 오차 3
if norm(e[:3]) < 1e-5 and norm(e[3:]) < 1e-4: # 0.01 mm, 0.006°
return q, True
J = jacobian(q)
dq = J.T @ np.linalg.solve(J @ J.T + lam**2 * np.eye(6), e)
q = q + dq
3.4 2-Axis Cartesian Gantry: A Structure Where Inverse Kinematics is Addition
If a racket is mounted on a 2-axis Cartesian gantry (horizontal x, vertical z) with a 2-axis yaw-pitch wrist at the end, the inverse kinematics boils down to the following.
손목 요 ψ = atan2(n_x, n_y) (n 은 원하는 라켓 법선)
손목 피치 φ = atan2(n_z, √(n_x² + n_y²))
손목 중심 = 라켓 중심 − d · n
갠트리 x = 손목 중심 x, 갠트리 z = 손목 중심 z
There is only a single solution, and because the Jacobian of the gantry axes is constant (an identity matrix), there are no singularities. Racket velocities match the axis velocities directly, independent of the posture. However, because the wrist center must lie on the gantry plane, the y-coordinate of the racket center (along the length of the table) is tied to the "gantry plane + d·n_y". In other words, the striking point is fixed to nearly a single plane. Koç et al. (2018) reported that such a fixed virtual striking plane restricts trajectories and lowers the return rate (about 10–40% for fixed-plane hardware, compared to about 40–60% for methods optimizing striking time and position simultaneously). This motivates designs like Google's system, which mounts a 6-axis arm on top of a gantry to combine the advantages of both.
4. Measurements
4.1 Analytical Solutions: Accuracy and Time
| Problem | Samples | Max Position Error | Max Orientation Error | Time per Solve |
|---|---|---|---|---|
| 2-Link Planar (2 solutions) | 100,000 targets | 6.9×10⁻¹⁶ m | - | 0.59 µs |
| 6-Axis Wrist Separation (8 solutions) | 10,000 postures | 1.1×10⁻¹⁵ m | 9.4×10⁻¹⁴ rad | 58 µs |
| 2-Axis Gantry + 2-Axis Wrist | - | (Exact by definition) | - | 0.61 µs |
All 8 solutions were found for all 10,000 6-axis postures, and substituting all 8 back into the forward kinematics confirmed that they regenerated the original posture. Because the postures were generated from random joint angles, the initial joint angles always returned to one of the 8 solutions (with a maximum difference of 6.7×10⁻¹² rad).
4.2 Numerical Solutions: Success Rate and Time by Method
300 target postures were generated using random joint angles and solved from two starting points. "Nearby" refers to starting points with 0.3 rad standard deviation noise added to the correct joint angles, while "Ready Pose" uses a fixed, identical posture for all targets. Up to 200 iterations were allowed, with success criteria of 0.01 mm for position and 10⁻⁴ rad for orientation.
| Method | Start | Success Rate | Iterations (Median/95%) | Median Time | Max Step Size (Median) |
|---|---|---|---|---|---|
| Pseudoinverse | Nearby | 99.7% | 4 / 23 | 0.77 ms | 0.92 rad |
| Pseudoinverse | Ready Pose | 99.3% | 16 / 45 | 2.5 ms | 61 rad |
| Pseudoinverse + 0.3 rad Step Limit | Ready Pose | 99.7% | 23 / 41 | 3.8 ms | 0.3 rad |
| DLS λ=0.01 | Ready Pose | 95.7% | 16 / 41 | 2.3 ms | 16 rad |
| DLS λ=0.05 | Ready Pose | 86.7% | 16 / 87 | 2.6 ms | 8.6 rad |
| DLS λ=0.1 | Ready Pose | 80.0% | 23 / 146 | 3.5 ms | 5.5 rad |
| DLS λ=0.01 + Step Limit | Ready Pose | 97.7% | 24 / 46 | 3.5 ms | 0.3 rad |
| Jacobian Transpose | Ready Pose | 1.3% | 130 / 184 | 17 ms | 1.3 rad |
Two results differed from expectations.
- Higher damping decreased the success rate. A large λ ensures safety near singularities, but it also reduces step sizes even in normal postures, increasing instances where convergence to 0.01 mm failed within 200 iterations. Mixing position (m) and orientation (rad) into a single vector and using the same λ is likely also a contributing factor (estimated). Buss likewise notes that λ must be large enough to survive singularities and small enough not to slow convergence, without providing specific values.
- The pseudoinverse eventually converged in most cases, but occasionally jumped by 61 rad in a single step along the way. While unproblematic in computation, sending such intermediate values directly to the motors would cause a disaster. In practice, step sizes are either restricted (e.g., "Step Limit" in the table) or only the final converged solution is passed to the trajectory generator (Part 8).
The Jacobian transpose is the cheapest to compute, but convergence is so slow that it rarely finished within 200 iterations. The analytical solution (58 µs) was about 40 times faster than numerical solutions starting from the ready pose (2.3 ms or more), and 12 times faster than numerical solutions starting near the correct answer (0.7 ms). It is also important to remember that numerical solutions cannot guarantee which of the 8 solutions they will converge todepending on the starting point. In robotics, one starts from the current joint angles to reach the nearest solution, or if an analytical solution is available, selects the one among the 8 closest to the current posture.
4.3 A Single Step Near a Singularity
The size of a single stepto correct posture errors (around 1 mm in position, 0.01 rad in orientation) was compared across different postures.
| Posture | Min Singular Value σ_min | Condition Number | Pseudoinverse Step | DLS λ=0.05 Step | Remaining Error After DLS Step |
|---|---|---|---|---|---|
| Normal Posture | 0.055 | 35 | 0.042 rad | 0.030 rad | 0.0009 |
| Wrist θ5 = 0.01 rad | 0.0020 | 977 | 1.77 rad | 0.034 rad | 0.0036 |
| Wrist θ5 = 0.001 rad | 0.0002 | 9,768 | 17.6 rad | 0.034 rad | 0.0036 |
| Elbow Nearly Straight (θ3 = π/2 + 0.001) | 0.00015 | 13,041 | 12.9 rad | 0.023 rad | 0.0019 |
Near singularities, the pseudoinverse demands two to three full revolutions of the joints to correct an error of 0.01. DLS caps the step size at 0.03 rad while sacrificing part of the error (the remaining error shown in the table above). This is a trade-off between "exact matching" and "smooth movement," and real robots almost always choose the latter.
4.4 Unreachable Targets
A 2-link arm (reaching limit of 0.75 m) was given a target 0.85 m away, repeated 50 times. The closest possible distance is 0.10 m.
| Method | Final Distance | Closest Distance Reached | Max Step | Last Five Steps |
|---|---|---|---|---|
| Pseudoinverse | 0.139 m | 0.100 m | 33.7 rad | 1.2, 2.6, 1.6, 1.3, 1.4 rad (continuous oscillation) |
| DLS λ=0.05 | 0.145 m | 0.104 m | 1.10 rad | 1.05 rad each time (back and forth in place) |
| DLS λ=0.2 | 0.100 m | 0.100 m | 0.36 rad | 10⁻¹⁰ rad (stopped) |
When no solution exists, the pseudoinverse oscillates endlessly, and DLS with a small λ bounces between the same two postures. Increasing λ brings it to a calm stop at the "closest posture." Buss noted that scaling down the magnitude of the error vector to about half the link length in such situations reduces oscillation even with small λ. In table tennis robots, since "balls coming outside the workspace" is a frequent scenario, an analytical solver that can quickly detect the absence of solutions firstis especially valuable.
5. Limitations
- Joint angle limits (e.g., ±170°) and self-collisions were not handled within the inverse kinematics. Joint limits were only applied when selecting solutions in Part 5.
- We compared DLS only with a fixed value for λ. The method of changing λ according to σ_min and the weights for matching the units of position and orientation errors were not measured (unmeasured).
- Most of the numerical solution time in Python comes from the cost of recomputing forward kinematics and the Jacobian at every iteration. The execution time of the C++ implementation is unmeasured.
6. Conclusion
- The 2-link arm obtains a closed-form solution via the law of cosines, and the 6-axis spherical wrist arm via wrist decoupling. Analytical solutions reveal the number of solutions and "no solution" all at once.
- Numerical solutions can be applied to any arm, but they converge to different solutions depending on the starting point and can take large steps in between. Step limits and damping are necessary.
- Near singularities, DLS sacrifices a bit of accuracy to prevent joint runaway. For unreachable targets, a sufficiently large λ stops the arm at the closest posture.
- The inverse kinematics of a gantry involves simple addition and has no singularities, but its striking point is constrained to a single plane.
Titi's note. There are eight different arm postures to hit the same ball. The trick is to choose the one closest to the current posture among them, and if the ball is out of reach, don't force it and stop at the closest point!
References
All materials were accessed on 2026-10-18.
- Lynch, Park, Modern Robotics, 2017, open preprint, Chapter 6 (6.1 Analytical IK, 6.2.1 Newton–Raphson).
- Buss, S. R., Introduction to Inverse Kinematics with Jacobian Transpose, Pseudoinverse and Damped Least Squares methods(PDF date 2009-10-07), Sections 3–6.
- Koç, Maeda, Peters, Online optimal trajectory generation for robot table tennis, RAS 105 (2018), author's public version, Figures 2 and 11.
- D'Ambrosio et al., arXiv:2408.03906, Section II-A.