Every control cycle, a legged whole-body controller must turn a desired net body wrench (force + moment) into individual ground-reaction forces fi at each stance foot — the classic "contact-force QP" at the core of whole-body control:
minimize Σ‖f_i‖²
subject to Σ f_i = F_des
Σ (p_i × f_i) = M_des
f_i,y ≥ 0 (unilateral)
‖f_i,xz‖ ≤ μ f_i,y (friction cone)
This demo solves it with alternating projections: a min-norm pseudoinverse enforces the linear wrench-equality constraint, and each contact force is then projected exactly onto its (Lorentz) friction cone in closed form, iterated until both hold. This is the force-allocation half of whole-body control — distinct from the null-space kinematic redundancy resolution used by fixed-base manipulator WBC.
- Push Fx/Fz sliders — the net horizontal force the body must exert on the ground (e.g. to accelerate or resist a shove).
- Roll/Pitch torque sliders — a net moment about the body, as when leaning or carrying an offset load.
- μ slider — the Coulomb friction coefficient; the cone half-angle is atan(μ), shown as the translucent cone at each foot.
- FL/FR/BL/BR buttons — lift a leg into swing, removing it from the stance set and forcing the QP to redistribute load across fewer contacts, shrinking the feasible region.
- Arrow colour encodes per-foot cone utilization (green → safely inside the cone, red → saturated against it); when the desired wrench cannot be realized by the active feet at all, the residual stays nonzero and the solver flags it as infeasible.
Real-world relevance: this exact QP (or a receding-horizon version of it) runs at 100s of Hz inside legged robots like Boston Dynamics' Spot/Atlas and MIT's Mini Cheetah to keep every stance foot's push physically realizable before the low-level joint torques are computed.