9 ms·
What is a control system anyway?
- moritonal 6y agoGreat explanation, we often end up writing the same rules in video games. Any "drone" logic to do with some kind of builder unit or even a literal drone in something like COD needs rules like this.
- artemonster 6y agoevery time I see such great, simple and intuitive explanations I always remember how these topics were presented in Uni and want to tear-up a little: monotone voiced prof draws some nonsensical formulas and crap on blackboard, explaining zero things, giving zero context and examples. After a lecture you'd go to an excercize and start applying these formulas to artificial isolated problems, like a symbol manipulating machine. I always imagined myself being a person in that famous "chinese room experiment", a mindless monkey, manipulating symbols in equations with zero underlying understandings, just as it was "taught". brrr.
- ilikerashers 6y agoI second that. University education in Electronic Engineering tends to favour rote learning over understanding. People could be genuinely interested in this stuff if engineering tried to focus more on creativity than memorization.
- arethuza 6y agoThe CS course I did had a lot of the maths content of the related electrical engineering courses - admittedly with a focus on discrete maths for the third and fourth years. This did give us a lot of maths, but with no real idea as to what people actually did with it. Fortunately, for me at least this was fixed when as a postgraduate I joined a research group that was largely control engineers!
- TeMPOraL 6y agoSame here. Give some interesting, non-artificial problems to solve. Tune a PID on an actual (real or simulated) pole balancing machine. Tune a controller on a (simulated!) rocket chasing a target in the sky. Give problems that students can relate to and understand, and in context that allows for exploration and interactively verifying solutions.
- regularfry 6y agoMy memory of learning control theory at university was learning some super complicated stuff that was applicable to 99% of control problems. PID controllers, which are good for probably 95% of control problems, were effectively "an exercise for the reader". So trivial compared to the broader theory we were studying that nobody even thought to mention them. The expectation seemed to be that when you needed them, they'd just drop out of the maths and they'd need no further explanation. We'd already done a form of proportional control with op-amps. It would have been enormously helpful to start control theory with discrete PI and PID to give us a practical grounding and something we could actually use before leaping off into the wider theory, but that's not how academia works...
- Filligree 6y agoAs someone who's only worked with PID controllers, do you have any pointers to the more complicated stuff you're thinking about? A wikipedia article maybe?
- nuclearnice1 6y agoTry Model predictive control (MPC) and linear quadratic regulator (LQR)
- regularfry 6y agoIt's been a while, but I remember https://en.wikibooks.org/wiki/Control_Systems/MIMO_Systems#State-Space_Representation https://en.wikibooks.org/wiki/Control_Systems/MIMO_Systems#S... as a fair example. State-space representation is very powerful, and totally unnecessary for PID.
- HeyLaughingBoy 6y agoThis problem persists even in applied classes. I was taking a set of courses in Mechatronics for engineers who were already working in in industry. We went deep into the theory of various types of controls but when one of the students (an engineer with probably 20+ years of experience) asked about PID, it was dismissed as a "special case" of (I think) a Phase Lead control. Happily the guy teaching the lab portion of the class was himself an experienced controls engineer who actually knew how to use the math to accomplish something useful. We learned far more from him than from the lecture classes.
- rcxdude 6y agoMaybe I shouldn't be so hard on the teaching at my uni then. There was a pretty decent amount of attempts at getting an intuitive explanation of how the systems worked, and quite a few demos of different control schemes and how they worked and might fail (as well as tons of maths).
- baylessj 6y agoReally like the visualization, this does a great job of explaining the concepts of PID in an easy to understand way! The visualization used here could also work as a nice foundation for more complex controls algorithms for 2D space like path planning splines and pure pursuit.
- roland35 6y agoPID loops are simple and effective control solutions and are relatively easy to incorporate into embedded controllers as well. Generally I have left out the integration step because it can easily cause instabilities, even with a wind-up preventer. When things get more complicated like with flight controllers or advanced motor drives PID is not recommended. Another problem I've seen is people gloss over tuning a PID controller properly too.
- ChuckNorris89 6y ago>Generally I have left out the integration step because it can easily cause instabilities, even with a wind-up preventer. Funny, in automotive we always left out the derivative component not the integral which IMHO is the most useful component of the controller.
- joeberon 6y agoYeah I've usually heard that the derivative component is what gets left out, never heard of leaving out the integral
- zwieback 6y agoIf you have a system without natural dampening and can't tolerate overshoot or oscillation you'd use a bit of D to slow things down.
- deleted 6y ago[deleted]
- edge17 6y agoYea, I built a ball beam balancing device that torqued the beam using electromagnets (instead of the standard 2nd order system with a motor in the center and fast response). The electromagnets can not 'instantly' change the angle of the beams, and the ball's dynamics lead to overall instability as it rolls around and accelerates faster than the system can respond.. Without a derivative term it would have been impossible to control the system. That being said, the project was deliberately contrived in a way where the effects of the P,I,D terms were observable.
- LoSboccacc 6y agoit's interesting but that not how thermostats work, sure they're on-off but they have hysteresis they don't keep switching also you can use bang bang demo and inertia to orbit the thing moving the point on the tangent at the fastest approach, which is awesome.
- paulgb 6y agoThe thermostat he describes is not stateless, the key phrase is "When the temperature is too high by some amount" (emphasis mine) -- the thermostat will turn on outside a particular range. This matches my understanding of a simple thermostat, is it wrong?
- TeMPOraL 6y agoThe JS simulation doesn't demonstrate this, though; the bang-bang controller keeps oscillating in very short steps around the goal.
- zwieback 6y agoVery nice! I've been working as a controls engineer for 20+ years and this is one of the best visualizations I've come across.
- daxterspeed 6y agoThese visualization are very satisfying and provide some wonderful insight. A few minor bugs: - The gray area is always too small, so there's plenty of area of the canvas that never gets cleared. - Perhaps this is intended, or maybe it's caused by by the demo running at 144Hz, but the drone is always swept away by the wind for me. It doesn't even stand a chance to fight it.
- vardump 6y agoSame issue at 120 Hz, the drone had no chance against the wind. Confused me up until reading your comment. Works fine after setting refresh rate to 60 Hz. (Btw, amazing how bad scrolling looks at 60 Hz after getting used to 120 Hz! Never noticed it before nor did I think it could matter...)
- timvdalen 6y agoVery cool! On my device, the actual canvas is a bit bigger than the area you're clearing, resulting in this[1]. [1]: https://i.imgur.com/orrXwZT.png https://i.imgur.com/orrXwZT.png
- aasasd 6y agoThat glitch is proper oldschool lo-fi trippy fun, though. Would consume substances and play with it for half an hour if I had anything right now.
- dmarchand90 6y agoI think I got a better insight into PID from this one page from me entire control engineering course in university
- regularfry 6y agoYeah, that's the best explanation I think I've ever seen of the I and D terms.
- scrooched_moose 6y agoI was thinking the same thing. In my class, at no point was it explained why we would want to do this. It was "This is the math for a P controller. Here's some homework. Now test. This is the math for a PID controller....". Things didn't click until years later. Looking back, it was a shortcoming in so many classes I took. Actually discussing the problem we were trying to solve adds so much intuition and understanding to the mathematics.
- Tade0 6y agoBeautiful introduction. I remember my PID lab in college - we had two plexiglass towers with water in them and a pump - our task was to calculate the PID parameters so that one of the columns reached a certain level. I think it was measured by a buoy, so we had a pretty noisy input to begin with, but that was part of the problem at hand. It was a great introduction because the lab was 2h and the pump rather slow, so we couldn't just half-ass it.
- zyberzero 6y agoWe had the same! Our towers leaked water as well (not sure if a feature or a bug in the lab, there was a non-trivial amount of duct tape involved), so you really needed to take "external forces" into consideration.
- jagged-chisel 6y agoOT anecdote If the cruise control in my vehicle is using PID, it still needs some tweaks. It's super aggressive when it's lower by 2pmh and often overshoots. My mom's is horrid: takes forever to get up to speed, then allows downhill drift to drive the vehicle nearly 5mph over the set speed. I feel like this kind of stuff would be fun to tweak in a simulator to help me understand why it doesn't work better, or show that I'm not entirely crazy and it can indeed be improved.
- ncallaway 6y agoWhat's often hard about this situation is tuning to one problem case (fixing that downhill drift) often makes a different scenario worse. For example, fixing the downhill drift can make that overshoot worse. I can imagine tuning something like this for a cruise control scenario would be tricky, because there's probably hundreds of different cases to test for. I think a simulator here could be particularly fun to toy with, because you could have "unit tests" with 200 different scenarios that you try to optimize for. You could set your parameters, and it could run the 200 different scenarios, and show you were your parameters did well and where they did badly.
- jacques_chester 6y agoThere's a lot of literature spread across a bunch of fields. The one I first saw was "Active Nonlinear Tests"[0] from the systems dynamics / complex systems area. The idea is that you perform searches of parameter space for a simualation to find the places where it exhibits dramatic nonlinearities. I've since seen something similar but not identical in the Statistical Process Control world: robust process (or product) design[1]. The idea is that any given system can be thought of as a function that represents X = F(a, b, c, ...) + E, where E is some measure of error or noise that can't be removed. The goal is to find settings for a, b, c etc that minimise the effect of E. So that even if uncontrolled noise swirls around, your process remains stable. You can imagine flipping that to look for maxima instead. [0] https://www.santafe.edu/research/results/working-papers/active-nonlinear-tests-ants-of-complex-simulation- https://www.santafe.edu/research/results/working-papers/acti... [1] Web search results are underwhelming, I refer you instead to Douglas Montgomery's Introduction to Statistical Process Control.
- carapace 6y agoHuh, I once plugged a 2D physics engine into Tkinter and made a little floaty PID drone sim. I added balls that spawned from above it and fell on it, and it would stay on point. I'll see if I can find it later today if anyone's interested?
- pgt 6y agoPID-controlled sous vide with Clojure transducers: https://blog.adafruit.com/2014/10/06/boiling-sous-vide-eggs-using-clojures-transducers/ https://blog.adafruit.com/2014/10/06/boiling-sous-vide-eggs-...
- Greek0 6y agoPID Without a PhD [1] is an excellent paper that gives a good intuition for PID controllers. In addition, it has concrete advice on how to go about implementing a practical control scheme, and how to tune the PID constants. It's really my go-to reference for any practical control theory application. [1]: https://www.wescottdesign.com/articles/pid/pidWithoutAPhd.pdf https://www.wescottdesign.com/articles/pid/pidWithoutAPhd.pd...
- wrigby 6y agoLove this! I had read another paper from Wescott about sampling[1] years ago and loved it, but I didn't realize there's a handful of other great articles[2] that they've published. 1: https://www.wescottdesign.com/articles/Sampling/sampling.pdf https://www.wescottdesign.com/articles/Sampling/sampling.pdf 2: https://www.wescottdesign.com/articles.html https://www.wescottdesign.com/articles.html
- RealityVoid 6y agoIt kind of bugs me that I understand PID quite well and I've coded quite a few for of them. But trying to dive deeper into control systems, I always hit a wall caused by my weak mastery or mathematics. I've heard someone say that PID is the deepest you can get without in control systems without advanced mathematics and I think hey might be right.
- tnecniv 6y agoDepends on what you define to be advanced and deep. If you know linear algebra, that opens up a variety of state space techniques. If you know a little optimization, that opens up optimal control, including the incredibly common LQR strategy. This stuff is typically accessible for an advanced undergrad with a few of the right prereqs. But control theory is a deep field. You can find papers that use differential geometry, topology, information theory, etc. for designing control systems.
- TheSoftwareGuy 6y agoI took a linear control systems class in college, probably at the peak of my mathematical abilities. I hadn’t yet forgotten the fundamentals of Laplace, Fourier, and solving differential equations. Not to say I was some math wizard, but at least the prerequisites were fresh on my mind. It was fascinating, but I just couldn’t grok it. Whatever weaknesses I had in the relevant maths, that class just seemed to amplify it x10. I still wish I could have absorbed more of the knowledge
- ryanmarsh 6y agoA great example of this is a tweet from Max Howell (creator of Homebrew) regarding interviewing at Google. Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so fuck off. https://twitter.com/mxcl/status/608682016205344768?lang=en https://twitter.com/mxcl/status/608682016205344768?lang=en
- seiferteric 6y agoIn lieu of my final in control systems class, the professor allowed anyone to make a PID controller and present it to the class instead. All the EEs went this route (seems unfair to the others in retrospect LOL) and it was a great experience. Many did it digitally, but I opted for purely analog with op-amps for P, I and D with a summing op amp circuit at the end. This was connected to a pair of power transistors to drive a DC motor (from my lego mindstorm) and some gears to move a stick on a board. The input was a potentiometer with a nice metal knob. Each of the PID also had a pot to control it's own amplification before going into the summing circuit so you could adjust and see the behavior of each element. This was one of the most rewarding projects I have ever done I think, so cool to see it in action.
- deadso 6y agoReminds me of this project from MIT students where they built an analog Segway: https://techtv.mit.edu/videos/687f4627e5c14a52b24c694f7eeecfa4/ https://techtv.mit.edu/videos/687f4627e5c14a52b24c694f7eeecf...
- jcims 6y agoThat's amazing, something very legit about the analog approach and I can imagine it was pretty thrilling to see it actually work.
- elteto 6y agoThis was the controls lab final project when I was back in college [0] (video is not mine). It was a super cool project. Our task was to tune two PID controllers (one for each motor) to move the "head/pickup tip" to the color balls on the screen and then drive back to "drop" the ball in its respective "bucket". We were given the forward and inverse kinematic models, as well as a black box piece of code to actuate the motors, so we could focus on just tuning the PIDs. Lots of fun! [0] https://www.youtube.com/watch?v=PLk7nn2hWN0 https://www.youtube.com/watch?v=PLk7nn2hWN0 Edit: found a video of a project from a different year, also really cool and about tuning PIDs: [1] https://www.youtube.com/watch?v=ohwVLDmCSns https://www.youtube.com/watch?v=ohwVLDmCSns
- pgt 6y agoI built a volume control system (hardware + software) using mainly a PID controller: https://wallfly.webflow.io/ https://wallfly.webflow.io/
- davedx 6y agoI'm working on this exact problem except for an autonomous boat, so probably it's completely transferable, so this is nice timing. For now though I think I'm going to use a much simpler autopilot system (that I've already coded): Accelerate towards target at maximum speed; if within a certain distance of target, slow to approach speed (10%); if within "arrived at target" distance, cut speed to 0 (station keeping). This seems to work "well enough" in my JavaScript simulator, but I really wonder how it will do on actual water.
- Jugurtha 6y agoI've had the chance to have had a teacher who exposed us to the design of robust RST controllers and optimal control (Pontryagin, Lyapunov, Bellman, Hamilton, Jacobi), Evans' work. Getting into an ML shop and looking at what my colleagues who do DL were doing made me think: hmmm, this backpropagation-thingy looks really familiar. There was, and still is, a comparatively scarcity of documentation on these as most of the content online only tackles PID when it comes to "control systems". Fascinating stuff.
- RealityVoid 6y agoSoo, if I wanted to look deeper in the maths for these RST controllers, where should I be looking? As I've been confessing in another comment in this thread, I am quite stumped how to proceed to understand more complex controllers. This is all my fault, because of my weak grasp of advanced mathematics.
- HeyLaughingBoy 6y agoThe best book I know of is pretty old by this point, but it's very readable! Modern Control Systems by Dorf & Bishop. Probably pretty expensive by now, too! There's also the Control Systems Design Guide, but that's more of a cookbook-style. Dorf and Bishop is a theory book, but a good one.
- lb1lf 6y agoAs others have said, this page provided more understanding than more than one university course I've taken. Oh, and anecdotally I'll state that while Ziegler-Nicholls was great for my lab exercises, it was, ahem, quickly dropped when I started tuning heavy lifting equipment. Increasing proportional gain until stable oscillation was achieved with 160 metric tons in the test tower outside was, ahem, not boring. Not in the least.
- supernova87a 6y agoThose are great controllable animations/simulations! Thanks for sharing that! I had always wanted to get a physical intuition for how PID changes led to different behaviors. (And for example, in practical life, how an autopilot doesn't wildly overshoot and oscillate around a VOR radial when trying to intersect it).
- ngcc_hk 6y agoThe idea in the article is about acceleration and not velocity is great. We do not deal with the target but error. And the response to acceleration has to be proportional. Why can’t it apply to real drone? Interrupt needed?