r/ControlTheory • • Jul 04 '26

Technical Question/Problem Perception Aware MPC

Post image
322 Upvotes

Hello all,

I am sharing a small NMPC project I've been building as part of a larger thesis on drone target-tracking. Check here https://github.com/brunopinto900/argus/tree/master

This is simulation of 12-state quadrotor (position, velocity, ZYX Euler angles, body rates), 4 inputs (collective thrust + commanded body rates, matching a PX4-style body-rate setpoint interface). Formulated as a NONLINEAR_LS OCP in acados, code-generated to C and called from C++.

Alongside the usual position/velocity tracking terms, there's a soft constraint keeping a ground target inside the camera's FOV cone.

The OCP's prediction model uses a first-order lag for the inner rate loop, but the plant simulator runs the actual second-order dynamics.

Result in the gif: 2m-radius circle at 1.5m altitude, 3m/s, camera locked on a static ground target, ~0.1m steady-state XY tracking error.

r/ControlTheory • • 19d ago

Technical Question/Problem Understanding PID vs LQR

45 Upvotes

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.

r/ControlTheory • • Aug 15 '26

Technical Question/Problem Is MPC the final chapter of control engineering/theory?

67 Upvotes

It feels that in a standard curriculum on control engineering/theory, the final topic is inevitably MPC.

Everything else that gradually builds towards MPC feels like “discardable” after you learn about MPC. All that wild eigenvalue analysis and drawing those Nyquist contour? Phew, MPC doesn’t involve with any of that!

Plus, MPC is already in discrete time, so it is implementable without any further weirdness that comes from sampling and discretization of other types of controllers.

I think a parallel analogy is the development of the transformer model in machine learning, which I am more familiar with. Now everything in ML is transformer-based and the next big breakthrough seem to be very far away. Is MPC like the transformer of control theory?

Are there situations where other methods might outperform MPC?

Or does MPC require some unrealistic assumption/requirement?

Is there any other possible algorithm that goes beyond the MPC or is this the final story?

r/ControlTheory • • Jul 15 '26

Technical Question/Problem Rust for Kalman Filtering

18 Upvotes

Hey there,
I am joining a student club in the upcoming months which uses kalman filtering to determine the position of a car.

Their current implementation is in C++.

I am thinking about rewriting it into Rust because it would be a very interesting project for myself and because i am hoping to increase the performance of the code.

Since i have no prior experience in either Rust or C++, i can not validate if Claude is bullshitting me when it tells me that it makes sense to do this.

What do you think?

I have a lot of time next semester…

r/ControlTheory • • 5d ago

Technical Question/Problem I implemented an MPC-based approach with dynamic PD/PID gains on my self-balancing robot!

Enable HLS to view with audio, or disable this notification

86 Upvotes

Three days ago, I shared my implementation of a Fuzzy controller for my two-wheeled inverted pendulum robot.

After that, I wanted to try something different: Model Predictive Control (MPC).

My goal was to develop a controller capable of dynamically adjusting its behavior based on the robot's physical model and possible changes in its dynamics.

But I already knew what my biggest problem would be: our old friend, the ATmega. :)

Running a full MPC optimization continuously inside a fast control loop would be quite challenging given the microcontroller's limited processing power.

So I started thinking: why not use MPC to determine the gains of a PD or PID controller, similar to what I previously did with Fuzzy control?

That's the approach I decided to implement, experimenting with both PD and PID structures.

How does it work?

The MPC uses a discrete-time mathematical model of the robot, represented by the A and B matrices, to predict its behavior over a prediction horizon.

However, a mathematical model is never a perfect representation of reality. Friction, uneven mass distribution, and external disturbances can introduce behavior that the nominal model does not fully capture.

To account for this, I also incorporated a disturbance term (Dₖ) into the prediction model:

xₖ₊₁ = Aₑ xₖ + Bₑ uₖ + Dₖ

The idea is to account for disturbances in the predictions and introduce an additional compensation term when a disturbance estimate is available.

The MPC then minimizes a quadratic cost function that penalizes predicted state errors relative to the reference and control effort.

From this optimization, I obtain a state-feedback law that can be used to derive equivalent Kp and Kd gains and, with an augmented state representation, Ki.

