Robot Wiki

Control

PID, LQR, MPC, and whole-body QP: the classical stack under every learned policy.

Last reviewed
Reading time
17 min
Citations
23

Motion planning decides where the robot should go. Control is what makes the robot actually go there, in a world where the model is slightly wrong, the payload shifted, and the floor is never quite flat. The tool is feedback: measure where the robot is, compare it to where it should be, and correct. That loop runs at every level of the stack, from the motor current loops deep inside an actuator to the whole-body torque controller of a humanoid, and it keeps running underneath whatever learned policy sits on top.

The field's own estimate of its workhorse is blunt: more than 95% of all industrial control problems are solved by PID control, many of them without the D Åström 2008. Everything in this module descends from that observation or reacts against it.

The loop is below, on the smallest problem that still shows everything: an inverted pendulum with a payload bolted off-center. Press Run, then drag the proportional gain down. Somewhere just under 9.81 in the slider's units the pole stops coming back up, and no setting of the other two gains rescues it.

Below 9.81 the pole cannot be held up at all.

Removes the steady lean left by the offset payload.

Damping. Near zero, the pole rings instead of settling.

+12.0°

angle +12.0° rate +0.0°/s integral 0.00 torque -5.2 N·m status holding at release

Default gains Kp 25.0, Ki 0.0 and Kd 3.0 leave the lab pole holding at release at +12.0 degrees with torque -5.2 N·m; angle and status stay frozen until Run or Push.

Current pendulum gains and regime
Kp
25.0
Ki
0.0
Kd
3.0
angle
+12.0°
status
holding at release

A point mass on a 1 m rod with torque applied at the pivot. The dot beside the tip mass is a payload bolted slightly off-center, a constant disturbance torque the loop must fight. Things worth trying: with the defaults the pole settles into a small steady lean, which is proportional-plus-derivative action reaching its limit; raise Ki and the integrator walks it back to vertical. Cut Kd toward zero and the recovery rings instead of settling. Drag Kp below 9.81, the mgl threshold for this plant, and no amount of damping can hold the pole up. The physics is exact and deterministic: the same gains always produce the same motion.

>95%
PID share
of industrial control problems
1960
LQR
Kalman's optimal-control paper
<1 ms
Cheetah 3 MPC
per convex QP, at 20-30 Hz
1 kHz
whole-body layer
Di Carlo's estimation and leg loops

PID: three ways to use an error

Close the loop on a scalar error e(t)=r(t)y(t)e(t) = r(t) - y(t), the difference between the reference and the measured output. The PID controller turns that error into an actuator command with three terms:

u(t)=Kpe(t)+Ki0te(τ)dτ+Kddedtu(t) = K_p\, e(t) + K_i \int_0^{t} e(\tau)\, d\tau + K_d\, \frac{de}{dt}

Åström and Murray's reading of the three terms is the one to keep: the proportional term reacts to the present error, the integral term accounts for the past, and the derivative term is a linear extrapolation into the future Åström 2008. Proportional action alone always leaves a steady-state error, because a nonzero error is what generates the corrective torque; that is exactly what the integral term exists to erase. Derivative action adds damping, predicting where the error is heading, at the cost of amplifying measurement noise.

Tuning those three gains is its own craft. The Ziegler-Nichols rules of 1942, drive the loop into oscillation with proportional gain alone, then back off from the critical gain and period by fixed fractions, are still printed in every textbook Ziegler 1942. The failure modes are just as canonical: integral windup, where a saturated actuator lets the integrator accumulate error it can never repay, and derivative kick, where a setpoint step spikes the derivative term.

The lab below is that loop made physical. The plant is the canonical one from underactuated control, a torque-driven inverted pendulum Tedrake 2024:

θ¨=gsinθ+u+τbiasm2\ddot{\theta} = \frac{g}{\ell} \sin\theta + \frac{u + \tau_{bias}}{m \ell^2}

with θ\theta measured from upright and τbias\tau_{bias} a constant disturbance from a payload bolted off-center. Linearized about the upright, the loop is stable only when Kp>mgK_p > m g \ell, which is the 9.81 threshold the lab at the top of this module is built around.

Prediction

