Disclaimer: This essay is provided as an example of work produced by students studying towards a engineering degree, it is not illustrative of the work produced by our in-house experts. Click here for sample essays written by our professional writers.

This content is to be used for educational purposes only and may contain factual inaccuracies or be out of date.

# Fuzzy Logic Control of a Mobile Robot

 ✅ Paper Type: Free Essay ✅ Subject: Engineering ✅ Wordcount: 2732 words ✅ Published: 31st Aug 2017

Abstract

In this report the development of mobile robot using fuzzy inference system is presented. The mobile robot has three inputs and two outputs. The three inputs are proximity measures of the wall and the two outputs are turning rate and speed of the mobile robot. The mobile robot is developed to follow the tracking path and avoid collision with the obstacle.

Contents

1. Overview and Introduction
2. Input and Output ranges
3. Appendix
4. Construction and performance of the rules
5. MATLAB code for control task
6. Critical evaluation

Overview

In the beginning of the development of the mobile robot, the virtual robot must be used for the development hence kiks robot is considered. The fuzzy inference system is designed by using MATLAB and implemented on a robot which is kiks robot. The kiks robot is setup by installing the kiks software and the related files are extracted and executed on MATLAB. Then the FIS is designed by coding and deciding the inputs and outputs for the kiks. The turning rate and speed of the robot is defined as per the rules of the parameters for robot movement and to avoid collision with the obstacles.

The steps involved are:

1. Defining universe of discourse
2. Deciding the fuzzy sets
3. Define membership functions

The fuzzy interference system used is mamdani FIS which involves

1. Fuzzification of input variables
2. Rule evaluation
3. Aggregation of rule output
4. DE fuzzification

Introduction

The fuzzy control systems are rule based or knowledge based system which contains collection of IF-THEN rules. The advantage of fuzzy system is it is wide usage in performing variety of computational and measurements.

1. Capabilities of handling uncertain and non-precise information.
2. Real time operation
3. Easy combinations and execution of various behaviours.
4. Develop perception based strategies.
5. Better and easy implementation.

The construction of fuzzy system depends on two important parameters which are identifying the universe of discourse and defining correct membership function. The reason for using mamdani over sugeno is because it uses fuzzy terms defined by the shape of the membership function. The mamdani type fuzzy system is better to choose for more human like behaviour of the robot which entails a substantial computational burden.

The building of the autonomous mobile robot involves few main considerations which are, path tracking, avoidance of the obstacle and behaviour co-ordination. The definition of universe of discourse and membership function and combination of rules are important for smooth movement and better outcome of the robot. Path tracking involves navigation of the desired path which is computed and defined by human operator tracking walls or obstacles. The difficulties of path tracking deals with incomplete perception of environment, inaccurate measurements and sensor fusion. Avoidance of obstacle using fuzzy logic involves avoiding the unforeseen or dynamic obstacles while it tracking a path or moving towards a target. Fuzzy logic for behaviour co-ordination is used to improve the total performance of the navigation system.

If you need assistance with writing your essay, our professional essay writing service is here to help!
Find out more about our Essay Writing Service

The infrared sensor with 6 sensors for the forward direction and 2 sensors for the backward direction. In this phase of training robot, I have used 2 sensors for right, 2 for left and 2 for front sensing. The sensor input is noun used ‘slow’, ‘fast’, ‘medium’. The fuzzy variables are adjectives that modify the variable, ‘left’ ‘right’ ‘medright’ ‘slowright’ ‘slowleft’. In the mamdani type of fuzzy system, the fuzzifier performs measuring of the input variables, scale mapping and fuzzification. The number of membership function defines the shapes of the initial inputs defined by the user. It holds a value of 0 and 1 which indicates the degree of belonging of the quantity to a fuzzy set.

Input and Output ranges.

 Input Membership function Input range Left Far, Intermediate, Close [0 21] Front Far, Intermediate, Close [0 21] Right Far, Intermediate, Close [0 21]
 Output Membership function Output range Turning rate Slowright, slowleft, medright, left, right, front. [0 200] Speed Veryslow, slow, medium, fast, veryfast. [0 200]

