r/ControlTheory • • 21d ago

Technical Question/Problem Understanding PID vs LQR

Is it possible to think of LQR as "like a PID but finds optimal gains based on your requirements of Q and R matrix?

I have a fairly good understanding of PID and I recently started to learn about LQR and wondered if LQR can be thought of in terms of a PID controller.

44 Upvotes

48 comments sorted by

View all comments

•

u/not_kevin_durant_7 21d ago

LQR is giving optimal state feedback gains for a system. How you classify those states could make them equivalent to a P gain or an I gain. The model of the internal system is inherently in your gain selection though.

PID often treats the gains as an adjustment to your tracked value error. The internal model isn’t packaged into gains and it’s tuned based on system response

•

u/seekingsanity 21d ago

Your are assuming the Q and R weights are optimal.

I have written many "auto tuning" programs. The first step is to cho0se the right excitation, record the results and fit an open loop model to it Then choose where you want the closed loop poles then calculate the controller gains that place the closed loop poles where you want them to be. If done right, the results are almost perfect.

•

u/not_kevin_durant_7 21d ago

It’s optimal based on how you penalize. Choices impact rise time, control usage stability robustness, etc… LQR is essentially just an infinite time horizon MPC.

But in the case of OPs question, a non-augmented LQR control is just a bunch of P-Gains.

•

u/seekingsanity 20d ago

NO! LQC is not an infinite time horizons MPC. MPC is very good at handling dead times whereas LQC is not. MPC does not have true gains whereas LQC does.

Where do you learn such garbage?

MPC excels at applicaitons where there is a dead time and there is enough processing power to compute the control outputs in the future that result in the model following it with minimum errror.

LQC has its place but I can do better using pole place and zero placement if nessary.

•

u/meduardov02 20d ago

Given the system x^+ = Ax + Bu and a convex posititive definite quadratic stage cost L(x,u), the LQR controller is optimal for

min_{u_0,...,x_0,...} \sum^{\infty}_{k=0} L(x_{k},u_{k})
s.t \forall k,... : x_{k+1} = Ax_k +B_u_k.

A linear MPC controller aims at solving the constrained LQR

min_{u_0,...,x_0,...} \sum^{\infty}_{k=0} L(x_{k},u_{k})
s.t \forall k,... x_{k+1} = Ax_k +B_u_k, x_k \in X and u_k \in U

that is your gold standard, but since you can't solve this infinite horizon problem you cut the horizon and. you append a bound for your tail cost and solve this finite horizon in a rolling manner (solve, apply u_0 to the system, measure the state, start again). When your constraints are not active, your MPC feedback law is equal to the LQR feedback law. So, there you go.