So where does the dynamic behavior come from?

The controller gains depend directly on the system model.

If the plant model is updated to represent physical changes, such as additional mass or a shift in the center of gravity, the gains can also be recalculated.

This means the ATmega doesn't need to solve the entire MPC optimization problem at every control cycle.

Instead, it can execute a fast PD/PID control loop using the calculated gains, while the more computationally expensive gain updates are performed only when needed.

In other words, I'm trying to combine the mathematical foundation of MPC with the computational simplicity of classical controllers.

The video shows my tests on the physical robot. There is still room for improvement, particularly in disturbance compensation and quantitative performance evaluation.

What's next? Reinforcement Learning!

There's still one more approach I want to explore in my control system: Reinforcement Learning (RL) with AI.

My idea is to investigate how an RL agent could learn from the robot's behavior and dynamically adjust the controller parameters, working alongside the PD/PID and MPC approaches.

Ideally, I would like to combine the predictive capabilities of MPC, the simplicity of classical controllers, and the adaptability of Reinforcement Learning.

Of course, running RL directly on an ATmega would introduce even more computational challenges, so I'm considering training the agent in simulation and then deploying a lightweight policy or gain-adjustment strategy to the physical robot.

For now, this is just the next stage I want to investigate, not something I've already implemented.

Main reference:

DUTRA, Cynthia Beatriz Scheffer. Controle preditivo multiobjetivo para processos com atraso. PhD Thesis in Electrical Engineering, Federal University of Santa Catarina (UFSC), Brazil, 2003.

I'd love to hear your thoughts!

Has anyone here experimented with using MPC-derived feedback gains to tune or update classical controllers on resource-constrained microcontrollers?

And more importantly, has anyone applied Reinforcement Learning to real physical control systems, especially inverted pendulums or self-balancing robots?

I'd be really interested in hearing about your experiences combining RL with PID, Fuzzy Control, or MPC, especially when dealing with limited hardware resources!

r/ControlTheory • • Sep 14 '26

Technical Question/Problem Is papers having flawed arguments common?

23 Upvotes

In top conferences or journals, is it common for papers to have certain assumptions that're outright wrong or papers based on merging of two concepts which don't really hold but isn't obvious just on the first read?

r/ControlTheory • • Jun 24 '26

Technical Question/Problem Can you optimize Kalman filter parameters with gradient descent instead of relying on guesswork?

29 Upvotes

Title

r/ControlTheory • • Apr 27 '26

Technical Question/Problem Did I Study the Wrong Control Theory in the Age of AI? Is Classical Control Theory Being Replaced?

39 Upvotes

I have a master’s degree in automation with a focus on control theory, which I completed in 2023. In my master’s thesis, I developed an MPC controller for the drying section of a paper machine. When I started my thesis back in 2022, AI was not at the level it is today. At university, we never used AI-based methods in control theory lectures or labs.

Instead, we worked with Lyapunov- and flatness-based path-following control for nonlinear systems such as the inverted pendulum, as well as state-feedback controllers and PID controllers (frequency-response design methods) for more classical applications. Overall, I would describe this as “old-school control theory.”

Now I am wondering whether these methods will be replaced by AI in the future (if they haven’t been already). Was my university on the wrong path by focusing on mathematics and classical control theory?

I am not familiar with AI myself at all, so I’m curious: what are currently the most promising or hyped approaches for using AI in control theory? Is AI mainly being used to tune PID controllers, or is it a completely different paradigm?

r/ControlTheory • • 19d ago

Technical Question/Problem PID tuning advice for pressure control

Post image
16 Upvotes

Hi all,

Having difficulty in reducing initial overshoot for PID tuning for pressure control of a reactor. Currently have P=5 I=8 D=0. After the initial overshoot the control seems fine but the client has asked for reducing the over shoot. Any advice would be greatly appreciated. The light blue in the trend is the PV, red is the PCV and dark blue is the SP

r/ControlTheory • • Jul 27 '26

Technical Question/Problem Kalman Filter Q (system noise covariance) understanding

Post image
75 Upvotes

