r/ControlTheory • • Nov 02 '22

Welcome to r/ControlTheory

94 Upvotes

This subreddit is for discussion of systems and control theory, control engineering, and their applications. Questions about mathematics related to control are also welcome. All posts should be related to those topics including topics related to the practice, profession and community related to control.

PLEASE READ THIS BEFORE POSTING

Asking precise questions

  • A lot of information, including books, lecture notes, courses, PhD and masters programs, DIY projects, how to apply to programs, list of companies, how to publish papers, lists of useful software, etc., is already available on the the Subreddit wiki https://www.reddit.com/r/ControlTheory/wiki/index/. Some shortcuts are available in the menus below the banner of the sub. Please check those before asking questions.
  • When asking a technical question, please provide all the technical details necessary to fully understand your problem. While you may understand (or not) what you want to do, people reading needs all the details to clearly understand you.

    • If you are considering a system, please mention exactly what system it is (i.e. linear, time-invariant, etc.)
    • If you have a control problem, please mention the different constraints the controlled system should satisfy (e.g. settling-time, robustness guarantees, etc.).
    • Provide some context. The same question usually may have several possible answers depending on the context.
    • Provide some personal background, such as current level in the fields relevant to the question such as control, math, optimization, engineering, etc. This will help people to answer your questions in terms that you will understand.
  • When mentioning a reference (book, article, lecture notes, slides, etc.) , please provide a link so that readers can have a look at it.

Discord Server

Feel free to join the Discord server at https://discord.gg/CEF3n5g for more interactive discussions. It is often easier to get clear answers there than on Reddit.

Resources

If you would like to see a book or an online resource added, just contact us by direct message.

Master Programs

If you are looking for Master programs in Systems and Control, check the wiki page https://www.reddit.com/r/ControlTheory/wiki/master_programs/

Research Groups in Systems and Control

If you are looking for a research group for your master's thesis or for doing a PhD, check the wiki page https://www.reddit.com/r/ControlTheory/wiki/research_departments/

Companies involved in Systems and Control

If you are looking for a position in Systems and Control, check the list of companies there https://www.reddit.com/r/ControlTheory/wiki/companies/

If you are involved in a company that is not listed, you can contact us via a direct message on this matter. The only requirement is that the company is involved in systems and control, and its applications.

You cannot find what you are looking for?

Then, please ask and provide all the details such as background, country or origin and destination, etc. Rules vastly differ from one country to another.

The wiki will be continuously updated based on the coming requests and needs of the community.


r/ControlTheory • • Nov 10 '22

Help and suggestions to complete the wiki

37 Upvotes

Dear all,

