# Gravity Compensation (spring counterbalance) — PARKED

Offloads the shoulder (output_1, 52% stall) so cheap servos do not fight gravity. Designed, deferred.
Viewer: `.../?file=two_servo_cb_shoulder.urdf` (recommended) / `..._cb_overhead.urdf`  ·  gen_cb.py, compute_cb.py

## The physics (zero-free-length spring)
Gravity torque follows `m·g·L·sin θ` (max horizontal, zero straight up/down). A spring anchored **directly
above the joint** (height h) to a point on the arm (distance a), if it behaves **zero-free-length** (force ∝
current length), gives torque `k·h·a·sin θ` — same shape. Set **k·h·a = m·g·L** → balanced at EVERY angle,
so it does **not** fight going down. Over-tensioning is the only thing that fights downward — size to offload
*up to*, never beyond, gravity.

## Computed for our arm (shoulder = output_1, τ=1.63 N·m, attach on connector_3, a=261 mm)
| | Overhead post | **Shoulder-integrated** (better) |
|---|---|---|
| Anchor | 200 mm post, fixed to ground | 80 mm tower on servo_1 |
| Spring k | 31 N/m | **78 N/m** |
| Length swing (±70°) | 62→361 mm (6× — needs cable+pulley) | 181→288 mm (1.6× — normal spring OK) |
| Base rotation | blocked | **free (rides arm)** |

## Key kinematic rule (learned the hard way)
Anchor the tower on the link **immediately proximal** to the compensated joint = **servo_1** (NOT servo_2,
which rotates with the load → zero compensation; NOT servo_0, which is below the base yaw → tangles on rotate).
Far end on a distal link (connector_3 / servo_3). Tunable on assembly (slide anchor / preload).

## Spring selection (shoulder-integrated, k≈78 N/m target)
**Real-spring caveat:** a normal extension spring delivers force ∝ *extension* (length − free length), but the
perfect-balance math assumes force ∝ *full length* (zero-free-length). So a bare spring **under-compensates**.
Two routes:
1. **Cable over a pulley** at the tower top → makes a normal spring behave zero-free-length → near-perfect
   balance at all angles. Recommended for full compensation.
2. **Partial** — size to offload ~60–70% of worst-case torque, tune the anchor/preload. Simple, and since it
   is under-compensated it can never fight downward.

**Buy-spec:** extension spring, rate **0.4–0.5 lbf/in (70–88 N/m)**, free length **~100–130 mm**, OD ~10–14 mm,
max safe extension **≥120 mm** (to cover the ROM), max load **≥5 lbf (22 N)**, music-wire or zinc.
Source: McMaster extension-spring stock (mcmaster.com/products/extension-spring-stock) or a hardware
assortment. A garage-door spring is far too stiff — do not use.

**Tuning on assembly:** mount it, let the arm hang, then raise the tower anchor / add preload (a small
turnbuckle in the cable) until the shoulder holds mid-range with near-zero servo current. The system is
designed to be dialed in by hand — the exact rate is not critical.
