A PID controller 'gradually adjusts things'. Is it fuzzy?
PID controllers are used when you fully understand the system, and you can properly model it. Robots are very complex machines, and you may not have the time/skills to write the differential equations needed to model it. A fuzzy algorithm is a type of 'fudged' PID controller, where it works 'good enough'. I'd say fuzzy logic is a sub-class of PID.
While you can use fuzzy logic to make a PID controller, it is not a sub-class of PIDs. A PID controller is a feedback system that uses logic to make decisions. The logic can be conventional boolean logic or you could use fuzzy logic to make the same decision.
Conventional boolean logic is actually a subset of fuzzy logic. In conventional logic you ask if something is true or false. In fuzzy logic you deal with how true or how false something is. Take politicians for example (since everyone hates politicians
), you don't ask if what they are saying is true, you ask how much truth is in their statement.
Many people think fuzzy logic's primary use is for imprecise applications. In actuality it can be used even in extremely precise applications. Its biggest advantage is that since the logic is continuous you can use it to make complex decisions simpler.
Take driving a car as an example. You want the car to drive the speed limit, 65 mph. Your controls are the gas and the brakes. The feedback is the speedometer.
In conventional logic you, when asked "Is the car going too fast" the answer would be "Yes" at 66 mph and no at 65 mph. When asked "Is the car going too slow" the answer would be "Yes" at 64 mph and no at 65 mph. Since it's an all or nothing deal, you would step on the gas at 64 mph and the brakes at 66 mph. (If you were to drive with someone who did that you would probably be suing them for whiplash
In fuzzy logic, when asked the same questions, you get a gradually changing range of possible responses. You might get answers like this:
Is the car going too fast?
<= 65 mph = no
66 mph = not really
70 = a little bit
75 = yes
125 = YES!
This allows for a much finer degree of control.
Now I know that we can do a lot more with conventional logic using more complex statements, but this illustrates the basic difference between the two. In real life, almost all logic we use is fuzzy logic. Fuzzy logic can give you a much finer degree of control with simpler logic statements. In programming choosing between a simple fuzzy statement or a complex boolean one can depend on many things specific to a given application. You need to consider code size, variable size, computational complexity, etc. Fuzzy logic can be an extremely valuable tool but is not the only solution, you should weight the pros and cons of any solution you wish to implement.
P.S. An analogy to the fuzzy logic vs boolean logic would be the difference between the Sharp GP2D12 IR Range finder and the GP2D15. (Comparison guide here
) The GP2D12 gives a continuously variable value between 10 and 80 cm, the GP2D15 gives a boolean output based on a fixed 24cm range. If all you need is a simple answer if an object is closer than about 24cm, then the GP2D15 is an acceptable sensor. The GP2D12 though can give you much more information if you choose to use it and can be used for a lot more things.