we are in the process of improving and completing the wiki (https://www.reddit.com/r/ControlTheory/wiki/index/) associated with this sub. The index is still messy but will be reorganized later. Roughly speaking we would like to list

- Online resources such as lecture notes, videos, etc.

- Books on systems and control, related math, and their applications.

- Bachelor and master programs related to control and its applications (i.e. robotics, aerospace, etc.)

- Research departments related to control and its applications.

- Journals of conferences, organizations.

- Seminal papers and resources on the history of control.

In this regard, it would be great to have suggestions that could help us complete the lists and fill out the gaps. Unfortunately, we do not have knowledge of all countries, so a collaborative effort seems to be the only solution to make those lists rather exhaustive in a reasonable amount of time. If some entries are not correct, feel free to also mention this to us.

So, we need some of you who could say some BSc/MSc they are aware of, or resources, or anything else they believe should be included in the wiki.

The names of the contributors will be listed in the acknowledgments section of the wiki.

Thanks a lot for your time.


r/ControlTheory • • 9h ago

Asking for resources (books, lectures, etc.) [Article] A direct predictive DC-link voltage control with warm-starting iterative approach for three-level NPC BTB converter fed PMSG-based wind turbine systems

3 Upvotes

Title: A direct predictive DC-link voltage control with warm-starting iterative approach for three-level NPC BTB converter fed PMSG-based wind turbine systems

Authors: Ganesh, Mayilsamy ; Jeong, Jae Hoon

Journal: Expert Systems with Applications, Volume 283, 2025

DOI: 10.1016/j.eswa.2025.127747

Link: https://doi.org/10.1016/j.eswa.2025.127747

Thank you!


r/ControlTheory • • 1d ago

Technical Question/Problem Can a system be too complicated for PID Tuning?

33 Upvotes

Hi all. I just made a career change from a project engineer to doing controls modeling. It's what a went to school for and really loved it and am excited. It is my first time actually doing controls work outside of academia.

I'm working on a propulsion system Simulink model and they want me to do PID tuning for a few subsystems. I've spent the past week just familiarizing myself with the model and understanding what is going on.

My coworker is very smart. Has been doing this for a while and did so much work putting this together. And let me tell you... It is dense. Some of the subsystems, for example the aircraft engine model probably has 20 subsystem level deep of different physics based models.

What im having trouble doing is understanding how PID tuning is even possible. My ultimate goal is to tune a PI control for an engine speed command. The issue is that the signal that is output, has about 20 other subsystems that it feeds into before the engine finally outputs a speed. And the signal names change a lot of those times.

Speed control out -> voltage controller -> voltage command -> FADEC (has soooo many subsystems) -> gearbox -> gearbox converter etc..

I don't have a direct way to an actual plant to understand responses. Is it even possible? Is frequency response the only possibility for systems that complicated?


r/ControlTheory • • 2d ago

Technical Question/Problem Custom Simulink physics model with ArduPilot SITL

6 Upvotes

Hi guys,

I’m currently working on a tiltrotor bicopter similar to the V-22 Osprey for my undergraduate project.
My professor prefers that I use ArduPilot, while I’d like to use MATLAB/Simulink for physics modelling and simulation, since I’ll also be using it during my upcoming internship in Attitude and Orbit Control Systems (AOCS).

Has anyone here successfully developed a custom physics model in Simulink and connected it to ArduPilot SITL? What would be the best approach to get started?
Any tips, examples or references would be greatly appreciated!

Thanks in advance!


r/ControlTheory • • 2d ago

Technical Question/Problem I'm building a robotics testing platform — would this be useful to you?

1 Upvotes

Hi everyone!

I'm an indie founder currently building a startup called Robo AI, and I'm trying to understand whether I'm solving a real problem for robotics engineers.

The idea is to build a platform that automatically stress-tests robot controllers in physics simulations before they're deployed on real hardware.

Here's how it would work:

  1. Upload your robot model and controller code.
  2. Run hundreds or thousands of simulation episodes with different conditions.
  3. Automatically test different physical parameters, including friction, mass, sensor noise, actuator limits, delays, and environmental conditions.
  4. Detect failures such as falls, instability, collisions, and performance degradation.
  5. Reproduce specific failures and compare different versions of your controller through regression testing.

The goal is to help robotics teams discover weaknesses in their controllers before testing on expensive physical robots.

We're currently starting with MuJoCo, with the long-term goal of supporting more robotics simulators.

I'd really appreciate your honest feedback.

I'd like to ask a few questions:

  1. How do you currently test your robot controllers before deploying them on real hardware?
  2. What is the biggest challenge you face when testing robots in simulation?
  3. Would you use a platform like this in your workflow?
  4. What features would make it genuinely valuable rather than just another simulation tool?

I'm not here to sell anything. I'm trying to validate the problem, understand existing workflows, and build something that robotics engineers actually need.

Thanks for your time!


r/ControlTheory • • 2d ago

Other Connecting people who enjoy exploring control theory

5 Upvotes

Hi everyone!

I'm working on a small project called MarkovChat, and I'm looking for people who enjoy exploring control theory, dynamical systems, feedback mechanisms, and how we can understand and influence the behavior of systems.

One of the ideas behind MarkovChat is that interesting conversations often happen when people have overlapping intellectual interests but bring different perspectives and experiences to the table.

For example, someone interested in control theory and robotics might have a lot to discuss with someone studying reinforcement learning, biological systems, or applied mathematics.

MarkovChat matches people based on their intellectual interests. Once at least three compatible people are matched, a private group conversation is created where they can exchange ideas and learn from each other.

We're still small, and I'd love to bring some people interested in control theory into the community!

Check it out at https://markovchat.com

I'd also love to hear your thoughts on the concept!


r/ControlTheory • • 2d ago

Other Heads-up: Lean 4 machine-checked proofs are starting to appear in control & engineering theory papers

9 Upvotes

Noticed Lean 4 almost never comes up here, so quick heads-up: machine-checked proofs (historically mostly a pure-math thing) are quietly starting to show up alongside engineering theory preprints - control (`eess.SY`), optimization (`math.OC`), dynamical systems (`math.DS`), robotics, and networking.

Our group at USC surveyed 12,613 engineering/applied-theory arXiv papers and saw Lean 4 companion repos jump ~7.6× over six months, mostly because AI coding assistants lowered the learning curve. While it is generally true that without care / human guidance and verification the early Lean 4 proofs can be poor quality (or not prove what they think they do) - quality has increased steadily and many modern machine-aided Lean 4 proofs are of high quality.

A couple of quick gotchas we noticed: ~22% of compact repos didn't compile out of the box purely from simple packaging mistakes, and "it compiles" still doesn't prove the Lean statement matches your LaTeX (or rule out shortcuts like `sorry`, `native_decide`, or Lean defaults like `x / 0 = 0`).

If you're curious to see what this looks like in practice - or want to try it on a paper of your own - we put together a few open-source resources:

  • Clean engineering examples to browse:

  • Build & visualize proofs with an AI agent:

    • proof-atlas - an agentic LLM skill for careful claim pinning, iterative proving, and graphical proof viewing
  • Audit a repo or double-blind `.zip`:

    • cLEANsheet - free, zero-LLM browser checker + optional offline build/axiom audit
  • The study (PDF):

If you find any of this useful, we'd love to hear what works (or doesn't) - and a citation to the study if it ends up helping with a paper! Curious if anyone here has tried formalizing a stability or optimal-control proof in Lean 4 yet, or how you'd feel refereeing a paper with one attached?

