go away spammer

Author Topic: ask help about fuzzy logic  (Read 8577 times)

0 Members and 1 Guest are viewing this topic.

Offline knossos

  • Robot Overlord
  • ****
  • Posts: 278
  • Helpful? 14
Re: ask help about fuzzy logic
« Reply #30 on: September 30, 2010, 02:59:34 PM »
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.
[/quote]

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.
"Never regret thy fall,
O Icarus of the fearless flight
For the greatest tragedy of them all
Is never to feel the burning light."
 
— Oscar Wilde

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: ask help about fuzzy logic
« Reply #31 on: September 30, 2010, 03:54:51 PM »
Hi,

I'd like to just add a bit to knossos' descriptions.
One of the important differences between a regular PID and  a Fuzzy Logic (FL) implemantation is that the FL uses what is called Linguistic Variables to input the variable factors (like eg... Hot, Warm, Tempered, Chilly, Cold and Freezing). This is far easier for humans, as this is in synch with how we think.
Then there's a lot more stages to take the data through, to make it useful, but I'll rather link you to a well written primer, rather than more or less repeat the stuff.
And just add to the ones saying there's absolutely nothing fuzzy about FL, it's very precise and far easier to tune a loop than when using a PID regulator.

The Fuzzy Logic primer - read it, then read it again, put it aside for a while and reread it.
Then program.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline knossos

  • Robot Overlord
  • ****
  • Posts: 278
  • Helpful? 14
Re: ask help about fuzzy logic
« Reply #32 on: September 30, 2010, 06:27:13 PM »
That's a great link, I had read it before but forgot about it.  Thanks a lot Soeren!
"Never regret thy fall,
O Icarus of the fearless flight
For the greatest tragedy of them all
Is never to feel the burning light."
 
— Oscar Wilde

 


Get Your Ad Here