views:

442

answers:

2

Hi, I'm trying to implement a fuzzy logic membership function in C for a hobby robotics project but I'm not quite sure how to start.

I have inputs about objects near a point, such as distance or which directions are clear/obstructed, and I want to map how strongly these inputs belong to sets like very near, near, far, very far. Does anyone have a tip on how to start? Thanks.

+2  A: 

I'm not expert with fuzzy logic, but according to my basic understanding, you could start by deciding what distances would constitute near (say 10 cm) far (say 1m), then you use probabilities to fill in the range in between (so 55cm might be 50% near, 50% far). Then you do something similar for your other properties, and combine the probabilities associated with each property with more probabilities.

Do you have a good reference for designing fuzzy controls?

I suppose you could start here. I think they at least describe simple fuzzification and defuzzification routines.

Suppressingfire
+3  A: 

Disclaimer: I've never implemented a fuzzy controller (I've only ever used PI or PID in real-life) and control class was 10 years ago.

Here's an presentation demonstrating moving towards a target using distance and angle for inputs and power as the output. FuzzyTech's Example positioning a crane
This just presents the topic and theory i.e. no code.

Best source is probably one of the robotics groups e.g Seattle Robotic Society fuzzy logic tutorial it is technical ... and long.

if you can access technical journals then search Google scholar for "fuzzy logic" "path planning" robotics

if you're looking for some ideas on how to implement fuzzy logic then perhaps a Application Note from one of the microchip manufactures will get you started e.g Microchip's paper on Airflow control or servo control. I know it's not Arduino but Microchips papers are usually very clearly presented.

And finally an example in c++ its probably more complex than you're looking for. Free fuzzy logic library Good luck.

10ToedSloth