Independent browser simulation · 2026
Controls Lab
Compare system orders, tune feedback controllers, and test a velocity controller against changes in the plant.
Modeling and control research
Rebuilt for hands-on exploration
The same PID gains, three different systems. More states change the response.
Tracking response
15.00 sApplied command
What the actuator must deliverOn narrow screens, scroll plots sideways or focus a plot and use the arrow keys. The CSV download includes every trace.
| System / controller | Tracking RMSE | ∫ u² dt | At limit (s) | Final error |
|---|
Read the experiment
Order is memory.
Feedback shapes it.
The order counts independent states in this scalar ODE representation. A first-order model stores one state. A second-order model can exchange energy between two states and oscillate. A third state adds another dynamic lag. Order alone does not determine stability or overshoot: coefficients and feedback matter.
Start with the same PID gains in all three plants. Then change the plant and design the controller around it. The normalized examples have unit steady-state plant gain; their bandwidths and poles are deliberately different.
2nd: y″ + 0.8y′ + y = u
3rd: y‴ + 1.8y″ + 1.8y′ + y = u
nth: aₙ y⁽ⁿ⁾ + … + a₁ y′ + a₀ y = b(u + d)
Three experiments worth trying
- Add memory. Compare the three orders with identical gains. Raise Kp, then Kd. Watch both response and command.
- Ask for the impossible. In Controller design, lower the command limit and add a disturbance. Compare integral action against state feedback without an integrator.
- Break the frequency assumption. In Velocity study, compare Matched frequency with +5% frequency mismatch. A tuned disturbance model can lose its advantage.
What each controller knows
PID sees output error. Its derivative acts on filtered measured output (30 ms filter), avoiding a reference-step derivative kick. P, PI and PD use the corresponding subset of the same gains. Anti-windup freezes the integral only when it would drive the command further into saturation.
Pole placement and LQR see every derivative state. Both include nominal equilibrium feedforward and omit integral action. Pole placement targets continuous poles; the sampled implementation and saturation can move the actual response away from that design.
LQR solves the discrete Riccati equation with cost Σ Δt[(x − x*)ᵀQ(x − x*) + ρ(u − u*)²], Q = diag(q, 1, …, 1). x* = [r, 0, …, 0], u* = a₀r/b. The actuator is clipped after optimization. The result is an unconstrained linear-quadratic design; clipping is outside that optimum. Normalized derivative states use the displayed time unit.
From the original project to the revised study
A controller built around
an uncertain actuator.
My original 2022 rover study integrated an eighteen-state plant and compared several control approaches. The later velocity-tracking manuscript isolates a narrower question: how should a fixed harmonic command compensate a periodic disturbance when actuator lag is uncertain?
The interactive Velocity study implements that revised model and its four comparison controllers. The parameters are synthetic. It is a demonstration of the manuscript’s model, not a rerun of the eighteen-state rover or a physical rover test.
Read the original project and its reconstruction ↗τF′ = m·u − F
d(t) = A sin(ωt)
u₀ = λr + (1 + τ₀λ)r′ + τ₀r″ + k(r − v)
u = u₀ + A[Re(C)sin(ωt) + Im(C)cos(ωt)]
m = 36.54 kg, λ = 0.25 s⁻¹, τ₀ = 0.11 s, k = 4 s⁻¹. The shared nominal reference inverse is included in all four controllers. PI adds an error integral (Ki = 2, back-calculation gain 5). Practical PR adds a damped resonant compensator. Fixed harmonic adds the coefficient from the constrained interval-lag design.
Research assumptions and stress cases
The coefficient C was synthesized for a known single disturbance frequency, known phase, known linear drag and a 20–200 ms lag interval. Its steady harmonic command budget is 0.3 m/s²; this is distinct from the physical amplitude limit of 0.45 m/s² in the saturation experiment. The browser holds C fixed; it does not resynthesize or adapt it.
The practical PR term is 12(1 + 0.2s)s/(s² + 0.48s + 144), discretized with the bilinear transform at 5 ms. It has no specialized resonant anti-windup. PI back-calculation includes both amplitude and slew limiting.
Gain/drag mismatch sets gain = 0.85, linear drag = 0.32 s⁻¹ and adds 0.08v|v| + 0.025 tanh(v/0.05). Other experiments isolate a 30° phase shift, +5% frequency, a second harmonic of amplitude 0.09 m/s², or 15 ms command delay plus 30 ms extra actuator lag. The manuscript’s combined noisy case is not reproduced here.
These comparisons do not establish a universal winning controller, experimental validation, or a claim of research novelty.
Reproducible numerical work
Inspect what runs.
The ODE lab propagates a linear state-space model with a matrix-exponential zero-order-hold step at a 10 ms controller period. Custom models support orders 1–8 with a constant input numerator. Coefficients are checked for finite values and scaling; unstable models are allowed. Runs stop if a state exceeds the numerical guard, and incomplete metrics are withheld.
The velocity experiment updates controllers every 5 ms and integrates the physical plant with RK4 at 1.25 ms. Its browser results are checked against saved MATLAB study metrics across eight experiments, three lags and all four controllers.
Verification details are included in the downloadable source.
Model boundaries
The ODE experiments use normalized quantities; controller gains are meaningful only in those chosen scales. Full-state feedback assumes ideal state access, without an observer. Integration checks establish numerical consistency, not safe physical operation.
Command-squared effort is a comparison metric, not energy. A short finite run cannot certify stability. Increasing order, aggressive pole placement or poor coefficient scaling can produce large excursions even when a nominal design exists.
Further reading
Russ Tedrake, MIT — Linear Quadratic Regulators explains the Riccati formulation and its assumptions. The velocity demonstration is based on Camden Boston’s 2026 velocity-tracking research revision, with its original parameters and fixed harmonic design.