Control Systems for Robotics
Learning Objectives
By the end of this page, you should be able to:
- Explain the difference between open-loop and closed-loop (feedback) control and why robots need feedback
- Describe how a PID controller works and what each of the P, I, and D terms corrects for
- Explain the effect of tuning each PID gain too high or too low
- Identify common control architectures used in robotics (PID, feedforward + feedback, cascaded control)
- Connect control system behavior to real robot applications like arm positioning, mobile navigation, and drone stability
Quick Answer
A control system is the part of a robot that continuously compares where the robot actually is against where it's supposed to be, and adjusts the actuator commands to close that gap. Robots need control systems because no real motor, joint, or wheel behaves exactly as commanded — friction, payload changes, disturbances, and modeling errors all cause deviation from the intended motion. The most common building block is the PID (Proportional-Integral-Derivative) controller, which reacts to the current error, its accumulated history, and its rate of change to compute a corrective output. Control systems matter because they're what turns a kinematically and dynamically correct plan into a robot that actually holds a position, follows a path, or stays balanced in the real, imperfect physical world.
Why Robots Can't Just "Send a Command and Trust It"
Imagine commanding a robot arm's motor to rotate to a specific angle by simply applying a fixed voltage for a calculated amount of time. This is open-loop control — the system never checks whether it actually achieved the target. In practice this fails almost immediately: friction varies with temperature, the payload might be heavier than assumed, small mechanical backlash accumulates, and tiny timing errors compound. The arm ends up somewhere close to, but not exactly at, the target — and the controller has no way of knowing this happened.
Closed-loop (feedback) control fixes this by continuously measuring the actual state (using an encoder, potentiometer, or other sensor), computing the error (desired minus actual), and adjusting the actuator command based on that error — repeatedly, many times per second. This feedback loop is what allows a robot to compensate for disturbances and modeling imperfections it was never explicitly told about.
Why it matters: virtually every functioning robot uses closed-loop control somewhere in its architecture. Open-loop control is only acceptable for very simple, low-precision tasks (like a fixed-speed conveyor) where small errors don't matter.
The PID Controller
The Proportional-Integral-Derivative (PID) controller is the workhorse of robotics feedback control because it's simple, well-understood, and effective for a huge range of systems. Given an error e(t) = desired value − actual value, the PID output is:
Output = Kp·e(t) + Ki·∫e(t)dt + Kd·(de(t)/dt)
Each term corrects a different kind of shortfall:
- Proportional (P): reacts to the current error. A bigger error produces a proportionally bigger correction. Alone, P control leaves a steady-state error — think of a spring pulling the system toward the target, but it settles slightly short because at the final resting error the correction is too small to fully close the gap against a constant disturbance (like gravity holding an arm down).
- Integral (I): accumulates past error over time. If a small steady-state error persists, the integral term keeps growing until it forces the output to eliminate that error. This is exactly why I is necessary to remove the offset that P alone leaves behind.
- Derivative (D): reacts to the rate of change of error, effectively predicting where the error is heading. It opposes fast changes, which dampens oscillation and reduces overshoot — like a shock absorber that resists sudden motion.
Why it matters: understanding what each term corrects lets you diagnose real tuning problems. If a robot arm consistently stops just short of its target and stays there, that's a classic P-only steady-state error — the fix is adding or increasing Ki. If the arm oscillates back and forth before settling, that's usually too little damping — the fix is increasing Kd (or reducing Kp if it was too aggressive).
What Happens When Gains Are Tuned Wrong
- Kp too high: the system responds fast but overshoots and can oscillate or even become unstable.
- Kp too low: the system responds sluggishly and may never get close enough to the target.
- Ki too high: the accumulated error correction overshoots and causes slow oscillations ("integral windup" is a related real problem where the integral term grows unboundedly during a period the actuator is saturated, causing a large overshoot once it's released).
- Kd too high: the system becomes overly sensitive to noise (since derivative amplifies rapid, tiny fluctuations in sensor readings), causing jittery, erratic actuator commands.
Common misunderstanding: students often think "more feedback correction is always better" and crank up all three gains. In reality, PID tuning is a balance — pushing any gain too far in isolation destabilizes the system. Good tuning is found empirically or through methods like Ziegler-Nichols, not by maximizing gains.
Control Architectures Beyond a Single PID Loop
Real robots rarely use a single, standalone PID loop. Common architectures layered on top include:
- Feedforward + feedback control: the controller uses a known dynamics model (recall inverse dynamics from Robot Dynamics) to compute an estimated torque before any error even appears (feedforward), then uses PID feedback only to correct the remaining, unmodeled error. This combination is far more responsive and accurate than feedback alone, because the feedback controller isn't doing all the work.
- Cascaded control loops: many robots use nested loops — an inner, fast loop controls motor current/torque directly, wrapped by a middle loop controlling velocity, wrapped by an outer loop controlling position. Each loop runs at a different rate and handles a different timescale of correction.
- Trajectory tracking control: rather than a single fixed setpoint, the controller continuously tracks a time-varying desired position/velocity profile, which is what's needed for smooth, coordinated motion (like an arm moving through a curved path) rather than just "reach point A and stop."
Real-world example: a drone's flight controller uses cascaded PID loops — an inner loop stabilizes angular rate (very fast, using gyroscope data), a middle loop controls attitude (orientation), and an outer loop controls position, each running at progressively lower update rates. This layered structure is why drones can react to sudden gusts of wind in milliseconds while still following a slower, smooth overall flight path.
Key Terms
| Term | Definition |
|---|---|
| Open-loop control | Control that applies a fixed command without checking the actual outcome |
| Closed-loop (feedback) control | Control that measures the actual state and adjusts commands based on the error |
| Error | The difference between desired and actual value of the controlled quantity |
| PID controller | A feedback controller combining proportional, integral, and derivative terms |
| Proportional term (P) | Correction proportional to the current error |
| Integral term (I) | Correction based on accumulated past error, eliminates steady-state offset |
| Derivative term (D) | Correction based on the rate of change of error, dampens oscillation |
| Steady-state error | A persistent offset between desired and actual value that remains after the system settles |
| Integral windup | Excessive buildup of the integral term during actuator saturation, causing overshoot |
| Cascaded control | Nested feedback loops, each controlling a different timescale/quantity (e.g., torque, velocity, position) |
| Feedforward control | Using a known system model to compute a command in advance, before error appears |
Common Mistakes
-
Misconception: "A well-designed robot shouldn't need feedback control if the mechanical design and motor sizing are done correctly." Why it's wrong: even a perfectly designed robot faces friction variation, payload changes, and disturbances that can't be fully predicted in advance; feedback control compensates for exactly these unpredictable, real-world deviations. Correct understanding: feedback control isn't a patch for bad design — it's a necessary complement to any mechanical/electrical design because no physical system behaves exactly like its model.
-
Misconception: "Increasing Kp is always the right way to make a sluggish robot respond faster." Why it's wrong: pushing Kp too high causes overshoot and can destabilize the system into oscillation, even though the immediate symptom (sluggishness) seems to call for "more correction." Correct understanding: response speed, overshoot, and stability are coupled — improving speed often requires balancing Kp against Kd (to add damping) rather than raising Kp alone.
-
Misconception: "The integral term is optional — proportional control is usually good enough." Why it's wrong: proportional-only control leaves a steady-state error whenever there's a constant disturbance (like gravity pulling on an arm), because the correction shrinks toward zero as the error shrinks, never fully cancelling a constant opposing force. Correct understanding: the integral term is specifically what eliminates persistent steady-state error; omitting it is only acceptable when some steady-state offset is tolerable or when feedforward compensation (like gravity compensation) already cancels the constant disturbance.
Comparison and Connections
| Concept | Similar To | Key Difference |
|---|---|---|
| Open-loop control | Following a recipe without tasting the food | No sensor feedback; ignores actual outcome |
| Closed-loop control | Adjusting your steering while driving based on where the car is | Actively senses and corrects for real-time deviation |
| Feedback control | Feedforward control | Feedback reacts after error appears; feedforward predicts and compensates before error appears |
| PID control | Bang-bang (on/off) control | PID produces a smooth, proportional response; bang-bang simply switches full-on/full-off based on error sign, causing more oscillation |
| Cascaded control | Single-loop PID | Cascaded control splits correction across nested loops at different timescales (torque/velocity/position); single-loop PID handles everything in one pass |
Practice Questions
Recall
- What is the fundamental difference between open-loop and closed-loop control? Answer guidance: closed-loop control measures the actual outcome and adjusts based on the error; open-loop control applies a fixed command without checking the result.
- Name the three terms of a PID controller and state what each one reacts to. Answer guidance: Proportional (current error), Integral (accumulated past error), Derivative (rate of change of error).
Understanding
- Explain why a proportional-only controller leaves a steady-state error when holding a robot arm against gravity. Answer guidance: as the arm approaches the target, the error shrinks, so the proportional correction shrinks too; eventually the shrinking correction can no longer fully counteract the constant gravitational torque, leaving a persistent small offset.
- Why does increasing the derivative gain reduce oscillation but risk making the controller noisy? Answer guidance: the derivative term dampens fast changes in error, opposing overshoot/oscillation, but it computes a rate of change from sensor data, so any small, rapid noise in the sensor reading gets amplified into large, jittery corrective commands.
Application
- A robotic arm consistently stops about 2 degrees short of its commanded angle and stays there. Which PID term is most likely insufficient, and what would you change? Answer guidance: this is a classic steady-state error symptom, pointing to insufficient integral gain (Ki); increasing Ki (carefully, to avoid overshoot/windup) should eliminate the persistent offset.
- A drone's flight controller uses cascaded PID loops for angular rate, attitude, and position. Explain why a single flat PID loop controlling position directly would likely perform worse in gusty wind conditions. Answer guidance: a single slow position loop can't react fast enough to sudden angular disturbances from wind gusts; cascaded control lets the fast inner rate loop correct disturbances in milliseconds, while the slower outer loops handle the larger-timescale position objective, giving both speed and stability.
Analysis
- Compare feedback-only control and feedforward+feedback control for a robot arm performing repetitive, known trajectories (like a pick-and-place cycle). Which would you recommend and why? Answer guidance: feedforward+feedback is preferable — since the trajectory and dynamics model are known in advance, feedforward can precompute most of the required torque, reducing the burden and lag on the feedback controller, resulting in more accurate, less sluggish tracking than relying on feedback corrections alone.
- A control engineer tunes a PID loop that works well for an unloaded robot arm, but the same gains cause oscillation once a heavy payload is attached. Explain why the dynamics of the system changed and what control strategy could make the system more robust to this variation. Answer guidance: adding payload increases the effective inertia matrix M(θ) and gravity torque G(θ) (from Robot Dynamics), changing the system's response to the same gains — effectively the "plant" the controller is tuned for has changed. More robust strategies include gain scheduling (different gains for different payload/configuration ranges), adaptive control, or combining feedforward dynamics compensation so the feedback loop only handles the residual, less variable error.
FAQ
Q1: Why is PID still used when more advanced control methods exist? PID is simple to implement, requires minimal knowledge of the system's exact dynamics model, tunes reasonably well for a huge range of systems, and runs efficiently on cheap microcontrollers — which is why it remains the default choice for most practical robotics applications.
Q2: What is integral windup and why is it a real problem? It happens when the actuator is saturated (already at its maximum output) while error persists — the integral term keeps accumulating even though the actuator can't respond further. When the actuator finally becomes unsaturated, the built-up integral term causes a large overshoot. Anti-windup techniques (like clamping the integral term) are used to prevent this.
Q3: Can a robot work with a P-only controller? Yes, for applications where some steady-state error is tolerable, or where a separate feedforward term already cancels constant disturbances like gravity. Pure P control is simpler to tune but generally less accurate.
Q4: How is PID tuning actually done in practice? Common approaches include manual trial-and-error (adjust one gain at a time and observe response), heuristic methods like the Ziegler-Nichols method, and increasingly, automated/simulation-based tuning that optimizes gains against a dynamics model.
Q5: Is feedforward control a replacement for feedback control? No — feedforward relies on an accurate model, which is never perfect in the real world. Feedback is still needed to correct for whatever the model gets wrong or fails to predict (like an unexpected bump or unmodeled friction). The two are complementary, not substitutes.
Quick Revision
- Open-loop control never checks the outcome; closed-loop (feedback) control measures actual state and corrects based on error.
- PID output = Kp·e(t) + Ki·∫e(t)dt + Kd·(de/dt).
- P reacts to current error, I eliminates steady-state error by accumulating past error, D dampens oscillation by reacting to the rate of change of error.
- P-only control leaves steady-state error against constant disturbances (like gravity).
- Too-high Kp causes overshoot/instability; too-high Kd amplifies sensor noise; too-high Ki risks slow oscillation and windup.
- Integral windup occurs when the actuator saturates while the integral term keeps accumulating — anti-windup logic prevents overshoot.
- Feedforward control precomputes a command from a known model before error appears; feedback corrects the remaining, unmodeled error.
- Cascaded control nests multiple loops (e.g., torque, velocity, position) each handling a different timescale of correction.
- Drones classically use cascaded PID: fast inner rate loop, middle attitude loop, slower outer position loop.
- Control gains that work for an unloaded system may destabilize once payload changes the effective dynamics — this motivates gain scheduling or adaptive control.
Related Topics
Prerequisites: Robot Dynamics, basic feedback control concepts, calculus (derivatives/integrals for the D and I terms).
Related Topics: Robot Kinematics, Sensor Integration.
Next Topics: Robot Programming — once you understand how a control loop stabilizes and drives a robot's motion, the next step is writing the software architecture (state machines, ROS nodes, control loops) that ties sensing, planning, and control together.