Locomotion, Humanoids, and Navigation › Whole-Body Control

Michael BrenndoerferJuly 27, 202617 min read
World Models HandbookAll chapters
Part 10 of 12Application Domains
Chapter 57Locomotion, Humanoids, and Navigation › Whole-Body Control
Reading section 3 of 8 · Whole-Body Control · 17 minSection 3 of 8 · 17 min

Book contents

Section 3 of 8 · 17 min read

Locomotion, Humanoids, and Navigation › Whole-Body ControlOne section · Sections in this chapter3 / 8 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

We have identified quantities a locomotion model may need to predict. The next question is how a controller uses them to choose actions. Whole-body control is one structured answer; direct learned policies and other feedback designs are also possible.

"Whole body" refers to coordinated motion across the torso, relevant joints, and active contacts. A controller may jointly choose foot placement, feasible contact forces, torso orientation, and limb posture; the exact decision variables depend on the robot and task. The coupling matters: changing foot placement affects contact forces and torso acceleration, which in turn affect posture and where the feet can reach next. Optimizing those pieces independently can miss a feasible or stable coordinated motion.

The MPC Formulation

One formulation is nominal model predictive control (MPC) over the hybrid dynamics. Recall from Part VII, Ch 1: Sampling-Based Planning and Model Predictive Control that MPC at each control step solves a finite-horizon optimization problem, applies the first action, then re-solves. Here the controller plans with one terrain estimate θ^t\hat\theta_t and minimizes stage costs subject to dynamics, actuator limits, and contact/friction constraints. This formulation does not propagate the full terrain belief; scenario or belief-space MPC would account for that uncertainty explicitly:

min⁡{at}t=0H−1∑t=0H−1c(st,at)+cH(sH)subject tost+1=f(st,at,θ^t)s0=s^0,at∈A(st)contact constraints and friction cones\begin{aligned} \min_{\{a_t\}_{t=0}^{H-1}} \quad & \sum_{t=0}^{H-1} c(s_t, a_t) + c_H(s_H) \\ \text{subject to} \quad & s_{t+1} = f(s_t, a_t, \hat\theta_t) \\ & s_0 = \hat{s}_0, \quad a_t \in \mathcal{A}(s_t) \\ & \text{contact constraints and friction cones} \end{aligned}

where:

  • HH: planning horizon (number of steps)
  • ata_t: control input at time step tt (e.g., joint torques). A planner may also optimize feasible desired contact forces, but a lower-level controller must realize them through the robot's actuators and contacts.
  • sts_t: full robot state (generalized coordinates and velocities)
  • f(st,at,θ^t)f(s_t, a_t, \hat\theta_t): hybrid dynamics evaluated at the current terrain estimate θ^t\hat\theta_t
  • c(st,at)c(s_t, a_t): stage cost at time tt (e.g., tracking error, control effort)
  • cH(sH)c_H(s_H): terminal cost at the horizon
  • s^0\hat{s}_0: estimated initial state (from state estimator)
  • A(st)\mathcal{A}(s_t): set of admissible actions at state sts_t (respecting actuator limits)
  • Contact constraints: constraints ensuring feet are on the ground and forces lie in friction cones

The objective sums costs over a horizon. A major difficulty lies in the constraints: the nominal dynamics st+1=f(st,at,θ^t)s_{t+1} = f(s_t, a_t, \hat\theta_t) are hybrid, so contact-mode choices create different feasible regions. The admissible-action constraint encodes hardware limits, while contact and friction constraints restrict forces and motion. A low-cost trajectory that violates one of these constraints is not executable as planned. A trajectory feasible for θ^t\hat\theta_t can still fail on uncertain terrain, which is why robust or belief-aware variants matter.