cLEANsheet currently focuses on features that can be statically evaluated with software, but we have found that things like statement-drift (latex vs lean), and assumption mismatch can be caught in many Lean 4 repos using modern AI models (e.g. Gemini 4 Neon High effort, Anthropic Opus 5.5, or OAI Astra 6.2). Could be a future enhancement to the cLEANsheet (but higher risk of mis-claim).


r/ControlTheory • • 3d ago

Technical Question/Problem Self Balancing Robot Help

Post image
23 Upvotes

Hello, I built a self balancing robot that balances for 1 minute, and I'm just curious as to why it fails in the end. It's a tilt only PID system so the robot does drift, but theoretically it should be able to stay standing upright and drifting infinitely. Are those growing oscillations indications that it's not tuned properly?


r/ControlTheory • • 4d ago

Educational Advice/Question What Are the Most Common Unsolved Problems in the GNC Industry?

0 Upvotes

I'm interested in hearing from engineers currently working in Guidance, Navigation, and Control (GNC), particularly in the aerospace industry.

What are some of the specific technical challenges or recurring problems you encounter in your day-to-day work?

I'm not referring to general challenges such as noise, uncertainty, delays, or sensor inaccuracies. I'm more interested in concrete engineering problems that require significant time, effort, or resources to solve.

For example:

  • Are there problems that existing algorithms don't handle particularly well?
  • Are there tasks that still require a lot of manual work or custom solutions?
  • Are there limitations in currently available commercial GNC software or tools?
  • Are there recurring problems for which you feel existing solutions are inadequate, expensive, or unnecessarily complicated?

I'm currently a master's student, and I'm looking for a thesis topic based on a genuine industry need. Ideally, I'd like to focus on a specific problem, develop a solution, and potentially explore turning it into a commercial product in the future.

I'd really appreciate hearing about your experiences, including problems that might seem relatively small but cause significant headaches in practice.

Thanks in advance!


r/ControlTheory • • 5d ago

Professional/Career Advice/Question As a fresher, what was your first job role? Did you start in this domain or end up here??

6 Upvotes

I'm a final year EE student from India and I'm interested in working in this field. But the roles appearing during our on-campus placements are not remotely related to control systems.

So if you're someone, who's working in this domain, how did you start and how did you switch?

Also one of my senior told me that as a fresher, it is important to start in the domain you want to work in, as switching is difficult. How much of it is the reality???


r/ControlTheory • • 5d ago

Asking for resources (books, lectures, etc.) [Article]The design of a neural network-based adaptive control method for robotic arm trajectory tracking

0 Upvotes

I need this article if one can provide me with, I will be appreciate


r/ControlTheory • • 6d ago

Technical Question/Problem Testing long-run consistency of an EKF on a hybrid production-line model

5 Upvotes

We run an extended Kalman filter on a production-line model: six physical states (oil temperature, pressure, seal wear, bearing damage, welder temperature, electrode tip wear) augmented with two model-error states for the energy balances. Covariance is propagated with the Jacobian of the same F used by the simulator, readings are applied as scalar Joseph-form updates, and we monitor the normalised innovation squared (NIS) as an exponential moving average (window of about 200 readings).

Over short windows the NIS stays within its χ² bounds. We are less sure about the long run:

  • breakdowns and repairs switch the dynamics (a hybrid system);
  • the wear states are weakly observable;
  • the parameters are periodically re-estimated by Gauss–Newton with a prior.

