Robot Arm Kinematics Lab: Forward, Inverse and Singularities

Self-check running...
Drag on the canvas to move the target. Drag to the edge of the workspace to see the singularity.
The science

Forward kinematics of a planar arm: x = sum Li cos(q1+...+qi), y likewise with sin.

Analytic inverse kinematics (2 links): cos q2 = (x²+y²-L1²-L2²)/(2L1L2), q1 = atan2(y,x) - atan2(L2 sin q2, L1+L2 cos q2). Two solutions (elbow up/down) exist inside the annulus |L1-L2| ≤ r ≤ L1+L2.

Damped least squares: dq = JT(J JT + λ²I)-1 e stays stable near singularities at the cost of a small residual error. The 3-link arm is redundant (infinitely many solutions); the solver picks a minimum-motion one.

Manipulability w = sqrt(det(J JT)) measures how freely the tip can move; it is zero when the arm is fully stretched or folded. Simplifications: planar, no joint limits, no dynamics, instantaneous joint motion.