๐Ÿฆพ Robotics Institute
Educational Resources

Robot Control Systems

How robots follow trajectories, respond to disturbances, and interact safely with the physical world. From classical PID to modern optimal and adaptive control.

What is Robot Control?

Robot control is the science of commanding a robot to perform desired motions while handling real-world disturbances: gravity, friction, payload changes, sensor noise, and model uncertainty. A controller computes the actuator commands (motor voltages, torques, or pressures) needed to track a desired trajectory or maintain a desired force/position relationship.

Setpoint r(t)
Σ
PID Controller
Robot (Plant)
Output y(t)
← Sensor feedback (encoder, IMU) →

The Control Problem

Given a desired trajectory q_d(t) (joint positions over time), the controller must compute torques tau(t) so that the actual joint positions q(t) track q_d(t) as closely as possible. The tracking error e(t) = q_d(t) - q(t) should converge to zero quickly, without oscillation, and stay bounded even under disturbances.

Task / Mission — 1-10 Hz
Motion Planning — 10-100 Hz
Task-Space Control — 100 Hz - 1 kHz
Joint-Level PID — 1-10 kHz

Control Architecture Levels

Open-Loop vs Closed-Loop

Feedback Control Fundamentals

The Feedback Loop

A standard feedback controller has: a reference signal r(t) (desired value), a plant (the robot), a sensor measuring the output y(t), and a controller C that computes the control signal u(t) based on the error e(t) = r(t) - y(t). The closed-loop transfer function is G_cl = C*G / (1 + C*G), where G is the plant transfer function.

Stability

A system is stable if, for any bounded input, the output remains bounded (BIBO stability). For linear systems, stability is determined by the poles of the closed-loop transfer function: all poles must have negative real parts (in the left half of the s-plane for continuous time, inside the unit circle for discrete time). Key analysis tools:

Overshoot
Setpoint
Rise
Settling
±2%
Step Response Characteristics

Performance Specifications

PID Control

The Proportional-Integral-Derivative (PID) controller is the most widely used control algorithm in the world. Over 95% of industrial control loops use some form of PID. It computes the control signal as a weighted sum of three terms based on the tracking error.

u(t) = Kp * e(t) + Ki * integral(e(t) dt) + Kd * de(t)/dt

Proportional (P) Term

The P term produces a control signal proportional to the current error: u_P = Kp * e(t). Higher Kp means faster response but can cause oscillation and instability. P-only control always has steady-state error for a constant disturbance (it needs a non-zero error to produce a non-zero output). In a robot joint, this is like a spring pulling toward the desired angle โ€” stiffer spring (higher Kp) = faster but more oscillatory.

Integral (I) Term

The I term accumulates past errors: u_I = Ki * integral(e(t) dt). It eliminates steady-state error by building up a correction signal even for small persistent errors. Essential for compensating gravity in robot arms: without I, a joint under gravity load will sag to a position where the P term balances gravity, leaving a static error. The downside: too much Ki causes overshoot and slow oscillation ("integral windup").

Derivative (D) Term

The D term responds to the rate of change of error: u_D = Kd * de(t)/dt. It provides damping, anticipating the error trend and braking before the setpoint is reached. In robot control, this is viscous damping โ€” it opposes rapid joint motion. Essential for stability with high Kp. The practical challenge: differentiating a noisy signal amplifies noise. Real implementations use a filtered derivative (low-pass filter on the D term) or differentiate the measurement rather than the error.

Effect of Each Gain

GainRise TimeOvershootSettling TimeSteady-State Error
Increase KpDecreasesIncreasesSmall changeDecreases
Increase KiDecreasesIncreasesIncreasesEliminates
Increase KdSmall changeDecreasesDecreasesNo effect

PD Control for Robot Joints

For a robot joint with gravity compensation, PD control is often sufficient. The equation of motion for a single joint is: I*q'' + b*q' + mgl*sin(q) = tau. A PD controller with gravity feedforward gives:

tau = Kp*(q_d - q) + Kd*(q_d' - q') + mgl*sin(q_d)