Which tests would you consider convincing? We are considering: NIS and autocorrelation of innovations over sliding windows against χ² bounds; replay of recorded runs with injected faults at known onsets; and checking that weakly observable parameters remain at their prior after re-estimation. What are we missing?

Disclosure: this is part of a closed-source digital-twin product. We are also looking for a few people with this background for a structured, paid review with credit (contact: [email protected]). The question above stands on its own, though; answers are welcome either way.


r/ControlTheory • • 6d ago

Technical Question/Problem Comparing 4 RL architectures (MLP vs. LTC/CfC vs. SANE vs. early GraphMamba) for adaptive Dual-Wheel PD control on a real Arduino self-balancing robot all trained on a single GTX 1650 (4 GB VRAM)

Thumbnail gallery
0 Upvotes

Sharing some early work-in-progress results from a Sim-to-Real project on a low-cost two-wheeled self-balancing robot (Arduino + MPU-6050 + wheel encoders + 10 Hz Bluetooth).

Instead of outputting raw motor torques from RL, the policy adapts the PD gains online at 10 Hz while the Arduino handles the inner balance loop. All 4 models are being trained in 100% JAX + MuJoCo MJX (800 parallel robots) on a single GTX 1650 (4 GB VRAM) across a progressive curriculum (P1–P2 Balance → P3–P4 Forward → P5–P6 Backward → P7–P8 Turn → P9–P10 Curve → P11+ All tasks under real-hardware randomization).

Moving from a symmetric MLP-PID to Dual-Wheel adaptive PD — predicting independent (Kp_L, Kd_L, Kp_R, Kd_R) from 10 sensor/command inputs — noticeably stabilized the learned gains and already transferred much better zero-shot to the physical robot:

Hardware note: I already ran initial zero-shot tests of MLP, LTC/CfC, and SANE on the physical Arduino robot — both LTC and SANE stabilized and controlled the real robot remarkably well, whereas the symmetric MLP struggled to transfer cleanly. These are still preliminary training runs, though: all policies (especially GraphMamba) still need further curriculum stages, hyperparameter refinement, and controlled physical disturbance benchmarks before drawing final conclusions.

Curious if others here have explored Liquid networks, specialist ensembles, or GNN+SSM policies for adaptive gain scheduling in low-cost Sim-to-Real any feedback or ideas for refinement are welcome!


r/ControlTheory • • 6d ago

Educational Advice/Question Help choosing graduate courses: Control Theory, AI/ML and Cybersecurity

2 Upvotes

Hi everyone,

I'm starting a PhD in Electrical and Computer Engineering in Canada in 2027, currently selecting my first-semester courses.

I have a Master's degree in Automation and Control Systems, with a background in classical control, dynamical systems, and industrial automation.

My supervisor's research interests are broadly around control systems, AI, and cyber-physical systems, including areas related to cybersecurity and system resilience.

I'm now looking to broaden my expertise toward AI/ML, cybersecurity, and cyber-physical systems, while keeping control engineering as my foundation. I'm still so beginner in ML and cybersecurity, so I'd like to build my knowledge progressively.

My supervisor asked me to select some courses of interest, after which he'll recommend which ones to take, a PhD student can select a maximum of 3 courses for the whole cycle

Here are some courses I'm considering from my university's catalogue:

  • Foundations of Cyber-Physical Systems
  • Fault Tolerance and Resilience of Cyber-Physical Systems
  • Applied Machine Learning for ECE
  • Neural Networks and Machine Learning
  • Network Security Architecture and Management
  • Embedded Systems Security
  • Artificial Intelligence in Cybersecurity
  • Fundamentals and Applications of Cyber-Physical Systems
  • Fundamentals of Network Security and Management
  • Adaptive Control

My main goal is to build a strong, practical profile for the industrial job market rather than pursue an academic career. Ideally, I'd like to choose courses that are manageable given my current knowledge gaps but still provide valuable skills for industry.

I'd appreciate your thoughts on which three courses you'd prioritize in my situation, and whether I'm overlooking anything important.

Thanks!


r/ControlTheory • • 7d ago

Technical Question/Problem Position PID controller causing erratic fish-like behaviour

9 Upvotes

Overview

I have been coding a PID control system for a 2D birotor drone in python, using pygame to display the simulated drone graphically. The controller achieves its goal of moving the drone towards the mouse position, but causes it to frequently jerk around vertically like a flopping fish, and I can't figure out how to solve this.

The Model