Three choices make this formulation useful for the legged example, though related choices also appear in manipulation:

  • ff is the hybrid rigid-body dynamics above. It contains contact events, and small differences in their timing can produce large differences in future state on trajectories sensitive to those events.
  • cc can penalize center-of-mass (CoM) tracking error, footstep error, body orientation, control effort, or torque rates; its form depends on the task.
  • At a sticking contact, the force fif_i must satisfy a unilateral normal-force condition and a friction cone {f:∥ftangential∥≤μfnormal,fnormal≥0}\{f : \|f_{\text{tangential}}\| \leq \mu f_{\text{normal}}, f_{\text{normal}} \geq 0\}. A force outside that cone cannot be sustained as a sticking contact. Force feasibility also depends on contact location, joint kinematics, and actuator torque limits; being inside the cone alone does not make a whole-body plan executable.

The cone is easiest to read directly in force coordinates, where it is the wedge bounded by the two lines ftangential=±μfnormalf_{\text{tangential}} = \pm \mu f_{\text{normal}}. Admissible contact forces sit inside the wedge, and slipping forces sit outside it.

In[9]:
Code
## Friction cone geometry for a single contact with friction coefficient mu.
mu_friction = 0.5
f_normal = np.linspace(0.0, 10.0, 100)
f_tangent_bound = mu_friction * f_normal
Out[10]:
Visualization
Force-space friction wedge with one point inside and one outside the sticking-contact bound.
Two-dimensional section of a Coulomb friction cone with coefficient 0.5. The dot lies inside the shaded force bound; the cross lies outside the sticking-contact bound. This test alone does not establish whole-body or actuator feasibility.

Solving the full hybrid optimization at a high control rate can be expensive; feasibility depends on the model, horizon, solver, and hardware. Three common strategies simplify different parts of the problem.

The first is contact-implicit trajectory optimization, exemplified by Posa, Cantu, and Tedrake (2014), "A Direct Method for Trajectory Optimization of Rigid Bodies Through Contact". Their formulation optimizes motion and contact forces together with complementarity constraints rather than fixing a contact schedule in advance. This mathematical program with complementarity constraints can be numerically difficult. Related contact-implicit formulations may be used in receding-horizon control, but the cited work is trajectory optimization, not a claim that a particular smoothing parameter is always used in MPC.

The second is contact-scheduled optimization, used in several legged-control systems, including MIT Cheetah-style controllers; Crocoddyl is a library that can formulate such problems. A gait pattern or higher-level planner supplies a candidate contact schedule, and continuous optimization then solves for motion and forces under it. This avoids searching over every schedule in each solve, but a poor schedule can rule out an otherwise feasible motion. Feedback can revise timing or the schedule when conditions change. These examples do not establish how prevalent the approach is across deployed quadrupeds.

The third category needs a distinction. A learned dynamics model can be used inside a model-predictive planner; TD-MPC, from Part VIII, Ch 5: TD-MPC and Control-Centric Representations, is an example that uses learned latent dynamics, rewards, and value estimates for short-horizon planning. A direct policy trained by imitation or reinforcement learning may instead map observations to actions without planning through an explicit learned model. Analytic and learned models offer different inductive biases and failure modes; neither has a general guarantee of better behavior on hardware.

The two optimization strategies and learned-model MPC share a predict–optimize–execute–replan loop, but direct learned policies need not. The relevant comparison is therefore between how a controller represents dynamics and contacts, how it selects actions, and how it uses feedback, not an assertion that all reinforcement-learning controllers run MPC.

Centroidal Dynamics as a Low-Dimensional Surrogate

One reason whole-body control can be tractable is that the net motion of the center of mass (CoM) and its angular momentum can be expressed in a smaller space than the full 6+nj6+n_j robot coordinates. Internal forces cancel from the whole-body balance equations. In differential form:

mp¨CoM=mg+∑ifiL˙=∑i[(ri−pCoM)×fi+τicontact]\begin{aligned} m \ddot{p}_{\text{CoM}} &= m \mathbf{g} + \sum_i f_i \\ \dot{L} &= \sum_i \big[(r_i - p_{\text{CoM}}) \times f_i + \tau_i^{\text{contact}}\big] \end{aligned}

Here g\mathbf g is the gravity-acceleration vector, rir_i the contact point, and τicontact\tau_i^{\text{contact}} any direct contact moment, which is zero in a point-contact model. Internal forces do not appear explicitly in these net equations. That does not make joint motion irrelevant: kinematics, torque limits, and available contacts determine which centroidal trajectories the robot can realize. A low-dimensional planner can propose CoM and momentum behavior, while a whole-body controller checks and realizes it through the joints.

The centroidal model is a useful low-dimensional planning surrogate. Its CoM dynamics depend on gravity and contact forces, while the contact sequence remains hybrid. A further simplification is the linear inverted pendulum model (LIPM): with constant CoM height, a point support, and negligible rate of centroidal angular momentum about the CoM, the horizontal equation becomes linear and foot placement becomes a planning input. These assumptions make the LIPM useful for illustration, not a full robot simulator.

The first equation is Newton's second law for the whole-body CoM: gravity and the vector sum of contact forces determine its acceleration. The second is the angular-momentum balance about the CoM: contact forces acting at moment arms ri−pCoMr_i-p_{\text{CoM}}, plus any direct contact moments, change LL. In the LIPM special case, the CoM height is fixed at z0z_0, support is a point at pfootp_{\text{foot}}, and the centroidal angular-momentum rate is neglected. The horizontal dynamics then become p¨x=(g/z0) (px−pfoot)\ddot{p}_x = (g/z_0)\,(p_x-p_{\text{foot}}), where gg is the positive magnitude of gravitational acceleration. Changing pfootp_{\text{foot}} between steps supplies the control input in the example below.

The instability and the role of foot placement are visible in a short numerical integration of that ODE. With a fixed foot, the CoM accelerates away from the contact point. In the plotted feedback run, re-placing the foot at the capture-point estimate p+p˙/ωp + \dot{p}/\omega every step interval brings the CoM toward a bounded position.

In[11]:
Code
## LIPM CoM dynamics with a simple foot-placement feedback law.
## The foot is re-placed every T_step seconds at p + pd / omega, a
## standard capture-point style rule. Deterministic; no randomness is used.
g_lipm = 9.81
z0_lipm = 0.8
omega_lipm = np.sqrt(g_lipm / z0_lipm)
dt_lipm = 0.01
T_step = 0.35
n_lipm = 400

p = 0.05
pd = 0.0
p_foot = 0.0
lipm_p = np.zeros(n_lipm)
lipm_foot = np.zeros(n_lipm)
lipm_t = np.arange(n_lipm) * dt_lipm
for i in range(n_lipm):
    lipm_p[i] = p
    lipm_foot[i] = p_foot
    pdd = omega_lipm**2 * (p - p_foot)
    pd = pd + pdd * dt_lipm
    p = p + pd * dt_lipm
    if i % int(T_step / dt_lipm) == 0 and i > 0:
        p_foot = p + pd / omega_lipm
Out[12]:
Visualization
CoM trajectory of the linear inverted pendulum stabilized by moving foot placements.
Center-of-mass position under the linear inverted pendulum model with periodic foot placement. The capture-point feedback bounds the plotted CoM trajectory; with a fixed foot, the same model would diverge.

For a fixed foot placement, the linear LIPM has a closed-form CoM solution; choosing the next pfootp_{\text{foot}} changes that solution. A controller can use a centroidal planner for a candidate CoM and momentum trajectory, then a whole-body inverse-dynamics layer to seek joint torques that realize it. The layers must be checked together: joint reach, torque limits, and contact availability can invalidate the candidate. Their update rates depend on the robot and implementation, not on a universal planner-versus-controller frequency split.

The LIPM gives a concrete interpretation of foot placement. With a fixed point support, its horizontal CoM dynamics are unstable: displacement from the support tends to grow. Repositioning the support can change that trajectory. The capture-point-style rule in the code illustrates one feedback choice, not a general solution for every gait, contact geometry, or robot.

Learned Models of Whole-Body Dynamics

Analytic whole-body controllers use approximate body dynamics, parameter estimates, and contact assumptions. Feedback can tolerate some mismatch, but unmodeled compliance, soft terrain, or damage may degrade performance. Learned corrections and adaptation are possible responses; their value must be tested against a well-tuned analytic baseline.