The gravity term handles the static load; the PD terms handle trajectory tracking. This is Lyapunov-stable: the error converges to zero if the desired trajectory is constant (regulation), though tracking errors persist for time-varying trajectories.

Practical PID Implementation

// Discrete PID controller (runs every dt seconds)
error = setpoint - measurement;
integral += error * dt;
integral = clamp(integral, -max_integral, max_integral);  // anti-windup
derivative = (error - prev_error) / dt;
derivative = alpha * derivative + (1-alpha) * prev_derivative;  // filter
output = Kp * error + Ki * integral + Kd * derivative;
output = clamp(output, -max_output, max_output);  // actuator saturation
prev_error = error;
prev_derivative = derivative;
🚿 PID control is like adjusting a shower. P (Proportional): if it's too cold, turn the hot tap more. I (Integral): if it's been cold for a while, turn it even more. D (Derivative): if it's getting warmer fast, ease off so you don't burn yourself!

Tuning Methods

Choosing Kp, Ki, and Kd values is an art informed by theory. Several systematic methods exist.

Ziegler-Nichols Method (1942)

The classic tuning method, developed by John G. Ziegler and Nathaniel B. Nichols at Taylor Instruments. Two variants:

Oscillation method (closed-loop):

ControllerKpKiKd
P only0.5 * Ku00
PI0.45 * Ku0.54 * Ku / Tu0
PID0.6 * Ku1.2 * Ku / Tu0.075 * Ku * Tu

This method produces an aggressive controller (quarter-decay ratio: ~25% overshoot). It is a starting point, not a final tuning. Real robots need refinement based on actual performance.

Step response method (open-loop):

Cohen-Coon Method

A refinement of Ziegler-Nichols for processes with large dead time (L/T > 0.25). Uses the same step response measurements but different formulas that give less aggressive tuning.

Tyreus-Luyben Method

Uses the ultimate gain Ku and period Tu like Ziegler-Nichols but with more conservative formulas: Kp = Ku/3.2, Ti = 2.2*Tu, Td = Tu/6.3. Produces less overshoot, commonly used in process control.

Frequency Domain Methods

Design the controller by shaping the open-loop frequency response (Bode plot). Place the crossover frequency at the desired bandwidth, ensure adequate gain and phase margins. Loop shaping is the method of choice for sophisticated single-loop controllers and is taught in every graduate control course.

Auto-Tuning

Modern industrial controllers (Siemens, ABB, Beckhoff) include auto-tuning: the controller automatically performs a relay test (oscillation method variant), identifies the process dynamics, and computes PID gains. Relay auto-tuning (introduced by Karl Astrom and Tore Hagglund in 1984) uses a relay (bang-bang) controller to induce oscillation at the ultimate frequency, which is safer than increasing gain to marginal stability.

State-Space Control

State-space representation describes a system using first-order differential equations. It is more general than transfer functions (handles MIMO systems, nonlinear systems, and time-varying systems) and is the foundation for modern control.

x_dot = A*x + B*u (state equation)
y = C*x + D*u (output equation)

where x is the state vector (dimension n), u is the input vector, y is the output vector, A is the system matrix (nxn), B is the input matrix, C is the output matrix, D is the feedthrough matrix (often zero).

For a Robot Joint

A single revolute joint with motor inertia I, viscous friction b, and no gravity:

x = [q, q_dot]^T
A = [0, 1; 0, -b/I], B = [0; 1/I], C = [1, 0], D = 0

Full-State Feedback

If all states are measurable, we can use u = -K*x + r, where K is a gain matrix. The closed-loop system becomes x_dot = (A - B*K)*x + B*r. The eigenvalues of (A - B*K) determine stability and performance. Pole placement: choose desired eigenvalues (closed-loop poles) and compute K using Ackermann's formula or the place() function in MATLAB/Python.

Observability and State Estimation

If not all states are directly measurable (e.g., velocity from position-only sensors), a state observer (Luenberger observer) estimates the full state from partial measurements:

x_hat_dot = A*x_hat + B*u + L*(y - C*x_hat)

The observer gain L is designed so that the estimation error converges quickly (observer poles faster than controller poles by a factor of 2-5x). The separation principle guarantees that observer and controller can be designed independently for linear systems.

