fuzzy logic inference for pong (flip) brandon cook & sophia mitchell undergraduate students,...

44
Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA Dr. Kelly Cohen Associate Professor, Department of Aerospace Engineering, Associate Fellow AIAA Sponsored by: NSF Type 1 STEP Grant, Grant ID No.: DUE- 0756921 1

Upload: gertrude-harrell

Post on 17-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

1

Fuzzy Logic Inference for Pong (FLIP)

Brandon Cook & Sophia MitchellUndergraduate Students, Department of Aerospace Engineering,

Student Members AIAA

Dr. Kelly CohenAssociate Professor, Department of Aerospace Engineering, Associate Fellow AIAA

Sponsored by: NSF Type 1 STEP Grant, Grant ID No.: DUE-0756921

Page 2: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

2

Outline

• Project Goal & Objectives• Project Research Tasks• Introduction to Fuzzy Logic• Results• Future Work

Page 3: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

3

Project Goals• Test the effectiveness of a fuzzy logic based robot at

emulating human like reasoning in a competitive environment

• Grasp understanding of intelligent robotics while enhancing capabilities for real world applications.

[5]

Page 4: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

4

Overall Objectives

• Create PONG simulation in MATLAB– Singles• Familiarize with gaming strategies• Cascading Fuzzy Logic

– Doubles• Collaborative robotics

[6]

Page 5: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

5

Project Research Tasks

• Conduct literature survey • Develop rules for the

Fuzzy Inference System (FIS)• Create an “Intelligent Team” of two autonomous agents• Successfully implement rotation DOF (Degree of

Freedom) & enhanced bounce characteristics• Test the effectiveness of the FIS• Test the effectiveness of the “Intelligent Team”

[7]

Page 6: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

6

Fuzzy Logic

• Allows classification of variables for more human-like reasoning

• Utilizes linguistic reasoning• Common terms• Inputs• Rules• Outputs• Membership Function• Fuzzy Inference System (FIS)

Page 7: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

7

Fuzzy Inference System

[3]

Page 8: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

8

Fuzzy Decision Making

Page 9: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

9

Page 10: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

10

Assumptions & Constraints

• Confined paddle movement and rotation speed

• Varying difficulty not available (e.g. easy, medium, hard)

• No physical system used– In real world scenario robotics would be equipped with

sensors to quantify ball speed, trajectory pattern, etc.– Must imitate how a human perceives the game with

eyesight• Supply qualitative data to Fuzzy paddle in real-time

Page 11: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

11

Singles Configuration

Page 12: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

12

Fuzzy Paddle

Page 13: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

13

Cascading Fuzzy Logic• Output from one FIS becomes input for subsequent FIS

Score Difference

Ball Speed

Opponent Position

Opponent Inertia

Where to hit the ball:Top, Middle, Bottom

Game Type:Offensive, Defensive

My Position:Top, Middle, Bottom

Desired Paddle Angle to Score on Opponent

Page 14: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

14

Open FISInertia

Position

Open

BE – Very Bottom, B – Bottom, M – Middle, T – Top, TE – Very TopGD – Going Down, S – Stationary, GU – Going UpVB – Very Bottom, B – Bottom, M – Middle, T – Top, VT – Very Top

15 Rules

Page 15: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

15

Open: Rule Set1. If (Position is VB) and (Inertia is GD) then (Open is M)2. If (Position is VB) and (Inertia is S) then (Open is T)3. If (Position is VB) and (Inertia is GU) then (Open is TE)4. If (Position is B) and (Inertia is GD) then (Open is T)5. If (Position is B) and (Inertia is GS) then (Open is T)6. If (Position is B) and (Inertia is GU) then (Open is TE)7. If (Position is M) and (Inertia is GD) then (Open is TE)8. If (Position is M) and (Inertia is S) then (Open is TE)9. If (Position is M) and (Inertia is GU) then (Open is BE)10. If (Position is T) and (Inertia is GD) then (Open is BE)11. If (Position is T) and (Inertia is S) then (Open is BE)12. If (Position is T) and (Inertia is GU) then (Open is B)13. If (Position is VT) and (Inertia is GD) then (Open is BE)14. If (Position is VT) and (Inertia is S) then (Open is B)15. If (Position is VT) and (Inertia is GU) then (Open is M)

