Live data from Hacker News

PID Controller Explainer (2022)

ben.bolte.cc

31–40 of 40 posts

Re: PID Controller Explainer (2022)

#31
post #27

Earlier quoted context omitted.

All physical systems have time delay, but software doesn’t necessarily. I bumped into PID controllers writing software for video games where I had the option to not have a time delay in the system, if I wanted to do something less physically realistic. In a game, you can (and I often did) use a proportional-only controller for certain things. Then I got surprised when that didn’t work, after a time delay was introduc…

> but software doesn’t necessarily. Is this true? I mean the delay may be inconsiderable but there is a delay, right?

It depends entirely on what you’re doing in software, but yes it’s true that you don’t always have a delay. Your simulation doesn’t have to involve time at all, so that’s one way you might not have delays. But if you do have a simulation involving time, and your update of some entity in the system can change it’s behavior instantaneously, then there’s no delay. Like I said, in a game you can choose whether your AI has to follow physics or not. It is easy to make a non-physical car that can turn instantaneously. When you do that, a P-controller works just fine. As soon as you make it follow physics, which adds time delay between input and response, then you have to have the I & D terms, otherwise your car will be unstable. In video games it’s very common for cameras to try to follow something (like your avatar) smoothly using a P controller, they are a good example of a very common bit of software that has no delay - they can follow and turn without being subject to physics, and thus they generally don’t need the I & D terms of a PID controller.

Re: PID Controller Explainer (2022)

#32

PID controllers are one way to control systems described by differential equations. Given a certain desired value of the solution they can be used to force the dynamics to converge towards that value. For certain types mostly linear equations they are the optimal way to achieve this. I have no idea why, but the topic is almost never presented that way. Instead people talk about valves and pistons and whatsoever, but…

The integral term handles an unknown (or unmodeled) additive error. So in that sense, you don't have the differential equation and you still apply PID.

Re: PID Controller Explainer (2022)

#35

If you study linear control theory and you can characterize the dynamics of the system you're trying to control, you can just solve the differential equations analytically with a Laplace transform* and write down the proper values of the coefficients instead of searching for them. *or Z transform if the system is discrete Furthermore, the equations will tell you whether you even need the "I" and "D" parts of PID.

Yup you can even make PI^mD^n controllers... the challenge comes in the linearization.... recently we struggled with the backlash in a gearbox... with a long chain of small backlashes... we estimated the state of every pair... treated as an inertial system with no K and a short travel until the next moment locked in after e.g. .1 to 2 degrees.

The higher level system (surgery robot) also had a closed loop so we didnt have to be perfect, but cleaning up gave higher bandwidth.

Re: PID Controller Explainer (2022)

#36
post #24
post #19

Earlier quoted context omitted.

Are you saying that a PID controller would not work in a system without time delay? Or in a system without time delay, a PID controller would function identically to a simpler controller (A proportional-only controller perhaps)? My understanding and experience has been that large time delays force less aggressive tuning of the controller. I've been meaning to experiment with model based controllers to try and improve…

I’m saying PID controllers are unnecessary and don’t help solve any problems if there’s no time delay (which can happen in software). The I and D terms are based on time, i.e. integrating/differentiating with respect to time, so talking about time delay is perhaps obvious, but it wasn’t obvious to me the first time I heard about PID controllers, and even in the article we’re commenting on, the problem statement isn’t…

I don't know that it's the time delay that's important, as much as unknown external forces acting on the system? If the problem was just that it took a known amount of time for the vehicle's angle to change, wouldn't we be able to compute open loop control solutions in advance?

Re: PID Controller Explainer (2022)

#37
post #3

In the ‘what is a PID controller’ section, it doesn’t mention time delay. PID controllers solve problems where there is a time delay in the system between inputs and corresponding outputs. If there is no time delay, then a PID controller won’t help. My favorite analogy is a suspension, like a car or mountain bike shock absorber. A PID controller is basically a unitless suspension system. P is like the spring, I is (s…

[deleted]

Re: PID Controller Explainer (2022)

#38
post #36
post #24

Earlier quoted context omitted.

I’m saying PID controllers are unnecessary and don’t help solve any problems if there’s no time delay (which can happen in software). The I and D terms are based on time, i.e. integrating/differentiating with respect to time, so talking about time delay is perhaps obvious, but it wasn’t obvious to me the first time I heard about PID controllers, and even in the article we’re commenting on, the problem statement isn’t…

I don't know that it's the time delay that's important, as much as unknown external forces acting on the system? If the problem was just that it took a known amount of time for the vehicle's angle to change, wouldn't we be able to compute open loop control solutions in advance?

Well if you have unknown external forces acting on the system, but the response to those forces is instantaneous, then a PID controller isn’t the right solution. A much simpler proportional controller with little to no tuning will do the entire job. Note that in a software system that uses discrete time-step samples, “instantaneous” means the system’s complete final response to the input is produced during the same time step that the input change was detected. If the response is produced more than 0 time steps later, then there is a delay.

On the other hand, even if you have known forces that take a known amount of time, a PID controller might be the right solution if the integrals you have to solve are unsolveable and/or just difficult. One problem with that idea is that it’s easy to get slightly wrong when complex physics is involved, and slightly wrong output can have unbounded catastrophically wrong consequences. You’d still want to monitor the inputs and responses, and so you’d end up with a PID controller even if you did try to pre-compute the solution.

However, vehicle steering does not take a known amount of time to complete, it takes an unknown amount of time, and there are many dimensions and variables. So, yes implicitly in PID controller land, you have a good point in the sense that part of the idea is that the inputs and response times are unknown. If the inputs were known and the solution was exactly computable and the exact answer was reliable, then you could use some kind of pre-integrator instead of a PID controller. But, I think it’s still fair to say that time delay is the main cause of the problem that PID controllers are designed to solve, because unknown inputs without time delays are not PID controller problems.

Re: PID Controller Explainer (2022)

#39
post #27

Earlier quoted context omitted.

All physical systems have time delay, but software doesn’t necessarily. I bumped into PID controllers writing software for video games where I had the option to not have a time delay in the system, if I wanted to do something less physically realistic. In a game, you can (and I often did) use a proportional-only controller for certain things. Then I got surprised when that didn’t work, after a time delay was introduc…

> but software doesn’t necessarily. Is this true? I mean the delay may be inconsiderable but there is a delay, right?

not necessarily. feedforward path delay can be zero. typical mistake done while modeling feedback systems in SW.
Post reply on HN