Controllability and Observability

LQR โ€” Linear Quadratic Regulator

LQR is the most elegant result in optimal control: it finds the state-feedback gain K that minimizes a quadratic cost function, balancing tracking performance against control effort.

Minimize J = integral(x^T*Q*x + u^T*R*u) dt from 0 to infinity
Subject to: x_dot = A*x + B*u

Q (positive semi-definite) penalizes state deviations; R (positive definite) penalizes control effort. Large Q/R ratio = aggressive tracking. Small Q/R ratio = energy-efficient but slower.

Solution

The optimal gain is K = R^{-1} * B^T * P, where P is the unique positive-definite solution of the algebraic Riccati equation:

A^T*P + P*A - P*B*R^{-1}*B^T*P + Q = 0

This is solved numerically by MATLAB's lqr(A,B,Q,R) or Python's scipy.linalg.solve_continuous_are(). The resulting closed-loop system is guaranteed stable (assuming controllability).

LQR for Robotics

LQR Limitations

Computed Torque Control

Also called inverse dynamics control or feedback linearization. This model-based approach uses knowledge of the robot dynamics to cancel nonlinear terms, then applies linear control on the linearized system.

Robot Dynamics

The equations of motion for an n-DOF robot manipulator (Euler-Lagrange formulation):

M(q)*q'' + C(q, q')*q' + g(q) = tau

where M(q) is the inertia matrix (nxn, symmetric, positive definite), C(q,q') contains Coriolis and centrifugal terms, g(q) is the gravity vector, and tau is the vector of joint torques.

Control Law

tau = M(q) * (q_d'' + Kd*(q_d' - q') + Kp*(q_d - q)) + C(q,q')*q' + g(q)

Substituting into the dynamics equation, the nonlinear terms cancel exactly (assuming perfect model), leaving:

e'' + Kd*e' + Kp*e = 0

This is a linear, decoupled second-order system for each joint. Choose Kp and Kd to place poles as desired (e.g., critically damped: Kd = 2*sqrt(Kp)).

Requirements and Limitations

Robust Computed Torque

Adding a robust term to handle model uncertainty: tau = M_hat * (q_d'' + Kd*e' + Kp*e) + C_hat*q' + g_hat + u_robust, where u_robust is a sliding-mode or H-infinity term that bounds the effect of model errors. Spong (1992) and Slotine & Li (1991) provide thorough treatments.

Model Predictive Control (MPC)

MPC (also called receding-horizon control) is the most powerful framework for robot control when constraints matter. At each time step, it solves a finite-horizon optimal control problem online, applies the first control action, then re-solves at the next step.

Formulation

Minimize: sum_{k=0}^{N-1} [x_k^T*Q*x_k + u_k^T*R*u_k] + x_N^T*Q_f*x_N
Subject to: x_{k+1} = f(x_k, u_k) (dynamics)
u_min <= u_k <= u_max (actuator limits)
x_min <= x_k <= x_max (state constraints)
h(x_k) <= 0 (obstacle avoidance, etc.)

Why MPC for Robotics?

Computational Cost

Linear MPC (with quadratic cost and linear constraints) reduces to a Quadratic Program (QP), solvable in milliseconds with solvers like OSQP, qpOASES, or ECOS. Nonlinear MPC requires solving a Nonlinear Program (NLP) at each step โ€” much harder but feasible for moderate-dimensional systems using CasADi, ACADOS, or Crocoddyl.

MPC in Practice

Key MPC Software

LibraryLanguageSpecialty
ACADOSC / PythonFast NMPC, code generation for embedded
CasADiC++ / Python / MATLABSymbolic framework for NLP formulation
CrocoddylC++ / PythonContact-aware optimal control for legged robots
OSQPC / PythonFast QP solver for linear MPC
🧠 MPC is like a chess player โ€” it thinks several moves ahead! Instead of just reacting to what's happening right now, the robot imagines what will happen over the NEXT few seconds and picks the best move. This is how the MIT Mini Cheetah robot can run, flip, and recover from kicks โ€” it's always planning ahead!

Impedance & Admittance Control

Traditional position control commands the robot to a position and resists any deviation. But for contact tasks (assembly, polishing, human-robot interaction), the robot must comply with external forces rather than fight them. Impedance and admittance control define the dynamic relationship between force and displacement.

Impedance Control

The robot behaves as a mass-spring-damper system: when pushed, it deflects proportionally. The desired impedance relationship is:

F_ext = M_d * (x'' - x_d'') + B_d * (x' - x_d') + K_d * (x - x_d)

where M_d, B_d, K_d are the desired inertia, damping, and stiffness (chosen by the designer), and x_d is the reference trajectory. The controller computes joint torques to realize this dynamic relationship.

Admittance Control

The inverse approach: measure external forces (via force/torque sensor) and compute position corrections. The admittance relationship is x - x_d = (1/Z) * F_ext, where Z is the impedance. Used when the inner loop is a stiff position controller (typical for industrial robots) and adding compliance on top.

When to Use Which

AspectImpedance ControlAdmittance Control
Inner loopTorque controlPosition control
Sensor neededPosition/velocityForce/torque sensor
Best forTorque-controlled robots (KUKA iiwa, Franka Emika)Position-controlled robots (UR, FANUC)
Free motionGood trackingExcellent tracking
ContactNaturally compliantRequires good force sensing

Applications

Adaptive Control

Adaptive control adjusts controller parameters in real-time to compensate for unknown or changing system dynamics. Essential when the robot picks up unknown payloads, wears out over time, or operates in varying conditions.

Model Reference Adaptive Control (MRAC)

Define a reference model that specifies the desired closed-loop behavior. The adaptive law adjusts controller gains so that the actual system tracks the reference model. Lyapunov-based design ensures stability. Used in aerospace (first practical application: X-15 flight control, 1960s).

Adaptive Computed Torque

The robot dynamics are linear in the dynamic parameters (masses, inertias, center of mass locations, friction coefficients): M(q)*q'' + C(q,q')*q' + g(q) = Y(q,q',q'')*theta, where Y is the regressor matrix and theta is the parameter vector. An adaptive law updates theta_hat based on tracking error:

theta_hat_dot = -Gamma * Y^T * s

where Gamma is a positive-definite adaptation gain matrix and s is a filtered tracking error. This guarantees convergence of the tracking error to zero even with unknown parameters. The result from Slotine and Li (1987) is one of the most important in adaptive robotics.

Challenges

Practical Tuning Tips

General Guidelines

Common Pitfalls

Frequency Response Testing

Inject a chirp signal (sine sweep from 0.1 Hz to 100 Hz) and measure the response. Plot gain and phase vs frequency. This gives the actual closed-loop bandwidth, identifies resonances (flexible modes), and validates that gain and phase margins are adequate. Every serious robot commissioning includes this step.

References & Further Reading

Siciliano et al: Robotics โ€” Modelling, Planning and Control (2009)

Chapters 8-12 cover joint-space control, task-space control, force control, and impedance control. The most complete treatment in one textbook.

Springer | Graduate level

Slotine & Li: Applied Nonlinear Control (1991)

The definitive reference for sliding mode control and adaptive control of robot manipulators. Chapter 9 covers adaptive robot control specifically.

Prentice Hall | Classic reference

Di Carlo et al: Dynamic Locomotion in the MIT Cheetah 3 (2018)

Details the model predictive control approach for quadrupedal locomotion. Convex MPC with simplified dynamics model running at 30 Hz.

IEEE Control Systems Magazine

Ziegler & Nichols: Optimum Settings for Automatic Controllers (1942)

The original paper introducing the Ziegler-Nichols tuning rules. Published in Transactions of the ASME. One of the most cited papers in control engineering.

ASME | Foundational paper

Lynch & Park: Modern Robotics (2017)

Chapter 11 covers robot control: PID, computed torque, motion/force control. Free PDF and companion Coursera course. Good blend of theory and practice.

Cambridge University Press | Free PDF

Stanford CS223A: Introduction to Robotics

Oussama Khatib's lectures on robot control, including operational space control (task-space dynamics control). The operational space formulation unifies motion and force control.

Stanford Engineering Everywhere | Free