Adaptive Cruise Control: State-Space Design and LQR
A fourth-year modern-control project (MSE 483), done as a team. We modelled a car-following system in state space, proved it controllable and observable, designed a pole-placement controller with a Luenberger observer, compared it with a family of LQR designs, and built the observer-based loop in Simulink. The figures on this page were re-plotted for this site from our scripts; where a plot uses settings beyond the original project, its caption says so.
- Course
- MSE 483 Modern Control
- Year
- 2020
- Tools
- MATLAB, Simulink, Simscape
- Methods
- State space, pole placement, observer, LQR
The problem
Adaptive cruise control keeps a car at a safe distance behind the vehicle in front by modulating throttle and brake from radar or GPS measurements. The controller has two jobs that pull in opposite directions: hold the gap tightly, because a gap violation is a safety problem, and do it with gentle acceleration, because harsh acceleration costs fuel, wear and comfort. Our brief was to build a state-space model of the longitudinal dynamics, show that it supports state feedback, and design and compare controllers that make that trade-off explicit. The specification we set ourselves: a time gap of 1.5 to 2.2 s, a minimum operating speed of 5 m/s, and a gap response with at most 3 % overshoot that settles in 10 s.
State-space model
The system is constrained to the longitudinal direction. Three states describe the ego (following) car relative to the lead car: its acceleration, its speed, and the gap. The driveline is a first-order lag from the commanded acceleration to the actual one, the gap grows with the lead car's speed and shrinks with the ego car's, and both the gap and the ego speed are measured:
Written as ẋ = Ax + Bu, y = Cx + Du, and with the values from the script that drove our Simulink run (starting speed 10 m/s and gap 40 m, so τ = 40 / 10 = 4 s):
Design note: in our scripts the lag constant τ took the value of the time gap, distance over speed (1.85 s in an early script, 3 s in the analysis script, 4 s in the Simulink script). That gives a deliberately slow actuator, 1/τ = 0.25 rad/s, which shapes the gains in the analysis below. A production powertrain responds in roughly 0.5 s; an illustrative extension near the end of the page shows the same design method with that value.
For the inner model of the ego car we also wrote a force balance, m·v̇ = F − Fd. The engine force comes from a full-throttle torque curve T(ω) = Tm(1 − β(ω/ωm − 1)²) through the gear ratio, and the resistive forces are rolling resistance m·g·Cr, aerodynamic drag ½·ρ·Cd·A·v² and a grade term m·g·sin θ (with m = 1000 kg, Tm = 190 N·m, ωm = 420 rad/s, β = 0.4, Cr = 0.01, Cd = 0.32, ρ = 1.3 kg/m³). We linearised it about 25 m/s on flat ground. That model gave the Simulink ego car realistic resistive forces; the controller design itself uses the linear three-state model above.
Stability, controllability and observability
The open-loop eigenvalues are the diagonal of A, because A is lower-triangular:
Note: the open-loop plant has poles at {0, 0, −0.25}. The two at the origin form a chain (the gap integrates the speed, which integrates the acceleration), so a speed mismatch makes the gap drift without bound and stability comes from feedback. That makes the controllability check the key step. With n = 3 states:
The two single-channel checks matter more than the full ones. The car can only actuate its own acceleration, so controllability has to hold from that input alone, and it does for any finite τ. And a radar that measures only the gap is already enough to reconstruct the speed difference and the acceleration, which is what makes the observer below possible.
Here is the start of the team script that sets the model up and runs those checks (lightly trimmed):
%% State-space model: x = [a; v_ego; d], u = [a_cmd; v_lead]
x0 = [0; 10; 40]; % initial acceleration, ego speed, gap
t = x0(3)/x0(2); % time gap, 40 m / 10 m/s = 4 s, used as the lag
A = [-1/t, 0, 0; 1, 0, 0; 0, -1, 0];
B = [ 1/t, 0; 0, 0; 0, 1];
C = [0, 0, 1; 0, 1, 0]; % measure gap and ego speed
D = [0 0; 0 0];
%% Controllability and observability
n = length(A);
if n <= rank(ctrb(A,B)), disp('The System is controllable'); end
if n <= rank(obsv(A,C)), disp('The System is observable'); end
Pole placement from the specification
The specification maps onto a dominant second-order pair. For a 3 % overshoot and a 10 s settling time (2 % criterion):
Putting the third pole ten times further left keeps the response second-order in character, so the overshoot and settling formulas still hold. MATLAB's place then returns the gain K for u = −Kx, and a pre-gain N̄ scales the reference so the closed loop has unit DC gain:
The design section of the script (team code, lightly trimmed):
%% Pole placement from the time-domain specification
OS = 3/100; ts = 10;
zeta = abs(log(OS))/sqrt(pi^2 + log(OS)^2); % 0.745
wn = 4/(zeta*ts); % 0.537 rad/s
eigen = eig(tf(wn^2, [1, 2*zeta*wn, wn^2])); % -0.400 +/- 0.358j
p = [10*real(eigen(1)), eigen(1), eigen(2)]; % third pole 10x further left
Kc = place(A, B, p); % state-feedback gain
L = place(A', C', p)'; % observer gain, by duality
Nbar = -inv(C*inv(A - B*Kc)*B); % reference pre-gain
Design note: modelling v_lead as a second column of B changes what the gains mean. place then returns a 2 × 3 gain whose second row acts on the lead car's speed, and multi-input placement has spare freedom, so that K is one of many. A cleaner formulation treats v_lead as a measured disturbance and leaves the acceleration command as the only input. That gives the unique gain above, and it is the formulation used for the figures on this page.
Observer and the separation principle
State feedback needs all three states, but the acceleration state isn't measured in our model (y is the gap and the ego speed). A Luenberger observer runs a copy of the model and corrects it with the output error:
The block-triangular structure is the separation principle: the closed-loop poles are the controller poles plus the observer poles, so K and L can be designed independently. L comes from the same place call applied to the dual pair (Aᵀ, Cᵀ), which works because (A, C) is observable. Numerically, the six closed-loop eigenvalues are exactly { −4.0, −0.400 ± 0.358j } twice.
The script places the observer poles at the controller poles p. A common rule of thumb puts them two to ten times faster, so that the estimate settles before the loop needs it, and the figure below compares the two choices. With two outputs, L is not unique either; these are the gains used in the figure:
LQR and the weighting study
Pole placement asks where the poles should go; LQR asks what we care about and lets the Riccati equation decide. The gain minimises
We started from Q = I, R = I and then made the trade-off explicit: a heavy weight on the gap (the safety state), a heavy weight on the acceleration command (the comfort and wear cost), and both together. For the Simulink run we settled on Q = diag(5, 4, 0.1) with R = 1. The table evaluates each case with the acceleration command as the only input, for the cut-in shown at the top of the page: a car merges 15 m inside the 40 m set-point at matched speed.
| Design | Q (a, v, d) | R | K | Closed-loop poles | 2 % settling | Peak |a| | Peak |u| |
|---|---|---|---|---|---|---|---|
| Pole placement | – | – | [18.20, 13.95, −4.61] | −4.0, −0.40 ± 0.36j | 11.0 s | 2.8 m/s² | 69 m/s² |
| LQR, no weighting | diag(1, 1, 1) | 1 | [4.44, 3.45, −1.00] | −0.62, −0.37 ± 0.52j | 10.6 s | 1.8 m/s² | 15 m/s² |
| LQR, gap penalised | diag(1, 1, 10) | 1 | [6.62, 7.02, −3.16] | −0.93, −0.49 ± 0.78j | 7.3 s | 4.0 m/s² | 47 m/s² |
| LQR, effort penalised | diag(1, 1, 1) | 10 | [2.68, 1.56, −0.32] | −0.44, −0.24 ± 0.35j | 16.0 s | 0.8 m/s² | 4.7 m/s² |
| LQR, both | diag(1, 1, 10) | 10 | [4.20, 3.24, −1.00] | −0.64, −0.33 ± 0.53j | 10.7 s | 1.8 m/s² | 15 m/s² |
| LQR, Simulink choice | diag(5, 4, 0.1) | 1 | [4.26, 2.71, −0.32] | −0.16, −0.58 ± 0.40j | 26.7 s | 0.6 m/s² | 4.7 m/s² |
The bottom panel is the most instructive. Every design brakes the car at a few m/s², because the 4 s lag filters the command, but pole placement gets there with a −69 m/s² initial command. Its third pole at −4 is sixteen times faster than the actuator (1/τ = 0.25 rad/s), and a fast pole on a slow actuator is paid for in command size. LQR accounts for that automatically through the effort term in J, which is why the weighting we carried into Simulink asks for only 4.7 m/s². Sweeping R over four decades for three gap weights traces out the whole trade-off:
The LQR part of the script is short, which is the point: two weighting matrices replace the whole pole-selection argument.
%% LQR: weight the states (Q) against the inputs (R)
% the study swapped the diagonals between 1 and 10 (see the table)
Q = [1 0 0; 0 1 0; 0 0 1];
R = [1 0; 0 10];
K_lqr = lqr(A, B, Q, R);
sys_lqr = ss((A - B*K_lqr), B, C, D);
[y_lqr, t_lqr, x_lqr] = lsim(sys_lqr, [A_x_lqr; V_mio_lqr], time, [1;20;50]);
%% the weighting carried into Simulink
Q = [5 0 0; 0 4 0; 0 0 0.1];
R = 1;
K_lqr = lqr(A, B, Q, R);
Nbar_lqr = -inv(C*inv(A - B*K_lqr)*B);
Design note: with v_lead in B, raising the gap weight from 1 to 10 mostly raised the gap gain on the lead-speed channel (0.99 to 3.16), while the acceleration row of K barely moved ([2.61, 1.41, −0.11] to [2.64, 1.41, −0.06]). Treating v_lead as a disturbance makes every weight act on the real actuator, which is how the table above was computed.
Simulink architecture
The Simulink model has three parts. A lead-car subsystem integrates a test acceleration profile (a sine plus pulses and steps) through a 0.5 s first-order filter to produce a realistic, wandering lead speed. The ego-car loop is built from gain and integrator blocks in two subsystems, "Controller Matrix" and "Observer Matrix", so every matrix in the equations above is a visible block. A Simscape multibody model of the two cars as point masses on prismatic joints served as a visual check.
An intermediate revision of the model also experimented with mode logic on top of the linear loop: it compared the measured gap with a speed-dependent safe distance and switched the acceleration request between accelerate and brake. That is the beginning of the "speed control versus gap control" mode switching that production ACC systems use.
Results
From our model (τ = 4 s, the acceleration command as the actuated input), re-plotted for this site:
- rank 3 / 3controllable from the acceleration command alone and observable from the gap alone
- 11.0 s, 0.45 mpole-placement recovery from a 15 m cut-in: 3 % overshoot, exactly the specification
- 69 → 15 m/s²peak command, pole placement against an LQR with the same settling time
- 9.6 s → 1.3 sobserver convergence, script poles against poles ten times faster
- 0.6 m/s²peak braking with the Simulink weighting, which restores the gap with no overshoot
Design insights
- Check controllability from the inputs you actually have. The single-input checks (acceleration command only, gap only) are the ones that matter for a real car, and they pass. Treating the lead car's speed as a measured disturbance rather than an input keeps every gain tied to the real actuator.
- Put the poles where the actuator can follow. The "10× further left" rule for the third pole is about keeping the response second-order, but it says nothing about the plant. Against a 4 s lag it needs a 69 m/s² command. LQR's effort term makes that cost visible, and the frontier plot shows how much command each extra second of settling costs.
- Observers should be faster than the loop they serve. The separation principle lets you pick L freely; moving the observer poles ten times faster cut estimate convergence from 9.6 s to 1.3 s. Sensor noise sets the practical upper limit.
- Linear design covers the operating region; mode logic covers the rest. Near the set-point the loop is accurate and smooth. For a large speed deficit the actuator saturates, which is why ACC pairs the gap controller with a speed-control mode, the direction our later model revision was taking.
Illustrative extension (not part of the original project)
The two plots in this section go beyond our project settings and were made for this site to illustrate the design method. They use a 0.5 s powertrain lag instead of our 4 s, and the stress test adds a ±3 m/s² command limit and a smooth lead-car profile. None of these numbers are results from the original project.
The same method with a 0.5 s powertrain lag
Keeping the specification and the design steps unchanged but using τ = 0.5 s changes every gain: the pole-placement peak command drops from 69 to 8.7 m/s², because the third pole at −4 is now only twice as fast as the actuator. An effort-weighted LQR (Q = I, R = 10) settles in the same 11 s as pole placement with 2.4 instead of 2.8 m/s² peak braking.
Stress test: the limits of a linear loop
The scenario from our Simulink run is deliberately harsh: the ego car starts at 10 m/s, 40 m behind a lead car doing 30 m/s. Illustrated here with the observer in the loop, the Simulink weighting Q = diag(5, 4, 0.1), R = 1, τ = 0.5 s, a smooth wandering lead-car profile, and the command limited to ±3 m/s² (about 0.3 g), roughly what a comfort-oriented ACC allows.
While the command is saturated the loop is effectively open, so the gap keeps growing (to about 119 m) until the speeds match; the linear controller then recovers that distance by briefly running above the lead car's speed. That is the expected behaviour of a saturated linear loop, and it is why production ACC wraps the gap controller in mode logic: a speed-control mode with a set-speed cap for large deficits, handing over to gap control near the set-point.
How this page was made
We worked as a team on the modelling, the MATLAB scripts and the Simulink model; the code excerpts are team code, lightly trimmed. The original figures were MATLAB and Simulink screenshots, so every plot here was re-plotted for this site in Python (NumPy and SciPy) from the matrices, specifications and weightings in our scripts, with the acceleration command as the only control input and the lead car's speed as a disturbance. The top figure and the observer, LQR-comparison and trade-off plots use τ = 4 s as in our Simulink script. Only the plots in the illustrative-extension section use settings beyond the project (a 0.5 s powertrain lag, a ±3 m/s² command limit and a smooth lead-car profile), and their numbers are not results from the original project. The observer gains for two outputs are one valid solution, so MATLAB may return different ones. An earlier version of this page assumed a 0.5 s lag inside our original model and a different state vector; the model, gains and numbers here now follow our files.