Page 16: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

16

Game Type FISScore

Ball Speed

Game Type

6 Rules

Page 17: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

17

Strategy FIS

Game

Strategy

Open

My Position

VB: Very Bottom, B: Bottom, C: Center, T: Top, VT: Very TopBE Very :Bottom, B: Bottom, M: Middle, T: Top, TE: Very Top

25 Rules

Page 18: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

18

Movement FIS

Movement

Angle Rotate

Distance

Fbelow: Far Below, Cbelow: Close Below, OnT: On Target, Cabove: Close Above, Fabove: Far Above , FCW: Far Clockwise, NCW: Near Clockwise, OnT: On Target, NCCW: Near Counter Clockwise, FCCW: Far Counter Clockwise, Dfast: Down Fast, Dslow: Down Slow, None: No Movement, Uslow: Up Slow, Ufast: Up Fast, CWFast: Clockwise Fast, CWSlow: Clockwise Slow, None: No Rotation, CCWSlow: CounterClockwise Slow, CCW Fast: CounterClockwise Fast

25 Rules

Page 19: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

19

Results

Page 20: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

20

Simulation: Human vs. Robot

Page 21: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

21

Results: Human vs. Robot

Conclusions:• Highly difficult to defeat the Fuzzy

controller• Rules are sufficient for defeating a human

player• Can use similar logic and methodology to

produce doubles game

Page 22: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

22

Results: Robot vs. Robot

Conclusions:• Each “volley” lasted nearly 5 minutes• Fuzzy controllers are equally matched• Highly effective at calculating the ball

trajectory to find intersection point

Page 23: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

23

Doubles Configuration

NOTE: FLIP 1 = Back Paddle, FLIP 2 = Front Paddle

Page 24: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

24

Human Collaboration

• Inspired by 2010 Australian Open tennis matches: Federer and Mirka

• Player’s positioning showed their role in the game– Front: Offensive– Back: Defensive

• Cover as much of the court as possible by staggering• Front player used hand signals to notify partner play or

movement– To mimic this, the front paddle makes final decision

to who goes for the ball

Page 25: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

25

Collaborative Reasoning

Page 26: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

26

Collaborative Reasoning: Part 1

• FLIP 2 calculates POI (Point Of Intersection)• FLIP 2 recognizes its own court position• FLIP 1 sends FLIP 2 its court position and POI• FLIP 2 decides who

goes for the ball– Closest to POI

• FLIP 2 determinesgame type

Page 27: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

27

Collaborative Reasoning: Part 2.1

• Option 1: FLIP 1 goes for the ball• FLIP 2 must avoid so doesn’t block the ball after

hit by FLIP 1• Recognizes FLIP 1

Angle & Position

Page 28: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

28

Collaborative Reasoning: Part 2.2

• Option 2: FLIP 2 goes for the ball• Calculates both opponents Position and Inertia• Finds open section of the court• Finds own position,

rotation, open portion of court, and game type

• Moves and rotates to intercept ball

Page 29: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

29

Collaborative Reasoning: Part 3

• FLIP 1:• Calculates its POI• Recognizes own position• Calculates how far it needs to translate to

intercept the ball

Page 30: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

30

Collaborative Reasoning: Part 4.1

• Option 1: FLIP 1 goes for the ball– FLIP 1 uses same logic as previously described to

find optimal location and strategy to hit the ball

Page 31: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

31

Collaborative Reasoning: Part 4.2

• Option 2: FLIP 2 goes for the ball– FLIP 2 tells FLIP 1 it needs to be backed up

(extremely defensive)• Move to normal POI

– FLIP 2 tells FLIP 1 it doesn’tneed backed up• Move to opposite side

of the court

Page 32: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

32Open FIS

Inertia 2

Open

Inertia 1

Position 1

Position 1

GD: Going Down, S: Stationary, GU: Going UpVB: Very Bottom, B: Bottom, C: Center, T: Top, VT: Very TopBE Very :Bottom, B: Bottom, M: Middle, T: Top, TE: Very Top