The drone is represented as a bar with two thrusters, one on either end and a centre of mass in the middle. The two thrusters can have positive or negative thrust, but only straight up or down relative to the drone (i.e., perpendicular to its long axis). Gravity is modelled with a value of 10 acting downwards.

For reference, the lines in the circle display in the top-right of the simulation represent the following:

- purple: desired force on the drone

- green: current acceleration of the drone

- yellow: current velocity of the drone

Control System

The controls system consists of the following:

- 2 PID controllers that take position errors (between the current drone position and the mouse position) in x and y as inputs, and output desired velocities in x and y (Kp = 1, Kd = 0, Ki = 0).

- 2 PID controllers that take velocity errors in x and y as inputs and output desired accelerations in x and y (Kp = 10, Kd = 0, Ki = 0).

Desired force is calculated as drone mass (which is 1) * desired acceleration

The total thrust required from the two thrusters is calculated from the following equation:

T = desired_force.y * cos(roll_angle) + desired_force.x * sin(roll_angle)

Where the roll angle is 0 if the drone is level and positive if the drone is tilted to the left. This calculation is performed so that if the drone is pointed straight up, the desired force in x is ignored as no amount of thruster output will be able to effect motion in the x axis.

Desired roll angle is calculated from the following equation (pygame uses a coordinate system where y is positive downwards):

desired_roll_angle = arctangent(-desired_force.x, -desired_force.y)

- A PID controller then takes roll angle error as an input and outputs desired angular velocity (Kp = 5, Kd = 0, Ki = 0).

- A PID controller takes angular velocity error as an input and outputs desired angular acceleration (Kp = 50, Kd = 0, Ki = 0).

Desired torque is calculated as desired angular velocity * drone moment of inertia (calculated as that of a slim rod).

The following motor mixing algorithms are then used to determine the output thrusts of the left and right thrusters:

left_thruster_output = T/2 + desired_torque/50

right_thruster_output = T/2 - desired_torque/50

Where 50 is the distance between each thruster and the centre of mass (measured in pixels).

The Code

Drone

