Earlier quoted context omitted.
Maybe I'm misunderstanding something, but wouldn't you still want/need a D term unless you have a system with a nearly instant response? I'd think that even if you stop applying a delta the second you hit the set-point, if you've built up non-trivial inertia, then you'll overshoot the target fairly significantly?
It's all a tradeoff of how system response vs. stability and how much overshoot is tolerable. For the domains I've worked in, with physical components, system response isn't instantaneous, but some level of overshoot is tolerable as long as the system rapidly converges and (this is the important part) cannot end up in a positive feedback scenario. The derivative term tends to amplify noise, which is never what you wa…
PID Controllers in Unity3D (2021)
31–40 of 46 posts
Re: PID Controllers in Unity3D (2021)
#32Re: PID Controllers in Unity3D (2021)
#33Earlier quoted context omitted.
The interesting thing is that if you can reframe the problem correctly, a PID controller will probably be involved in the closed loop solution. And most of the time you don't even need the derivative term. The last few systems I've worked on professionally have been nested PI controllers with some filters on the front or back of them. Just needed the correct framing for the problem (the hard part) and it becomes stra…
The D term is complicated. Where you do you get the derivative? If you have to differentiate the input, and there is noise, the raw derivative will have huge variations. Then you need a low pass filter before the differentiator. This introduces lag. So you now have both D gain and filter frequency to tune. See any classical control theory book for the theory on this.
Re: PID Controllers in Unity3D (2021)
#34Earlier quoted context omitted.
It's all a tradeoff of how system response vs. stability and how much overshoot is tolerable. For the domains I've worked in, with physical components, system response isn't instantaneous, but some level of overshoot is tolerable as long as the system rapidly converges and (this is the important part) cannot end up in a positive feedback scenario. The derivative term tends to amplify noise, which is never what you wa…
Control theory doesn't come up much in what I do but as a practitioner are Root Locus ever utilized? I've been unpleasantly surprised to see that exact positive feedback instance existing in places you wouldn't want (things wobbling above earth after a control input). Poles and Zeros felt like a lot of magic until a foray into complex analysis ripped that band aid off ;)
Re: PID Controllers in Unity3D (2021)
#35Control theory is also used by databases (probably not as often as it should be). It's great for "self tuning" [1], for example tuning the various cache sizes a database has to maximize throughput under changing workload conditions. Its definitely worth spending the time to understand PID controllers if your an engineer working on databases. [1] https://www.vldb.org/conf/2006/p1081-storm.pdf
There's a lot of terrible things people do in ignorance of control theory while trying to come up with solutions in that space.
Re: PID Controllers in Unity3D (2021)
#36Earlier quoted context omitted.
The interesting thing is that if you can reframe the problem correctly, a PID controller will probably be involved in the closed loop solution. And most of the time you don't even need the derivative term. The last few systems I've worked on professionally have been nested PI controllers with some filters on the front or back of them. Just needed the correct framing for the problem (the hard part) and it becomes stra…
Maybe I'm misunderstanding something, but wouldn't you still want/need a D term unless you have a system with a nearly instant response? I'd think that even if you stop applying a delta the second you hit the set-point, if you've built up non-trivial inertia, then you'll overshoot the target fairly significantly?
Of course, a "perfectly" tuned PID loop will be "better" - more efficient, faster to reach setpoint, and minimize overshoot. But the effort/engineering time/operation time involved in tuning it, combined with the risks presented by a subtly poorly tuned loop that goes haywire one day when the system paradigm (characteristic) changes...just isn't worth it.
Obviously there are times when you really do need a D term, but I can confidently say that they're not commonly used in HVAC or petrochemical plants. I'm sure there are other domains where the D term is needed, but in my time as a controls engineer I didn't run across them.
Re: PID Controllers in Unity3D (2021)
#37A thermostat is not an on/off-controller but a proportional controller. The lower the temperature, the higher the flow rate. At least for thermostatic radiator valves this is true.
Re: PID Controllers in Unity3D (2021)
#38Re: PID Controllers in Unity3D (2021)
#39Earlier quoted context omitted.
Maybe I'm misunderstanding something, but wouldn't you still want/need a D term unless you have a system with a nearly instant response? I'd think that even if you stop applying a delta the second you hit the set-point, if you've built up non-trivial inertia, then you'll overshoot the target fairly significantly?
Everyone will say "depends on the system" but generally the D term is not only not needed, but typically considered counter-productive or even against best practices. PI-loops tend to be much more stable than PID-loops and far easier to successfully tune for an acceptable response. You do get overshoot with a decently tuned PI-loop, but it's not enough to cause problems. A bit of overshoot doesn't tend to hurt anythi…
A really good way to tell is to consider the relationship between your input and output. PID get's thrown around all the time because a lot of the time you are talking about controlling an accerlation (gas pedal, throttle) to effect a position, so you theoretically need a PID to stand in for a 2nd order differential equation since position and acceleration are two derivatives apart with respect to time. But as you pointed out, you usually can generalize your input and not worry about the D term.
In the video game I'm making, I don't really worry about derivative control, but PID control is mostly there to give the illusion that someone is driving a vehicle rather than it be controlled perfectly by a computer program. I don't want to model out how "skilled" the driver is - all I have to do to give that impression is just give the vehicle better handling.
Re: PID Controllers in Unity3D (2021)
#40My favorite use of a PID controller in Unity was to act as a camera operator for a VR football game. We used cameras for the screen-display (we could either show you the VR player's perspective, or one of several cameras), and for the jumbotron in the stadium. This ended up being really cool for downfield throws. When you bombed the ball 45 yards to a receiver, it could be a little hard to see the action. It was real…
Wouldn't it be better to model imperfections separately rather than rely on PID oscillations? I can see how this can easily fail and cause some dramatic and unnatural camera movements.
Generally though, It would be pretty trivial to add noise for this stuff. You would probably want some noise on the orientation if you wanted to model more of a camera shake. Perlin noise is my go to if I want to introduce randomness to positions really quickly.