Fuzzy Logic
description
Transcript of Fuzzy Logic
![Page 1: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/1.jpg)
Fuzzy Fuzzy LogicLogic
![Page 2: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/2.jpg)
Priyaranga Koswatta
• Mundhenk and Itti, 2007
![Page 3: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/3.jpg)
• Advantages of Fuzzy Controllers
• Minimal mathematical formulation
• Can easily design with human intuition
• Smoother controlling
• Faster response
![Page 4: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/4.jpg)
Agenda
• General Definition• Applications• Formal Definitions• Operations• Rules• Fuzzy Air Conditioner• Controller Structure
![Page 5: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/5.jpg)
General Definition
Fuzzy Logic - 1965 Lotfi Zadeh, U.C. Berkeley
• superset of conventional (Boolean) logic that has been extended to handle the concept of partial truth
• central notion of fuzzy systems is that truth values (in fuzzy logic) or membership values (in fuzzy sets) are indicated by a value on the range [0.0, 1.0], with 0.0 representing absolute Falseness and 1.0 representing absolute Truth.
• deals with real world vagueness
![Page 6: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/6.jpg)
![Page 7: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/7.jpg)
Applications
• ABS Brakes
• Expert Systems
• Control Units
• Bullet train between Tokyo and Osaka
• Video Cameras
• Automatic Transmissions
![Page 8: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/8.jpg)
Formal Definitions• Definition 1: Let X be some set of objects, with elements noted as x.
• X = {x}.
• Definition 2: A fuzzy set A in X is characterized by a membership function
mA(x) which maps each point in X onto the real interval [0.0,
1.0]. As mA(x) approaches 1.0, the "grade of membership" of x
in A increases.
• Definition 3: A is EMPTY iff for all x, mA(x) = 0.0.
• Definition 4: A = B iff for all x: mA(x) = mB(x) [or, mA = mB].
• Definition 5: mA' = 1 - mA.
• Definition 6: A is CONTAINED in B iff mA mB.
• Definition 7: C = A UNION B, where: mC(x) = MAX(mA(x), mB(x)).
• Definition 8: C = A INTERSECTION B where: mC(x) = MIN(mA(x), mB(x)).
![Page 9: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/9.jpg)
• http://www.seattlerobotics.org/Encoder/mar98/fuz/flindex.html
• http://www.cs.cmu.edu/Groups/AI/html/faqs/ai/fuzzy/part1/faq.html
• http://plato.stanford.edu/entries/logic-fuzzy/
![Page 10: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/10.jpg)
![Page 11: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/11.jpg)
![Page 12: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/12.jpg)
Operations
A B
A B A B A
![Page 13: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/13.jpg)
Example:Example:Using Fuzzy Using Fuzzy
Logic for a Line Logic for a Line Following RobotFollowing Robot
![Page 14: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/14.jpg)
Mechanical Design of a very Mechanical Design of a very inexpensive Line-Following Robotinexpensive Line-Following Robot
![Page 15: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/15.jpg)
Basic Motions of a Basic Motions of a Differential Drive robotDifferential Drive robot
![Page 16: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/16.jpg)
Input Membership FunctionsInput Membership Functions
![Page 17: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/17.jpg)
Sample Fuzzy Rule BaseSample Fuzzy Rule Base
![Page 18: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/18.jpg)
Output Membership FunctionOutput Membership Function
![Page 19: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/19.jpg)
![Page 20: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/20.jpg)
![Page 21: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/21.jpg)
![Page 22: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/22.jpg)
![Page 23: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/23.jpg)
Example:Example:Using Fuzzy Logic Using Fuzzy Logic
for an Obstacle for an Obstacle Avoiding RobotAvoiding Robot
![Page 24: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/24.jpg)
![Page 25: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/25.jpg)
![Page 26: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/26.jpg)
Very Basic Control Theory
Your speed towards a goal or away from
an object should be proportional to the
distance from it.
If you want to get to a goal in an optimal
amount of time you want to move quickly.
However, you need to decelerate as you
grow near the target so you can have more
control.
Speed distance-to-target∝
![Page 27: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/27.jpg)
Very Basic Control Theory In systems with momentum (i.e. the real world) we
have to worry about more complex acceleration and
deceleration.
We can overshoot our target or stop short!
You increase your rate of deceleration based on how
close you are to a goal or obstacle.
You can also integrate over the distance to a goal to
create a steady state.
This is the basic idea behind a PID controller.
Proportional Integral Derivative
The physical derivation of PID can be tricky, we will
avoid it for now.
However this part of an extremely interesting topic!
![Page 28: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/28.jpg)
IDEA!
Lets just hack a fuzzy controller together
and avoid some math.
The gods will curse us….
But if it works, that may be all that matters!
Derive rule of thumb ideas for speed
and direction
If I’m 6 meters from the obstacle, am I far from it?
![Page 29: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/29.jpg)
![Page 30: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/30.jpg)
Try some fuzzy rules…
Lets look at adjusting trajectory first then
we will look at speed…
If an obstacle is near and center, turn sharp
right or left.
If an obstacle is far and center, turn soft left
or right.
If an obstacle is near, turn slightly right or
left, just in case.
Etc…
![Page 31: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/31.jpg)
![Page 32: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/32.jpg)
![Page 33: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/33.jpg)
![Page 34: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/34.jpg)
![Page 35: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/35.jpg)
![Page 36: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/36.jpg)
![Page 37: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/37.jpg)
The robot works in continuous
time
The fuzzy rules should change slightly at
each time step.
We don’t want the robot to jerk to a new
trajectory too quickly. Smooth movements tend
to be better.
How often we need to update the controller is
dependant on how fast we are moving.
For instance: If we update the controller 30
times a second and we are moving < 1 kph then
movement will be smooth.
Ideally, the commands issued from the fuzzy
controller should create an equilibrium with the
observations.
![Page 38: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/38.jpg)
Our robot has momentum
We have somewhat implicitly integrated
the notion of momentum.
This is why we would slow down as we get
closer to an obstacle
What about more refined control of
speed and direction?
Use the derivative of speed and trajectory to
increase or decrease the rate of change.
Thus, if it seems like we are not turning fast
enough, then turn faster and visa versa.
![Page 39: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/39.jpg)
![Page 40: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/40.jpg)
![Page 41: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/41.jpg)
Controller Structure
• Fuzzification– Scales and maps input variables to fuzzy sets
• Inference Mechanism– Approximate reasoning– Deduces the control action
• Defuzzification– Convert fuzzy output values to control signals
![Page 42: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/42.jpg)
Rule Base
Air Temperature
• Set cold {50, 0, 0}• Set cool {65, 55, 45}• Set just right {70, 65, 60}• Set warm {85, 75, 65}• Set hot {, 90, 80}
Fan Speed
• Set stop {0, 0, 0}• Set slow {50, 30, 10}• Set medium {60, 50, 40}• Set fast {90, 70, 50}• Set blast {, 100, 80}
![Page 43: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/43.jpg)
Rules
Air Conditioning Controller Example:
• IF Cold then Stop
• If Cool then Slow
• If OK then Medium
• If Warm then Fast
• IF Hot then Blast
default:
The truth of any statement is a matter of degree
default:
The truth of any statement is a matter of degree
Membership function is a curve of the degree of truth of a given input value
Membership function is a curve of the degree of truth of a given input value
![Page 44: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/44.jpg)
Fuzzy Air Conditioner
Stop
Slow
Medium
Fast
Blast
0
10
20
30
40
50
60
70
80
90
100
0
1
45 50 55 60 65 70 75 80
0C
old
C
ool
85 90
Just
Rig
ht
W
arm
Hot
if Coldthen Stop
IF CoolthenSlow
If Just Rightthen
Medium
If WarmthenFast
If HotthenBlast
![Page 45: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/45.jpg)
Mapping Inputs to Outputs1
0
10
20
30
40
50
60
70
80
90
100
0
1
45 50 55 60 65 70 75 80
0
85 90
t
![Page 46: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/46.jpg)
EXAMPLE:EXAMPLE:
Using Fuzzy Logic Using Fuzzy Logic for a SWERVING for a SWERVING
ROBOTROBOT
![Page 47: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/47.jpg)
Motivating Example: Motivating Example: Swerving RobotSwerving Robot
![Page 48: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/48.jpg)
![Page 49: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/49.jpg)
![Page 50: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/50.jpg)
![Page 51: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/51.jpg)
![Page 52: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/52.jpg)
![Page 53: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/53.jpg)
![Page 54: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/54.jpg)
![Page 55: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/55.jpg)
![Page 56: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/56.jpg)
![Page 57: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/57.jpg)
![Page 58: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/58.jpg)
![Page 59: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/59.jpg)
![Page 60: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/60.jpg)
![Page 61: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/61.jpg)
![Page 62: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/62.jpg)
![Page 63: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/63.jpg)
![Page 64: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/64.jpg)
![Page 65: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/65.jpg)
![Page 66: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/66.jpg)
![Page 67: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/67.jpg)
![Page 68: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/68.jpg)
![Page 69: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/69.jpg)
![Page 70: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/70.jpg)
![Page 71: Fuzzy Logic](https://reader031.fdocuments.in/reader031/viewer/2022013011/56813fe7550346895daad4b6/html5/thumbnails/71.jpg)