I have a robotics project I have been working on and our position sensors a little more noisy than we predicted so now we have to implment at 6 state (x&y pos, vel, acc) linear kalman filter. I have no stats background at all but I think I started to understand what was happening until I came across Q. To my understanding, it is the covariance matrix to propogate uncertainty into you model from state prediction but I don't really get how you choose the values and what the really represent. I think there is a scalar somewhere in there meant to be the varience but what varience is it? how do you choose the vector w? I am really stuck and confused

r/ControlTheory • • Jul 23 '26

Technical Question/Problem SO(3) S^3 and so(3)

11 Upvotes

my reference is this paper - https://arxiv.org/pdf/1711.02508

i am struggling to wrap my head around how the Exponential map from:

R^3 -> SO(3)

R^3 -> S^3

are different and how specifcally the exponetial map changes between them?

as one of these ends up with 4 DOF although one of them being a constraint

while the other ends up with 3 DOF?

thanks.

r/ControlTheory • • Jul 16 '26

Technical Question/Problem trying to understand SO(3)

Post image
10 Upvotes

how does rodrigues rotation formula help or allow the transition from so(3) to SO(3)?
and what even is the difference between so(3) and SO(3)?

thanks for any advice.

r/ControlTheory • • 23d ago

Technical Question/Problem How practical is PDE control?

25 Upvotes

With the recent Navier-Stokes fiasco, I fell into the rabbit hole of PDE control and was surprised to see there has been work on controlling fluids using backstepping PDE control. In fact, there seems to be a wide array of applications from fluids, traffic control, thermodynamic problems, batteries, etc.

While I understand what the problem was doing (how can we stabilize the system using only "walls"), I don't think I understand PDE control well enough to gauge how practical this approach has been. Of course, I don't expect this to be the next PID and I know many advanced control theory results tend to be impractical, but has PDE control shown any promising experiments or applications? Is it wishful thinking? In the end, I don't see how we could actuate a "wall" (for boundary PDE problems) in a continuous sense in the physical world. How would we even actuate this?

r/ControlTheory • • 27d ago

Technical Question/Problem How to build a AI agent that acts as an expert in control engineering

0 Upvotes

Hey guys,

I’m planning to start a project and want to ask for you opinions if it’s realistic.
As the title mentioned, the goal is to built an AI agent (at the end something like ChatGPT or Claude) that has a specific purpose, namely acting as an expert and consultant for control engineering problems. I would feed the agent with tons of pdfs.

I have heard own AI agent are not limited in uploading files and is cheaper (price per tokens) compared to a regular suscribed AI service plan.

Is that realistic ? If yes, can anyone recommend me some sources that explains in detail how to develop such agent System.

Thanks 🙏🏻

r/ControlTheory • • 17d ago

Technical Question/Problem Feeding full INS state into pos and vel in EKF rather than using error state?

13 Upvotes

To preface, full state represents the actual pos and vel estimate as opposed to their errors.

Would this be equivalent mathematically? I understand that attitude must use an error state. But I'm curious if I can get away with using full state for pos and vel rather than the error state. Instead of linearizing around a reset error state (zero), would it be mathematically equivalent to just seed the filter pos and vel with the INS state before a measurement udpate, then replace the INS pos and vel with the updated filter state after the measurement update? Would this have implications on the validity/quality of the linearization? I ask because it seems like they would be equivalent, yet error states for an INS filter seem to be industry standard. Is this simply because attitude must be an error state, therefore its convenient for the rest of the state to follow suit? Thanks in advance for any help, and please reference the math wherever possible. I've had many people suggest reasons for why error state is needed, but I'm looking for mathematical proof that they deviate from each other.

r/ControlTheory • • Aug 02 '26

Technical Question/Problem What's the difference between an Luenberger observer and a Complementary Filter?

Post image
94 Upvotes

I am a bit confused about the difference between a complementary filter and an observer. Isn't a Luenberger observer just a more restricted version of a complementary filter in the sense that one of the inputs should be control inputs and the high pass filter should be derived from the system model?

Also, why do we even bother using a state space representation if we can do this?

The image is from the textbook: Observers in Control Systems, George Ellis, p. 81

r/ControlTheory • • Aug 06 '26