The lab above is released 12 degrees off vertical with the payload bias in place. Below what proportional gain does the loop lose the pole entirely, however the other two gains are set?
Read the reasoning
The lab is mounted at Kp 9.5 with the threshold at 9.81 half a unit above it: press Run and the pole falls. Raise the gain one step and it holds.

Below 9.81 the pole cannot be held up at all.

Removes the steady lean left by the offset payload.

Damping. Near zero, the pole rings instead of settling.

+12.0°

angle +12.0° rate +0.0°/s integral 0.00 torque -2.0 N·m status holding at release

The prediction-step pole starts at Kp 9.5, under the 9.81 mgl hold threshold, still +12.0 degrees off upright and holding at release so the prompt can be answered before playback.

Current pendulum gains and regime
Kp
9.5
Ki
0.0
Kd
3.0
angle
+12.0°
status
holding at release

A point mass on a 1 m rod with torque applied at the pivot. The dot beside the tip mass is a payload bolted slightly off-center, a constant disturbance torque the loop must fight. Things worth trying: with the defaults the pole settles into a small steady lean, which is proportional-plus-derivative action reaching its limit; raise Ki and the integrator walks it back to vertical. Cut Kd toward zero and the recovery rings instead of settling. Drag Kp below 9.81, the mgl threshold for this plant, and no amount of damping can hold the pole up. The physics is exact and deterministic: the same gains always produce the same motion.

  • Kp must clear the weight threshold, about 9.8 here; below it the pole falls no matter how high the dampingLinearized about upright, the loop is stable only when Kp exceeds m g l, 9.81 in the slider’s units. The derivative term can shape the recovery but cannot create a restoring torque the proportional term does not supply, so below the threshold nothing holds the pole up.tedrake-underactuated
  • Any positive Kp holds the pole in the usual case; a small gain only corrects more slowly and the lean settles outThis is the expectation the lab exists to break. Proportional action generates corrective torque from error, and below the gravity torque the correction is always outrun: the mounted figure sits half a unit under the threshold and the status reads fallen within seconds of Run.
  • A Kp below the threshold can still work, provided Kd is raised enough for the damping to hold the pole upDamping opposes rate, not position. With the pole leaning and accelerating away, a high Kd slows the fall and can hold it ringing at large angles, but the classification still lands on fallen: drag Kd to its ceiling in the figure and watch the status line.

The restoring torque must outweigh gravity before anything else matters: past that floor the loop is unstable, and damping alone cannot buy it back.

State space and LQR

PID acts on one error. State feedback acts on the whole state. Write the plant in state-space form, x˙=Ax+Bu\dot{x} = Ax + Bu, and close the loop with u=Kxu = -Kx: every state gets its own gain, and pole placement becomes a linear-algebra exercise Åström 2008. The natural question is which KK is best, and Kalman's 1960 formulation made that precise Kalman 1960: pick the gain that minimizes a quadratic cost trading state error against control effort,

J=0(xQx+uRu)dtJ = \int_0^{\infty} \left( x^{\top} Q x + u^{\top} R u \right) dt

The optimal gain is K=R1BPK = R^{-1} B^{\top} P, where PP solves the algebraic Riccati equation:

AP+PAPBR1BP+Q=0A^{\top} P + P A - P B R^{-1} B^{\top} P + Q = 0

That is the linear quadratic regulator. Two design knobs, QQ and RR, replace per-gain intuition with a statement of what you care about: penalize angle deviation heavily and the controller gets stiff; penalize torque and it gets gentle. And the connection back is direct. Linearize the pendulum above, choose a diagonal QQ weighting angle and rate, and the LQR gain is a PD controller. The sliders you just moved were a hand-tuned version of what Riccati solves in one shot Tedrake 2024.

The catch is in the word "linearized". LQR's guarantee is local to the operating point; swinging the pole up from hanging takes a different controller entirely (energy shaping), with LQR catching it at the top Tedrake 2024. Real systems run a gain schedule: different KK for different regions of the state space.

MPC: re-solve the plan at every step

Model-predictive control takes the optimal-control idea online. Instead of precomputing a gain, solve a short-horizon optimal control problem at every control step, from the current measured state, subject to the constraints that actually bind:

minu0,,uN1  k=0N1(xkQxk+ukRuk)s.t.xk+1=f(xk,uk),  ukU,  xkX\min_{u_0, \dots, u_{N-1}} \; \sum_{k=0}^{N-1} \left( x_k^{\top} Q x_k + u_k^{\top} R u_k \right) \quad \text{s.t.} \quad x_{k+1} = f(x_k, u_k), \; u_k \in \mathcal{U}, \; x_k \in \mathcal{X}

Then apply only the first input, measure the new state, and solve again. The receding horizon is what makes MPC robust: model error is not baked into a fixed gain but re-corrected at every step, because each new solve starts from reality. The constraints are the other half of the value: torque limits, joint limits, and friction cones enter the optimization directly rather than as saturation afterthoughts. Making that rigorous took decades; the modern stability theory, terminal costs and constraint sets that guarantee the receding-horizon loop inherits the infinite-horizon optimum, was consolidated by Mayne and collaborators in 2000 Mayne 2000.

The industrial lineage is older than the theory. MPC grew out of power-plant and petroleum-refinery practice in the 1970s and 1980s, where slow, constrained, multivariable plants were exactly what PID could not handle Qin 2003; by 2003 a vendor survey counted thousands of installed applications, still concentrated in refining and petrochemicals Qin 2003. What changed since is compute. Di Carlo and colleagues put convex MPC on the MIT Cheetah 3 by simplifying the robot to a single rigid body with contact forces as decision variables: prediction horizons up to half a second, each QP solved in under a millisecond, replanned 20-30 times per second, one set of gains for every gait from standing to gallop Di Carlo 2018. And in 2026, Zhang and collaborators showed the simplification is no longer forced: plain iLQR with MuJoCo dynamics and finite-difference derivatives runs whole-body MPC in real time on quadrupeds and a full-size humanoid, transferring to hardware with few sim-to-real accommodations Zhang 2026. The standing assumption that full-order MPC is too slow for legged robots no longer holds, and the debate between MPC and learned policies has its own module in reward design and the MPC debate.

Whole-body QP: the bottom of the stack

Below the planner and the MPC layer sits the fastest loop in a legged or humanoid robot: the whole-body controller, which turns desired accelerations and contact forces into joint torques hundreds to thousands of times per second. The intellectual root is Khatib's operational-space formulation from 1987, which writes the dynamics where the task lives, at the end-effector, rather than in joint space Khatib 1987:

Λ(x)x¨+μ(x,x˙)+p(x)=F\Lambda(x)\, \ddot{x} + \mu(x, \dot{x}) + p(x) = F

with Λ\Lambda the task-space inertia and μ\mu, pp the Coriolis and gravity terms, mapped back to joints through the Jacobian. Sentis and Khatib extended this into a hierarchy of tasks, so a humanoid can respect balance and contact constraints while lower-priority tasks, a reaching arm, a head gaze, fill the remaining degrees of freedom Sentis 2005.

The modern implementation collapses that hierarchy into one quadratic program per control tick:

minq¨,τ,fiwiAiq¨bi2s.t.M(q)q¨+h(q,q˙)=Sτ+Jc(q)fτminττmax,fF\begin{aligned} \min_{\ddot{q},\, \tau,\, f} \quad & \sum_i w_i \, \lVert A_i \ddot{q} - b_i \rVert^2 \\ \text{s.t.} \quad & M(q)\, \ddot{q} + h(q, \dot{q}) = S^{\top} \tau + J_c(q)^{\top} f \\ & \tau_{min} \le \tau \le \tau_{max}, \qquad f \in \mathcal{F} \end{aligned}

The decision variables are joint accelerations, torques, and contact forces at once; the equality constraint is the rigid-body dynamics itself; F\mathcal{F} is the friction cones that keep feet from slipping. Every task, hold the torso upright, track the swing foot, keep the head level, is a weighted row in the objective. This is whole-body control as it ships on humanoids today, and the humanoid whole-body control module covers how learned policies relate to it.

Impedance control: making contact a design variable

