University project · 2020 · modern control

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
Two stacked plots for a car cutting in 15 metres inside the 40 metre set-point. The pole-placement design restores the gap in about 11 seconds with 0.45 metres of overshoot, exactly the 3 percent specification, braking at up to 2.8 metres per second squared. LQR with Q equal to the identity settles in the same time with 1.8 metres per second squared peak braking; the effort-weighted LQR is slower and gentler; the Simulink weighting closes the gap with no overshoot and only 0.6 metres per second squared of braking.
A car cuts in 15 m inside the 40 m set-point. Our pole-placement design meets its 3 % overshoot specification in about 11 s; LQR with Q = I matches that settling time with 1.8 instead of 2.8 m/s² peak braking, and the weighting we chose for Simulink restores the gap with no overshoot and only 0.6 m/s² of braking. Re-plotted for this site from our scripts: τ = 4 s, our pole locations and our LQR weightings, with the gains acting on the acceleration command.

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:

states x = [ a v_ego d ]ᵀ acceleration, ego speed, gap inputs u = [ a_cmd v_lead ]ᵀ commanded accel., lead speed outputs y = [ d v_ego ]ᵀ gap (radar), ego speed ȧ = (a_cmd − a) / τ v̇_ego = a ḋ = v_lead − v_ego

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):

⎡ −1/τ 0 0 ⎤ ⎡ −0.25 0 0 ⎤ A = ⎢ 1 0 0 ⎥ = ⎢ 1 0 0 ⎥ ⎣ 0 −1 0 ⎦ ⎣ 0 −1 0 ⎦ ⎡ 1/τ 0 ⎤ ⎡ 0.25 0 ⎤ B = ⎢ 0 0 ⎥ = ⎢ 0 0 ⎥ ⎣ 0 1 ⎦ ⎣ 0 1 ⎦ C = ⎡ 0 0 1 ⎤ D = ⎡ 0 0 ⎤ ⎣ 0 1 0 ⎦ ⎣ 0 0 ⎦

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:

eig(A) = { −1/τ, 0, 0 } = { −0.25, 0, 0 }

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:

𝒞 = [ B AB A²B ] (3 × 6) rank 𝒞 = 3 → controllable 𝒪 = [ C ; CA ; CA² ] (6 × 3) rank 𝒪 = 3 → observable from the acceleration command alone (first column of B, b₁): 𝒞₁ = [ b₁ Ab₁ A²b₁ ] = ⎡ 0.25 −0.0625 0.0156 ⎤ ⎢ 0 0.25 −0.0625 ⎥ ⎣ 0 0 −0.25 ⎦ det 𝒞₁ = −1/τ³ = −0.0156 ≠ 0 → rank 3 from the gap alone (first row of C, c₁): 𝒪₁ = [ c₁ ; c₁A ; c₁A² ] = ⎡ 0 0 1 ⎤ ⎢ 0 −1 0 ⎥ rank 3 ⎣ −1 0 0 ⎦

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):

ζ = −ln(OS) / √(π² + ln²(OS)) = 0.745 ωn = 4 / (ζ · ts) = 0.537 rad/s dominant poles s = −ζωn ± jωn√(1 − ζ²) = −0.400 ± 0.358j third pole s = 10 · Re(dominant) = −4.0

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:

