Sistemi per il Governo dei Robot
Silvia Rossi - Lezione 14
mercoledì 28 novembre 12
ARCHITETTURE REATTIVE
FUZZY
mercoledì 28 novembre 12
Behavioral Coordination: Fuzzy
Lofti Zadeh
mercoledì 28 novembre 12
Maze Problem
Could use pfields Corridor following?
Wall following?
mercoledì 28 novembre 12
Or...
3 behaviors, one for each sensor Combine with rules
mercoledì 28 novembre 12
Maze Problem
If left sensor is too close and right sensor is too far then
turn right.
If left-sensor is just right and forward sensor is too far then drive straight.
If left-sensor is too far and
forward sensor is too far then turn left.
If forward sensor is close then turn right sharply.
mercoledì 28 novembre 12
Maze Problem
If left sensor is too close and right sensor is too far then
turn right.
If left-sensor is just right and forward sensor is too far then drive straight.
If left-sensor is too far and
forward sensor is too far then turn left.
If forward sensor is close then turn right sharply.
mercoledì 28 novembre 12
Not Regular “Production” Rules
If left sensor is too close and right sensor is too far then
turn right.
If left-sensor is just right and forward sensor is too far then drive straight.
If left-sensor is too far and
forward sensor is too far then turn left.
If forward sensor is close then turn right sharply.
Imprecise inputs and outputs (fuzzy)
ALL rules execute, not just the first one that is “true”
The “truth” of the output is an area under a curve
The “area” is like a proportional vote for an outcome
mercoledì 28 novembre 12
Not Regular “Production” Rules
Imprecise inputs and outputs (fuzzy)
ALL rules execute, not just the first one that is “true”
The “truth” of the output is an area under a curve
The “area” is like a proportional vote for an outcome
mercoledì 28 novembre 12
So How To Do This?
If left sensor is too close and right sensor is too far then
turn right.
If left-sensor is just right and forward sensor is too far then drive straight.
If left-sensor is too far and
forward sensor is too far then turn left.
If forward sensor is close then turn right sharply.
mercoledì 28 novembre 12
General Procedure
1. Fuzzification: Perceptual Schema generates fuzzy inputs for the rules
Have a set of INPUT SETS that convert sensor reading to a fuzzi value or strength
mercoledì 28 novembre 12
Fuzzification
Have pre-defined fuzzy sets which are like look up tables:
x-axis is the sensed reading
y-axis is the membership or strength in EACH set
mercoledì 28 novembre 12
Fuzzification (up, left)
Reading: 320
mercoledì 28 novembre 12
Fuzzification (up, left)
Reading: 320
mercoledì 28 novembre 12
Fuzzification (up, left)
Reading: 320
mercoledì 28 novembre 12
Fuzzification (up, left)
Reading: 320
mercoledì 28 novembre 12
Membership Function
PROXIMITY Membership function for Sensor Left 320 is:
(Mc=0.66, Mr=0.33, Mf=0.00)
mercoledì 28 novembre 12
Left-Sensor
Reading is 320, Fuzzification is (Mc=0.66, Mr=0.33, Mf=0.00)
If left sensor is too close (0.66) and right sensor is too far then turn right.
If left-sensor is just right (0.33) and forward sensor is too far then drive straight.
If left-sensor is too far (0.00) and forward sensor is too far then turn left.
If forward sensor is close then turn right sharply.
mercoledì 28 novembre 12
Other Sensors (iterate)
Forward Sensor Membership function for 640 is:
(Mc=0.00, Mr=1.00, Mf=0.00)
Sensor-Rigt Membership function for 1024 is:
(Mc=0.00, Mr=0.00, Mf=1.00)
mercoledì 28 novembre 12
Fuzzification is Complete
Left-sensor: (Mc=0.66, Mr=0.33, Mf=0.00)
Forward-sensor: (Mc=0.00, Mr=1.00, Mf=0.00) Right-sensor: (Mc=0.00, Mr=0.00, Mf=1.00)
If left sensor is too close (0.66) and right sensor is too far (1.00) then turn right.
If left-sensor is just right (0.33) and forward sensor is too far (0.33 for the ex.) then drive straight.
If left-sensor is too far (0.00) and forward sensor is too (0.00) far then turn left.
If forward sensor is close (0.00) then turn right sharply.
mercoledì 28 novembre 12
Next Step
2. Apply fuzzy rules (Fuzzy Rules, by motor schema)
Get the strength of each rule which is called the fuzzy output The strength of the IF is the strength of the output
If left sensor is too close (0.66) and right sensor is too far (1.00) then turn right.
If left-sensor is just right (0.33) and forward sensor is too far (0.33 for the ex.) then drive straight.
If left-sensor is too far (0.00) and forward sensor is too (0.00) far then turn left.
If forward sensor is close (0.00) then turn right sharply.
mercoledì 28 novembre 12
Evaluating Rules
If left sensor is too close (0.66) and right sensor is too far (1.00) then turn right.
If left-sensor is just right (0.33) and forward sensor is too far (0.33 for the ex.) then
drive straight.
If left-sensor is too far (0.00) and forward sensor is too (0.00) far then turn left.
If forward sensor is close (0.00) then turn right sharply.
mercoledì 28 novembre 12
Boolean Operators
A AND B is minimum(A, B) A OR B is maximum(A, B) NOT A is 1-A
mercoledì 28 novembre 12
Evaluating Rules
If left sensor is too close (0.66) and right sensor is too far (1.00) then turn right.
If left-sensor is just right (0.33) and forward sensor is too far (0.33 for the ex.) then
drive straight.
If left-sensor is too far (0.00) and forward sensor is too (0.00) far then turn left.
If forward sensor is close (0.00) then turn right sharply.
mercoledì 28 novembre 12
Final Step
If left sensor is too close (0.66) and right sensor is too far (1.00) then turn right.
If left-sensor is just right (0.33) and forward sensor is too far (0.33 for the ex.) then
drive straight.
If left-sensor is too far (0.00) and forward sensor is too (0.00) far then turn left.
If forward sensor is close (0.00) then turn right sharply.
Combine fuzzy outputs (Defuzzification)
Each motor schema or behavior produces fuzzy output, but this has to be converted to a single number
mercoledì 28 novembre 12
Defuzzification
As with fuzzification, defuzzification relies on a fuzzy set that was prevously determined
mercoledì 28 novembre 12
Defuzzification (right, down)
“Opposite” of fuzzification
mercoledì 28 novembre 12
Defuzzification (right, down)
“Opposite” of fuzzification
mercoledì 28 novembre 12
Defuzzification (right, down)
“Opposite” of fuzzification
mercoledì 28 novembre 12
Defuzzification (right, down)
“Opposite” of fuzzification
mercoledì 28 novembre 12
Hedges
If left sensor is too close (0.66) and right sensor is too far (1.00) then turn right.
If left-sensor is just right (0.33) and forward sensor is too far (0.33 for the ex.) then
drive straight.
If left-sensor is too far (0.00) and forward sensor is too (0.00) far then turn left.
If forward sensor is close (0.00) then turn right sharply.
mercoledì 28 novembre 12
Hedges
Hedges move the set over
If left sensor is too close (0.66) and right sensor is too far (1.00) then turn right.
If left-sensor is just right (0.33) and forward sensor is too far (0.33 for the ex.) then drive straight.
If left-sensor is too far (0.00)
and forward sensor is too (0.00) far then turn left.
If forward sensor is close (0.00) then turn right sharply.
mercoledì 28 novembre 12
Defuzzification (right, down)
Result is an area of the fuzziness of the output Find the centroid
mercoledì 28 novembre 12
Defuzzification: Take the Centroid of Blended Area
mercoledì 28 novembre 12
Alternative: Centroid of Largest Area
mercoledì 28 novembre 12
Weighted Means
mercoledì 28 novembre 12
Recap
Perceptual schema == fuzzification
Input sets can be schema knowledge
Membership function for the fuzzy variable TURN
mercoledì 28 novembre 12
Recap
Motor schema == fuzzy rules and defuzzification Output set can be schema knowledge
mercoledì 28 novembre 12
Fuzzy Logic
Input sets and output sets may look similar
because we tend to use trapezoids and between 3 to 5 sets, but they are different!
Sets can have many shapes, can be learned, do not have to be symmetric
The membership function is usually 0 to 1 (normalized) for convenience
There’s a huge body of work - this is most simple level
mercoledì 28 novembre 12
Be aware of Problems
Consider the output of an avoid ...
And where would the centroid be?
mercoledì 28 novembre 12
Be aware of Problems
Consider the output of an avoid ...
And where would the centroid be?
Consider the Centroid of Largest Area (CLA)
mercoledì 28 novembre 12
Example
The Robot1 is in a race agaist another robot2.
During the race, Robot1 wants to stay ahead of
robot2, but must not run into the wall that is at the end of the track.
mercoledì 28 novembre 12
Example
The Robot1 is in a race agaist another robot2.
During the race, Robot1 wants to stay ahead of
robot2, but must not run into the wall that is at the end of the track.
The wall is 4 feet away.
The robot2 is 5 feet away
Robot1 is currently moving at 8 ft/s
Une Robot1 Fuzzy rules to determine how fast Robbie Shold go
The sets and rules are given a priori
mercoledì 28 novembre 12
Robot1’s Rules
if the WALL is CLOSE and SPEED is FAST,
then SPEED is SLOW
If robot2 is NOT FAR,
then SPEED is FAST
mercoledì 28 novembre 12
Mfast = 0.8
mercoledì 28 novembre 12
Mclose = 0.5
mercoledì 28 novembre 12
Robot1’s Rules
if WALL is CLOSE (Mclose = 0.5) and SPEED is FAST (Mfast = 0.8),
then SPEED is SLOW
If robot2 is NOT FAR (Mfar = 0.375),
then SPEED is FAST
mercoledì 28 novembre 12
Robot1’s Rules
min(0.5, 0.8) Mslow = 0.5
NOT(1 - 0.375) Mfast = 0.625
mercoledì 28 novembre 12
Defuzzification
mercoledì 28 novembre 12
Defuzzification
5.62
mercoledì 28 novembre 12
Design a Reactive Behavioral System
mercoledì 28 novembre 12