0% found this document useful (0 votes)
146 views5 pages

Obstacle Avoidance Based On Fuzzy Logic

In this paper we design an obstacle avoidance controller for a wheeled robot, based on Fuzzy Logic. The robot uses 3 ultrasonic sensors to detect obstacles, and dead reckoning to know its position with respect to the target. The Fuzzy Logic controller is tuned using Genetic Algorithms. In particular, we optimize the total path time and the smoothness of the steering profile. Simulations show that the controller is successful in simple scenarios.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
146 views5 pages

Obstacle Avoidance Based On Fuzzy Logic

In this paper we design an obstacle avoidance controller for a wheeled robot, based on Fuzzy Logic. The robot uses 3 ultrasonic sensors to detect obstacles, and dead reckoning to know its position with respect to the target. The Fuzzy Logic controller is tuned using Genetic Algorithms. In particular, we optimize the total path time and the smoothness of the steering profile. Simulations show that the controller is successful in simple scenarios.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

OBSTACLE AVOIDANCE BASED ON FUZZY LOGIC

Marc Alomar Payeras


[email protected]

Abstract
In this paper we design an obstacle avoidance controller for a wheeled robot, based on Fuzzy Logic.
The robot uses 3 ultrasonic sensors to detect obstacles, and dead reckoning to know its position with
respect to the target. The Fuzzy Logic controller is
tuned using Genetic Algorithms. In particular, we
optimize the total path time and the smoothness
of the steering profile. Simulations show that the
controller is successful in simple scenarios.
Keywords: Obstacle Avoidance, Fuzzy Logic
Controller, Genetic Algorithm, Intelligent Control.

INTRODUCTION

Obstacle avoidance is one of the most critical tasks


performed by an autonomous robot. Depending
on the knowledge of the environment, the strategy followed by the robot can be global or local.
If the robot has access to a map of the environment, global path planning is feasible. In this case,
the robot can find an optimal path that avoids all
the obstacles. However, the situation is different
in uncertain environments, when the robot has to
reach a target without a global map. In this case,
a local strategy is needed.
Humans face this situation on a daily basis. Routine activities, like walking on the street or driving
a car, require local strategies to avoid obstacles.
Humans follow common sense principles, like reducing the velocity or turning to the sides. Even
if it is a trivial task for a human, it is difficult to
implement this capability on a classical controller.
In this context, Fuzzy Logic Controllers (FLC) appear as a natural solution. An FLC contains a set
of natural language rules that follow the IF-THEN
scheme (e.g. IF an obstacle is close, THEN reduce
the velocity). The designer gathers a set of rules
from an expert, and defines a relation between numeric and natural language terms by means of
membership functions. These functions are critical for the performance of the controller, but the
choice of parameters is usually rather arbitrary.

Figure 1: Functional architecture of the robot.

FLC can be tuned using Genetic Algorithms


(GA). This technique, often used in non-linear
optimization problems, is inspired on the natural process of evolution. FLC are usually combined with GA to tune the membership functions
according to a cost function, which describes the
design objective. For example, we can use GA to
find the parameters that lead to the shortest path,
or to the smoothest trajectory.
In this paper, we design an obstacle avoidance controller for a terrestrial robot based on FLC and
GA. The controller not only avoids obstacles, but
also guides the robot towards a target. In section 2
the architecture of the perception and guidance
modules is presented. Section 3 describes the design of the FLC and the tuning mechanism based
on GA. Finally, we present some simulation results.

GUIDANCE SYSTEM

The mission of the robot is to reach a target without any collisions. We consider a wheeled robot
equipped with 3 ultrasound sensors for obstacle
detection. If an obstacle is intercepted, the sensors
calculate the range by a time of flight measurement. The robot estimates its position by dead
reckoning, so that it knows its relative position
with respect to the target all along the trajectory.
The trajectory can be controlled by the steering
angle and the velocity.
We also consider that the robot does not have any
map about the environment. Instead, all the decisions taken by the robot are local, based on the
information provided by the sensors in real time
(i.e. the robot does not store previous measure-

Figure 2: Navigation loop.

ments). The absence of global information leads


to a very simple path planning law: try to reach
the target in a straight line. The robot compares
its position with the target, and calculates the angle of the line that joins both points. This would
be the desired heading, which is compared with
the actual heading of the robot. The difference
is the heading error, which the controller tries to
bring to zero.
If an obstacle lies on the path followed by the
robot, then it will have to change its trajectory.
The obstacle avoidance module uses information
from the ultrasonic sensor and the heading error
to calculate the corrective actions. The controller
is based on Fuzzy Logic, with 4 inputs (i.e. heading error, left, front and right obstacle range) and
2 outputs, velocity and steering angle. The inference rules and the design of the membership
functions are presented in the following section.
Figure 1 shows a functional diagram of the system.
In the simulations found in section 4 the environment is codified on a map, on which the function
Detect Obstacles executes an algorithm that mimics the operation of an ultrasonic sensor. Based on
the distance to the obstacles and the position of
the target point, the function Plan Motion calculates the actions to be executed by the function
Move Robot. Figure 2 shows the sequence of actions, executed every second.

FUZZY LOGIC CONTROLLER

The Fuzzy Logic Controller is implemented in the


Plan Motion function. The details are shown on
Figure 3: the three collision ranges and the heading error are fuzzified, and inference rules are applied to calculate the output commands, velocity
and steering angle. The input variables are codified with the set Range = {close (0), far (1)} and
Error = {negative (-), zero (0), positive (+)}. The
output variables can take the values Velocity =
{slow(0), fast (1)} and Steering = {left (-), zero
(0), right (+)}.