class Drone(pygame.sprite.Sprite):
    def __init__(self, groups, pos):
        # setup
        super().__init__(groups)
        self.original_image = self.create_image()
        self.image = self.original_image.copy()
        self.rect = self.image.get_frect(center=pos)

        # scalars
        self.mass = 1
        self.moment_of_inertia = 1/12 * self.mass * self.image.width**2
        self.max_angular_acceleration = 0
        self.angular_acceleration = 0
        self.angular_velocity = 0
        self.roll = 0

        # vectors
        self.thrust = pygame.math.Vector2()
        self.velocity = pygame.math.Vector2()
        self.acceleration = pygame.math.Vector2()

        # targeting
        self.desired_pos = pygame.math.Vector2()
        self.desired_velocity = pygame.math.Vector2()
        self.desired_acceleration = pygame.math.Vector2()
        self.desired_force = pygame.math.Vector2()

        self.desired_roll = 0
        self.desired_angular_velocity = 0
        self.desired_angular_acceleration = 0
        self.desired_torque = 0

        # equipment
        self.left_thruster = Thruster(-1000, (-50, 0), self.roll)
        self.right_thruster = Thruster(-1000, (50, 0), self.roll)

        # controllers
        self.position_x_controller = Controller(1, 0, 0, None)
        self.position_y_controller = Controller(1, 0, 0, None)
        self.velocity_x_controller = Controller(10, 0, 0, None)
        self.velocity_y_controller = Controller(10, 0, 0, None)

        self.roll_controller = Controller(5, 0, 0, None)
        self.angular_velocity_controller = Controller(50, 0, 0, None)

        # controller timings
        self.position_frequency = 100
        self.velocity_frequency = 100
        self.roll_frequency = 100
        self.angular_velocity_frequency = 100

        self.position_last_update_time = 0
        self.velocity_last_update_time = 0
        self.roll_last_update_time = 0
        self.angular_velocity_last_update_time = 0

        self.set_target_pos()

    def set_target_pos(self):
        self.desired_pos = pygame.math.Vector2(pygame.mouse.get_pos())

    def create_image(self):
        surf = pygame.Surface((100, 20), pygame.SRCALPHA)
        surf.fill((150,150,150))

        left_thruster_surf = pygame.Surface((20, 20), pygame.SRCALPHA)
        left_thruster_surf.fill((200, 50, 50))

        right_thruster_surf = pygame.Surface((20, 20), pygame.SRCALPHA)
        right_thruster_surf.fill((50, 200, 50))

        surf.blit(left_thruster_surf, (0, 0))
        surf.blit(right_thruster_surf, (80, 0))

        return surf

    def calculate_acceleration(self):
        self.acceleration = ((self.left_thruster.thrust + self.right_thruster.thrust) / self.mass) + GRAVITY

    def calculate_angular_acceleration(self):
        self.angular_acceleration = (self.left_thruster.rel_pos.cross(-self.left_thruster.thrust)+
                                     self.right_thruster.rel_pos.cross(-self.right_thruster.thrust))/self.moment_of_inertia # Negative thrust to account for flipped coordinate system.

    def update_rotation(self, dt):
        self.calculate_angular_acceleration()
        self.angular_velocity += self.angular_acceleration * dt
        self.roll += self.angular_velocity * dt

        self.left_thruster.set_rotation(self.roll)
        self.right_thruster.set_rotation(self.roll)

        self.image = pygame.transform.rotate(self.original_image, math.degrees(self.roll))
        self.rect = self.image.get_frect(center=self.rect.center)

    def update_motion(self, dt):
        self.calculate_acceleration()
        self.velocity += self.acceleration * dt
        self.rect.center += self.velocity * dt

    def get_thrust(self, dt):
        # timings
        time_since_last_position_update = (pygame.time.get_ticks() - self.position_last_update_time) / 1000
        time_since_last_velocity_update = (pygame.time.get_ticks() - self.velocity_last_update_time) / 1000
        time_since_last_roll_update = (pygame.time.get_ticks() - self.roll_last_update_time) / 1000
        time_since_last_angular_velocity_update = (pygame.time.get_ticks() - self.angular_velocity_last_update_time) / 1000

        # position control
        if time_since_last_position_update >= (1/self.position_frequency):
            desired_x_velocity = self.position_x_controller.calculate_actuating_signal(self.desired_pos.x-self.rect.centerx, time_since_last_position_update)
            desired_y_velocity = self.position_y_controller.calculate_actuating_signal(self.desired_pos.y-self.rect.centery, time_since_last_position_update)
            self.desired_velocity = pygame.math.Vector2(desired_x_velocity, desired_y_velocity)
            self.position_last_update_time = pygame.time.get_ticks()

        # velocity control
        if time_since_last_velocity_update >= (1/self.velocity_frequency):
            desired_x_acceleration = self.velocity_x_controller.calculate_actuating_signal(self.desired_velocity.x-self.velocity.x, time_since_last_velocity_update)
            desired_y_acceleration = self.velocity_y_controller.calculate_actuating_signal(self.desired_velocity.y-self.velocity.y, time_since_last_velocity_update)
            self.desired_acceleration = pygame.math.Vector2(desired_x_acceleration, desired_y_acceleration)-GRAVITY
            self.velocity_last_update_time = pygame.time.get_ticks()

        # setting force
        desired_force = self.mass * self.desired_acceleration
        collective_thrust = desired_force.y * math.cos(self.roll) + desired_force.x * math.sin(self.roll)
        self.desired_force = desired_force

        # roll control
        self.desired_roll = math.atan2(-desired_force.x, -desired_force.y)

        # angular velocity control
        if time_since_last_roll_update >= (1/self.roll_frequency):
            self.desired_angular_velocity = self.roll_controller.calculate_actuating_signal(self.desired_roll-self.roll, time_since_last_roll_update)
            self.roll_last_update_time = pygame.time.get_ticks()

        # angular acceleration control
        if time_since_last_angular_velocity_update >= (1/self.angular_velocity_frequency):
            self.desired_angular_acceleration = self.angular_velocity_controller.calculate_actuating_signal(self.desired_angular_velocity-self.angular_velocity, time_since_last_angular_velocity_update)
            self.angular_velocity_last_update_time = pygame.time.get_ticks()

        # setting torque
        self.desired_torque = self.moment_of_inertia * self.desired_angular_acceleration

        # setting thrusts
        left_thrust = collective_thrust/2+self.desired_torque/50
        right_thrust = collective_thrust/2-self.desired_torque/50

        self.left_thruster.set_thrust(left_thrust)
        self.right_thruster.set_thrust(right_thrust)

        print(self.roll)

    def _display_vectors(self):
        left_thruster_thrust = 100 * self.left_thruster.thrust.normalize() if self.left_thruster.thrust else self.left_thruster.thrust
        right_thruster_thrust = 100 * self.right_thruster.thrust.normalize() if self.right_thruster.thrust else self.right_thruster.thrust

        desired_force = 100 * self.desired_force.normalize() if self.desired_force else self.desired_force

        # thrusters
        pygame.draw.line(pygame.display.get_surface(), (255, 0, 0), self.rect.center+self.left_thruster.rel_pos,
                         self.rect.center+self.left_thruster.rel_pos+left_thruster_thrust, width=3)
        pygame.draw.line(pygame.display.get_surface(), (0, 255, 0), self.rect.center+self.right_thruster.rel_pos,
                         self.rect.center+self.right_thruster.rel_pos+right_thruster_thrust, width=3)

        # other
        pygame.draw.line(pygame.display.get_surface(), (255, 255, 0), self.rect.center, self.rect.center + desired_force,
                         width=3)

    def update(self, dt):
        self.set_target_pos()
        self.get_thrust(dt)

        self.update_motion(dt)
        self.update_rotation(dt)

