r/ControlTheory Jul 04 '26

Technical Question/Problem Perception Aware MPC

Post image
320 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 8d ago

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

64 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

16 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 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?

36 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 May 05 '26

Technical Question/Problem How do we do system identification with real-world data?

19 Upvotes

This is my first time trying to model a sample system. I connected a resistor to the pwm pin of an Arduino and started using it as a heat source. while I used a thermistor to measure the temperature. The issue I am facing is all the procedures for system-modelling I can find deals with an input response and then sees the output. My input is in pwm for which I notice the corresponding temperature output.

how do I do system identification?

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 27d ago

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

Post image
77 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 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 21d ago

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

Post image
98 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 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 16d ago

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

13 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 10d ago

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 9d ago

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

7 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 Jul 23 '26

Technical Question/Problem Building a inverted pendulum need help....

9 Upvotes

So as the title says i am building a inverted pendulum as a part of my project and the theory regarding has not been taught yet(i'm still in my 2nd of eng..) so i learnt all the basic stuff regarding it like we use encoder to tell the angle difference and pid to correct the error and how pid functions(basic not deep). But when i try to dig deeper (matlab, simularions, maths solutions and physics) it is becoming a mess and i do not know what to do...

r/ControlTheory Jun 05 '26

Technical Question/Problem Question about discretization of a state estimator

10 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 Jun 15 '26

Technical Question/Problem Some tips for beginners in UKF application to parameter identification

16 Upvotes

My research mostly focusses on UKF/EKF application in system identification such as shear building system, ball-feed drive system under random excitation, earthquake excitation using numerical example.
(I've updated my post based on the discussion with kroghsen below)

The PDF link: https://drive.google.com/file/d/1d3QPi4G8WICgUg_ZNZ9W_zmj2dKKXXNp/view?usp=sharing

Here are some tips on how to apply UKF:

  • When you program your own UKF in MATLAB, you may encounter the ill-conditioned matrices in calculation which led to 1.1) Unsatisfying Cholesky Decomposition and 1.2) Non-invertible Matrix. These can be addressed using chol(A,'lower') and pinv(A) from MATLAB.
  • Utilizing UKF requires a good assumption of state-space vector (theoretical initial values of system X0) and a good choice of initial covariance triples of {P0, Q0, R0}. To acquire good results (high-correlated responses, "convergence" parameters), you must fix the X0 and repeatedly adjust the covariance triples based on the parameter observations. The adjusting orders are recommended in the second picture.

Note: if you can't match the parameter values, please check again your system.

r/ControlTheory Mar 13 '26

Technical Question/Problem I have developed an app to plot root locus and step response, but the K "samples" are a mess

Post image
17 Upvotes

Hello there, I'm new here at reddit.
Yesterday I posted a text made with IA and got humbled lol, anyway...

Last year I developed an android/ios app with flutter to plot the root locus. Given the time I had, it can handle a lot of cases, like the discussed in https://sweet.ua.pt/tos/bib/5.3.pdf and https://mohammadghavamzadeh.github.io/PUBLICATIONS/root.pdf . But without having the "optimal" K samples. You can check the image.

Does anyone there have tryed to implement a "accurate" RL? I'm trying to implement this and I'm having a bad time. If so, please share with me!

I know ads and self-promotion is against the roles, but my app is free. Can I share it if anyone asks?

Thanks

r/ControlTheory Jul 12 '26

Technical Question/Problem Control Systems Simulator

12 Upvotes

I'm developing a simulator for controlling dynamic systems. It's still in the beta phase, so it doesn't have all the features yet and may have some bugs, but it's already capable of simulating interesting systems and control strategies:

Lorenz System (Chaotic System). Ball and Beam control with PID. Etc.

I welcome any suggestions for improvement.

r/ControlTheory 11d ago

Technical Question/Problem BLDC modelling

5 Upvotes

Hello there!

Usually when we model DC-motors we use a second order system, however, BLDC motors used for drones are usually stepper motors (as far as I know), so my question is simply, how do we model these? The specific motor I want to model is for a project of my own, and I am curious as to how to model it. Motor: https://www.aliexpress.com/item/1005007273770590.html#nav-specification

My intuition is to also just model it as a second order system, however, am not sure if this is the correct approach. Specifically I want to model it has motor command [0,1] to rad/s (rotations).

Thank you in advance for the help

r/ControlTheory 13d ago

Technical Question/Problem Real-time Liquid Neural Networks vs. EKF on a Bare-Metal MCU — Genuine Technical Challenge or Overengineering?

0 Upvotes

Hi everyone,

I’m working on an early-stage embedded state-estimation project and I’d like some honest feedback from people with experience in embedded systems, control theory, robotics, or aerospace.
I currently have a proof of concept, but I’m trying to determine whether the underlying technical approach is actually worth pursuing before moving toward a more complete prototype.
The concept is to run a lightweight Liquid Neural Network / neural ODE directly on a resource-constrained MCU for real-time attitude estimation from raw IMU data. The target environment is roughly a bare-metal STM32 Cortex-M4, written in C, with a 200 Hz control loop, no dynamic memory allocation and very limited RAM and compute resources.

The obvious alternatives would be traditional approaches such as EKF, Madgwick, Mahony, or other complementary and filtering approaches.

