My first robot was ussed fuzzy logic (even though I didn't realize it at the time).

Here is what I did.I had 2 Sharp IR range Finders and my goal was to get a differential dirverobot to wonder around with out hitting any thing. Sharp IR's read fromlow voltage at long distance to high voltage at short distance. So whatI did was mount two of them on my robot looking across the nose so thecrossed infront much like this picture:

So I fed the inverted value (which was now big for a long distanceand small for a short distance) to the motor speed for that side(left IR looks right and gives motor value to left motor) and shazam youhave a robot that steers away from objects. I added a little bit of offset sothat if an object was closer than x distance the motor would turn in reverseand it ran away from objects even better.

It was a simple bot that I programed in assembly on a pic controller.Personaly I don't recomend Pics any more because the arn't that powerfullas far as micro controllers go and development can only be done cheeply in assembly.

hmm, ur bot is interesting, by positioning in different angle and invert the signal into normalize condition which easy to be understand by all, well, i got what u mean, but basically how do u apply to fuzzy logic? how u obtain the signal changes in terms of resolution but not digital 1 or 0? is it with the aid of ADC? thx for sharing~

yea generally you would use ADC or some other kind of quantitative measuring process.Say you only have on and off for some kind of sensor. Well if you wanted to use fuzzy controll based on that,what you could do is to take a sample at a certain rate and average it out.

I wouldn't say it's hard at all to get any rate you want...all proccessors run at a given clock speed.there is such a thing as hard time constraints and soft time constraints but for our level generalysoft time constraints work fine. especialy if the resolution of your time constrainat is fairly small.Mine was purley reflexive robot with a small layer of subsumption so it wouldn't get caught in a corner.I left out the fact that I had a sensor looking forward for brevity but it determined if it was in a corner or not.So what the bassic code looked like was this:

Not exactly. I averaged out the converted readings which were effectively motor comands.So we just added the front sensor to both right and left sides....meaning if the way was clear both wheels went forward.But if there was a wall on the right, then the left sensor always slowed down the left wheel forcing a turn.

oic, so u did actually fuzzy using the value of IR to determine the rotational direction of ur motor? Is that possible for us to use random motion to apply in robot? which simply means we use the random function and create the random number, with some condition, it will behave randomly and fuzzy.?

Stictly speaking, kinda sorta? Admin what are your thoughts on this?my thought on this is you can have a random reaction built in but, part ofwhat fuzzy logic is is taking in continous values and using those values as akid of truth. for my robot i used the metric "is there a wall close by?" wellit's realative isn't it? so I made a function that gave a fuzzy answer to that question(through the use of an analog range finder and the adc) and used that to mold my motor schema.Have you read this by the way? http://www.societyofrobots.com/programming_fuzzy_logic.shtml

What you could do is come up with a fuzzy controller and put a "mood" modifier on it.So you take my robot and have 2 other fuzy components that affect it's performance, Decisivness, Spazziness.These could be randomly controlled variables but depending on Decisivness I could move up and down myvalue that switches the direction, eg high decisivness = turn motor backwards further as opposed to shorter, so it givesthe apearance of makeing the decission to turn away form a wall quicker. Spazziness could be the scaling of how fastthe motor goes from 0 to 255. the spazzier it gets the closser to full on and full off the robot gets. the further from spazziness the slower it accelerates.

So then I just randomly generate it's Decisivness and Spazziness. But that doesn't seem very interesting so lets make it's decisiveness depend on how many corners it it falls into because the more decisive it is the less corners it will get into.

I guess my explination is hard to understand if you don't understand my robots motor schema in the first place but....well....i've got class in 10min.

So bonomonod, your example is not fuzzy logic - it is binary. Its either true, or false. It is either between 1000 and 2000, or it isnt. There is no 'close to but not actually inbetween' rule.

Fuzzy logic however is not binary. Its kinda like me shining light in your eyes. The brighter the light, the more you cover your eyes. A little light and you do nothing. Extreme light and you cover your eyes with your hands. But in between, you squint. The amount you cover your eyes is equal to the amount of light in your eyes. Its that fuzzy 'brightness level' that makes it fuzzy logic.

In Jesse's example, he used motor speed instead of squinting. Fuzzy logic for robots is a sort of proportional controller. Basically set the sensor value to the motor speed (modified by some constant).

Fuzzy logic is also great for combining multiple sensors, as Jesse did. Instead of devising some weird binary true/false table, what fuzzy logic does it just lets you add sensor values together (each modified by different tweakable constants).

Good Old Fashioned Artificial Intelligence is not fun....there's too much work involved and not enough of the clever.Ofcouse it has it's place....If you are working on having your robot not drive into a wall you can put a software safty check in the lower levels of your firmware, and make it so the AI can disable that feature for very controlled movement untill it's clear of the danger.

Agreed. I always have an emergency backup function in my code, saying if 'wall is too close, forget everything and back away.'

But fuzzy logic can give higher priority to certain sensors than others . . . or even exponential gain priority. The closer the wall is, the more dominating that sensor becomes in the equation . . . to the point the others are insignificant in decision making . . .

oic, i got wat u mean already, for mine example, its like behavior, whether it is behave like that or not which false under binary 0 or 1. as for fuzzy logic, we are talking about the value in between 0 and 1. erm, now i ask, for light detection, we can actually measure the rc constant as constructed rc network to determine the rc constant value. as the cds resistance differs, the t=rc will be changing, with the changing of the t, is that possible for us to apply fuzzy logic for that though?