Everything above regulates motion in free space. The half it leaves out is contact, and contact changes the objective itself. A stiff position controller is the right answer where the world is exactly where the model says it is, and the wrong one the moment it is not: drive a rigid arm into a surface 2 mm nearer than modeled, and the position error no longer measures a tracking mistake, it measures stored energy in a collision. The stiffness-versus-compliance tradeoff is therefore a control objective, not a gain choice. You decide, as part of specifying the task, whether the arm should push back like a spring or yield like a suspension, and the controller implements that decision at the contact.

Hogan's impedance control from 1985 states the idea: stop commanding position or force and command the relationship between them instead, so the manipulator presents itself to the environment as a programmable mass-spring-damper whose stiffness and damping you choose Hogan 1985. The argument underneath is a port argument. A contact is an interaction port whose conjugate variables are force and velocity, and a duality governs it: you may command motion or force at a contact, but not both independently, because the environment fixes the other one. Salisbury's active stiffness control, five years earlier, was already the special case: set the apparent Cartesian stiffness matrix per task axis Salisbury 1980. Admittance control is the dual assignment: measure force with a wrist sensor, command motion. Each has a natural home. A low-inertia, backdrivable direct-drive arm realizes an impedance directly, because torque commands are its native language; a stiff geared arm with a wrist force-torque sensor runs admittance control in software on top of its excellent position loop. Ott, Mukherjee and Nakamura's unified formulation shows the two are the same port with the causality flipped, and how to switch between them without losing passivity Ott 2010.

Where the task geometry allows it, the older and still dominant scheme is Mason's and Raibert and Craig's hybrid force/position control: decompose the contact into a task frame from its geometry, control force along the constrained axes and position along the free ones, never both on the same axis Mason 1981 Raibert 1981. Polishing controls force normal to the surface and tracks a path tangent to it. The decomposition is a property of the task, which is both its strength, nothing is guessed, and its limit: someone must supply the contact geometry in advance.

The hardware consequence reaches everything the learned stack wants to do. A position-controlled, non-backdrivable geared arm cannot regulate contact force at all: it has no force channel, so the contact force is set by the position error, the gear ratio, and whatever the surface does, which is to say by nothing the controller commanded. A learned policy that outputs joint positions on that hardware cannot perform the contact-rich tasks the dexterity module argues are the frontier, however good the training data; no dataset creates a force channel the actuator does not have. The alternatives: torque-controlled arms, whose joint torques are commanded directly, and series elastic actuation, which puts a deliberate spring between the gear and the load so the drivetrain has a mechanical force sensor and impact filter Pratt 1995. Cartesian impedance controllers of the Albu-Schäffer line made torque-controlled flexible-joint arms practical for fine contact work Ott 2003, and the shipped evidence is vendor-level: Franka's interface exposes a 1 kHz impedance layer as the product's core feature Franka Robotics 2026, while Universal Robots, the archetype of the geared collaborative arm, implements force mode as an admittance loop in software Robots 2025. Backdrivability is an actuator decision made long before any controller or policy runs, and backdrivability is the property that decides which of these schemes the hardware can even attempt.

The lab below puts that claim in your hands. Command a penetration depth, program the stiffness and damping of the contact impedance, and watch the peak force move against the object's crush limit and a transient contact-force limit stated from published biomechanical measurements Han 2024 rather than the paywalled ISO table ISO 2016. Then select the position-controlled arm and watch the sliders grey out: there is nothing to program, because the position loop has already decided the force.

hardware

the surface is closer than the model said, by this much

the programmable spring at the contact

the programmable damper at the contact

0100200320contact force (N)object crush limit 25 Ncontact-force limit 255 N (thigh, transient contact; research basis: 75th-percentile force pain threshold, Han 2024)

steady 1.6 N peak 23.7 N outcome task succeeded

On the torque-controlled arm at depth 2.0 mm, stiffness 800 N/m and damping 40 N·s/m, the contact peaks at 23.7 N and settles at 1.6 N against the 255 N research-basis transient limit: task succeeded.

Current contact lab settings and outcome
depth
2.0 mm
K
800 N/m
D
40 N·s/m
peak
23.7 N
outcome
task succeeded

