Skip to content
Physical AI
All experiments

Ideal versus delayed feedback

Why a controller that works with ideal, instantaneous observations can oscillate or fall when observations and actions are delayed, even with the same 200 Hz physics and 50 Hz control rates.

Loading simulation…

What it demonstrates

Why a controller that works with ideal, instantaneous observations can oscillate or fall when observations and actions are delayed, even with the same 200 Hz physics and 50 Hz control rates.

How it works

Two identical inverted pendulums (4 kg at 0.6 m, standing in for a robot balancing over its ankles) are integrated with semi-implicit Euler at 200 Hz. A PD controller runs every fourth physics step (50 Hz) and its torque is held between steps and clipped at 40 N·m.

The ideal copy sees the state of the current physics step and its torque applies immediately. The delayed copy samples the state into a timestamped buffer at 200 Hz; each sample becomes visible only after the observation delay plus jitter, and each command takes effect only after the action delay plus jitter. Both receive the same pushes.

Adjustable parameters

  • Observation delay (0–60 ms)
  • Action delay (0–60 ms)
  • Jitter (0–10 ms)
  • Kp (30–250 N·m/rad)
  • Kd (0–30 N·m·s/rad)
  • Periodic pushes / push button

Known limitations

  • A single-joint pendulum is far simpler than a legged robot; it shows the mechanism, not Asimov's numbers.
  • The controller is a hand-tuned PD law, not a learned policy.
  • Delays are quantised to 5 ms physics steps.

Equations

ml2θ¨=mglsin⁡θ−bθ˙+τ+τpushm l^2 \ddot\theta = m g l \sin\theta - b\dot\theta + \tau + \tau_{push}
τk=clip⁡(−Kp θ(tk−dobs)−Kd θ˙(tk−dobs), ±τmax) applied at tk+dact\tau_k = \operatorname{clip}\big(-K_p\,\theta(t_k - d_{obs}) - K_d\,\dot\theta(t_k - d_{obs}),\ \pm\tau_{max}\big) \text{ applied at } t_k + d_{act}
ϕlag(ω)≈ω (dobs+dact+12Δtpolicy)\phi_{lag}(\omega) \approx \omega\,(d_{obs} + d_{act} + \tfrac{1}{2}\Delta t_{policy})

Core update rule

obs.push(t, t + obsDelay + jitter * rng(), [theta, omega]);   // IO, 200 Hz
if (runsOnStep(k, 50)) {
  const o = obs.latest(t);                                   // newest visible sample
  actions.push({ tApply: t + actDelay + jitter * rng(), u: -kp * o[0] - kd * o[1] });
}
u = latestDue(actions, t);                                   // zero-order hold
omega += ((m * g * l * Math.sin(theta) - b * omega + clip(u)) / (m * l * l)) * dt;
theta += omega * dt;

Explained in Chapter 6: Asimov Simulation