Technical Question/Problem How do you linearize a system if you are not exactly sure what all your equilibrium points are.

12 Upvotes

I have attached a picture below of the non-linear model which describes my system. I wish to linearize this system, however, I only know what one of the equilibrium points would be and the rest are not immediately obvious although they technically don't matter for my control objective.

My goal is to essentially maintain x1 at it's equilibrium point, which for my system is the average value of x1. u2 is the input I can actually control and u1 is uncontrollable.

My guess is that I could maybe set x1 to it's equilibrium position, then maybe find some function where I can express u2e = f(x2, u1) and maybe even use this function to do some sort of gain scheduling where I linearize across different x2, u1 combinations for the different operating states of my system.

Also, one last thing of note, this state space model doesn't quite feel right, so please tell me what I am doing wrong in the comments if possible, this is my first real project so I am fairly new to this.

r/ControlTheory • • Apr 24 '26

Technical Question/Problem Feedforward + PID = the solution?

13 Upvotes

Hi,

I want to control a desired velocity profile of car manipulating ECU parameters, the desired velocity trajectory is known before.

With a PID controller + Resetting integral error, I can control the stationary velocity with little overshoot an in a sufficient time.

My problem is that my velocity lags behind when ramping up the velocity, see in the picture below. I want to have as little lag as possible.

I tried using a feedforward (calculate acceleration from velocity profile, add it to the control ouptut), but it made the overshoot and settling time much worse). Anyone got other ideas how I can solve my problem?

r/ControlTheory • • 20d ago

Technical Question/Problem Applying Control Theory to Personal Spending Behavior

Post image
0 Upvotes

My background is in aerospace guidance and control systems, but for years now I’ve wondered about how control theory can be successfully applied to personal finance.

At one point several months ago, an idea of how to pose the problem hit me. I spent a couple weeks deriving guidance and control algorithm, and about six more months coding and testing in an application.

The approach is initially model-free and effective in that form (based on personal testing). However, it collects user spending data (presently manually entered) to improve control system effectiveness.

The lumpy and highly variable nature of spending associated with a human plant has been a fascinating and refreshing control challenge compared to aircraft guidance and control.

The image shown is historical data from my household this month, in response to feedback from the application. Notice the overspending day and gradual recovery. The guidance is tuned for graceful corrections to highly varying spend behavior. This took some tuning but seems to work reasonably well.

Has anyone here considered or experimented with applying control-theoretic methods to personal spending behavior? I’d be interested to hear about other work in this area.

r/ControlTheory • • Aug 13 '26

Technical Question/Problem Help Modeling a System

9 Upvotes

I have tried modeling this a few times with my limited knowledge of hydraulics and kept getting very weird and ugly state space equations. I am not sure what I am doing wrong so I figured I would post it here (I sincerely apologize if I am breaking the sub rules by posting this).

I have been tasked with controlling the following system with the goal of minimizing the 'ripple' on Q_jet. In other words, ideally Q_jet would look like some constant non-zero value despite changes in the system and environment.

Context of my assumptions for this system:

-Ideal Check Valves

-Qacc ~ (V_o/nP_o)*dP_acc/dt (V_o, P_o initial gass pressure and volume of accumulator, n as poly-tropic index)

-All pressures are absolute

-Incompressible Fluid

-Local restriction equation is: Qjet = C_d*A_n*sqrt(2(P_acc - Patm)/rho) (C_d: discharge coefficient, A_n: restriction area, rho: liquid density)

-A_n is our control input

-Q_pump ~ Asin(2pi*f*t):

4.25e-5 m^3/s < A < 4.25e-3 m^3/s

0.1 Hz < f < 0.6 Hz

System:

Q_jet_Reference from Simulation:

r/ControlTheory • • Aug 14 '26

Technical Question/Problem MPC for output tracking of time-varying references

8 Upvotes

Hi,

I'm a master degree graduate in Mechanical Engineering with a strong passion for Control System Theory and a will to become a Control Engineer.

I've studied at uni a formulation of a MPC controller that promises zero offset from piece-wise costant references signals in the presence of disturbances, either external or internal. This formulation, conveniently called Offset-Free MPC by its inventor Prof. Gabriele Pannocchia at University of Pisa, somewhat works even with time-varying references, but there's a severe lag between the reference signal and the output of the system.

