Loading...
Logo
Processing Forum

Fuzzy logic

in Share your Work  •  2 years ago  
I have now successfully created a fuzzy logic controller using Processing.

My test case was getting an object avoiding obstacles when given order to move to specific target..

You can try it here

The input variables was simple angle and distance. 

Fuzzy sets for inputs:

Angel to obstacle:
smallAngle
mediumAngle
largeAngle

Distance to obstacle:
smallDist
mediumDist
largeDist

Instead of using linguistic rules I used something called FAMM(Fuzzy associative memory matrix) and that only work in a 2 input, 1 output scenario.

   smallAngle   mediumAngle   largeAngle
smallDist   90°   55°   35°
mediumDist   55°   35°   25°
largeDist   35°   25°   5°

Then defuzzification is done true weighting the relationships in the FAMM..

Are there any one how have experience of Fuzzy logic and are some other ones interested in this topic?

I would like to make a controller that can handle more then 2 inputs..

Replies(5)

Re: Fuzzy logic

2 years ago
Nice application!
But that's not a programming question. Not a question, even.
So I change its type and move it to exhibition section.

Re: Fuzzy logic

2 years ago
Very good. I compared it with an other pathfinder program http://www.robotacid.com/PBeta/AILibrary/Pathfinder/bfs_demo/index.html and it seems that your program is a (allot?!) more efficient. It feels really analog.

Re: Re: Fuzzy logic

2 years ago
@dipperson
I still need to clean up the code a lot and also tweak the parameters some more.. Nice that you liked it

Re: Fuzzy logic

2 years ago
I have updated it now so you also see what the fuzzy logic controller are doing..

Re: Fuzzy logic

1 year ago
How you handle more than two inputs is to multi stage with more than one FAM.

FAM 1 has two inputs and outputs its result which is combined with another input in FAM 2 to output the final result.

It sounds clunky but with traditional sets of fuzz rules you increases the number of rules to the power of the number of inputs. With multi staging FAMs adding a new input just adds another FAM, a lot less processing and memory usage.