🦾 Robot Arm IK

Error—
Iterations—
Joint 10°
Joint 20°
Joint 30°
Step size α: 0.50
Damping λ: 0.10
Link lengths (px)
L1=L2=L3= 100px

🦾 Robot Arm Kinematics — Forward & Inverse IK

Click anywhere on the canvas to set a target position. The 3-joint planar robot arm will use Jacobian transpose inverse kinematics to move its end-effector towards that point in real time.

Algorithm

  • Forward Kinematics: Joint positions computed via 2D homogeneous transforms T0·T1·T2, each encoding link length and joint angle.
  • Jacobian: Each column is the cross product of joint axis z with (end-effector − joint position). In 2D: J[:,i] = z × (P_ee − P_i).
  • IK Update: δθ = α · JT · e, where e = P_target − P_ee.
  • Singularity Damping: When ‖J·JT‖ is small, damp the step to avoid divergence.
  • Joint Limits: Angles clamped to [−150°, +150°] after each iteration.

Key Equations

// Forward kinematics (2D)
P0 = base
P1 = P0 + L1·[cos(θ1), sin(θ1)]
P2 = P1 + L2·[cos(θ1+θ2), sin(θ1+θ2)]
P3 = P2 + L3·[cos(θ1+θ2+θ3), sin(θ1+θ2+θ3)]

// Jacobian column i (2D revolute)
Jx_i = -(P_ee.y - P_i.y)
Jy_i = +(P_ee.x - P_i.x)

// Jacobian transpose IK step
dθ = α · J^T · e
θ_new = clamp(θ_old + dθ, θ_min, θ_max)

Controls

  • Click / Tap — set target position
  • α slider — convergence step size (larger = faster but may overshoot)
  • λ slider — singularity damping (higher = more stable near singular configs)
  • Link length — adjust all three link lengths simultaneously
  • Pause/Play — freeze the simulation
  • Reset — return arm to home configuration

Did You Know?

The Jacobian transpose method was independently discovered in robotics and animation. Unlike pseudo-inverse methods, it requires no matrix inversion and is always numerically stable, making it popular in real-time character animation and game engines.

Frequently Asked Questions

What is forward kinematics in robotics?

Forward kinematics (FK) computes the position and orientation of a robot's end-effector given known joint angles. For a planar 3-joint arm, each joint contributes a rotation compounding through the chain: P = T0 · T1 · T2, where each Ti encodes a link translation and a joint rotation.

What is inverse kinematics and why is it harder than FK?

Inverse kinematics (IK) finds joint angles that place the end-effector at a desired position. It's harder because the mapping from Cartesian space to joint space can be non-unique (multiple solutions), have no solution (outside workspace), or be ill-conditioned near singularities.

How does the Jacobian transpose method work?

The Jacobian J maps joint velocities to end-effector velocities: v = J · dθ/dt. The Jacobian transpose method uses dθ = α · JT · e, where e is the position error. It's cheap (no inversion) and naturally handles redundancy, though convergence slows near singularities.

What are kinematic singularities and how are they handled?

Singularities occur when the Jacobian loses rank — the robot loses a degree of freedom. In planar arms this happens when links are fully extended or folded. This simulation uses damped steps with constant λ to prevent infinite joint velocities near singular configurations.

What are joint limits and why do they matter?

Joint limits define the physically achievable range of motion for each joint (here ±150°). Exceeding them in hardware causes collisions or damage. After each IK iteration joint angles are clamped to their limits, which may prevent convergence to unreachable targets.

What is a SCARA robot?

SCARA (Selective Compliance Assembly Robot Arm) has 4 DOF — 3 rotary joints in a planar configuration plus a vertical axis. This simulation models the planar 3-joint portion, which is representative of SCARA kinematics and widely used in electronics assembly.

What are Denavit-Hartenberg (DH) parameters?

DH parameters are a standardised convention (a, α, d, θ) for describing kinematic chains. For planar revolute joints α=0 and d=0, reducing the description to link length a and joint angle θ — exactly what this simulation uses for its 3-joint arm.

How is the workspace of a 3-joint arm defined?

For a 3-joint planar arm with link lengths L1, L2, L3 the outer reachable boundary is a circle of radius L1+L2+L3. The inner boundary radius is |L1−L2−L3|. Joint limits further restrict the reachable region. Points outside this annulus cause the IK solver to stall at the workspace boundary.

What is the difference between position-only and full pose IK?

Position-only IK (as used here) targets only x,y — 2 constraints for 3 joints, leaving one degree of redundancy. Full pose IK also constrains end-effector orientation (angle), consuming all 3 DOF with zero redundancy in a planar 3-joint arm.

When does the iterative IK solver fail to converge?

The solver fails to converge when the target is outside the workspace, when the configuration is singular with insufficient damping, or when joint limits prevent reaching the target. The status indicator turns red for unreachable targets and orange while actively solving.