Robots and Virtual Robots I Agents in Physical and Virtual Environments Lecture 4: Fuzzy Control in Robotics Gal A. Kaminka galk@cs.biu.ac.il Fall 2002 © Gal Kaminka, 2 Previously, on Robots I… Fuzzy set theory, fuzzy logic Generalizations of set theory and logic Probability versus Fuzziness (a productive discussion?) Fuzzy control IF … THEN … rules where LHS, RHS refer to fuzzy sets All rules matched, all matching rules combined Three stages: Fuzzification, inference, defuzzification Useful when mathematical model of plant unavailable Fall 2002 © Gal Kaminka, 3 This week, on Robots I…. Fuzzy Logic basics A crash course in Fuzzy Control Fuzzification, Inference, Defuzzification Applications of Fuzzy Control in robotics Simple skills: avoid obstacles, greedy navigation Issues and challenges to fuzzy control Curse of dimensionality Real-time responses Incomplete controllers Last Week Fall 2002 © Gal Kaminka, 4 But first…. םיפד איצוהל .1 םיאתמ רלורטנוקב דחא קוחמ רתוי רשאכ הרוק המ ?רוסנס תאירקל .2 םהמNegative Rules? Fall 2002 © Gal Kaminka, 5 Fuzzy Control When plant model unavailable A set of rules associating sensor readings with action IF Close-by(right-sensor) THEN Left IF Clear(forward-sensor) THEN Forward IF Right(goal-location) THEN Right All rules fire in parallel, and their results are combined Fall 2002 © Gal Kaminka, 6 Three stages Fuzzification (each rule): Sensor reading are matched with the IF side LHS: Left-Hand Side Inference (each rule): As a function of matched LHS, THEN part is operationalized RHS: Right-Hand Side Defuzzification (all rules together) The operationalized RHS of all rules are combined A crisp result is extracted Fall 2002 © Gal Kaminka, 7 Fuzzification Determine degree of membership of sensor reading IF Close-by(right-sensor) AND FAR(goal-location) THEN Left IF Close-by(forward-sensor) THEN Left OR Right Get value of sensors right, forward, goal-location Find membership value of value in fuzzy sets Close- by This value determines activation of this rule Fall 2002 © Gal Kaminka, 8 Inference (see blackboard) Each rule’s LHS activation determines RHS activation Two common types of inference: Cut RHS set(s) to LHS activation value Scaling: Multiply RHS function by LHS activation value Fall 2002 © Gal Kaminka, 9 Defuzzification (see blackboard) Aggregation: Combine all RHS sets Approaches: Non-additive: Multiple contributions count as one (e.g., max) Additive: Multiple contributions strengthen result (sum) Now we have a combined output of the system Pick a crisp value to send to actuators: Max: Pick maximum value as representing set COG: pick center-of-gravity as representing set MOM: Mean-of-Maxima … Fall 2002 © Gal Kaminka, 10 ?תולאש [...].. .Fuzzy Control in Robotics Mathematical model of task, robot body unavailable Information from sensors is often imprecise, uncertain Good match with fuzzy control Fall 2002 © Gal Kaminka, 11 Case Study: Controller for YODA Denning MRV-3 Robot Old: ~20 years Massive: ~1m tall, ~75cm wide, ~30Kg 24 sonar sensors (distance), internal x, y, theta odometry Task:... heading=left IF small-posive(angle-to-goal) THEN heading=small-right … IF dead-on(angle-to-goal) THEN heading=zero-change Fall 2002 © Gal Kaminka, 17 Design alternative 2 summary Add some pre-processing of sensor data Gain scalability, readability Notice that we can do goal-seeking in about 10 rules! Sonar (x24) Speed Controller Curr X, Y, Theta Heading Change Goal X, Y Fall 2002 © Gal Kaminka,... rules to increase weight Add distance to goal into obstacle-avoidance rules Re-define fast to be slower Fall 2002 © Gal Kaminka, 27 A systematic method There are essentially two sets of rules in our design Goal-seeking Obstacle-avoiding Split controller into two, then merge their results Sonar (x24) Theta Avoid Obst Seek Goal Current X, Y Goal X, Y Fall 2002 Speed Heading Change Speed Heading Change... sensor readings again Treat sensors relative to heading: IF obstacle-close(forward) THEN speed=stop IF obstacle-close(right30) THEN speed=slow, turn=left IF obstacle-close(left50) THEN speed=slow, turn=small-right …… Fall 2002 © Gal Kaminka, 21 Goal-relative sensing Create virtual-sensors based on heading In principle, we can do this using rules IF north(current-heading) THEN... north(current-heading) THEN left45=north-west IF north(current-heading) THEN right90=east … IF south(current-heading) THEN forward=south IF south(current-heading) THEN left45=south-west …… Fall 2002 © Gal Kaminka, 22 Goal-relative sensing Note these are no longer fuzzy rules Indeed, why do this with rules? Only dynamically rename sensors, no inference Simple pre-processing algorithm Yet... this not work? What did we give up here? Fall 2002 © Gal Kaminka, 23 Controller: Complete Design Sonar (x24) Theta Curr X, Y Speed Controller Heading Change Goal X, Y Fall 2002 © Gal Kaminka, 24 From design to implementation Requires assigning membership values There is significant literature on doing this Including automated learning For our purposes, this can be done by hand Pick trapezoid... combinations Raw heading IF current-heading(theta0) AND current-at(x0,y0) AND goalat(xg,yg) THEN turn=D0 { some function of angle to goal } Fall 2002 © Gal Kaminka, 14 Problem: Too many rules For each possible location And each heading in each location How is this ever going to scale? Fall 2002 © Gal Kaminka, 15 Design alternative 2 Let’s do some pre-processing of the sensors Instead... THEN obstacle-close=true …… Fall 2002 © Gal Kaminka, 29 Problems with fuzzy control Avoid-obstacles controller needed to know the goal This may result in rule explosion Would be much simpler to have negative rules All combinations of sensor readings and goal state But these are not trivial in fuzzy Defuzzification, inference methods may or may not work Also, what do we do with multi-modal... north(current-heading) THEN speed=slow, turn=small-left IF object-close(north-east) AND south(current-heading) THEN speed=fast, turn=no-change … IF object-close(south) AND north(current-heading) THEN speed=fast, turn=no-change Fall 2002 © Gal Kaminka, 20 Alternative Design 2 Again, seems we consider all combinations For each sensor and heading, consider obstacle distance Let’s try pre-processing the... location Angle from current heading to line pointing to goal Then controller looks very different Fall 2002 © Gal Kaminka, 16 Design Alternative 2 Rules Distance difference IF large(distance-to-goal) THEN speed=fast IF small(distance-to-goal) THEN speed=slow IF zero(distance-to-goal) THEN speed=zero Heading Difference IF large-positive(angle-to-goal) THEN heading=right IF large-negative(angle-to-goal) . 2002 © Gal Kaminka, 3 This week, on Robots I…. Fuzzy Logic basics A crash course in Fuzzy Control Fuzzification, Inference, Defuzzification Applications of Fuzzy Control in robotics Simple. I Agents in Physical and Virtual Environments Lecture 4: Fuzzy Control in Robotics Gal A. Kaminka galk@cs.biu.ac.il Fall 2002 © Gal Kaminka, 2 Previously, on Robots I… Fuzzy set theory, fuzzy. as representing set COG: pick center-of-gravity as representing set MOM: Mean-of-Maxima … Fall 2002 © Gal Kaminka, 10 ?תולאש Fall 2002 © Gal Kaminka, 11 Fuzzy Control in Robotics Mathematical