Locomotion, Humanoids, and Navigation

Michael BrenndoerferJuly 27, 202666 min read

Part of World Models Handbook

Model legged locomotion, whole-body control, and map-based navigation with hybrid contact dynamics, terrain uncertainty, and sim-to-real transfer.

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

Locomotion, Humanoids, and Navigation

Imagine three tasks: a quadruped meeting an unfamiliar slope, a humanoid balancing while reaching, and a wheeled robot navigating with a map built earlier. These are illustrative scenarios, not reported trials. They differ in embodiment and horizon, but each requires predicting how actions change the robot's state and surroundings before choosing what to do.

Earlier chapters introduced state, action, partial observability, system identification, and planning. Part V: World-Model Architectures developed learned predictive representations; Part VII: Planning and Agency used them for action selection. Here we ask what those ideas require when a robot makes and breaks contact with terrain while moving toward a goal.

Locomotion and navigation put different pressures on a model. A legged controller must account for changing contact modes and uncertain surface properties; a navigator also needs spatial memory and a way to evaluate routes. Errors can compound over repeated predictions, especially when a planned footfall or route crosses a poorly modeled region. The fixed-base manipulation examples in the previous chapter have different actuation and contact assumptions, but neither domain is categorically easier.

This chapter follows body dynamics and terrain interaction, whole-body control, then spatial memory and goal navigation. We finish with cross-embodiment and sim-to-real transfer. The worked models are deliberately small: they show how contact modes, terrain uncertainty, and map uncertainty enter prediction and planning without claiming to reproduce a full robot stack.

We begin with the mechanics of a floating base so the later control equations have concrete state and force variables. Planning then connects those predictions to actions. Navigation adds a map and longer-horizon decisions; it does not replace the shorter control loop beneath it.

Terrain uncertainty appears at several levels. At the physics level, unknown height or friction changes predicted transitions. At the control level, it can change which candidate motions satisfy contact limits. At the navigation level, it can change the cost or feasibility of a route. A single aggregate prediction score can miss these differences, so we evaluate the quantities each decision uses.

A physical transition model is one component of that planning system:

st+1=f(st,at)s_{t+1} = f(s_t, a_t)

where:

  • sts_t: your robot's physical state at time tt (base pose, joint angles, and velocities).
  • ata_t: the control action at time tt (joint torques or desired joint positions).
  • ff: the physical transition model mapping current state and action to next state under an assumed body, terrain, and contact mode. Goals, route costs, and spatial memory belong to the task or map model used by the planner; they need not be components of ff.

A too-smooth terrain estimate and an overestimated friction coefficient might fit familiar trajectories yet fail on a different surface. Aggregate one-step error alone may not identify which component is responsible. Contact-specific tests, terrain-parameter checks, and closed-loop outcomes provide different evidence about the model.

Body Dynamics and Terrain Interaction

A typical legged robot has a floating base with six local configuration coordinates: three for position and three for orientation. Joint torques do not directly actuate those coordinates; gravity and external contact forces affect base motion. This differs from the fixed-base arm examples in the previous chapter, though mobile manipulators can also have moving bases. Inverse kinematics can propose a pose, but dynamic feasibility still depends on contact, torque, and friction limits.

The equations of motion for a floating-base robot with njn_j joints describe the balance of inertial forces against actuation and contact forces. The floating-base rigid-body dynamics in standard form are:

M(q)q¨+C(q,q˙)q˙+G(q)=S⊤τ+∑i∈CJi⊤(q)fiM(q) \ddot{q} + C(q, \dot{q}) \dot{q} + G(q) = S^\top \tau + \sum_{i \in \mathcal{C}} J_i^\top(q) f_i

where:

  • q∈R6+njq \in \mathbb{R}^{6 + n_j} is a local coordinate representation of base pose plus joint angles; three orientation coordinates require a local chart.
  • M(q)M(q) is the mass matrix, coupling joint and base accelerations.
  • C(q,q˙)q˙C(q, \dot{q}) \dot{q} is the Coriolis and centrifugal force vector.
  • G(q)G(q) is the gravity force vector.
  • S=[0nj×6∣Inj]S = [0_{n_j \times 6} \mid I_{n_j}] selects the actuated joints, so S⊤τS^\top \tau applies joint torques and nothing to the six unactuated base degrees of freedom.
  • C\mathcal{C} is the set of currently active contacts, JiJ_i is the contact Jacobian, and fif_i is the contact force at contact ii.
  • Ji⊤(q)fiJ_i^\top(q) f_i is the generalized force induced by contact ii, including a wrench on the floating base.

The left-hand side of the equation collects inertial, velocity-dependent, and gravitational terms. On the right, S⊤τS^\top\tau applies commanded joint torques, while Ji⊤fiJ_i^\top f_i represents generalized contact forces, including forces on the floating base. Contact forces are not independent commands in this formulation: they must be feasible consequences of motion, geometry, and contact constraints.

The important observation is that the base has no actuation term in the right-hand side: joint torques act on it only through the limbs and their contacts. Gravity still accelerates the center of mass in flight, and active contact forces can accelerate and rotate the base. Locomotion uses joints to push the ground so that the ground pushes back in a direction that moves the robot toward its goal. You must also respect actuator torque limits, joint velocity limits, and the available friction at each contact, or the base motion you plan will not be achievable. These limits separate a mathematically valid trajectory from one the hardware can execute, and they reappear throughout the whole-body control section below.

Two things follow. First, the base motion is not directly commanded; it emerges from gravity, internal body motion, and contact. A world model of locomotion must account for contact forces as well as joint angles. Second, if no contact is active, the robot is in free flight and M(q)q¨+C(q,q˙)q˙+G(q)=S⊤τM(q) \ddot{q} + C(q,\dot q)\dot{q} + G(q) = S^\top \tau. Joint motion can reorient the torso relative to the limbs, as in the "falling cat" effect. But internal torques cannot accelerate the whole-body center of mass. With gravity as the only external force, that center of mass follows a ballistic trajectory; its linear momentum changes under gravity, not under internal actuation.

The falling-cat intuition is worth dwelling on because it recurs across the whole chapter. A gymnast who has left the ground cannot accelerate her center of mass upward using only internal motion, but she can twist her limbs to reorient her torso. In the same way, a legged robot in the flight phase of a hop can tuck or extend its legs to change its orientation for landing, but it cannot steer its center-of-mass trajectory without an external force. For the vertical hopper below, flight is simple ballistic motion; predicting a full robot's free-flight orientation and landing configuration can still be difficult. Stance adds large, state-dependent contact forces, so splitting predictions by contact mode is useful.

Another structural feature is that legged locomotion often has distinct contact modes. Touchdown, liftoff, and slip can change the applicable force law; a rigid impact may reset velocity, whereas a compliant-contact model can change forces continuously. A predictor may need both within-mode dynamics and the timing of transitions. The consequences of mistiming depend on the model and task: a wrong contact mode can produce a large rollout error, but neither a discontinuous state jump nor error growth is inevitable.

Consider a one-dimensional vertical hopper, the simplest instructive example. Let zz be the height of the body, vv its vertical velocity, and h(x)h(x) the terrain height at horizontal position xx. The dynamics switch between two modes: ballistic flight under gravity, and stance with a compliant ground reaction force. Written as a piecewise law:

z¨={−gif in flight−g+F(z,z˙)mif in stance\ddot{z} = \begin{cases} -g & \text{if in flight} \\ -g + \dfrac{F(z, \dot{z})}{m} & \text{if in stance} \end{cases}

where:

  • zz: the height of the body, with z¨\ddot{z} its vertical acceleration.

  • gg: the gravitational acceleration.

  • mm: the body mass.

  • F(z,z˙)F(z, \dot{z}): the toy spring-damper force in stance, given by F(z,z˙)=−k (z−h(x))−b z˙F(z, \dot{z}) = -k\,(z - h(x)) - b\,\dot{z}.

  • h(x)h(x): the terrain height at horizontal position xx.

  • kk: the ground stiffness, and bb: the ground damping. The transition rules are equally important:

  • Flight →\to stance when z≤h(x)z \leq h(x) and z˙≤0\dot{z} \leq 0.

  • Stance →\to flight when z>h(x)+ϵz > h(x) + \epsilon in this toy's hysteretic mode rule.

This simple system illustrates gravity, a terrain-dependent force, event-triggered mode switches, and a trajectory shaped by switch timing. It is deliberately not a physically exact unilateral contact model: the unclamped spring-damper can briefly pull downward while the mode remains stance, whereas a real ground contact cannot pull the foot toward the surface. Extending to a biped also requires multiple contacts, surface normals, friction, impact handling, and active joint torques. The hopper isolates the hybrid timing problem without claiming to capture every difficulty of locomotion.

To build intuition for the one-dimensional case, note that the flight mode is a simple kinematic equation z¨=−g\ddot{z} = -g whose solution is a parabola, and the stance mode is a mass-spring-damper system:

mz¨=−mg−k(z−h(x))−bz˙m\ddot{z} = -mg - k(z - h(x)) - b\dot{z}

where:

  • mz¨m\ddot{z}: the inertial force on the body.
  • −mg-mg: the gravitational force.
  • −k(z−h(x))-k(z - h(x)): the elastic restoring force from the compliant ground, proportional to how far the body has compressed below the terrain height h(x)h(x).
  • −bz˙-b\dot{z}: the damping force opposing vertical velocity.

In this toy, a state-dependent guard switches between flight and stance, so the trajectory is piecewise smooth and guard timing matters. Near a transition, a small height or velocity error can select the wrong mode. The resulting rollout then uses the wrong force law until its mode estimate is corrected; its error may be substantial, but its magnitude and direction depend on the trajectory. Guard accuracy and within-mode accuracy both matter, and neither is universally the dominant engineering problem.

Hybrid Dynamical System

A hybrid dynamical system is a system whose state evolves continuously within each of several modes, with discrete jumps or mode switches triggered by state-dependent events (guards). Locomotion, grasping, and many contact-rich manipulation tasks are hybrid; the events (footstrike, liftoff, slip) are often the hard part of the prediction problem.

Terrain as a Latent Variable

Here is where locomotion world models differ most sharply from generic sequence models. The transition function depends on variables such as terrain height and friction that are not part of the robot's proprioceptive state. The robot senses terrain through a camera, LiDAR, a depth sensor, or proprioceptive feedback when its feet make contact. Predictions over terrain it has not yet stepped on are inherently uncertain. Put differently, the hopper's rollouts above assumed the terrain function h(x)h(x) was known; in reality hh is one of the quantities the robot must estimate, and it changes from one part of the world to the next.

We can make this formal by writing the environment as a partially observable process. Let θ\theta denote the terrain parameters (per cell: height, slope, friction, compliance), sts_t the robot's physical state, and oto_t its observations. A latent-parameter model has a transition law conditioned on terrain and an observation law conditioned on both state and terrain:

st+1∼p(st+1∣st,at,θ)ot∼p(ot∣st,θ)\begin{aligned} s_{t+1} &\sim p(s_{t+1} \mid s_t, a_t, \theta) \\ o_t &\sim p(o_t \mid s_t, \theta) \end{aligned}

where:

  • θ\theta: terrain parameters (per-cell height, slope, friction, compliance) that are fixed but unknown
  • sts_t: robot's physical state (base pose, joint angles, velocities)
  • ata_t: control action (joint torques or desired joint positions)
  • oto_t: observation (proprioceptive sensors and exteroceptive sensors such as camera or LiDAR)

The controller maintains a belief bt(θ)b_t(\theta) over terrain, in the sense of the posterior introduced in the filtering sections. A landing's impact and resulting body motion can be informative; between contacts, exteroceptive sensing can also update the belief. This is the belief-state framework from Part II, Ch 2: Bayesian Filtering and Belief States, applied to terrain alongside robot-state estimation. Here θ\theta is fixed but unknown over the modeled region; sts_t is robot pose, joints, and velocities; ata_t is a commanded torque or joint target. The conditional transition may itself be deterministic or stochastic. Even if it is deterministic for a fixed θ\theta, marginalizing over bt(θ)b_t(\theta) makes the controller's prediction uncertain. A controller can plan against a nominal terrain estimate or average over belief samples; the nominal MPC formulation below illustrates the former. In practice terrain and body state are often estimated jointly: a footstep on an unexpectedly soft patch informs both the surface model and the body's velocity estimate.

The terrain remains uncertain even when the robot's pose is well estimated. If terrain were fully observed, one could append it to the robot state and recover a standard MDP. The latent-parameter framing clarifies what each observation contributes: contact measurements are local and direct but can be distorted by slip or compliance; exteroception covers terrain ahead but depends on visibility and geometry. An estimator can combine both, updating its local surface estimate after contact while using cameras or depth sensors to anticipate terrain ahead.

We can see a toy belief over terrain narrowing as observations arrive. In the following synthetic measurement model, each contact supplies an independent, unbiased Gaussian observation of one fixed local height. With the stipulated flat prior, posterior standard deviation is 0.12/n0.12/\sqrt{n} after nn observations. Real contacts can be biased or correlated, so they need not follow this curve.

In[3]:
Code
## Fixed-seed synthetic posterior over a single terrain-height parameter.
## The measurement noise is Gaussian with standard deviation 0.12; with a flat prior,
## the posterior mean is the running sample mean and the posterior std is
## 0.12 / sqrt(n) by construction. No randomness is used at plot time.
rng_belief = np.random.default_rng(0)
true_h = 0.35
n_obs = np.arange(1, 26)
belief_obs = true_h + rng_belief.normal(0.0, 0.12, size=n_obs.size)
post_mean = np.cumsum(belief_obs) / n_obs
post_std = 0.12 / np.sqrt(n_obs)
Out[4]:
Visualization
Posterior over terrain height narrowing as more contact observations arrive.
Posterior over terrain height as contact observations accumulate. The shaded band spans two posterior standard deviations around the running mean, contracting toward the true height as more foot contacts arrive, showing how each landing sharpens the terrain belief.

The practical lesson is conditional. Ignoring uncertainty in a terrain estimate can make a predicted step overconfident; omitting task-relevant terrain information can increase transition error or hide useful foothold choices. Neither outcome follows for every controller or gait. Perceptive locomotion systems can combine proprioceptive feedback with exteroceptive information about terrain ahead, as in Miki et al.'s quadruped work below. Their sensing and control update rates depend on the implementation; both information streams can contribute to feedback and prediction.

Learned Terrain Reference Models

There is a middle ground between a full physics-based simulator and an end-to-end neural network. Some systems learn a terrain-related latent from recent proprioceptive history and condition a policy on it. Such an encoder approximates information in a terrain belief bt(θ)=p(θ∣o1:t,a1:t)b_t(\theta) = p(\theta \mid o_{1:t}, a_{1:t}), although its latent need not be a calibrated posterior. Lee et al. (2020), "Learning Quadrupedal Locomotion over Challenging Terrain" trained a proprioceptive student policy with a temporal convolutional network over observation history, supervised by a privileged teacher. Miki et al., 2022, "Learning robust perceptive locomotion for quadrupedal robots in the wild" combined proprioception with exteroceptive height samples from an elevation map constructed from onboard sensor data; an attention-based recurrent belief encoder learned how to use imperfect perception. Miki et al. did not learn the elevation map itself in the policy. These examples show different ways to condition locomotion on inferred terrain information, not a single explicit probabilistic world-model architecture.

Such architectures can separate an estimator from a policy, making the interface inspectable when it is explicitly defined. A history encoder may infer terrain-related properties from joint and body measurements, commands, and contact responses; which signals are useful depends on the sensors and actions. Similar histories can arise on different surfaces, and terrain can change within an episode, so an inferred latent is not automatically an identifiable or calibrated terrain parameter.

When terrain is not directly observable but affects a trajectory, explicit parameter estimation and recurrent history encoding are two options; exteroceptive sensing and hybrid estimators add others. An explicit estimate can be easier to inspect and calibrate, while a recurrent latent can retain useful history without a hand-specified terrain variable. Neither has a general advantage in data efficiency or failure rate. Those properties need comparison on the intended robot, sensor suite, and terrain.

The tradeoff can be read as a choice of where uncertainty lives. Explicit estimation keeps the terrain posterior separate and lets the planner propagate it forward, whereas recurrent absorption pushes the uncertainty into the hidden state, which is harder to inspect but avoids hand-designing a terrain model. Which choice is better depends on what you intend to do with the uncertainty. If you plan to plan conservatively, an explicit posterior that can be queried for a confidence bound is invaluable. If you only need a policy that acts well, an absorbed hidden state may be all you need, and the representational freedom it allows can be an advantage rather than a liability.

Let us make the hybrid, terrain-dependent dynamics concrete by simulating the simple 1D hopper. The simulator below uses a fixed two-millisecond explicit step and a spring-damper guard rule. We do not establish numerical convergence or model a rigid impact; the goal is to expose mode structure, not to match a production simulator.

In[5]:
Code
import matplotlib.pyplot as plt
import numpy as np

## Physical constants for the 1D hopper
g = 9.81
m = 1.0
k = 200.0
b = 5.0


def terrain_height(x, a1=0.10, a2=0.05, w1=4.0, w2=1.3):
    """Rolling, mildly irregular terrain."""
    return a1 * np.sin(2 * np.pi * x / w1) + a2 * np.sin(2 * np.pi * x / w2)


def simulate_hopper(
    x0, z0, vz0, vx0, terrain_fn=terrain_height, dt=0.002, steps=3000
):
    """Simulate a 1D hopper: ballistic in flight, spring-damper in stance."""
    xs = np.zeros(steps)
    zs = np.zeros(steps)
    vzs = np.zeros(steps)
    phases = np.zeros(steps, dtype=int)  # 0 = flight, 1 = stance

    x, z, vz = x0, z0, vz0
    phase = 0
    x_c = x0  # horizontal position of the current foot contact

    for t in range(steps):
        xs[t], zs[t], phases[t] = x, z, phase
        vzs[t] = vz

        if phase == 0:  # flight
            vz_next = vz - g * dt
            z_next = z + vz_next * dt
            x_next = x + vx0 * dt
            ground_next = terrain_fn(x_next)
            if z_next <= ground_next and vz_next <= 0:
                phase = 1
                x_c = x_next
                x = x_next
                z = ground_next
                # Retain impact velocity for the compliant spring to decelerate.
                vz = vz_next
            else:
                x, z, vz = x_next, z_next, vz_next
        else:  # stance
            ground = terrain_fn(x_c)
            F = -k * (z - ground) - b * vz
            vz_next = vz + (-g + F / m) * dt
            z_next = z + vz_next * dt
            if z_next > ground + 1e-3:
                phase = 0
                x = x_c + vx0 * dt
                z, vz = z_next, vz_next
            else:
                z, vz = z_next, vz_next

    return xs, zs, vzs, phases

The simulator is a compact illustration of the flight–stance switch, not a complete contact model. It tracks body height, vertical velocity, and an integer mode flag. Flight applies gravity and constant horizontal drift, then tests for a descending touchdown. Stance applies a spring-damper force referenced to terrain height at the latched contact and tests for liftoff after crossing a small height threshold. These programmed guards control the toy's mode changes; full legged-robot dynamics require more state, constraints, and impact handling.

We now run a single trajectory from fixed initial conditions. The compliant-contact model retains downward velocity at touchdown, so its spring can return some energy before liftoff; damping dissipates energy across subsequent contacts.

In[6]:
Code
xs, zs, vzs, phases = simulate_hopper(
    x0=0.0, z0=0.6, vz0=0.0, vx0=1.5, steps=4000
)
ground = terrain_height(xs)
t_array = np.arange(len(xs)) * 0.002

We can visualize the trajectory against the terrain, shading the intervals where the foot is in contact. The plot cell consumes the arrays computed above and does no simulation itself.

Out[7]:
Visualization
Line plot of hopper height versus horizontal position atop a sinusoidal terrain profile.
Trajectory of the 1D hopper over rolling terrain, with stance segments in orange and flight segments in blue. Parabolic arcs appear during flight and compressed, bounced trajectories appear during stance, revealing the hybrid mode structure directly.

The plot makes the hybrid structure visible, though this particular run spends most of its sampled steps in stance. The short flight segments trace shallow parabolic arcs; during stance the trajectory bends as the compliant spring pushes against the ground. Contact state and impact velocity influence the next apex; a whole-body controller can also change the subsequent stance response. This hybrid behavior can be modeled as a switched system, where the mode variable mt∈{0,1}m_t \in \{0,1\} (0 = flight, 1 = stance) determines which dynamics govern the state evolution, so that each mode contributes its own dynamics and the guard condition selects which one is active at each instant. The value of mtm_t is itself a prediction target because the world model has to know when the next touchdown or liftoff will occur.

The same trajectory can be read in state space rather than in time. Coloring height–velocity samples by mode shows how this run moves through flight and stance; the programmed guards, not separation in this projection, determine when the active mode changes.

Out[8]:
Visualization
Phase portrait of hopper height versus vertical velocity split by flight and stance.
Phase portrait of the hopper trajectory in the height and vertical velocity plane. Flight segments lie on ballistic curves and stance segments follow compressed compliant-contact trajectories, so the two modes occupy visibly distinct regions.

Notice how much the terrain function enters even this one-dimensional model. Its stance force depends on displacement relative to terrain height at the contact, so height error changes the predicted force and acceleration. A full legged robot can have similar coupling at its active contacts; joint terrain and body-state estimation is one possible response, not a requirement for every controller.

Whole-Body Control

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.

Spatial Memory and Goal Navigation

Locomotion determines how the robot moves its body. Navigation determines where it should go. The two are coupled: the choice of gait depends on the destination and obstacles, and the choice of route depends on what gaits the terrain permits. In an autonomous mobile robot, the coupling is managed through a world model that includes a map: an internal representation of the environment that supports spatial reasoning over long horizons.

The map is not a luxury. A robot's sensors have finite range; a decision about where to go next must often be made based on information that left the field of view minutes ago. The environment is partially observable, and the belief state includes the robot's estimate of layout, occupancy, and semantics of the space. This is the navigation-specific instance of the POMDP belief state from Part II, Ch 1: Markov and Partially Observable Decision Processes and Part II, Ch 2: Bayesian Filtering and Belief States. In the navigation case the latent state includes the robot pose xtx_t, the map mm, and often the motions of other agents, while the observations ztz_t are range or image measurements and the actions utu_t are velocity commands or waypoints.

One reason to build a map is to support choices beyond the current sensor view. A purely current-observation policy cannot distinguish two locally identical hallways with different known destinations; stored spatial information can. An explicit map is one such memory structure, while a recurrent policy or other memory can also retain useful history. A probabilistic map may be part of the robot's belief over persistent layout, but maps need not always be represented as posteriors.

What a Navigation World Model Contains

Several map representations appear in navigation. A metric occupancy grid or volumetric map assigns occupancy estimates to spatial cells, as in OctoMap. It can support local planning, but dense high-resolution coverage of a large environment can be costly. Sparse, hierarchical, feature-based, and graph representations have different storage and query scaling; SLAM does not imply a dense grid.

The second layer is topological: a graph whose nodes are landmarks or rooms and whose edges represent traversability, as in the classical work on topological SLAM and in Chaplot et al. (2020), "Neural Topological SLAM for Visual Navigation". Topological maps are scale-efficient and support long-horizon reasoning, but they require a mechanism to decide which observations become nodes. That mechanism is the crux: a topological map is only as good as its node placement, and getting the granularity right, coarse enough to be compact and fine enough to be informative, is a real design problem.

The third layer is semantic: object or place categories and their relations. Such information can provide priors for where a goal object might be, including when geometry is incomplete. Vision-language models may supply candidate semantic priors, but they cost computation and can be wrong; a category association is not an observation of what lies behind a closed door.

Different systems combine these representations according to task and scale. A metric map can help resolve nearby obstacles; a topological graph can organize long routes; semantic labels can guide object search. None has a single exclusive function, and this chapter does not establish a universal most-robust combination. The useful mixture depends on localization quality, map updates, route length, and the cost of mistakes.

SLAM as a World-Model Build

Simultaneous localization and mapping (SLAM) is a family of methods for jointly estimating a robot trajectory and a map from sensor data. One probabilistic formulation tracks a belief over current pose xtx_t and map mm:

bt(xt,m)=p(xt,m∣z1:t,u1:t−1)b_t(x_t, m) = p(x_t, m \mid z_{1:t}, u_{1:t-1})

where:

  • xtx_t: robot pose at time tt (position and orientation)
  • mm: map of the environment (e.g., occupancy grid, landmarks)
  • z1:tz_{1:t}: sequence of observations from time 1 to tt
  • u1:t−1u_{1:t-1}: controls applied between successive poses x1x_1 through xtx_t
  • bt(xt,m)b_t(x_t, m): belief over pose and map given all observations and controls

The observations through time tt and controls applied before time tt condition a joint belief over the robot's location and the surrounding world. This is a world model that is updated from data and queried by a downstream planner. The chicken-and-egg structure is why SLAM is hard: the robot needs its location to build a consistent map, and it needs a map to estimate its location. Joint inference addresses both unknowns together. Other indexing conventions are possible if the time interval attached to each uku_k is defined consistently.

SLAM systems make different structural choices. EKF-SLAM maintains a Gaussian approximation over pose and landmarks, with covariance updates that can be expensive as landmark count grows. Factor-graph and bundle-adjustment systems, including Cartographer and ORB-SLAM, optimize pose and measurement constraints. Their speed and loop-closure reliability depend on data association, graph size, solver, and implementation; graph structure alone does not guarantee either advantage.

Loop closures are one payoff of the graph formulation. Dead reckoning can let pose uncertainty accumulate along a trajectory; a valid, informative loop-closure constraint can reduce drift or uncertainty after optimization. A mistaken association may instead damage the estimate.

In[16]:
Code
## Synthetic pose-variance profiles along a trajectory.
## Without loop closure the variance grows linearly with pose index; a
## stylized loop-closure effect begins after pose 80 and variance then decays.
n_slam = 120
slam_t = np.arange(n_slam)
cov_no_loop = 0.02 * (slam_t + 1)
cov_with_loop = cov_no_loop.copy()
for i in range(80, n_slam):
    cov_with_loop[i] = cov_with_loop[i] * np.exp(-0.06 * (i - 80))
Out[17]:
Visualization
Two synthetic pose-variance curves coincide at pose 80, then the loop-closure curve gradually declines while dead-reckoning variance keeps increasing.
Synthetic pose-variance profiles with and without a stylized loop-closure effect. The curves coincide at pose 80; afterward, the illustrated correction reduces variance relative to the continued dead-reckoning trend. This is not covariance computed by a SLAM solver.

Neural implicit mapping can represent geometry with fields queried at spatial points; some systems combine such fields with explicit structures. Neither an explicit nor a learned map is automatically compact, cheap to query, complete, or calibrated in unobserved regions. Explicit maps can retain unknown cells or uncertainty, while learned maps may interpolate plausible geometry that needs validation. Their value for planning must be measured on the target scene and query workload.

Learning to Navigate from a Built Map

A map supports goal-directed navigation, but localization, perception updates, and motion control remain necessary. Three illustrative planning strategies follow.

The first is geometric planning: run A*, D*, or a sampling-based planner over an occupancy grid or topological graph, then follow the resulting path. This classical approach remains useful where the map and travel constraints can be represented explicitly. The map is the spatial model, the planner computes a policy or route, and the objective may be path length or a risk-adjusted cost. Its explicit representation often makes a bad route easier to diagnose: one can inspect the map cells or graph edges that the planner used.

The second is learned navigation with a spatial map. Chaplot et al. (2020), "Learning to Explore using Active Neural SLAM," combine a learned map-and-pose module, hierarchical policies, and analytical path planning. They reported stronger exploration performance and sample efficiency than the particular end-to-end baselines they evaluated. That result supports explicit spatial structure as a useful inductive bias in their setting; it does not establish a universal advantage over recurrent or other map-free policies.

The third strategy uses learned spatial features. A network may write observation-derived features into cells or graph nodes and let a policy or planner query them. This extends temporal memory with spatial indexing (Part III, Ch 4: Temporal State and Memory). The cells may be deterministic latent features or an explicit uncertainty-aware belief; latent storage alone does not require Bayesian posterior planning or guarantee accurate geometry.

These strategies vary in how much geometry and uncertainty they expose. Explicit maps can make a route easier to inspect but can contain unnoticed estimation errors; learned features can help with ambiguous observations but may also hallucinate missing geometry. Storage, query cost, calibration, and transfer vary by implementation. A hybrid map is one option, not an established most-robust design for every navigation task.

Why Navigation World Models Are Different From Locomotion Ones

Compared with a local gait controller, a navigation model often emphasizes two additional demands; a full locomotion system can also face them.

First, navigation can span far more time and distance than one gait cycle. Long-route planning therefore benefits from abstract state such as occupancy grids or topological maps. A fine-grained dynamics rollout over a long route would require many model steps and incur substantial computation and potential compounding error; a route planner can instead work at a coarser scale and leave local motion to the locomotion controller.

Second, some navigation actions gather information rather than shorten the immediate route. Turning a corner may reveal whether a hallway continues; that observation can improve a later route choice. Part VII, Ch 5: Active Perception, Dual Control, and Exploration develops this trade-off. Exploration is useful when the expected value of a better map outweighs its travel and sensing costs; it is not automatically the best choice on every task.

We now make the geometric planner concrete by building an occupancy grid, running value iteration on it, and extracting a path.

In[18]:
Code
## Build a simple occupancy grid for a house-like environment
B = 25
occupancy = np.zeros((B, B), dtype=bool)

## Walls and obstacles (rows, cols)
occupancy[5:20, 12] = True  # vertical wall with a gap
occupancy[5, 5:12] = True  # horizontal wall
occupancy[15:20, 8] = True  # small block
occupancy[15:20, 18] = True  # small block
occupancy[10:15, 18:22] = True  # table in another room

start = (2, 2)
goal = (22, 22)
occupancy[start] = False
occupancy[goal] = False

## Value iteration: V(state) = -1 + max_a gamma * V(next state)
gamma = 0.95
V = np.zeros_like(occupancy, dtype=float)
actions = [(-1, 0), (1, 0), (0, -1), (0, 1)]

for _ in range(400):
    V_next = V.copy()
    max_delta = 0.0
    for r in range(B):
        for c in range(B):
            if occupancy[r, c] or (r, c) == goal:
                continue
            best = -np.inf
            for dr, dc in actions:
                nr, nc = r + dr, c + dc
                if 0 <= nr < B and 0 <= nc < B and not occupancy[nr, nc]:
                    best = max(best, gamma * V[nr, nc])
            if best > -np.inf:
                V_next[r, c] = -1.0 + best
                max_delta = max(max_delta, abs(V_next[r, c] - V[r, c]))
    V = V_next
    if max_delta < 1e-4:
        break

The value iteration loop is worth reading as a compressed statement of what planning on a map means. Each sweep visits every free cell, looks at its four neighbors, computes the best discounted neighbor value, and charges a step cost. Repeated sweeps propagate information backward from the goal until values stop changing. In this deterministic grid with a zero-valued terminal goal and constant step penalty, the converged value is the negative discounted cost along a best route. Selecting the neighbor with the highest value yields a shortest feasible path here. The map supplied the geometry; the iteration supplied the policy.

We then extract a greedy path from the start to the goal.

In[19]:
Code
## Greedy path extraction from the value function
path = [start]
current = start
visited_steps = 0
while current != goal and visited_steps < 200:
    best_val = -np.inf
    best_next = None
    r, c = current
    for dr, dc in actions:
        nr, nc = r + dr, c + dc
        if 0 <= nr < B and 0 <= nc < B and not occupancy[nr, nc]:
            if V[nr, nc] > best_val:
                best_val = V[nr, nc]
                best_next = (nr, nc)
    if best_next is None:
        break
    path.append(best_next)
    current = best_next
    visited_steps += 1

path = np.array(path)
print(f"Path length: {len(path)} states ({len(path) - 1} moves)")
print(f"Final state: {path[-1]}")

The value function plot and the path make clear what the map-based world model gives us.

Out[20]:
Visualization
Heatmap of the value function with an L-shaped white path up column 2 and across row 22 from start to goal.
Value function and greedy path over the occupancy grid, where darker cells are lower value and lie farther from the goal. The path goes up column 2 from row 2 to row 22, then traverses row 22 to the goal, avoiding the interior obstacles.

The path is not a straight line to the goal because the world model encodes the geometry of the environment. It follows open column 2 to row 22, then traverses row 22 to the goal, avoiding the interior walls and blocks. Value iteration is the classical answer, and it is instructive to note what is not happening: you are not learning a policy, you are computing a policy from a known map. The value iteration update is:

V(s)←−1+γmax⁡aV(s′)V(s) \leftarrow -1 + \gamma \max_{a} V(s')

where:

  • V(s)V(s): the discounted return from ss under the best route in this deterministic grid, with reward −1-1 per step and zero terminal value.
  • γ\gamma: the discount factor, with 0<γ<10 < \gamma < 1, weighting future costs relative to immediate ones.
  • s′s': a neighboring state reached by taking action aa from state ss.
  • −1-1: the per-step cost, a penalty charged for each step taken.

The max is over admissible neighboring states that are not occupied. The same value-iteration update can use occupancy estimates from a learned mapper if states and transitions are defined for them. Other learned-map systems use graph search, analytical planners, or policies instead; Chaplot et al.'s system is not this notebook's value-iteration loop. Here the map supplies spatial state and value iteration computes a route. A body MPC and a route planner can both be updated as observations change, but their models, actions, and replanning schedules differ.

Cross-Embodiment and Sim-to-Real Transfer

Up to this point we have assumed a single robot and a single terrain. Real robots differ in mass, actuators, wear, and payload, and collecting failure-rich locomotion data on hardware can be costly or damaging. Simulation is therefore an important training and testing tool, raising the question of how a model transfers to physical hardware or another body.

Cross-embodiment is the study of world models and policies that transfer across morphologies: a quadruped that can be re-trained to walk on a different quadruped, a humanoid that shares a world model with a small biped, a manipulation policy that generalizes across gripper widths. Sim-to-real transfer moves a model or policy from simulation to physical hardware; it may keep the same embodiment or involve an embodiment change.

Cross-embodiment is plausible because robots share conservation laws and contact mechanics, even though their kinematics, actuators, observation spaces, and feasible contacts differ. A transferable representation can encode shared structure while retaining body-specific state and action interfaces. Whether joint training helps is an empirical question for the bodies and tasks involved.

Why Sim-to-Real is Hard

Three gaps bite.

The dynamics gap is mismatch between simulated dynamics and the physical robot. Real joints may exhibit friction, backlash, stiction, saturation, thermal effects, and delay that a particular simulator approximates imperfectly. Mass and actuator parameters may also be uncertain. These errors can alter contact timing or forces, sometimes changing a stable predicted step into a stumble; the size of the effect depends on the robot, controller, and surface.

The perception gap is mismatch between simulated and real sensing. A simulator may omit depth holes, reflections, lighting changes, lens distortion, latency, or other noise; these effects can also be modeled or randomized. The importance of a particular gap depends on which sensors the controller uses and at what rates. Exteroceptive terrain estimates can be especially sensitive to visibility and surface appearance, but no fixed slow-loop architecture follows.

Contact modeling can be a substantial source of sim-to-real mismatch. Contact geometry, friction, compliance, and numerical handling of impact can differ from physical behavior, and their effects interact with actuation and sensing. This chapter does not measure whether contact is the largest gap for any particular robot; that comparison requires target-system tests.

What Makes Transfer Work

We can state one transfer objective as follows: train a fixed policy πϕ\pi_\phi on a source distribution psrc(θ)p_\text{src}(\theta) over environment parameters and evaluate its return J(πϕ;θ)J(\pi_\phi;\theta) under a target distribution ptgt(θ)p_\text{tgt}(\theta). We want Eθ∼ptgt[J(πϕ;θ)]\mathbb{E}_{\theta\sim p_\text{tgt}}[J(\pi_\phi;\theta)] to remain useful. The difference between source and target expectations depends on both the distribution shift and how the fixed policy's return varies with θ\theta; coverage alone does not establish target performance.

We can see the coverage argument directly. On a single environment-parameter axis, a narrow source concentrates its mass far from the target, while a wide source spreads its probability mass across a broader range that includes the target.

In[21]:
Code
## Synthetic source and target densities over one environment parameter.
## The narrow source is a single Gaussian; the wide source is a three-component
## mixture; the target is a Gaussian near one end of the axis.
param_grid = np.linspace(0.0, 1.0, 200)


def gauss_pdf(x, mu, sigma):
    return np.exp(-0.5 * ((x - mu) / sigma) ** 2) / (sigma * np.sqrt(2 * np.pi))


narrow_pdf = gauss_pdf(param_grid, 0.3, 0.05)
wide_pdf = (
    0.33 * gauss_pdf(param_grid, 0.25, 0.08)
    + 0.34 * gauss_pdf(param_grid, 0.5, 0.1)
    + 0.33 * gauss_pdf(param_grid, 0.75, 0.08)
)
target_pdf = gauss_pdf(param_grid, 0.7, 0.06)
Out[22]:
Visualization
Density of narrow and wide source distributions with the target overlaid.
Illustrative source and target densities over one scalar parameter. The wide source places more density near the target than the narrow source in this setup; overlap alone does not establish a smaller performance gap.

One technique is domain randomization: train on varied simulated dynamics and terrain so the policy encounters more of the conditions it may face later. Coverage of a target parameter range does not guarantee small transfer error, and finite data, mismatched observation and action interfaces, and optimization can still matter. Curriculum-style schedules may begin with a narrower range and widen it later, but their effect must be measured for the particular task and robot.

A second technique is system identification: use real observations to estimate parameters relevant to prediction or control, then adapt a simulator, model, or policy accordingly. Estimation may be performed offline or online. The architecture and measured benefit depend on the robot; this chapter does not establish a general actuator-calibration and terrain-adaptation pattern for Cheetah-style controllers.

A third is residual or adaptation learning: start from a model or policy trained under nominal conditions and learn a correction from target-domain data. The amount of real data and risk during adaptation depend on coverage, action limits, and validation. A nominally working policy does not by itself make online adaptation safe, and no broad industrial prevalence claim follows from this example.

A fourth is rapid adaptation: train a policy or estimator across varied conditions so it can use a short recent history, context vector, or a few update steps on a new condition. Terrain and payload changes can make this useful for locomotion, as demonstrated in named adaptation studies. Whether rapid adaptation outperforms a well-tuned fixed or robust controller depends on the target distribution and evaluation.

Cross-Embodiment Representation Learning

One approach to cross-embodiment modeling is to represent the robot as a graph of links and joints. Shared update rules can operate over different graph structures, while body-specific encoders, decoders, or action interfaces handle differing sensors and actuators. This is a design pattern, not a guarantee that a single learned model transfers across arbitrary morphologies.

The body-graph approach addresses one practical interface problem. Flat joint-angle vectors have different lengths for robots with different joint counts, so a fixed-width model needs padding, adapters, or another alignment scheme. A graph model instead shares a local update rule across links and joints of varying number. That gives it a mechanism for parameter sharing across body sizes, but generalization still depends on training coverage and physical similarity.

Training across many bodies could help a model learn reusable structure, but it also expands the data and validation problem. A systematic error in shared parameters can affect multiple morphologies, and aggregate performance can hide body-specific failures. Evaluation must therefore report results by body and task rather than only a pooled score.

As in Part X, Ch 2: Robotic Manipulation, transfer depends on which physical and sensing structure is shared. Locomotion changes foot geometry, gait, and contact forces; manipulation changes end effectors, objects, and grasp contacts. Neither domain is uniformly easier to transfer across, and methods from one require validation before reuse in the other.

Sim-to-Real as World-Model Transfer

We can recast the whole discussion as a world-model transfer problem. Suppose we have a source world model fsrc(s,a)f_\text{src}(s, a) trained in simulation, and we want a target model ftgt(s,a)f_\text{tgt}(s, a) that predicts the physical robot. The simplest transfer model assumes that the target dynamics differ from the source dynamics by an additive residual, which lets us write:

ftgt(s,a)=fsrc(s,a)+Δ(s,a)f_\text{tgt}(s, a) = f_\text{src}(s, a) + \Delta(s, a)

where:

  • fsrc(s,a)f_\text{src}(s, a): the source world model, trained in simulation
  • ftgt(s,a)f_\text{tgt}(s, a): the target world model, describing the physical robot
  • Δ(s,a)\Delta(s, a): the residual dynamics not captured by the source model
  • ss: the robot state (e.g., joint angles and velocities)
  • aa: the control action

The additive form is a modeling assumption, not a law. It requires comparable state and action interfaces; even then, a learned residual may not extrapolate reliably across changes in friction, mass, or compliance. When robots have different state or action dimensions, a direct additive residual is undefined until their interfaces are aligned. Padding, adapters, shared task-space variables, or body-graph representations are possible alignments; a graph is not required.

These four transfer techniques address different parts of the transfer problem; not all require the additive residual model:

  • Domain randomization varies simulated parameters to expose a policy or model to a range of conditions. It does not require the residual Δ\Delta to have zero mean; its benefit must be measured on target conditions.
  • System identification estimates physical dynamics parameters from real rollouts; a residual model may instead learn parameters of Δ\Delta directly.
  • Residual learning trains a neural network to approximate Δ\Delta directly.
  • Meta-learning trains a policy whose behavior depends on a context that is inferred from a few real rollouts.

These techniques can be combined. Domain randomization exposes the learner to anticipated variation, while residual learning or online estimation can correct systematic target mismatch observed on hardware. Neither contribution is automatic; the combination must be evaluated on the target robot and terrain.

A Minimal Domain Randomization Experiment

We close with a small experiment that makes these ideas concrete. We generate two training sets: one uses a single fixed terrain, while the other uses ten randomly drawn terrains with three episodes on each. We fit a linear model of the vertical hopper dynamics on each set, then evaluate on a held-out terrain absent from both training sets.

In[23]:
Code
def make_terrain_random(rng):
    a1 = rng.uniform(0.05, 0.15)
    a2 = rng.uniform(0.02, 0.08)
    w1 = rng.uniform(3.0, 6.0)
    w2 = rng.uniform(1.0, 2.0)

    def terrain_fn(x):
        return a1 * np.sin(2 * np.pi * x / w1) + a2 * np.sin(2 * np.pi * x / w2)

    return terrain_fn


def collect_data(terrain_fns, n_per_terrain, rng, steps=1500):
    X, Y = [], []
    for tfn in terrain_fns:
        for _ in range(n_per_terrain):
            vz0 = rng.uniform(3.0, 5.5)
            z0 = rng.uniform(0.3, 0.6)
            _, zs_i, vzs_i, _ = simulate_hopper(
                x0=0.0, z0=z0, vz0=vz0, vx0=1.5, terrain_fn=tfn, steps=steps
            )
            X.append(
                np.column_stack(
                    [zs_i[:-1], vzs_i[:-1], np.ones_like(zs_i[:-1])]
                )
            )
            Y.append(
                np.column_stack([zs_i[1:] - zs_i[:-1], vzs_i[1:] - vzs_i[:-1]])
            )
    return np.concatenate(X, axis=0), np.concatenate(Y, axis=0)


def fit_linear(X, Y):
    theta, *_ = np.linalg.lstsq(X, Y, rcond=None)
    return theta


## Narrow source: one terrain
narrow_source = [terrain_height]
## Wide source: 10 randomized terrains
wide_rng = np.random.default_rng(0)
wide_source = [make_terrain_random(wide_rng) for _ in range(10)]

## Held-out target terrain: a new randomized terrain
target_rng = np.random.default_rng(999)
target_terrain = make_terrain_random(target_rng)

data_rng = np.random.default_rng(7)
X_narrow, Y_narrow = collect_data(narrow_source, 30, data_rng)
X_wide, Y_wide = collect_data(wide_source, 3, data_rng)

theta_narrow = fit_linear(X_narrow, Y_narrow)
theta_wide = fit_linear(X_wide, Y_wide)

print(f"Narrow model trained on {X_narrow.shape[0]} transitions")
print(f"Wide model trained on {X_wide.shape[0]} transitions")

The two training sets contain the same number of transitions: 30 trajectories on one fixed terrain versus three trajectories on each of ten fixed, randomly drawn terrains. This controls the sample count but not every other source of variation. Any observed advantage on the one held-out target is a result of this toy setup, not a general guarantee for domain randomization.

We now evaluate each model as an open-loop predictor on the held-out target terrain and compare the rollout error.

In[24]:
Code
## Ground-truth trajectory on the target terrain
xs_t, zs_t, vzs_t, _ = simulate_hopper(
    x0=0.0, z0=0.5, vz0=4.5, vx0=1.5, terrain_fn=target_terrain, steps=1500
)


def rollout_error(theta_model, z_true, v_true, H=500):
    z_pred = np.zeros(H)
    v_pred = np.zeros(H)
    z_pred[0], v_pred[0] = z_true[0], v_true[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_model
        z_pred[t] = z_pred[t - 1] + delta[0]
        v_pred[t] = v_pred[t - 1] + delta[1]
    return np.abs(z_pred - z_true[:H])


err_narrow = rollout_error(theta_narrow, zs_t, vzs_t)
err_wide = rollout_error(theta_wide, zs_t, vzs_t)

## Report the average error over the rollout for each model
mean_err_narrow = float(np.mean(err_narrow))
mean_err_wide = float(np.mean(err_wide))
Out[25]:
Console
Mean rollout error, narrow-trained model: 0.3298 m
Mean rollout error, wide-trained model:   0.2982 m

Finally, we visualize the error comparison across the rollout horizon.

Out[26]:
Visualization
Line plot comparing rollout error between a narrow-trained and wide-trained model on a new terrain.
Open-loop height-prediction error on one seeded held-out terrain. The wide-trained model has lower mean error in this run; the curves do not establish a general transfer advantage or isolate the cause of the narrow model's error.

In this seeded toy comparison, the wide-trained predictor has lower mean open-loop height error on the single held-out terrain. That is not a closed-loop control result or evidence that widening the source always helps. A simple distributional bound explains one consideration: if the fixed policy's return J(π;θ)J(\pi;\theta) on an environment parameter θ\theta lies between zero and Jmax⁡J_{\max}, then

∣Eθ∼ptgt[J(π;θ)]−Eθ∼psrc[J(π;θ)]∣≤Jmax⁡ DTV(psrc,ptgt)\left| \mathbb{E}_{\theta\sim p_\text{tgt}}[J(\pi;\theta)] - \mathbb{E}_{\theta\sim p_\text{src}}[J(\pi;\theta)] \right| \leq J_{\max}\,D_{\mathrm{TV}}(p_\text{src},p_\text{tgt})

where:

  • J(π;θ)J(\pi;\theta): return of the fixed policy π\pi in environment θ\theta.
  • psrcp_\text{src} and ptgtp_\text{tgt}: source and target distributions over the same environment-parameter space.
  • Jmax⁡J_{\max}: an assumed finite upper bound on nonnegative return.
  • DTVD_{\mathrm{TV}}: total variation distance, defined as sup⁡A∣psrc(A)−ptgt(A)∣\sup_A|p_\text{src}(A)-p_\text{tgt}(A)| over measurable sets AA.

This bound is loose and says nothing about whether a learned policy succeeds on the target. A wider source can reduce some distribution mismatch while also making learning harder or placing too little training mass on important target conditions. Measure target performance directly and distinguish open-loop model error from closed-loop return.

Domain Randomization

Domain randomization trains a policy or model across a chosen distribution of simulated parameters or observations to improve robustness to anticipated variation. Whether that distribution covers the deployment target is an empirical question.

Limitations and Impact

The modeling and planning methods in this chapter are useful in legged and mobile robotics, but they carry limitations that affect system design and evaluation.

The first limitation is that contact-mode changes are difficult for a single smooth predictor to represent accurately. A model fitted across a switch can blur the event or mistime it, as the hopper experiment showed. Contact schedules, event predictors, and discrete mode variables make the switch explicit; contact-implicit optimization instead keeps the contact decision inside a constrained numerical problem. Each choice trades modeling detail against computational and estimation demands.

The second limitation is that one-step prediction quality need not imply good decisions. Error can accumulate under rollout and can be concentrated near task-critical contact events. A limited bound shows what can be concluded. For one fixed open-loop action sequence a0:H−1a_{0:H-1}, suppose each stage cost and the terminal cost are LL-Lipschitz in state, the same actions are evaluated by both models, and both trajectories start from the same state. Then:

∣Cmodel(a0:H−1)−Ctrue(a0:H−1)∣≤L∑t=0H∥s^t−st∥\left| C_{\text{model}}(a_{0:H-1}) - C_{\text{true}}(a_{0:H-1}) \right| \leq L \sum_{t=0}^{H} \| \hat{s}_t - s_t \|

Here s^t\hat{s}_t and sts_t are the modeled and true states reached under that same action sequence. The bound follows by applying the Lipschitz condition to each cost term and then the triangle inequality. It does not compare two different policies. To bound the regret from choosing actions with the model, one additionally needs a uniform bound ∣Cmodel(a)−Ctrue(a)∣≤δ\left|C_{\text{model}}(a)-C_{\text{true}}(a)\right|\leq\delta for every candidate sequence in a common feasible set. If amodela_{\text{model}} minimizes modeled cost and atruea_{\text{true}} minimizes true cost over that set, then 0≤Ctrue(amodel)−Ctrue(atrue)≤2δ0\leq C_{\text{true}}(a_{\text{model}})-C_{\text{true}}(a_{\text{true}})\leq 2\delta. A small error on one observed trajectory alone does not supply that uniform guarantee.

The evaluation question "does this world model help you act?" is the one that matters for locomotion, and it is not answered by looking at one-step prediction loss. We return to this in depth in Part XI, Ch 4: Planning, Control, and Policy Evaluation.

The third limitation is model exploitation in optimization. An MPC optimizer can prefer a plan that relies on contact forces the physical robot cannot generate if its model or constraints permit them. Friction, actuator, and balance constraints can rule out some such plans when their parameters and contact assumptions are valid, but the constraints can also be wrong. Structured prior knowledge helps narrow the search; it does not by itself establish hardware safety. Identification, monitoring, and closed-loop tests remain necessary.

The fourth limitation is sim-to-real mismatch. A new body, payload, sensor, or terrain can change which simulator errors matter. Domain randomization, system identification, and residual learning have reduced specific gaps in published systems, but their effects are not automatic or interchangeable. Deployment-specific characterization and fallback behavior may be useful; this chapter does not establish how frequently companies use a particular fallback design.

The fifth limitation is data coverage. Physical-robot trajectories can be costly and valuable for validating real contact and sensing, while simulation can provide more controlled variation at lower collection cost. Required data volume and the best data source depend on the model and task. Pretrained approaches discussed in Part IX: Foundation and World-Action Models may reduce per-deployment data in some settings, but cross-embodiment locomotion transfer still needs measured evidence.

The sixth limitation is that navigation can require distinct estimates of metric layout, semantic content, and moving agents. A system may represent them separately or jointly. If dynamic obstacles or doors are not updated, a route planned from an older map can become invalid. Testing map updates and distinguishing persistent from changing structure matter when people or other agents share the space.

These methods are relevant to deployed robots, but deployment evidence should be named and measured rather than inferred from the toy experiments. Boston Dynamics documents Spot use on construction sites, and warehouse operators document mobile-robot fleets. This chapter does not quantify fleet-wide daily floor area, establish a single dominant humanoid deployment pattern, or attribute every deployment's success to one world-model family. Explicit mapping, model-based control, and learned dynamics are different design choices whose contribution must be evaluated in each system.

Summary

Locomotion, humanoids, and navigation are the application domain where world models meet the physical body. We have seen that:

  • Body dynamics and terrain interaction can involve hybrid contact modes, uncertain surfaces, and an underactuated floating base. The 1D hopper illustrates mode switching, but not every legged controller needs a latent terrain estimate or a flight mode.
  • Whole-body control can connect a centroidal plan to joint torques under contact and actuator constraints. Model-based MPC predicts and replans; a direct learned policy need not follow that loop. The useful horizon and update rate are task-dependent.
  • Spatial memory can support long-horizon navigation. Metric, topological, semantic, and learned maps expose different information; a map can be a probabilistic belief or a deterministic representation. Their relative value needs task-specific evaluation.
  • Cross-embodiment and sim-to-real transfer require compatible interfaces and target-domain tests. Domain randomization, system identification, residual learning, and rapid adaptation address different mismatches; they do not all assume one additive dynamics residual.

The through-line is that a locomotion or navigation world model is never just p(st+1∣st,at)p(s_{t+1} \mid s_t, a_t). It is a structured composition of body, terrain, and task, each with its own uncertainty and its own failure modes, and each requiring its own evaluation. The next chapter turns to autonomous driving, where the map is a road network, the body is a car, and the road surface and other agents pose distinct prediction problems.

Quiz

Ready to test your understanding? Take this quick quiz to reinforce what you've learned about locomotion, humanoids, and navigation world models.

Locomotion, Humanoids, and Navigation

Question 1 of 80 of 8 completed
For a floating-base robot, why does the base have no direct actuation term in the equations of motion?

Comments

No comments yet. Be the first to share your thoughts!

Reference

Citation details

Cite or share this article.

BIBTEXAcademic
@misc{brenndoerfer2026locomotionhumanoids, author = {Michael Brenndoerfer}, title = {Locomotion, Humanoids, and Navigation}, year = {2026}, url = {https://mbrenndoerfer.com/writing/locomotion-humanoids-navigation-world-models}, organization = {mbrenndoerfer.com}, note = {Accessed: 2026-09-30} }
APAAcademic
Michael Brenndoerfer (2026). Locomotion, Humanoids, and Navigation. Retrieved from https://mbrenndoerfer.com/writing/locomotion-humanoids-navigation-world-models
MLAAcademic
Michael Brenndoerfer. "Locomotion, Humanoids, and Navigation." 2026. Web. September 30, 2026. <https://mbrenndoerfer.com/writing/locomotion-humanoids-navigation-world-models>.
CHICAGOAcademic
Michael Brenndoerfer. "Locomotion, Humanoids, and Navigation." Accessed September 30, 2026. https://mbrenndoerfer.com/writing/locomotion-humanoids-navigation-world-models.
HARVARDAcademic
Michael Brenndoerfer (2026) 'Locomotion, Humanoids, and Navigation'. Available at: https://mbrenndoerfer.com/writing/locomotion-humanoids-navigation-world-models (Accessed: September 30, 2026).
SimpleBasic
Michael Brenndoerfer (2026). Locomotion, Humanoids, and Navigation. https://mbrenndoerfer.com/writing/locomotion-humanoids-navigation-world-models

About the author

Continue with the full handbook

This chapter is part of World Models Handbook. Use the handbook page to browse the complete table of contents and continue reading in sequence.

Explore World Models Handbook
Newsletter

Stay up to date

Get articles, book updates, and news delivered to your inbox.

No spam, unsubscribe anytime.

or

Join the community

Sign in to remove popups, track your reading progress, and join the discussion.