Fuzzy logic membership function in C

Anon picture Anon · Nov 23, 2009 · Viewed 10.6k times · Source

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.

Answer

10ToedSloth picture 10ToedSloth · Nov 23, 2009

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.