• For a robotic BLDC motor velocity control application, I moved to using a linear ADRC (Active Disturbance Rejection Control) [0] controller. It is not much more complex to implement that a PID, but at least in my context it handles changing real-world environmental conditions with a correctness which I could not achieve with a PID however much I tried to tune it.

    Still uses a PID for BLDC motor coil current control, as this control loop is much more predictable.

    Currently using the proportional part only from a PID for position control, but this may change in the future.

    [0] https://en.wikipedia.org/wiki/Active_disturbance_rejection_c... (although this isn't a very useful reference if you want the implementation maths!)

    • I once tried to make a RC toy car so that it has proportional speed controls. I used some hall effect sensors to measure the speed at which the wheels are rotating and used it to compute the PWM signal that should be fed to the motor.

      But the interference from the PWM signal appeared to mess with the speed sensor readouts that I couldn't make it work.

      Can what you describe be used to solve it? If you would be kind enough to describe it, that would be great.

  • The fascination of programmer types with classical control and estimation topics is endlessly interesting as someone who studied control and estimation and hangs out here for interest in the programming. For me it was surprising to see that JEPA is a model predictive control algorithm it an almost literal sense; I guess I’m happy to have studied what I chose when I was 18.
    • I signed up for one of the first MOOCs ever, about self driving cars by Sebastian Thrun, and of course PID was part of the curriculum.

      I think that PID hits a certain sweet spot between cleverness, ease of implementation and practical utility that makes it catnip for the typical programmer's mind.

      I liked it so much that when we had to implement it, I downloaded an open source driving simulator to see it work there instead of the simpler python environment we were using.

      • It’s very intuitively appealing. We like it at my university for teaching first years how to build a line following robot. It’s one of the first times you can get students to really get that “ah” moment when they realise what they can do with code—it can affect the real world!
      • Whatever happened to this guy?

        Sounds like he made a bag with the first AI craze and retired.

    • Yeah, kind of hilarious to me that this was posted here. I suppose if you’ve never encountered control systems at all before they are quite simple, elegant, and cool, but I’m surprised any technical person hasn’t come across them at some point.
      • I think CS degrees are a bit light on classical theory in the modern day. In Australia CS degrees are what they say on the tin, but in America it seems almost as if CS degrees are anywhere from cybernetics to pure software development
        • Interesting generalization; that’s almost the opposite of my experience.

          A common hiring anecdote we share with people outside tech is literally: “A CS degree doesn’t teach you how to code.”

          For me, ~25 years ago in the UC system, it was all math/science/theory-oriented. Some C++/Java that was introduced to get you through all that theory. Learning how to code/actual software engineering comes with practical experience.

          • My CS degree was a software engineering degree in a trench coat. I went back to give a guest lecture a decade later and the curriculum had changed to be more theory-focused.

            (I am quite happy to have gotten the software engineering education.)

        • That hasn’t been my experience in the US, either personally or from talking to others who took CS degrees.

          Keep in mind that plenty of people on HN and in the industry did not take CS degrees in college. We did learn about PIDs, if briefly.

    • This classic programming text book discusses computational analogs of the "signals" in signal-processing systems.

      https://mitp-content-server.mit.edu/books/content/sectbyfn/b...

  • I used it in metal detector (direct frequency measurement kind). It works really well. I (and you probably too) half assed pid controllers before you even know what it is. But it makes perfect sense. Proportional part reacts to the acute difference, derivative adjusts it when your controller is already going right direction to limit overshoot, and integral part improves cases when the difference is small but persist for long time. Learn them and use them, they're good tool.
    • Almost always a good analysis will find a control strategy which performs better than PID...

      But the benefit of PID is it is fairly easy to tune and works in a really wide range of situations.

      • And it is most of the time not overkill
  • PIDs are great but notoriously hard to tune. They require deep insight into the underlying physical phenomena to get right. They are also rather rigid and cannot adjust well to a changing environment (temperature and humidity can fluctuate dramatically between summer and winter in some climates).

    Of course, no one tunes them by hand anymore for these reasons, relying instead on optimization techniques like particle swarm to find the best set of coefficients for a given steady state condition. Eventually, I suspect we will replace most PIDs with a small neural network for almost all industrial applications (a handful of nodes is sufficient). The neural network is also easier to adapt to changing conditions.

    • This isn’t meant to be an attack, but almost everything you say here is false.

      > PIDs are great but notoriously hard to tune. They require deep insight into the underlying physical phenomena to get right. They are also rather rigid and cannot adjust well to a changing environment (temperature and humidity can fluctuate dramatically between summer and winter in some climates).

      This is not true. PID controllers are often the least dependent on the physical characteristics. They can be tuned with heuristic methods like Ziegler-nichols, often with no knowledge of the actual system.

      > Of course, no one tunes them by hand anymore for these reasons, relying instead on optimization techniques like particle swarm to find the best set of coefficients for a given steady state condition.

      This is also not true. In the Amazon consumer robotics group we still tuned pid by hand. I’ve _never_ heard of tuning pid with particle swarm, that seems very silly, difficult, and overkill. If you’re going to use an optimization technique, you might as well move to a better controller structure like LQR. I have seen particle swarm used as an estimator, as an alternative to a kalman filter, but never seen it used for tuning.

      > Eventually, I suspect we will replace most PIDs with a small neural network for almost all industrial applications (a handful of nodes is sufficient). The neural network is also easier to adapt to changing conditions.

      This sounds unlikely to me. Classic control techniques give guarantees that a neural net just can’t. For example, things are provably stable under some assumptions. With a neural net you get no such guarantee. Also, it would be harder to debug and understand, and it would take more memory and compute. I can’t imagine a world where we replace pid with neural nets, they’re fit for very different purposes.

      Source: have a masters in controls, worked in robotics in controls team, still do consulting in this area when I have time, and I love it all.

      • I saw a crazy stat somewhere like some large fraction of the industrial PID controllers that are actually deployed in plants are completely untuned--that is, just running default settings. I think it was a book about tuning PID controllers, but I don't have the exact citation handy..
        • I’d totally believe that. You can buy devices that even tune themselves automatically, using model-free methods like Ziegler-nichols. I’m not familiar with the domains where you would use that sort of thing, but I guess it would be applications that aren’t safety-critical, maybe air conditioning or something like that. I bet many people put the thing in place, and then it works well enough that they never even click the “tune” button
          • I don't have a good intuition about the what makes a problem sensitive to tuning, is it possible there are a large number of control problems where proper tuning doesn't matter much? Or the deleterious effects of improper tuning (like oscillations or overshoot) are masked somehow?

            EDIT: I guess intuitively, big (lots of inertia) damped systems are probably pretty safe--you can do all kinds of crazy things with the control input and it won't really have much effect. The only way you could go wrong is drift.. Anything that is inherently stable seems like it should be "easy"--like a high-wing monoplane with lots of dihedral angle, you release all control inputs and it defaults to straight and level flight.

    • > Eventually, I suspect we will replace most PIDs with a small neural network for almost all industrial applications

      With or without serverless lambda architecture bitcoins ?

    • > Of course, no one tunes them by hand anymore

      in the industry, maybe. Otherwise, FRC competitions are seeing a LOT of manually tuned PIDs

    • I wanna know more about particle swarm . Btw i tuned my line follower with a customgui/pypidtune+mujoco
  • My personal exposure to the PID algorithm was my GPU fan. There is supposed to be some sort of internal fan curve to control it's speed but mine was not working, crashes everywhere. I Could still set the speed by hand. and while I was putting together a sort of hacky user space fan curve I had an epiphany. I Don't actually want a fan curve. I want to set an ideal temperature and have the computer figure out what fan speed is needed to maintain it. So I learned more about control logic than I was really prepared for and my user space fan speed script has a cute little PID controller to do just that. (technically for fan thermals you really only need a PD controller. No anticipatory preload needed. but who's counting)

    I do sort of suspect a fan thermal control curve is a PID response curve written out in long hand but don't really have the math to prove it.

    • > I do sort of suspect a fan thermal control curve is a PID response curve written out in long hand but don't really have the math to prove it.

      No, a fan response curve is kinda-sorta a P controller. It does not take into account 1) how quickly the temperature is rising or dropping (D) 2) the time passed since the system has drifted from the target temp (I).

    • why not just set maximum speed and forget about it?
  • I did a lab exercise (part of physics curriculum) with a PID controller once. It controlled a small electric motor with a small flywheel (i.e. not much inertia). We hand-tuned the parameters with potentiometers. The effect was quite impressive: the flywheel kept spinning at the same speed when we touched it, even with moderate force. It felt like there was a huge motor driving it because the RPM just wouldn't budge. It was still not hard to stop it completely (small motor after all), but it felt very stiff before that point.
  • Thanks to the advice of a colleague who had studied control theory, I once used PID controllers to manage autoscaling compute resources downstream of a lot of message queues. We used plenty of more typical autoscaling systems too, but for some workloads, PID controllers were ideal—when we had thousands of compute clusters across many queues, they minimized the state that needed to be stored between scaling system polls while effectively smoothing out the scale up/down rate to minimize resource waste and pointless whipsawing.
  • Jesus christ. The wretched control system paper we had for B-Tech computer science!

    The text book jumped right on to the integrals and derivations without even a whisper on what the thing is supposed to be useful for!

    I want to understand this so much now, but the memories of that paper is such a turn off!

  • Honest question: are wiki links to any technical topic post worthy now?
    • At least for me, it's not about the wiki link. I'm here for the comments, the stories, anecdotes, related deep Diving links and general chit chat. If you view the link as "this is the control systems thread for today", all the upvoter make a lot more sense.
    • Why the hell not ?

      I still learn a lot from wikipedia. Maybe it's not useful for those who are experts in every thing. I am not one of them.

    • I think you can post more or less whatever you want.

      Whether it gets upvoted depends on a lot of things.

      For example, I will upvote this submission, but not your comment.

  • Terry Davis implements a PID controller for a rocket in SimStructure: https://youtu.be/25hLohVZdME?t=207
    • A brilliant mind failed by society. Thank you for the link.
  • [dead]