The two joints are driven by impedance control, not rigid position control. Each joint is a virtual torsional spring-damper toward the target angle computed by inverse kinematics for the current goal:
τ = K·(θ_target − θ) − D·θ̇
θ̈ = τ / I (per joint, integrated with semi-implicit Euler)
Because the joint only ever feels a spring pulling it, not a hard position command, it naturally yields under external load — this is what lets it be safe on contact. The end-effector (wrist tip) is checked every frame against the obstacle circle; if it penetrates, a contact force is computed from the penetration depth and pushed back through both joints as an external torque, exactly like a real force sensor at the tip would.
The safety limiter watches the measured contact force. When it exceeds the configured limit, the controller does not just clip the torque — it genuinely reduces the effective stiffness Keff in proportion to the overshoot for the next several frames, so the arm goes compliant and backs off the obstacle instead of grinding into it at full force. Turn the limiter off to see the same collision handled by a fixed-stiffness spring instead — high K then pushes through with a large sustained force spike.
- Stiffness K — how hard each joint fights to reach the target angle. High K = fast, precise reaching but large contact forces on collision. Low K = slow, compliant, gentle on contact.
- Damping D — resistance to joint velocity; prevents oscillation/overshoot. Too little D with high K rings like a spring; too much makes the arm sluggish.
- Contact force limit — the safety threshold (in simulated newtons) above which the limiter starts pulling Keff down.
Real-world relevance: this is the same principle behind collaborative robot arms (cobots) working near humans — ISO/TS 15066 power-and-force limiting is implemented in real hardware exactly this way, as compliant torque control rather than rigid trajectory following.