Thrusters

class Thruster:
    def __init__(self, initial_thrust, rel_pos, angle_radians):
        # setup
        self.original_rel_pos = pygame.math.Vector2(rel_pos)
        self.rel_pos = self.original_rel_pos.copy()
        self.thrust = pygame.math.Vector2(0, initial_thrust)
        self.angle_radians = -angle_radians

        self.current_thrust = initial_thrust
        self.set_thrust(initial_thrust)

    def set_rotation(self, new_angle_radians):
        self.angle_radians = -new_angle_radians
        self.rel_pos = self.original_rel_pos.copy().rotate_rad(-new_angle_radians)
        self.set_thrust(self.current_thrust)

    def set_thrust(self, thrust):
        self.current_thrust = thrust
        self.thrust = pygame.math.Vector2(0, self.current_thrust).rotate_rad(self.angle_radians)

    def add_thrust(self, thrust):
        self.current_thrust += thrust
        self.thrust = pygame.math.Vector2(0, self.current_thrust).rotate_rad(self.angle_radians)

PID Controller

class Controller:
    def __init__(self, k_p, k_i, k_d, saturation_limits):
        self.k_p = k_p
        self.k_i = k_i
        self.k_d = k_d

        self.integral = 0
        self.derivative = 0
        self.previous_error = 0
        self.previous_error_time = 0

        self.saturation_limits = saturation_limits
        self.unclamped_signal = 0
        self.clamped_signal = 0

        # flags
        self.integral_on = True

    def set_clamped(self, error, unclamped_signal, clamped_signal):
        self.integral_on = not((unclamped_signal != clamped_signal) and (error*unclamped_signal>0))

    def calculate_actuating_signal(self, error, dt):
        if self.integral_on:
            self.integral += error
        if dt:
            self.derivative = (error - self.previous_error) / dt

        self.previous_error = error
        self.unclamped_signal = (error * self.k_p) + (self.integral * self.k_i) + (self.derivative * self.k_d)

        if self.saturation_limits:
            self.clamped_signal = max(self.saturation_limits[0], min(self.unclamped_signal, self.saturation_limits[1]))
            self.set_clamped(error, self.unclamped_signal, self.clamped_signal)
            return self.clamped_signal
        else:
            return self.unclamped_signal

Any ideas on how to fix the erratic movement of the drone would be much appreciated. TIA.


r/ControlTheory • • 7d ago

Educational Advice/Question How important is interacting with real world physical systems for understanding control theory?

18 Upvotes

Can I in theory do everything in like Modelica or IsaacSim? What do I miss out on if I don’t build the real thing?


r/ControlTheory • • 7d ago

Educational Advice/Question What’s your main motivation to study control theory?

53 Upvotes

I’m looking for a source of motivation myself.

What do you plan to do with this skill? Why control theory? Why not machine learning or robotics or something?


r/ControlTheory • • 9d ago

Educational Advice/Question Is doing a simulation of a magnetic ball suspension system as a graduation project for my mechatronics engineering degree a good idea? (read the body text)

9 Upvotes

I'm doing the graduation project alone. The purpose of the project is to design a lot of controllers and compare their effect on the system (A 3D simulation of the system using unity or Labview). That's it...

I have finished the modeling part of the system (I keep coming back to it to edit stuff I got wrong or to add explanations to things I did not understand).
I have reached the PID tuning part of the control section and stopped their because it is the Middle exams time.

Can you tell me any ideas that could improve my project like unpopular controller algorithms or PID tuning methods I should try?
I'm planning to use lead compensation, pole placement, gain scheduling, fuzzy logic, and maybe model predictive control (I'm learning alot about these subjects along the way).