A 4 kg effective end-effector mass pressing into a surface modelled as a 400 kN/m spring, under the impedance law the stiffness and damping sliders program. The two reference lines are the object's crush limit and the transient contact-force limit for the thigh, 255 N, stated on the research basis of measured 75th-percentile force pain thresholds Han 2024 rather than the paywalled ISO/TS 15066 table. Things worth trying: soften K and the peak force falls with it; harden K toward its maximum and the transient limit is crossed even though the steady force barely moves; select the position-controlled arm and the compliance sliders grey out, because a position loop has no force to program.

The policy-to-controller contract

A learned action is a controller request, not a motor command by default. Specify the request type, expected update rate, horizon, frame, saturation behavior and the lower loop that interprets it. A Cartesian delta sent to a position controller has different contact behavior from the same delta interpreted as an impedance target. A torque output transfers still more responsibility to the policy and demands a faster, better observed loop.

Keep deadline handling and hard bounds outside the model. On every tick, validate observation age, action shape, finite values, joint and workspace bounds, then define what the controller holds or stops when inference is late. Measure command-to-actuation latency rather than model latency alone. The action-space guide helps choose the interface; this control hierarchy determines whether that choice can be executed safely and at the claimed rate.

Where this meets the learned stack

Classical control did not lose to learning; it became the floor learning stands on. Every actuator in a learned-policy demo still closes a current loop, usually PI, at kilohertz. The interesting boundary is one level up. MPC has no sim-to-real gap in the reinforcement-learning sense, because it re-solves against the measured state every step rather than baking a model into weights; the sim-to-real transfer problem is largely a problem of open-loop policies. The honest 2026 picture is hybrid: Boston Dynamics added reinforcement learning to Spot's existing MPC stack to handle variability, rather than replacing it Dynamics 2024, and the classical floor a learning paper must clear now includes an iLQR controller the authors kept deliberately simple, an easy-to-reproduce hardware baseline by design Zhang 2026.

The stack you have now seen end to end, kinematics to locate the body, planning to pick the motion, control to execute it, is the half of robotics that learning has absorbed least. State estimation, the module after this one, closes the loop: none of these controllers know where the robot is without it.

Self-check

A payload bolted off-center puts a constant torque bias on one joint of a walking robot. Which layer of the stack removes that bias without retraining anything?
Read the reasoning
  • The integral term of the joint-level controllerProportional action alone always leaves a steady-state error, because a nonzero error is what generates the corrective torque. The integral term accumulates that residual error and erases a constant offset, which is why the current loop inside every actuator of a learned-policy demo is usually PI.
  • Retrain the walking policy with the payload presentThis encodes the belief that a constant disturbance is a data problem. The module’s own estimate says more than 95% of industrial control problems are solved by PID feedback, most without any learning: the loop exists precisely so that constant offsets are removed at runtime rather than trained away.
  • A higher MPC re-solve rate at the whole-body layerRe-solving faster does not remove a bias the model omits: MPC re-solves against the measured state every step, so tracking improves, but a constant unmodeled offset survives each re-solve exactly as it survived the last one. Speed pays for constraints and horizon, not for erasing offsets.

A constant disturbance is the textbook case for integral action: the loop removes it at runtime, whatever learned policy sits above it.

See also

Linked from

  • Action Spaces for Robot Learning

    Joint, Cartesian, torque, impedance, chunked and tokenized actions: what each representation gives the learner and pushes onto the controller.

  • Model-Based Robot Learning

    Learn dynamics, plan through them, and improve from imagined rollouts: the common structure behind Dreamer, TD-MPC2 and robotic world models.

  • Motion Planning

    RRT and its optimal variants, trajectory optimization, and CHOMP/TrajOpt.

  • State Estimation

    Kalman filters, factor graphs, and pose estimation from noisy sensors.

  • Grasp Planning

    Contact mechanics, grasp quality metrics, and force closure.

  • ROS 2 for Machine Learning Engineers

    Topics, services, actions, QoS, tf2, rosbag2 and MoveIt explained as the production boundary around a learned policy.

  • Dexterity

    Contact-rich manipulation, the tactile sensing gap, in-hand reorientation, and deformables.

  • Safety and Assurance

    Industrial robotics can certify a control system but not a learned policy, so what ships is a verifiable safety layer wrapped around an unverifiable one.

