A robot joint is usually driven by a small fast motor through a gear reduction of ratio N, so the output link sees N× the motor's torque at 1/N of its speed. In this rig the PID controller only reads the motor-side encoder — exactly as most low-cost joints are built, since an output-side encoder doubles the sensor cost:
motor torque: τ_m = Kp·(N·θ_cmd − θ_m) − Kd·ω_m
Between the motor pinion and the output gear there is a small dead-zone — the backlash gap b — where the teeth are not in contact and no torque crosses the mesh at all. Only outside that gap do the teeth press against each other, modelled as a stiff spring-damper contact:
e = θ_m/N − θ_out (relative gear-mesh position)
if e > b/2: τ_mesh = k·(e − b/2) + c·(ω_m/N − ω_out)
if e < −b/2: τ_mesh = k·(e + b/2) + c·(ω_m/N − ω_out)
else: τ_mesh = 0 ← free play, no coupling
The output link then obeys Newton's second law for rotation, including gravity pulling it back toward hanging-down and viscous joint friction:
J_out·α_out = τ_mesh·N − m·g·(L/2)·sin(θ_out) − b_visc·ω_out
- Backlash gap — widen it and the motor can swing several degrees before the gear teeth even touch the output side; the controller "sees" a perfectly tracked motor while the arm sits still or drifts under gravity.
- Gear reduction N — a higher ratio multiplies output torque but also multiplies the backlash's effect on the controller's blind spot, since the motor travels N times further than the output for the same gap.
- Kp / Kd — push the motor gains too high with a wide gap and the arm falls into a limit cycle: it overshoots the gap, slams the far tooth face, bounces back through the dead zone, and repeats — visible as the readouts oscillating even though the commanded trajectory has settled.
- This exact mechanism — a controller that looks perfectly stable on its own sensor while the actual end-effector chatters — is why real industrial arms use anti-backlash gearing (harmonic drives, preloaded double-helical pairs) or add a second output-side encoder for high-precision tasks.