08 · The mind
Control, from current loop to planner
A robot is seven feedback loops stacked by clock speed. This chapter walks down the stack, from the planner that thinks a few times a second to the current loop that fires 40,000 times a second.
Every modern robot runs the same shape of software: fast, dumb, certifiable loops at the bottom and slow, clever, learned models at the top, each layer handing targets down and reading state back up. The bottom of the stack is solved and nearly free. The middle, whole-body balance and contact, is where learned networks replaced hand-written code in 2026. Knowing which layer a company actually built tells you what it's worth and what will break.
The stack of clocks
A controller is any piece of code or circuitry that compares what you want with what you measured and decides what to do next. The thing you want is the setpoint: 90 degrees at the elbow, 1.2 m/s forward, "put the cup in the sink". When the controller measures the result and corrects, you have a closed loop. When it fires a command without checking, you have an open loop.
Real
A closed loop measures the output, subtracts it from the setpoint to get an error, and computes a command from that error on every tick. An open loop applies a pre-planned command with no measurement, so it works exactly as well as your model of the machine and the repeatability of the world. Production machines use both: a model-based command does most of the work and feedback trims what the model got wrong.
ELI5
A toaster is open loop. It runs the heater for two minutes and has no idea whether the bread is frozen. An oven with a thermostat is closed loop. It keeps checking the temperature and switches the heater on and off to hold it. Open loop follows the recipe blind. Closed loop tastes as it cooks.
A robot stacks these loops. Each layer runs 5 to 10 times faster than the layer above it verified, because a loop only behaves if the loop inside it looks instantaneous. The rate each layer runs at is its control frequency. Chinese engineers split the stack into the "big brain" (大脑 dànǎo), the slow planning model, and the "little brain" (小脑 xiǎonǎo), the fast motion control layer that keeps the body upright. That split is the brain and cerebellum architecture.
Read the stack from the bottom. The current loop lives on the motor driver inside each joint module and runs field-oriented control at 10 to 40 kHz verified. The velocity loop runs at 1 to 4 kHz and the position loop at 100 Hz to 1 kHz. Above them, a whole-body controller balances the robot at 500 Hz to 1 kHz. A learned policy or a model predictive controller decides the next second of motion at 25 to 200 Hz, and a reasoning model plans the task at 1 to 10 Hz verified. The actuators chapter covers the bottom three loops in hardware; this chapter covers the logic.
Delay kills loops faster than bad maths does. A loop that responds at 10 Hz and picks up just 20 ms of extra delay, one slow bus message or one dropped camera frame, loses about 72 degrees of its stability margin verified. That's why the fast loops live on chips next to the motors and the slow models live on the main computer. Where each loop physically runs is one of the most telling facts about a robot.
PID, the loop inside every joint
The workhorse is the PID controller. It watches one number, the error, and adds up three reactions to it. About 97% of the controllers running the world's factories and process plants are still PID estimate, because it's free, certifiable and good enough whenever one input drives one output.
Real
Command = Kp × error + Ki × (error summed over time) + Kd × (rate of change). P sets stiffness and speed but leaves a steady offset against a constant load such as gravity. I keeps ratcheting until the offset is exactly zero, at the cost of slower, wallowing oscillation. D adds damping so you can run a higher Kp. Real controllers filter D (the filter coefficient N is usually 8 to 20) and take the derivative of the measurement instead of the error, so a sudden setpoint change doesn't produce a spike.
ELI5
You're holding a heavy bag at arm's length. P is "the further it droops, the harder I pull". I is "it's been drooping for a while, pull harder still". D is "it's moving fast, ease off before I overshoot". Too much P and your arm bounces. Too little and the bag sags. The three together hold it level and still.
Try it. The toy below is a 1 kg weight on a 0.5 m arm, hanging straight down, told to swing up and hold horizontal. Holding it level against gravity takes 4.9 N·m, and the motor can give at most 10 N·m. The simulation runs at 1 kHz, like a real joint loop.
Three things the toy teaches that you'll see on real robots. First, turn Kp up past 30 and the arm hits the 10 N·m limit: the motor saturates and more gain buys nothing. Second, the I term has a trap called integral windup. When the motor is saturated and the error stays big, a naive integrator keeps piling up error, then overshoots wildly once the arm arrives. The toy freezes the integrator while the motor is at its limit, which is one of the two standard fixes. Third, tuning is a craft. The classic recipe, Ziegler and Nichols from 1942, raises Kp until the loop oscillates and derives the rest from that; it gives 25 to 60% overshoot verified, so treat it as a starting point.
Joints rarely run one PID. They run a cascade: a position loop commands a velocity loop, which commands the current loop, and engineers tune from the inside out. On a humanoid the position loop usually drops the I term and becomes a PD controller with two numbers per joint, stiffness kp and damping kd. Those two numbers matter more than they look, as the next section shows.
Feedforward and gravity compensation
Good motion control computes most of the command before any error appears. That's feedforward: use a model to predict the torque the motion needs (mass times planned acceleration, plus friction, plus gravity), send it, and let feedback clean up the few percent the model got wrong. Engineers say "a good servo is 90% feedforward" folklore. The most common piece is gravity compensation: at every joint angle the controller knows how much torque holding the arm against gravity takes and adds it automatically.
Real
Gravity compensation adds τ = g(q), the torque gravity puts on each joint at configuration q, computed from link masses and centres of mass. With it, a PD loop with modest gains holds position with zero sag. Without it you need either high kp (stiff, hot and dangerous in contact) or an integrator (slow and prone to windup).
ELI5
Hold a full glass out in front of you. You don't wait for your arm to droop before you push up. Your brain already knows the glass is heavy and pushes the right amount from the start. That's feedforward. Your eyes only fix the little wobbles.
Here's why this matters for money. Owner reports on the Unitree G1 show that most of its hardware failures start in software. When NVIDIA's open-source whole-body controller ran on a G1, both ankle motors hit their 90 °C warning in 5 to 10 minutes while the robot stood still; Unitree's stock controller keeps the same ankles at 30 to 45 °C owner report, Jun 2026. Another owner fitted a heavier dexterous hand, kept the gains at kp 40 and kd 1.5, and the shoulder motor overheated within minutes owner report, Jan 2026. Heat comes from current, current comes from torque, and torque demand comes from the controller. Same hardware, a 45 to 60 °C difference at the ankle, decided entirely by control code.
Kinematics: joint angles to hand position and back
Forward kinematics answers "if every joint is at these angles, where's the hand?" It's easy: multiply out the geometry of the kinematic chain link by link. Inverse kinematics answers the question you actually care about: "I want the hand here, so what angles do I need?" It's harder, because there may be two answers, infinitely many, or none.
A two-link arm has a clean formula. A 7-joint arm reaching a point in 3D space has one joint more than it needs, so it has infinitely many solutions and can move its elbow out of the way while its hand stays still. A humanoid with 23 to 56 degrees of freedom (a base Unitree G1 has 23, Atlas has 56 verified Sep 2026) has dozens more than any one task needs. Real robots solve inverse kinematics numerically, many times a second, picking the solution that also keeps joints away from their limits and the body balanced.
The Jacobian and singularities
The numerical method runs on one object: the Jacobian. It's a table that says, for the current pose, how fast the hand moves in each direction when each joint turns a little. Turn it around and it tells you which small joint moves produce the hand motion you want. It also converts in the other direction for force: the torques each joint must apply to push with a given force at the hand.
Real
The Jacobian J(q) maps joint velocities to end-effector velocity, v = J(q) q̇, and end-effector force to joint torques, τ = Jᵀ F. At a singularity J loses rank: some hand direction becomes impossible, and solving for joint speeds divides by a number near zero, so commanded joint speeds shoot up. Controllers add damping to the inverse (damped least squares) and planners keep trajectories away from singular poses.
ELI5
Stretch your arm straight out and try to push your hand further away from your shoulder. You can't: every joint you move swings the hand sideways instead. That's a singularity. Near it, a tiny hand move needs a huge, fast joint move, and a robot that tries anyway jerks violently.
Dynamics in words
Kinematics is geometry with no forces. Dynamics adds the forces. The whole of robot dynamics fits in one equation, usually written M(q)q̈ + C(q, q̇)q̇ + g(q) = τ. In words, the torque at the joints pays for four things:
- Inertia: accelerating the links, where the effective mass changes with the pose. An arm stretched out is harder to swing than one tucked in.
- Coupling: the forces one moving link puts on the others, like the pull you feel in your shoulder when you swing your forearm fast.
- Gravity: holding everything up, the g(q) term that gravity compensation cancels.
- Everything outside: contact with the floor, a box, a person, which enters through the Jacobian.
Solve it forward and you have a simulator: torques in, motion out. Solve it backward, which engineers call inverse dynamics, and you have the feedforward term: motion you want in, torques you need out. Every whole-body controller and every physics simulator in the locomotion chapter is built on this equation.
Position control versus torque control
There are two ways to command a joint. Position control says "go to 42 degrees and stay there, whatever it takes". An industrial arm with a 100:1 harmonic drive works this way: stiff, precise, and blind to what it hits. Force control says "push with 5 N·m" and lets the position be whatever results. It needs a joint that can feel torque, either from a torque sensor or from motor current in a low-friction quasi-direct-drive joint.
Real
Gearing multiplies the motor's own inertia by the ratio squared, so a 100:1 joint feels its rotor 10,000 times heavier from the outside and hides contact forces below its friction. Quasi-direct drive uses a large motor with a 6:1 to 10:1 planetary stage, keeping reflected inertia about 100 times lower than a harmonic joint, so motor current is an honest force signal verified. MIT's Mini Cheetah made this the standard for legged robots in 2018 to 2019; Unitree builds its own QDD joints.
ELI5
A position-controlled arm is a car with the steering locked: it goes exactly where it's told and flattens anything in the way. A torque-controlled arm is your own arm with your eyes shut: it feels the table and stops. Legged robots need the second kind, because feet hit the ground hundreds of times a minute.
Most humanoids blend the two. The policy sends a target angle plus two gains, and the joint computes torque = kp × (target angle minus actual angle) + kd × (target speed minus actual speed). Low gains make the joint soft; high gains make it stiff. That's why the gains on the G1 owner report above caused the overheating: kp 40 on a shoulder carrying a heavier hand kept the motor pushing hard against every small error.
"Our robot is backdrivable and safe" often means the joint feels soft at rest. The real test is what happens when a learned policy sends a large target in a state it never trained on. On a G1 that switch can command a torque spike big enough to trip the battery's over-current protection and drop the robot maintainer reply. Softness is a gain setting, and software can change it in one tick.
Impedance and admittance: choosing how stiff to feel
The useful middle ground is to control the relationship between force and motion. Impedance control makes the hand behave like a spring and a damper you choose: push it 5 cm and it pushes back with exactly the force a spring of that stiffness would, then returns. Admittance control is the mirror image for stiff position-controlled arms: a force sensor at the wrist measures the push and the controller moves the arm away by a matching amount.
This is how a robot wipes a table with steady pressure, inserts a plug without jamming, or survives a person bumping into it. Pick a soft spring for contact with people and a stiff one for precise placement. Figure 02 placed parts to a 5 mm tolerance in about 2 seconds at BMW verified Nov 2025, which is precision territory; wiping and plugging are compliance territory. The same arm switches between them in software.
Whole-body control: many goals, one body
A humanoid carrying a box has several goals at once: don't fall, keep both feet planted, hold the box level, keep the elbows off the torso, stay within every joint's torque limit. Whole-body control solves all of them together, up to 1,000 times a second, with strict priorities.
Real
The classical whole-body controller writes each goal as a task (a desired acceleration of the centre of mass, a foot, a hand) and solves a small optimisation, usually a quadratic program, for the joint torques and contact forces that satisfy the high-priority tasks exactly and the low-priority ones as well as possible, subject to friction and torque limits. Solvers such as OSQP, qpOASES and acados finish in microseconds to milliseconds verified.
ELI5
A waiter with a tray on a crowded floor has a ranked to-do list: don't fall over, don't drop the tray, don't bump anyone, look relaxed. When he slips, he lets "look relaxed" go first and "don't fall over" last. Whole-body control is that ranked list, re-solved a thousand times a second.
- Balance: keep the centre of mass over the feet (see balance).
- Contacts: planted feet don't slip; forces stay inside friction limits.
- Task: the hand follows the box trajectory.
- Posture: joints stay near comfortable angles, away from limits and singularities.
This is the layer that learning took over in 2026. Figure's Helix 02, announced 27 Jan 2026, replaced 109,504 lines of hand-written C++ balance and whole-body code with a 10-million-parameter neural network, called S0, that runs at 1 kHz verified. It was trained entirely in simulation on more than 1,000 hours of retargeted human motion, across more than 200,000 parallel simulated environments with randomised physics verified. Boston Dynamics took the other route with Atlas: it writes the low-level control itself and buys the reasoning layer from Google DeepMind verified.
Model predictive control: plan ahead, commit to one step
PID only looks at the error right now. Model predictive control, or MPC, looks ahead. At every tick it simulates the next half second with a model of the robot, finds the best sequence of commands that respects every limit, sends only the first command, then throws the plan away and does it again.
Real
At each tick, minimise the sum of squared tracking error and effort over N future steps, subject to the dynamics model, actuator limits and safety constraints; apply the first input; shift the horizon; re-solve. Legged robots run MPC at about 25 to 100 Hz over a horizon of about 0.5 s with a 1 kHz loop underneath, the MIT Cheetah convex-MPC recipe from 2018 that became standard across quadrupeds verified.
ELI5
PID is a driver who only looks at how far the car sits from the lane line right now. MPC is a driver who thinks "if I steer like this, I'll be there in two seconds; like that, over there", picks the best plan, turns the wheel a little, then looks again and plans from scratch.
MPC earns its compute, roughly 100 times PID's, in three situations: when limits matter (it plans inside them instead of hitting them), when many inputs interact, and when you know what's coming (the next footstep, the stairs ahead). Its costs are equally real. It needs a decent model, because it turns model error into confident wrong plans, and a solver that is guaranteed to finish inside every tick. As of 2026 many quadruped and humanoid stacks replace MPC with a learned policy, or keep MPC as a safety layer under one contested.
Motion planning: finding a path that hits nothing
Control follows a path. Planning finds one. Motion planning searches for a collision-free route from here to there through the space of joint angles. Trajectory planning then puts timing on that route, speeds and accelerations the motors can deliver without shaking the arm.
- RRT (rapidly exploring random tree) grows a tree of random collision-free poses outward from the start until a branch reaches the goal, then smooths the path. It works well in the high-dimensional joint space of a 7-joint arm, where a grid search would never finish.
- Collision checking is where most of the compute goes. The planner tests thousands of candidate poses against simplified 3D shapes of the robot and the scene, often from a depth camera or LiDAR map.
- MoveIt is the open-source motion planning framework built on ROS 2. Most research arms and many integrators start there.
- Time parametrisation turns the path into a trajectory, using smooth S-curve profiles so the arm never asks for an acceleration that excites its resonances, which usually sit somewhere between 20 and 500 Hz verified.
Classical planners are exact and slow to adapt: they need a geometric model of the scene. That's why a learned policy that goes straight from camera pixels to motion, the VLA covered in the brains chapter, is eating planning for cluttered, changing scenes such as homes and kitchens.
Where learning replaces classical control, and where it doesn't
| Layer | Rate | Status in Sep 2026 | Example |
|---|---|---|---|
| Task planning | 1 to 10 Hz | learned | Helix S2, Gemini Robotics on Atlas and Apollo |
| Motion generation | 50 to 200 Hz | mostly learned for manipulation | Helix S1 at 200 Hz; π0 action chunks at 50 Hz |
| Locomotion policy | about 50 Hz | learned, trained in simulation | most quadrupeds and humanoids (locomotion) |
| Whole-body balance | 500 Hz to 1 kHz | moving to learned | Helix 02 S0 learned; Boston Dynamics classical |
| MPC | 25 to 100 Hz | contested | replaced, or kept as a safety layer |
| Joint PD loop | 100 Hz to 1 kHz | classical | every robot |
| Current loop | 10 to 40 kHz | classical | field-oriented control on every driver |
| Safety functions | fixed | classical, certified | IEC 61508 and ISO 10218 style functions |
The pattern: learning wins where the world is too messy to model (vision, contact-rich motion, balance over rough ground) and loses where certification, determinism and microsecond timing rule. The bottom three rows won't be learned in this decade, because a regulator can audit a PID loop and can't audit a network estimate. Watch the whole-body row. When a company says its "little brain" is learned end to end, ask how it was validated, what the joint temperatures look like after an hour, and what classical safety layer sits under it.
Terms in this chapter
| English | 中文 + pinyin | ELI5 | Real definition |
|---|---|---|---|
| Controller | 控制器kòngzhìqì | The part of the robot that keeps asking "where am I, where should I be" and pushes the difference to zero. | Code or circuitry that computes a command from a setpoint and a measurement. In a robot, controllers are stacked by rate, from the 10 to 40 kHz current loop on each motor driver to a 1 to 10 Hz planning model. |
| Motion control | 运动控制(运控)yùndòng kòngzhì (yùnkòng) | The software that turns "walk forward" or "reach there" into exact motor pushes, fast enough to keep the robot upright. | The layers that turn motion targets into joint torques: whole-body control, joint position and velocity loops, and current control. Chinese makers call it 运控 and treat it as the "little brain" (小脑) under the planning model. |
| Closed loop | 闭环bìhuán | Checking the result and correcting, like tasting soup while you cook it. | Control that measures the output, compares it with the setpoint and corrects the command on every tick. Rejects disturbances and model error at the cost of sensors and a stability risk if delay grows. |
| Open loop | 开环kāihuán | Following the recipe without tasting. A toaster runs for two minutes whether the bread is frozen or not. | Control that applies a pre-planned command with no measurement of the result. Accurate only as far as the model and the world's repeatability allow; in robots it survives as feedforward under a feedback loop. |
| PID | PID控制PID kòngzhì | Three reflexes added together: push harder the further off you are, harder still the longer you've been off, and ease off when you're closing in fast. | Proportional, integral, derivative controller: u = Kp·e + Ki·∫e dt + Kd·de/dt. P sets stiffness, I removes steady offset, D adds damping. Practical versions filter D (N about 8 to 20), take the derivative of the measurement and add anti-windup. About 97% of process loops are PID. |
| Integral windup | The controller keeps adding up how far off it is while the motor is already maxed out, then overshoots badly when it finally gets there. | Integrator accumulation during actuator saturation, which causes large overshoot and slow recovery. Fixed by clamping (freeze the integrator while saturated) or back-calculation. | |
| Feedforward | 前馈qiánkuì | Pushing the right amount before anything goes wrong, because you already know how heavy the thing is. | A command computed from a model or plan instead of from error: inverse-dynamics torque from planned acceleration, gravity and friction. Carries most of the load in production motion systems; feedback trims the residual. |
| Gravity compensation | 重力补偿zhònglì bǔcháng | The robot adds exactly the push needed to hold its own arm up, so the rest of the controller only fixes small errors. | Feedforward torque τ = g(q) that cancels gravity at each joint configuration, computed from link masses and centres of mass. Lets low-gain PD loops hold pose without sag. |
| Setpoint | The number you want: 90 degrees at the elbow, 1.2 m/s forward. | The target value a controller tries to make the measured output match; it can change every tick when it comes from a trajectory. | |
| Control frequency | 控制频率kòngzhì pínlǜ | How many times a second a loop checks and corrects. | The update rate of a control loop, in Hz. Each loop in a cascade runs 5 to 10 times faster than the loop outside it; robot stacks span about 1 Hz (planner) to 40 kHz (current loop). |
| Forward kinematics | 正运动学zhèng yùndòngxué | Given where every joint is bent, work out where the hand ends up. | The map from joint angles to the pose of a link or end effector, computed by chaining each link's transform. Always has exactly one answer. |
| Inverse kinematics | 逆运动学nì yùndòngxué | Given where you want the hand, work out how to bend every joint to get it there. | The map from a desired end-effector pose to joint angles. Two-link arms have closed-form solutions (two per target); redundant arms and humanoids have infinitely many and are solved numerically, usually through the Jacobian, with limits and balance as extra goals. |
| Jacobian | 雅可比矩阵yǎkěbǐ jǔzhèn | A table that says how fast the hand moves in each direction when each joint turns a little. | The matrix J(q) of partial derivatives mapping joint velocities to end-effector velocity (v = J q̇) and end-effector force to joint torques (τ = Jᵀ F). Its inverse or pseudo-inverse drives numerical IK and operational-space control. |
| Singularity | 奇异点qíyì diǎn | A pose, like a fully straight arm, where the hand can't move in some direction and trying makes the joints jerk. | A configuration where the Jacobian loses rank: the end effector loses a direction of motion and joint speeds needed for nearby motions tend to infinity. Handled with damped least squares and by planning away from singular poses. |
| Dynamics | 动力学dònglìxué | The maths of which forces make the robot move how, including gravity and the swing of its own limbs. | The relation between joint torques and motion, M(q)q̈ + C(q, q̇)q̇ + g(q) = τ + Jᵀ F_ext: inertia, coupling, gravity and external contact. Solved forward in simulators and backward (inverse dynamics) for feedforward. |
| Position control | 位置控制wèizhì kòngzhì | Telling a joint "go to 42 degrees and stay there, whatever it takes". | Control mode that tracks a joint or end-effector position with high-gain feedback. Precise and stiff, and blind to contact forces; the default on industrial arms with high-ratio reducers. |
| Force control | 力控lìkòng | Telling a joint how hard to push and letting it move wherever that push takes it. | Control of contact force or joint torque, using a torque or force sensor or motor current in a low-friction joint. Needed for legs, wiping, insertion and safe contact with people. |
| Impedance control | 阻抗控制zǔkàng kòngzhì | Making the robot's hand act like it's held by a spring you picked: push it and it gives a bit, let go and it comes back. | Control that imposes a chosen relation between motion and force at the end effector, F = K·Δx + D·ẋ (+ M·ẍ). Needs torque-controllable joints. Soft K for contact with people, stiff K for placement. |
| Admittance control | 导纳控制dǎonà kòngzhì | A stiff arm feels your push with a wrist sensor and moves out of the way on purpose. | The dual of impedance control: measure force (usually with a six-axis wrist sensor) and command a position offset from a virtual mass-spring-damper. Suits stiff position-controlled arms and hand-guiding of cobots. |
| Whole-body control | 全身控制quánshēn kòngzhì | A ranked to-do list for the whole body (don't fall, keep feet planted, hold the box, look natural) solved a thousand times a second. | Control that computes all joint torques and contact forces together from prioritised tasks, classically as a quadratic program at 500 Hz to 1 kHz. Increasingly a learned network, for example Figure's Helix 02 S0 (10M parameters, 1 kHz, trained in simulation). |
| Model predictive control | 模型预测控制móxíng yùcè kòngzhì | Imagine the next half second, pick the best plan, do only the first bit, then imagine again. | MPC: at each tick, solve a constrained optimisation over a receding horizon using a dynamics model, apply the first input, re-solve. Legged robots run it at about 25 to 100 Hz over about 0.5 s with a 1 kHz loop underneath (MIT Cheetah, 2018). |
| Motion planning | 运动规划yùndòng guīhuà | Finding a route for the arm or body that doesn't bump into anything. | Search for a collision-free path through configuration space, with sampling planners such as RRT or optimisation-based planners; MoveIt is the common open-source framework on ROS 2. |
| Trajectory planning | 轨迹规划guǐjì guīhuà | Deciding how fast to move along the route, so the motors can keep up and the arm doesn't shake. | Time parametrisation of a path into positions, velocities and accelerations within joint limits, typically with S-curve profiles and input shaping to avoid exciting structural resonances. |
| RRT | Throw out random safe poses, grow a tree of them from the start, and stop when a branch reaches the goal. | Rapidly exploring random tree: a sampling-based motion planner that grows a tree of collision-free configurations toward random samples; effective in high-dimensional joint spaces. RRT* adds asymptotic optimality. |
Sources for this chapter
- Figure, Helix 02 announcement, 27 Jan 2026 (S0 at 1 kHz, 109,504 lines of C++ replaced, 200,000+ simulated environments): figure.ai
- Figure, production at BMW, Nov 2025 (5 mm tolerance in about 2 s): figure.ai
- NVlabs GR00T whole-body control, issue 174, ankle motors at 90 °C on G1, 2 Jun 2026: github.com
- Unitree SDK issue 129, shoulder overheating with a heavier hand at kp 40, kd 1.5, 6 Jan 2026: github.com
- Unitree RL issue 14, torque spike tripping battery over-current protection: github.com
- Boston Dynamics, Atlas product page (56 DOF): bostondynamics.com
- Unitree G1 product page: unitree.com
- Groundcrew research dossiers, Sep 2026, built from the sources listed above.