One pattern is residual learning: fit a model of the mismatch between analytic and observed dynamics and use it alongside the analytic model. This resembles system identification with a flexible model class (Part II, Ch 3: System Identification). Training data can come from simulation, hardware, or both, and the residual must be evaluated on the target states and contacts. An unconstrained residual does not automatically fall back to physics outside its training data; that behavior requires an explicit gate, bound, or uncertainty-aware design.

Another pattern learns dynamics or a policy from data. The Dreamer family from Part VIII, Ch 3: The Dreamer Family learns a recurrent latent model from experience and trains an actor and critic using imagined trajectories. This is distinct from privileged teacher–student locomotion training: some methods train with simulator-only terrain information and then distill or adapt a controller that uses onboard sensing. Neither approach implies that every humanoid or quadruped learns a single latent world model of body and terrain, and a privileged teacher does not guarantee successful extraction from noisy sensors.

The distinction is about inductive bias, not a strict body-versus-terrain split. An analytic backbone can preserve useful structure, but a learned residual may still produce physically implausible outputs unless constrained. An end-to-end model can learn unmodeled effects and can also incorporate physical structure. Which combination works best depends on the robot, data, and validation regime.

Failure Modes of Whole-Body Control

Whole-body control can encounter several failure modes worth testing explicitly; their frequency and severity depend on the system.

  • Contact mistiming. The controller expects a foot to be in contact at time tt and it is not, or vice versa. This happens when terrain height is misestimated, when the compliance of the surface is not modeled, or when the actuator bandwidth limits how fast the leg can extend.
  • Friction cone violation. A requested tangential force may exceed the available sticking-friction bound, causing slip; whether the robot recovers depends on its feedback and remaining contacts. A model trained on one surface may misestimate this bound on another.
  • Model exploitation. The optimizer finds a plan that is optimal under an inaccurate model but impossible in reality: for example, a step that relies on force that the model thinks is available but the actuator cannot produce. This is the canonical "model-based RL gone wrong" story from Part XII, Ch 1: Failure Modes and Model Exploitation.
  • Compounding rollout error. Repeated model errors can accumulate over an open-loop horizon, though they can also contract under stable dynamics. The relevant horizon depends on the model, controller, and task.

The four failure modes interact rather than dividing neatly into physical and computational categories. Contact mistiming or slip may follow a poor terrain estimate, while model exploitation can end in a physical loss of balance. Compounding prediction error can also misrank otherwise feasible plans without making any action physically impossible. Better contact and friction estimates help, as does measuring where the predictive model is unreliable; a controller needs both kinds of checks because an unexpected contact changes the state from which the next prediction begins.

No single mitigation covers all four. Re-observation and replanning can reduce exposure to open-loop error, subject to sensing and computation limits. Contact and friction failures also require feasible constraints, calibration, and monitoring. An ensemble may reveal model disagreement, but disagreement is not a calibrated detector of every out-of-distribution state or model-exploitation risk. Feedback update rate and rollout horizon should be chosen from measured closed-loop behavior, not a universal short-horizon rule.

A Learned-Model Rollout Diagnostic for MPC

We test whether a learned hopper model can sustain the multi-step predictions that MPC would use. The experiment collects simulator transitions and fits a linear model of vertical dynamics; it does not optimize actions or close a control loop.

In[13]:
Code
rng = np.random.default_rng(42)

## Collect (z, vz, 1) -> (dz, dvz) pairs from many simulated hops
X_list, Y_list = [], []
for _ in range(40):
    vz0 = rng.uniform(3.0, 5.5)
    z0 = rng.uniform(0.3, 0.6)
    xs_i, zs_i, vzs_i, _ = simulate_hopper(
        x0=0.0, z0=z0, vz0=vz0, vx0=1.5, steps=3000
    )
    # Delta form: predict change from current step to next step
    X_list.append(
        np.column_stack([zs_i[:-1], vzs_i[:-1], np.ones_like(zs_i[:-1])])
    )
    Y_list.append(
        np.column_stack([zs_i[1:] - zs_i[:-1], vzs_i[1:] - vzs_i[:-1]])
    )