References

  1. Karl Johan Åström, Richard M. Murray, Princeton University Press, 2008.

    https://fbswiki.org/wiki/index.php/Feedback_Systems:_An_Introduction_for_Scientists_and_Engineers

  2. J. G. Ziegler, N. B. Nichols, Trans. ASME, 1942.

    https://doi.org/10.1115/1.2899060

  3. R. E. Kalman, Bol. Soc. Mat. Mexicana, 1960.

    https://doi.org/10.1109/9780470544334.ch8

  4. Russ Tedrake, MIT course notes, 2024.

    https://underactuated.mit.edu/

  5. Carlos E. Garcia, David M. Prett, Manfred Morari, Automatica, 1989.

    https://doi.org/10.1016/0005-1098(89)90002-2

  6. D. Q. Mayne, James B. Rawlings, Christopher V. Rao, P. O. M. Scokaert, Automatica, 2000.

    https://doi.org/10.1016/S0005-1098(99)00214-9

  7. S. Joe Qin, Thomas A. Badgwell, Control Engineering Practice, 2003.

    https://doi.org/10.1016/S0967-0661(02)00186-7

  8. Jared Di Carlo, Patrick M. Wensing, Benjamin Katz, Gerardo Bledt, Sangbae Kim, IEEE/RSJ IROS, 2018.

    https://doi.org/10.1109/IROS.2018.8594448

  9. John Z. Zhang, Taylor A. Howell, Zeji Yi, Chaoyi Pan, Guanya Shi, Guannan Qu, Tom Erez, Yuval Tassa, and 1 more, ICRA 2026.

    https://arxiv.org/abs/2503.04613

  10. Oussama Khatib, IEEE J. Robotics and Automation, 1987.

    https://doi.org/10.1109/JRA.1987.1087068

  11. Luis Sentis, Oussama Khatib, Int. J. Humanoid Robotics, 2005.

    https://doi.org/10.1142/S0219843605000594

  12. Boston Dynamics, 2024.

    https://bostondynamics.com/blog/starting-on-the-right-foot-with-reinforcement-learning/

  13. Neville Hogan, ASME J. Dynamic Systems, Measurement, and Control, 1985.

    https://doi.org/10.1115/1.3140702

  14. M. H. Raibert, J. J. Craig, ASME J. Dynamic Systems, Measurement, and Control, 1981.

    https://doi.org/10.1115/1.3139652

  15. Matthew Mason, IEEE Trans. Systems, Man, and Cybernetics, 1981.

    https://doi.org/10.1109/TSMC.1981.4308708

  16. J. Salisbury, 19th IEEE Conf. Decision and Control, 1980.

    https://doi.org/10.1109/CDC.1980.272026

  17. Gill Pratt, Matthew Williamson, IEEE/RSJ Int. Conf. Intelligent Robots and Systems, 1995.

    https://doi.org/10.1109/IROS.1995.525827

  18. Christian Ott, Alin Albu-Schäffer, Andreas Kugi, Gerd Hirzinger, IEEE Int. Conf. Robotics and Automation, 2003.

    https://doi.org/10.1109/ROBOT.2003.1242067

  19. Christian Ott, Ranjan Mukherjee, Yoshihiko Nakamura, IEEE Int. Conf. Robotics and Automation, 2010.

    https://doi.org/10.1109/ROBOT.2010.5509861

  20. Franka Robotics, Franka Robotics, as of 2026-08-20.

    https://frankarobotics.github.io/docs/

  21. Universal Robots, Universal Robots, as of 2026-08-20, 2025.

    https://www.universal-robots.com/articles/ur/programming/urscript-dynamic-force-control/

  22. ISO, ISO Technical Specification (public catalogue entry), 2016.

    https://www.iso.org/standard/62996.html

  23. D. Han, M. Y. Park, J. Choi, H. Shin, R. Behrens, S. Rhim, Frontiers in Robotics and AI, 2024.

    https://doi.org/10.3389/frobt.2024.1374999

Spot a factual error or missing qualification? Report a content correction.