Figure 4: Membership functions.

3.1

MEMBERSHIP FUNCTIONS

The membership functions are shown on Figure 4.


The variable Range is codified with two trapezoidal functions. If the distance is less than 30
cm, we consider that the obstacle is close to the
robot, whereas if it is further than 40 cm, it is far.
Between 30 and 40 cm there is a crossover. These
values should be tuned according to the dimensions of the robot and the range of the ultrasonic
sensors. The heading error is codified with triangular functions for the front value, and trapezoidal
for the left and right values.
With regards to the output functions, we use two
triangular functions for the velocity, centered at 0
and 5 cm/s, which is the maximum velocity of the
robot. The output value is calculated using the
center-of-mass algorithm, which implies that the
velocity is going to be between 0 and 5 cm/s. The
steering angle is defuzzified with 3 sharp triangular functions, centered at -10o , 0 and 10 o .
3.2

INFERENCE RULES

Table 1 lists the inference rules of the Fuzzy Logic


controller. They have been deduced by the author from common sense principles. When there
are no obstacles, the objective is to correct the
heading error. If the error is negative, we steer
on the opposite direction to correct the error, and
so on. However, if there is an obstacle in front of
the robot the strategy is different: the robot must
steer to the sides to avoid it. With regards to the
velocity, we take a simple rule: reduce the velocity
only if there is an obstacle in front of the robot.
The inference algorithm is implemented as follows.
First, the input values are fuzzified using the membership functions described previously. Then, the
inference rules are applied: for each of the 4 input

Figure 3: Detail of the Fuzzy Logic Controller.

Left
0
1
0
0
1
1
0
1

Input
Front Right
0
0
0
0
1
0
0
1
1
0
0
1
1
1
1
1

Error
-/0/+
-/0/+
-/0/+
-/0/+
-/0/+
-/0/+
-/0/+
-/0/+

Output
Vel. Strng.
1
+ /0/1
0/0/0
-/+/+
1
+/0/0
0
1
0
0
+
0
+

Table 1: Inference rules.


values, we take the minimum membership value,
which corresponds to an AND implication. To
defuzzify the output values, we calculate the area
below the output membership functions and calculate the center of mass.
3.3

TUNING WITH GENETIC


ALGORITHMS

One of the problems that we face with Fuzzy Logic


controllers is the design of the membership functions. The designer has to make a guess according
to the characteristics of the problem, but it is difficult to tune them in order to optimize a specific
criteria. One of the solutions is to use Genetic
Algorithms (GA).
In this case, we have chosen to tune the membership functions by changing the input and output
gain, i.e. by multiplying the input and output values by a constant factor. As a result, we shrink
the membership functions if the gain is larger than
one, or expand them if it is smaller than one. For
example, if the range variable has a gain of 2, an
obstacle at a distance of 20 cm will be far, like if it
were originally at 40 cm. There are more complex
strategies, like modifying the shape of the functions. However, the output and input gains have
more impact on the controller.
To optimize the Fuzzy Logic controller we have to

define a cost function. In this paper we consider


two objectives: to minimize the total time and to
obtain a smooth steering profile. The function is
f = Kt T 2 + Ks

(i i1 )

where T is the total time, i the steering angle


at step i, and Kt , Ks are weight parameters. The
choice of the weight parameters allows us to modify the optimization criteria. For example, if we
choose Kt = 1, Ks = 0 we optimize only the total
time. The choice of a squared value is to facilitate the convergence of the algorithm for the total
time, and to avoid cancellations in the steering
angle.

SIMULATIONS

The Fuzzy Logic controller has been implemented


using Matlab. We have tested a simple scenario,
where the robot has to avoid several obstacles to
reach a target. We considered 3 cases: a trivial
case, without GA tuning, and two cases with GA,
which we call fast and smooth (see Table 2). When
we use the GA algorithm, we tune the range, heading error and steering gains, which can vary between 0.7 and 4 with a precision of 3 significant figures. The algorithm is executed with a population
of 20 chromosomes and a total of 10 generations.
These modest values are due to the high computational cost of the algorithm. The GA algorithm
has not been implemented by the author, but it
has been taken from a script of Kevin Passino.
The result of the simulations is shown in Figure 5.
The robot avoids all the obstacles, and reaches
the target even in the trivial case. When the
robot finds an obstacle, it reduces the velocity and
changes the steering angle. In the fast case the
robot reaches the target in 12 steps less than in
the trivial case. However, the steering angle oscillates all along the trajectory between 30o and
-30o , which makes the trajectory very irregular. A

Krange
Kh.error
Ksteer
Kt
Ks
Steps

Trivial
1
1
1
60

Fast
2.9
2.9
3.2
1
0
47

Smooth
1.95
1.12
0.7
0
1

Table 2: Parameters for the simulation.


much smoother trajectory is found in the last case.
Here, the trajectory has a circular shape, minimizing the variations in the steering angle, but at the
expense of a longer time.

CONCLUSION

We have described an obstacle avoidance function


based on Fuzzy Logic. The robot is capable of
reaching the target without a global map, only
with the information provided by ultrasonic sensors and dead reckoning. The controller can be
tuned according to an optimization criteria. In
this case, we have used Genetic Algorithms to find
the controller that optimizes a given cost function.
In particular, we have considered two functions,
one to minimize the total time, and another to
generate a smooth steering profile. Simulations
confirm that the controller successfully avoids the
obstacles, and that it can be tuned according to
the objectives of the designer.

Figure 5: Simulation results.

You might also like