225 Rules

Page 33: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

33

Avoidance FISBack Paddle Angle

Back Paddle POI

Target Position

RD: Rotated Down (CW), OnT: On Target, RU: Rotated Up (CCW)FB: Very Bottom, B: Bottom, OnT: Center, A: Top, FA: Very TopBE Very :Bottom, B: Bottom, M: Middle, T: Top, TE: Very Top

20 Rules

Page 34: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

34

Results

Page 35: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

35

Simulation: Humans vs. Robots

Page 36: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

36

Results: Humans vs. Robots

Methods:• Two veteran “gamers” selected to test the effectiveness of the

Fuzzy LogicConclusions:• Fuzzy team is superb at collaborating effectively to defeat the

opposing team• Highly effective at communicating in a time-critical manner• Excellent at making adjustments to the infinite gameplay

scenarios to defeat opponent

Page 37: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

37

Simulation: Robots vs. Robots

Page 38: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

38

Results: Robots vs. Robots

Methods:• Ran simulation for 30 servesConclusions:• Each “volley” lasted nearly 3 minutes• Intelligent teams are equally matched• Highly effective at calculating the ball trajectory to find

intersection point• Very challenging to score a point on the fuzzy team

Page 39: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

39

Accomplishments• Rotational DOF added to human and Fuzzy paddles• Enhanced bounce characteristic– No longer a “convex paddle”– Angle of Incidence: allows for more intuitive ball control

• Ability to rotate and translate simultaneously– Less delay between commands and response– Allows Fuzzy paddle to rotate fully to desired output

• New Fuzzy Rules

Page 40: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

Conclusions

• Fuzzy logic is an effective tool for collaboration between autonomous agents in a time-critical spatio-temporal environment

• A completely autonomous, robotic, intelligent team (or swarm) would be very useful in applications including:– Space robotics– Celestial body exploration and colonization– Unmanned Aerial Vehicles (UAVs)– Homeland security– Disaster relief programs

40

[8]

Page 41: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

41

Future Work• Include game difficulty– Easy, Medium, Hard

• Modify FLIP’s FIS for extreme offensive moves capability– Passing from back to front paddle– Speeding up ball between paddles– Both go for ball with different paddle angles

• Use knowledge gained from research to create a real-life intelligent swarm of robotics

• Incorporate Type II Fuzzy Logic for learning capabilities

Page 42: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

43

Acknowledgements

UC Academic Year – Research Experience for Undergraduates (AY-REU) Program

Sophia Mitchell (Base Pong Script)

Dr. Kelly Cohen

Page 43: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

References1. Kosko, Bart. Fuzzy Thinking: The New Science of Fuzzy Logic. New York: Hyperion, 1993. Print.2. Mendel, Jerry M., and Dongrui Wu. "Interval Type-2 Fuzzy Sets." Perceptual Computing: Aiding People in Making Subjective Judgments. Piscataway, NJ: IEEE, 2010. 35-64. Print.3. Sabo, C., Kingston, D., Cohen, K., “SMART Heuristic for Pickup and Delivery Problem (PDP) with Cooperative UAVs”, AIAA Infotech@Aerospace Conference, St. Louis, MO, March 29-31, 2011, AIAA Paper 2011-14644. http://gamerfront.net/2012/02/atari-announces-the-100000-pong-indie-developer-challenge/172355. http://en.wikipedia.org/wiki/File:NASA_Curiosity_Rover.jpg6. http://gamerfront.net/2012/02/atari-announces-the-100000-pong-indie-developer-challenge/172357. http://gamerfront.net/2012/02/atari-announces-the-100000-pong-indie-developer-challenge/172358. http://www.lynnehartke.com/2012/10/what-to-say-to-someone-with-chronic.html#!/2012/10/what-to-say-to-someone-with- chronic.html9. http://orbitertutorials.zxq.net/astronaut_qualifications.htm

Page 44: Fuzzy Logic Inference for Pong (FLIP) Brandon Cook & Sophia Mitchell Undergraduate Students, Department of Aerospace Engineering, Student Members AIAA

45

Questions?