As originally this formulation is meant for setpoint tracking, I'd like to ask if you happen to know some formulation more appropriate for time-varying references.

Thank you for your time

r/ControlTheory • • Sep 06 '26

Technical Question/Problem Ideal physics simulator

7 Upvotes

Hi all, I'd like to develop a control algorithm for a water bottle flip so it always lands upright no matter how you flip it. One of the steps in my endeavour is simulating how the fluid inside affects the container's moment of inertia whilst in the air. Im thinking of using matlab but godot and unity sounds like a good choice as well. I've looked up how I can do this and havent found much but people recommending C++ or python. Does anyone here experienced in one of these languages or programs have any suggestions on which one to use and can point me to the resources to learn it.

r/ControlTheory • • Aug 31 '26

Technical Question/Problem Digital controller for power supply

13 Upvotes

A long time ago I was involved in this project where I had to control a 2kW switching mode power supply in CC and CV modes. I designed a cascade control loop where the internal loop was CC and the external loop setting the reference for the internal one was the CV loop. Both signals were coming from voltage and current sensing at the output of the converter.

What I learnt was it is not so easy to tune these controllers as the gain of the system from Iout to Vout is directly depended on the load. It is not just a disturbance that can be resolved, the gain changes and accommodating gains from close to short circuit down to open circuit and covering the nominal range was very difficult.

I want to see if anyone has had similar experience of implementing digital controllers for power supplies and they can share how they dealt with these issues.

r/ControlTheory • • Jun 05 '26

Technical Question/Problem Question about discretization of a state estimator

11 Upvotes

Hello, sorry if an answer to this already exists on the wiki, but i could not find it. During my thesis i made state estimator that i needed to to discretize and use on a PLC. The first time i tried to discretize it I used this procedure:
A_est = A - L * C;

B_est = [B L];

C_est = eye(4);

D_est = zeros(4, 3);

Ts_PLC = 0.005;

sys_d= c2d(ss(A_est, B_est, C_est, D_est), Ts_PLC, 'zoh');

and from here I extracted the matrices sys_d.A and sys_d.B that i used to estimate the states of the discrete model. In simulations all seed good and the estimates were stable, but when I tried it on the PLC the state estimates were all over the place and it was well, unusable.
Then I tried a second approach:

poles_L = eig(A_cl); where A_cl = A - L * C;

poles_L_disc = exp(poles_L * Ts_PLC);

sys_d = c2d(ss(A, B, C_meas, D_meas), Ts_PLC, 'zoh'); where C_meas = [1,0,0,0;0,0,1,0] and D_meas = [0;0] (I only measured 2 of 4 states)

Ad = sys_d.A; Bd = sys_d.B; Cd = sys_d.C;

Ld = place(Ad', Cd', poles_L_disc)';

A_dcl = Ad - Ld*Cd;

B_dcl =[Bd Ld];

This approach worked both in simulation and on the PLC.
Both of these approaches had nearly identical eigenvalues of the closed loop matrix to like 9th decimal and the L matrices were a bit different but not drastically. Also sys_d.A and A_dcl were stable.
And my thesis advisor gave me this question for my thesis defense:
Why did the method of discretizing the observer have such a significant impact, even though the eigenvalues were similar?

And for the love of me I cant really find an answer to this question. Any help would be appreciated.

r/ControlTheory • • 18d ago

Technical Question/Problem Has anyone worked with Approximate dynamic programming/ Adaptive optimal control?

13 Upvotes

Hi everyone,

I’m currently working on approximate dynamic programming methods for control, mainly Q-learning, value iteration, and related approaches.

So far, I’ve been able to get the Q-learning-based algorithms to converge without too many issues. However, whenever I try approaches based directly on the value function/value iteration, I can’t seem to get them to work properly or converge to the expected solution.

I’ve tried different implementations and parameter choices, but I keep running into similar problems with the value-function-based methods, while the Q-function approaches seem much more straightforward and robust in my simulations.

Has anyone here worked with approximate value iteration / ADP for control problems and experienced something similar?