closed loop ẋ = (A − BK) x + B N̄ r pre-gain N̄ = −[ C (A − BK)⁻¹ B ]⁻¹ acceleration command as the only input (unique; checked with Ackermann's formula): K = [ 18.20 13.95 −4.61 ] eig(A − b₁K) = { −4.0, −0.400 ± 0.358j }

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:

x̂̇ = A x̂ + B u + L (y − C x̂) u = −K x̂ + N̄ r estimation error e = x − x̂ ė = (A − LC) e closed loop in (x, e): ⎡ ẋ ⎤ ⎡ A − BK BK ⎤ ⎡ x ⎤ ⎣ ė ⎦ = ⎣ 0 A − LC ⎦ ⎣ e ⎦ det(sI − A_cl) = det(sI − (A − BK)) · det(sI − (A − LC))

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:

observer poles = controller poles observer poles 10× faster { −4.0, −0.40 ± 0.36j } { −40, −4.0 ± 3.58j } ⎡ 0.188 0.502 ⎤ ⎡ −6.09 27.27 ⎤ L = ⎢ −1.270 3.620 ⎥ L = ⎢ −2.01 7.86 ⎥ ⎣ 0.930 −2.195 ⎦ ⎣ 39.89 −2.89 ⎦
Three stacked plots of estimation error for acceleration, relative speed and gap over 20 seconds, starting from a deliberately wrong estimate. With observer poles equal to the controller poles the errors take about 10 seconds to die out; with poles ten times faster they vanish in about 1.3 seconds, after a brief 10 metre per second squared spike in the acceleration estimate.
Observer error convergence from a wrong initial estimate (1 m/s², 5 m/s and 8 m off). With observer poles equal to the controller poles the estimate takes about 9.6 s to fall within 2 % of the initial error; ten times faster poles get there in 1.3 s, with a brief spike in the unmeasured acceleration estimate. Re-plotted for this site from our model.

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

J = ∫₀^∞ ( xᵀ Q x + uᵀ R u ) dt K = R⁻¹ Bᵀ P, where Aᵀ P + P A − P B R⁻¹ Bᵀ P + Q = 0

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.

DesignQ (a, v, d)RKClosed-loop poles2 % settlingPeak |a|Peak |u|
Pole placement––[18.20, 13.95, −4.61]−4.0, −0.40 ± 0.36j11.0 s2.8 m/s²69 m/s²
LQR, no weightingdiag(1, 1, 1)1[4.44, 3.45, −1.00]−0.62, −0.37 ± 0.52j10.6 s1.8 m/s²15 m/s²
LQR, gap penaliseddiag(1, 1, 10)1[6.62, 7.02, −3.16]−0.93, −0.49 ± 0.78j7.3 s4.0 m/s²47 m/s²
LQR, effort penaliseddiag(1, 1, 1)10[2.68, 1.56, −0.32]−0.44, −0.24 ± 0.35j16.0 s0.8 m/s²4.7 m/s²
LQR, bothdiag(1, 1, 10)10[4.20, 3.24, −1.00]−0.64, −0.33 ± 0.53j10.7 s1.8 m/s²15 m/s²
LQR, Simulink choicediag(5, 4, 0.1)1[4.26, 2.71, −0.32]−0.16, −0.58 ± 0.40j26.7 s0.6 m/s²4.7 m/s²
Three stacked plots for the cut-in case comparing pole placement with four LQR weightings: gap error rising from minus 15 metres to zero, actual acceleration, and commanded acceleration. The gap-weighted LQR is fastest but brakes at 4 metres per second squared; the effort-weighted LQR is slowest and gentlest; pole placement asks for minus 69 metres per second squared at the first instant.
The cut-in response for each design. The gap and the actual acceleration look similar across designs; the commanded acceleration, which is what R penalises, shows the real differences. Re-plotted for this site from our model, no saturation.

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:

Log-scale plot of peak commanded acceleration against settling time for LQR designs with gap weights 1, 10 and 100 as R sweeps from 0.01 to 100. The curves form a falling frontier from over 1000 metres per second squared at 2.5 seconds to under 2 at 25 seconds. The pole-placement design sits well above the frontier at 11 seconds and 69 metres per second squared.
The LQR frontier: each point is one (q, R) pair. For the same 11 s settling time, LQR needs about 15 m/s² of peak command against 69 m/s² for the pole-placement design. Re-plotted for this site from our model (τ = 4 s).

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.

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.

Block diagram: reference r through pre-gain N-bar into a summing junction minus K times x-hat, giving the acceleration command u. u and the lead-car speed drive the linear ego-car model, whose outputs are gap and ego speed. A Luenberger observer takes u and y and produces x-hat, which feeds back through K.
The observer-based loop as we built it, with the lead car entering as a disturbance. Redrawn for this page from the model files and our report's block diagram.

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.

Two stacked plots for the same cut-in with a 0.5 second powertrain lag. Pole placement and an effort-weighted LQR restore the gap in about 11 seconds with under half a metre of overshoot; a faster LQR tuning settles in 8.5 seconds while braking at up to 4 metres per second squared.
The cut-in from the top of the page with τ = 0.5 s and no saturation. Illustrative, not part of the original project.

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.

Three stacked plots over 120 seconds. The ego car starts 20 metres per second slower than the lead car; the gap opens to about 119 metres while the command sits at the 3 metre per second squared limit for about 10 seconds, then closes onto 40 metres by about 40 seconds and follows the lead car within about 0.6 metres. Ego speed briefly overshoots to about 40 metres per second while it recovers the gap.
Catch-up from a 20 m/s speed deficit with a ±3 m/s² limit. Once out of saturation the loop locks onto 40 m and tracks the lead car within ±0.6 m. Illustrative, not part of the original project.

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.

Skills shown

  • State-space modelling
  • Controllability & observability
  • Pole placement
  • Luenberger observers
  • Separation principle
  • LQR / Riccati
  • Linearisation
  • MATLAB
  • Simulink
  • Simscape