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..
The input variables was simple angle and distance.
Fuzzy sets for inputs:
Angel to obstacle:
Distance to obstacle:
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..
I will improve some parameters of the controller and optimize it a little before I try It on my balancing robot..