Input range for a sensor is 10bits and the input value for sensor is 1024, the sensors are grouped into 2 and wherein each one variable defined by 1024(210) i.e. 2048 therefore that divided by 100 is 21, hence the input range is [0 21]. The input is taken left, right, front with 2 sensors each. The membership function for them is defined far, intermediate, close for the robot to sense the obstacle. The outputs are turn and speed, where in turn has membership functions slowright, slowleft, medright, right, left, front for the robot to turn to a direction when the robot is nearing the robot. The range of the speed is considered as [0 200] as the robot movement was meant to be faster compared to when the speed was in the range [0 100] because the robot must cover more distance in less time and better speed. The membership function for speed is taken as slow, veryslow, fast, veryfast, medium as the robot should move in different direction with different speed so that the robot follows the path and is not disturbed by sudden obstacle. The combination of the membership functions are rules for the robot to follow to follow the path and along with that to avoid obstacles and give smoother movement.

Appendix

1a. Movement of robot in arena1

1b. Monitored simulation of arena1

2a. Movement of robot in arena2

2b. Monitored simulation of arena2.

Construction and performance of fuzzy rules.

1. If (left is far) and (front is far) and (right is far) then (turn is medright)(speed is fast) (1)
2. If (left is far) and (front is far) and (right is intermediate) then (turn is front)(speed is medium) (1)
3. If (left is far) and (front is far) and (right is close) then (turn is slowleft)(speed is medium) (1)
4. If (left is far) and (front is intermediate) and (right is far) then (turn is medright)(speed is fast) (1)
5. If (left is far) and (front is intermediate) and (right is intermediate) then (turn is front)(speed is medium) (1)
6. If (left is far) and (front is intermediate) and (right is close) then (turn is slowleft)(speed is very_slow) (1)
7. If (left is far) and (front is close) and (right is far) then (turn is medright)(speed is very_slow) (1)
8. If (left is far) and (front is close) and (right is intermediate) then (turn is slowleft)(speed is very_slow) (1)
9. If (left is far) and (front is close) and (right is close) then (turn is slowright)(speed is very_slow) (1)
10. If (left is intermediate) and (front is far) and (right is far) then (turn is right)(speed is fast) (1)
11. If (left is intermediate) and (front is far) and (right is intermediate) then (turn is front)(speed is fast) (1)
12. If (left is intermediate) and (front is far) and (right is close) then (turn is slowleft)(speed is slow) (1)
13. If (left is intermediate) and (front is intermediate) and (right is far) then (turn is medright)(speed is very_slow) (1)
14. If (left is intermediate) and (front is intermediate) and (right is intermediate) then (turn is front)(speed is medium) (1)
15. If (left is intermediate) and (front is intermediate) and (right is close) then (turn is slowleft)(speed is fast) (1)
16. If (left is intermediate) and (front is intermediate) and (right is far) then (turn is slowleft)(speed is slow) (1)
17. If (left is intermediate) and (front is close) and (right is intermediate) then (turn is slowright)(speed is very_slow) (1)
18. If (left is intermediate) and (front is close) and (right is close) then (turn is slowright)(speed is very_slow) (1)
19. If (left is close) and (front is far) and (right is far) then (turn is medright)(speed is slow) (1)
20. If (left is close) and (front is far) and (right is intermediate) then (turn is front)(speed is medium) (1)
21. If (left is close) and (front is far) and (right is close) then (turn is slowleft)(speed is veryfast) (1)
22. If (left is close) and (front is intermediate) and (right is far) then (turn is right)(speed is fast) (1)
23. If (left is close) and (front is intermediate) and (right is intermediate) then (turn is front)(speed is medium) (1)
24. If (left is close) and (front is intermediate) and (right is close) then (turn is slowleft)(speed is medium) (1)
25. If (left is close) and (front is close) and (right is far) then (turn is slowright)(speed is very_slow) (1)
26. If (left is close) and (front is close) and (right is intermediate) then (turn is slowright)(speed is very_slow) (1)
27. If (left is close) and (front is close) and (right is close) then (turn is slowleft)(speed is very_slow) (1)
28. If (left is far) and (front is far) and (right is far) then (turn is slowright)(speed is fast) (1)
29. If (left is far) and (front is intermediate) and (right is far) then (turn is slowright)(speed is fast) (1)
30. If (left is far) and (front is close) and (right is far) then (turn is slowright)(speed is medium) (1)
31. If (left is far) and (front is close) and (right is intermediate) then (turn is slowright)(speed is slow) (1)
32. If (left is far) and (front is close) and (right is close) then (turn is slowright)(speed is fast) (1)
33. If (left is intermediate) and (front is close) and (right is close) then (turn is slowright)(speed is very_slow) (1)
34. If (left is intermediate) and (front is far) and (right is close) then (turn is slowright)(speed is very_slow) (1)
35. If (left is intermediate) and (front is intermediate) and (right is close) then (turn is slowright)(speed is fast) (1)
36. If (left is close) and (front is far) and (right is far) then (turn is slowright)(speed is far) (1)
37. If (left is close) and (front is intermediate) and (right is intermediate) then (turn is slowright)(speed is far) (1)
38. If (left is close) and (front is close) and (right is close) then (turn is slowright)(speed is slow) (1)
39. If (left is close) and (front is close) and (right is close) then (turn is slowright)(speed is veryfast) (1)

