Using fuzzy logic (Balancing robot for dummies)

I would like to go one step further with the Balancing robots for dummies project and implement fuzzy logic on it.

More info about Balancing robot for dummies

And 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..

I will improve some parameters of the controller and optimize it a little before I try It on my balancing robot..

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

I have added a view of the fuzzy controller input variables and output as it could look if you had a GUI to a future fuzzy controller in arduino..

You can see the updated one here

Hi Patrick,

I really enjoyed the work that You and Kas did on the balancing robot.

My "balancing robot" is working quit well with the Kas PID (using encoders).

the only problem I can see is that the initial position (when the sensors are zeroed) does affect a lot the behaviour of the robot.

Is there any way to fix it ?

Kas said that the initial position is not so important because of the feedback of the encoders, but my expirience is different.

Any idea?

Are You working on a "fuzzy PID" ?

Is there any post where to continue Kas discussion?

Bye,

Prof

prof_jazz:
the only problem I can see is that the initial position (when the sensors are zeroed) does affect a lot the behaviour of the robot.

Is there any way to fix it ?

Kas said that the initial position is not so important because of the feedback of the encoders, but my expirience is different.

Yes, I have the same question, I don't see how the encoder based solution can help with self calibration as it doesn't adjust the setpoint.

I'm sorry for my late response but I have been away working so my bot has been standing a while but now I will take it up again. I will rewrite the hole PID part for my bot and also give it two separate PID controls for each motor that will try to keep a exact speed coming from a fuzzy logic control. Check my blog or here for updates..