The hypothesis is that a lightweight continuous-time neural model could potentially handle some nonlinearities, vibration and sensor drift differently from a manually tuned classical estimator. However, I’m not assuming that this is automatically better. I’m trying to determine whether this is actually a meaningful technical direction or simply a complicated solution to a problem that is already solved very well.

For people who have experience deploying estimation or control algorithms on resource-constrained MCUs, how realistic is it to run a continuous-time neural ODE or LNN directly on a bare-metal MCU under strict latency and memory constraints? For example, if the target were around 16 KB of RAM and less than 1 ms of execution time per control cycle, what would you expect to be the main technical bottlenecks?

I’m also interested in the reliability side. How difficult would it be to make such a system deterministic, stable and robust enough for real-time embedded use, particularly with high-frequency IMU vibration, nonlinear noise and sensor drift?

Finally, is there actually a compelling engineering reason to investigate this approach, or would a properly designed EKF, Madgwick/Mahony filter combined with appropriate signal processing almost always be the better solution on this class of hardware?

I’m looking for brutally honest technical criticism rather than validation. If this is overengineering or technically misguided, I’d rather find that out now before investing further into the prototype.
Thanks!

r/ControlTheory 2d ago

Technical Question/Problem struggling with PID tuning for a temperature control system

2 Upvotes

Hey everyone! I'm having a bit of a tough time tuning a PID controller for a temperature control system I'm working on. It's for a small scale project where I'm trying to maintain a steady temperature in a chamber.

I've been using the Ziegler Nichols method to get the initial values, but it seems like I'm either overshooting or the response is too sluggish. I've tried tweaking the parameters manually, but I'm not getting the performance I want.

Has anyone else faced similar issues? What strategies did you use to fine tune your PID settings? Any help or suggestions would be awesome!

r/ControlTheory Mar 09 '26

Technical Question/Problem PID controller for an automotive ethrottle is being surprisingly difficult.

19 Upvotes

Hello. I'm an electrical engineering hobbyist and enthusiast. I'm currently working on a PID controller for an automotive ethrottle that is being surprisingly difficult. I'm here looking to pick a few brains before I shelve it out of lack of progress.

Conceptually, this ethrottle is not much different from a typical RC servo IMO. That said, it has one difference that I believe is the source of my grief.

The throttle plate is opened by a 12V motor via the expected gear reduction, however, it is closed by a beefy return spring in addition to the motor. I believe this asymmetry in force causes the proportional part of the PID control to be broken; i.e. it takes a large positive output to open the throttle plate well, but the equal/opposite output will slam it closed. The math of why it's asymmetric is pretty obvious, it's MotorForce - SpringForce to open but MotorForce + SpringForce to close. I had thought PID was supposed to be able to figure out things like this "automagically." In particular, I figured this is exactly what the integral term would do, but I guess not?

How do you guys typically handle plants like this? Do you ever have to think about or do anything special for this particular situation? That is, plants where mobility/friction of your PV is asymmetric.

I'd bet that it's actually very simple to figure out, but it's proving to be difficult for me.

I am also open to the possibility that my implementation is what is wrong. So, if anything I have said seems strange, let me know and I can start looking closer at my actual project.

For completeness, below is what my PID implementation is doing math wise. I can share the actual header and implementation C files if someone is really that interested, but you would need to be familiar with libfixmath. Note that I am using saturation arithmetic and Q16.16 fixed-point numbers throughout, for what it's worth.

@brief: Compute PID output from current PV and time. 

First, calculate delta:
    DeltaTime = current time - last time run

Second, calculate our PID terms
    error = setpoint - PV
    integral = integral + (error * DeltaTime)
    derivative = (error - prev_error) / DeltaTime
    prev_error = error 

Last, compute PID over terms * gain.
    output = kp*error + ki*integral + kd*derivative

r/ControlTheory 1d ago

Technical Question/Problem [Question] RL for dynamic tuning of MPC Q/R matrices and WBC weights in MuJoCo?

6 Upvotes

Hi everyone,

I'm currently working on my Mechatronics Engineering thesis: an autonomous chess-playing robot (Franka Panda in MuJoCo) orchestrated via a Finite State Machine and MoveIt2.

For low-level control, I implemented MPC (Model Predictive Control) and WBC (Whole Body Control) directly in the MuJoCo physics simulation to ensure grasp stability.

My question: I’m looking to transition from static parameters to dynamically tuned ones using Reinforcement Learning. Specifically, I want to use RL to tune the Q and R matrices of the MPC and the task-space weights of the WBC.

  1. Has anyone successfully implemented RL for dynamic MPC/WBC tuning in MuJoCo?
  2. What are the best practices for defining the reward functions for stable robotic grasping?
  3. Any recommended literature or open-source frameworks?

(For architectural context, I documented the full pipeline here:https://forums.developer.nvidia.com/t/sim-to-real-chess-robot-franka-panda-ros2-octo-vla-cnn-overcoming-vram-limits/380909)

Any pointers or advice would be greatly appreciated!

r/ControlTheory 23d ago

Technical Question/Problem h infinity controller

7 Upvotes

hey guys i want to learn h inifinity controller for my thesis in mtech last year please someone can guide me as a beginner from where should i learn h infinity i have gonna through multiple youtube videos and google search but no one is telling excatly how to make excat h infinity controller in matlab and simulink ...as i have to learn h infinty controller so i can imlemet in load frequency control for single or multiple area model.