MATLAB Code to implement the control task

% ————————————————-

%  (c) 2000-2004 Theodor Storm <theodor@tstorm.se>

%  http://www.tstorm.se

%  Modified by Lily Meng 16th September 2009

% ————————————————-

function FIS_navigate(port,baud,time)

% FIS_navigate(port,baud,time)

% port = serial port to communicate with (port<0 ==> simulated robot, port>=0 ==> real robot

% baud = baud rate

% time = time to run behaviour

if nargin<3 time=60; end;

if nargin<2 baud=9600; end;

if nargin<1 port=-1; end;

ref=kiks_kopen([port,baud,1]);

kSetEncoders(ref,0,0);

reflex = 0;

t0=clock;

loops=0;

% Read the FIS from disk

% (don’t forget to save your FIS after you make changes to it.)

% You need to replace the question marks with the name of your FIS.

while (kiks_ktime(port)<time)

loops=loops+1;

% Read the Khepara’s range sensors and group them.

% Change these if you want to group the sensors differently.

reflex = kProximity(ref);

left = sum(reflex(1:2))/100

front = sum(reflex(3:4))/100

right = sum(reflex(5:6))/100

% Use the FIS to compute the speed and trun rate

FIS_outputs = evalfis([left, front, right],fis);

% Assign the speed and trun rate to outputs generated by the FIS

turn = FIS_outputs(1);

speed = FIS_outputs(2);

% use the function to calculate the wheel speeds

setWheelSpeeds(ref,speed,turn);

end;

%kGetEncoders(ref)

t=etime(clock,t0);

disp(sprintf(‘%.1f loops in %.1f seconds = %.1f loops/second (%.0f%%)n’,loops,t,loops/t,(time/t)*100));

kSetSpeed(ref,0,0);

kiks_kclose(ref);

% *************************************************************

% The following function implements the kinemtatics of the

% robot, converting turn speed and forward speed into speeds

% for the left and right wheels.

% DO NOT MAKE ANY CHANGES TO THIS FUNCTION !!!!!!!!!!!!!!!!!!

function setWheelSpeeds(ref,velocity,rotation)

% Prevent the robot “drifiting to the left”

% Seems to be a bug in KiKs?

if abs(rotation)<0.01

rotation = 0;

end

Critical evaluation

Building of autonomous mobile robot using mamdani type fuzzy system had difficulties to get the desired output. The first problem while building the kiks was to define the membership functions and universe of discourse for better path. Following the steps in building the robot, the definition of the parameters, fuzzy rules, membership functions, the combination of membership function was difficult, reason is when more than certain rules are defined the robot did not respond to the code and instead the robot started spinning 360 degrees in same position. The trial and error method was used to define the rules took a long time. When the rules and membership functions were defined the robot, response was observed but at the same time the robot could not sense the obstacle hence used the obstacle as path till the end of the obstacle. During the evaluation of the problems, the robot stopped responding to the rules and movement was observed to be very slow, so, the speed of the robot was changed. The changes in speed and time of execution helped in movement of the robot, testing the rules for continuous movement of the robot and avoidance of the obstacle took more time. But finally, after numerous changes in the rules and membership function, speed of the robot in the code and other minor changes makes the robot follow the tracking path and makes the robot avoid the obstacle.

View all

## DMCA / Removal Request

If you are the original writer of this essay and no longer wish to have your work published on UKEssays.com then please:

Related Services

Prices from

SGD206

Approximate costs for: