# Fuzzy Logic and Robot Control Mundhenk and Itti, 2007.

## Presentation on theme: "Fuzzy Logic and Robot Control Mundhenk and Itti, 2007."— Presentation transcript:

Fuzzy Logic and Robot Control Mundhenk and Itti, 2007

Problem:  We have a robot and we want it to move around obstacles based on how close we are to them. How do we do this? Current Path

Ideal New Path The closer you are to an obstacle, the harder you need to turn to avoid it. Your course adjustments are minimally proportional to the distance to an obstacle and your current speed and heading.

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

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!

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?

Near? Far? Ideal New Path In addition to a change in speed, we may need to turn to avoid hitting an obstacle. If we are near, our course correction may need to be more abrupt.

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…

IF AND THEN 20 M0 M Distance Trajectory 0°90° -90° Near Far Center Hard Right Soft Right Center Turn -25°0° A very simple example... Yes the robot only turns right.

IF AND THEN 20 M0 M DistanceTrajectory 0°90° -90° Near Far Center Hard Right Soft Right Center Turn 10 ° 10 M Happy Robot ( 幸せなロボット ) El mal de plantas We have a robot and an obstacle we want to avoid. We create some fuzzy rules about how much to steer in any direction to avoid hitting the obstacle based on how far we are from it and to what degree it’s in our way. Translations by Google. Are they any good?

IF AND THEN 20 M0 M DistanceTrajectory 0°90° -90° Near Far Center Hard Right Soft Right Center Turn 10 ° 10 M Happy Robot ( 幸せなロボット ) El mal de plantas Implication of the rules: RULE 1. “Near” is less than “Center” we take the min since we are using “AND” RULE 2. We are getting near so we do a “Soft Right” RULE 3. We center to a certain degree since the obstacle is still kind of far away.

IF AND THEN 20 M0 M DistanceTrajectory 0°90° -90° Near Far Center Hard Right Soft Right Turn 13 ° 9 M Defuzzification: Center of gravity – Turn -10 ° We can see that the second rule gives us a slight right turn much of the time. Thus, it’s not a very good rule! Lets get rid of it… Aggregation

20 M0 M DistanceTrajectory 0°90° -90° Near Far Center Hard Right Center Turn 13 ° 9 M Center of gravity – Turn -10 ° The second rule turned out to not be very helpful anyways…

20 M0 M DistanceTrajectory 0°90° -90° Near Far Center Hard Right Center Turn 10 ° 6 M Center of gravity – Turn -17 ° Thus, as we get closer and the obstacle is more centered in our trajectory, we will tend to turn more to the right.

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.

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.

IF AND THEN 20 M0 M Distance Trajectory 0°90° -90° Near Far Center Hard Right Soft Left Center Turn -25° 10°  Trajectory Far-ish? Prevent over steering with our robotChange in Trajectory

IF AND THEN 20 M0 M Distance Trajectory 0°90° -90° Near Far Center Slow Very Slow Fast Speed 0 kph 10 kph  Distance Quick 0 mps10 mps Possible Rules to define speed

Demo