X = np.concatenate(X_list, axis=0)
Y = np.concatenate(Y_list, axis=0)
theta, *_ = np.linalg.lstsq(X, Y, rcond=None)

print(f"Transition data shape: {X.shape}")
print(f"Linear model shape: {theta.shape}")

Note the deliberate choice to model the change in state rather than the next state directly. Because the next state is close to the current one, an absolute-state predictor can appear accurate under a raw next-state error metric even if it mainly copies its input; that metric needs a persistence baseline. Predicting the change exposes the nontrivial part of the transition in a one-step residual. For this single fit pooled across flight and stance, the mean absolute residual is larger in flight than in stance; it is not a mode-specific model.

The linear model has the form Δ[z,z˙]=Θ⊤[z,z˙,1]\Delta [z, \dot{z}] = \Theta^\top [z, \dot{z}, 1], where Δ[z,z˙]\Delta [z, \dot{z}] is the one-step change in height and vertical velocity, [z,z˙,1][z, \dot{z}, 1] is the input feature vector augmented with a bias term, and Θ\Theta is the least-squares fit matrix. Flight dynamics are linear, but this one fitted map pools flight and stance transitions, so it need not fit either mode exactly, especially near a contact switch. We test it on a held-out trajectory rather than claiming an exact fit from the model class alone.

In[14]:
Code
## Held-out trajectory from the true simulator
xs_h, zs_h, vzs_h, _ = simulate_hopper(
    x0=0.0, z0=0.5, vz0=4.5, vx0=1.5, steps=1200
)

## Roll the learned model forward from the same initial state
H = 600
z_pred = np.zeros(H)
v_pred = np.zeros(H)
z_pred[0], v_pred[0] = zs_h[0], vzs_h[0]
for t in range(1, H):
    x_in = np.array([z_pred[t - 1], v_pred[t - 1], 1.0])
    delta = x_in @ theta
    z_pred[t] = z_pred[t - 1] + delta[0]
    v_pred[t] = v_pred[t - 1] + delta[1]

## One-step predictions use held-out true states, not the training design matrix.
heldout_features = np.column_stack(
    (zs_h[: H - 1], vzs_h[: H - 1], np.ones(H - 1))
)
one_step_pred = zs_h[: H - 1] + (heldout_features @ theta)[:, 0]
one_step_err = np.zeros(H)
one_step_err[1:] = np.abs(one_step_pred - zs_h[1:H])
recursive_err = np.abs(z_pred - zs_h[:H])

The distinction between one-step error and recursive error is central to the experiment. One-step error evaluates a prediction from a true state, matching the model's training inputs. Recursive error evaluates a model after its own predictions become inputs, as in an open-loop planner rollout. Both diagnostics matter, but the second exposes drift that a low one-step error can hide.

We now visualize how recursive error changes with horizon, an important diagnostic for a model used in multi-step planning.

Out[15]:
Visualization
Line plot comparing one-step and recursive prediction error over 600 steps.
One-step versus recursive rollout error for the learned hopper model. One-step error stays much smaller, with a brief spike; recursive error grows under repeated prediction.

The takeaway is that one-step height prediction is small but not exact, including in flight: although the true flight law is linear, this fitted map pools flight and stance transitions. Recursive prediction diverges as small biases accumulate and the model fails to represent contact-mode changes. Re-solving MPC from new observations limits the time spent following an open-loop prediction, but the appropriate update rate and horizon depend on sensing, computation, and the robot's dynamics. This toy experiment establishes open-loop prediction error, not a safe control frequency.

The plotted divergence can reflect fitted-model bias and missed contact structure, but this experiment does not isolate their contributions. Bias need not grow smoothly, and a mode-timing error need not enter a different basin. Better data, explicit modes, contact-aware losses, uncertainty estimates, and timely feedback are candidate remedies; each needs testing against the failure it is meant to address.

Planning Horizon vs. Model Fidelity

The useful planning horizon depends on prediction error, task timescale, contact events, sensing, and compute. A short learned-model horizon may support a near-term footstep, while a higher-level planner can reason over a longer route; replanning does not by itself extend a model's reliable open-loop horizon.