Is there a way that I can send the documentaion to someone to review my work?

Thanks for reading.


r/ControlTheory • • 10d ago

Other Lyapunov stability and PID control, explained visually (free study slides)

Thumbnail gallery
370 Upvotes

I've been studying Lyapunov stability and PID control through the animated videos of Prof. Giordano Scarciotti (Imperial College London, YouTube channel Prof Gio), and put together two slide decks for my own study:

  • Lyapunov stability and Lyapunov functions (55 slides): stability vs attractivity vs asymptotic stability, energy intuition with the pendulum, a step-by-step graphical proof of Lyapunov's direct method, and why generalized Lyapunov functions are needed beyond energy.
  • The PID controller (32 slides): from open loop and bang-bang control to P, PI and PID, steady-state error and tuning.

The slides follow the videos closely, with a few extra notes where the videos skip details. All figures are stills from his videos, shared with his permission.

PDFs: https://github.com/giusalfieri/control-theory-notes

Original videos:

Feedback (pun intended) is very welcome, especially if you spot mistakes or imprecise statements.


r/ControlTheory • • 9d ago

Other Stay Strapped

Post image
22 Upvotes

r/ControlTheory • • 9d ago

Other I am working on a open source Simulink parser in c++ any help ?

1 Upvotes

Hi i just want to share that i was working on a Simulink , reading and writing library in c++, ( link-github) almost did so much work and a lot still, since i am working on full time job, i am seeking people to help me with and make simulink available at zero cost for all people , any experienced c++ programmers here can evaluate or criticize my work i love your feedback guys thanks


r/ControlTheory • • 9d ago

Professional/Career Advice/Question How do you see automatic code generation now that LLMs can write code for MCUs?

0 Upvotes

I’ve been wondering where automatic code generation fits now that LLMs are getting pretty good at writing MCU code.

I was making a little fan controller for an electronics enclosure. On the bench it seemed fine, then I started unplugging the temperature sensor, switching between auto and manual, that kind of thing. Turns out auto mode would sometimes turn the fan back down a tick after the sensor fault had set it to full speed. I fixed that and then found that clearing the fault could bring back an old manual setting. Every fix seemed to uncover another weird interaction.

At that point I was tempted to redo the logic as a state machine in a model-based tool and generate the C. I wanted to see all the transitions in one place because I was losing track of them across three different functions.

What I ended up doing was giving an LLM the existing code and asking it to help me reproduce those two bugs in tests. That got me far enough to rewrite the logic as a small state machine in C. The funny part is I still ended up drawing the states and transitions on paper. I just never got to the code generation part.

For people who’ve used codegen on real MCU projects, has AI changed where you use it?


r/ControlTheory • • 10d ago

Professional/Career Advice/Question How exposed are applied mathematics, control theory and robotics careers to AI automation?

19 Upvotes

Hi everyone,

I'm currently pursuing a Master's degree in Applied Mathematics and Computer Science, specializing in Data Science, in Russia.

I've been reading quite a few discussions lately about AI replacing data scientists, the entry-level job market becoming increasingly saturated, and people advising others to move toward software engineering or cybersecurity.

This has made me think about my own career path, because I feel that my academic background is somewhat different from that of a typical Data Analyst or generalist Data Scientist.

My Master's research is focused on Control Theory and Robotics, particularly:

- Iterative Learning Control (ILC) for a gantry robot performing repetitive movements.
- Optimal controller design using Linear Matrix Inequalities (LMIs).
- State estimation using Kalman filters.
- Stochastic disturbances, including Ornstein–Uhlenbeck processes.
- Comparing Gradient and Heavy Ball control algorithms under different noise conditions.
- Working with MATLAB, YALMIP and SeDuMi.

I'm also taking a course in satellite engineering and space communications, with an interest in CubeSat projects.

What interests me is the combination of applied mathematics, optimization, control systems, robotics and data-driven methods.

My questions are:

  1. Would you consider this profile closer to Control Systems Engineering, Robotics, Applied Mathematics or Data Science?
  2. Are these fields less exposed to AI-driven automation than general-purpose Data Analysis and Data Science, or are they likely to face similar changes?
  3. How vulnerable are entry-level positions in robotics, control engineering and industrial automation?
  4. What additional skills would you recommend developing to remain competitive over the next 5–10 years?

I'm particularly interested in hearing from people who actually work in robotics, control engineering, industrial automation or applied machine learning.

I'm not looking for reassurance. I'd genuinely appreciate honest opinions, including criticism of my current skill set and career direction.

Thanks!