You are on page 1of 115

AUTONOMOUS NAVIGATION FOR A

NON-HOLONOMIC ROBOTIC VEHICLES


PARKING MANEUVER USING IT2 FLS

THESIS

SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENT FOR THE


AWARD OF THE DEGREE OF

MASTER OF TECHNOLOGY
(Electronics & Communication)

SUBMITTED BY

VIKRAM MUTNEJA
APRIL 2008

PUNJAB TECHNICAL UNIVERSITY


JALANDHAR (Punjab), INDIA
AUTONOMOUS NAVIGATION FOR A
NON-HOLONOMIC ROBOTIC VEHICLES
PARKING MANEUVER USING IT2 FLS

THESIS

SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENT FOR THE


AWARD OF THE DEGREE OF

MASTER OF TECHNOLOGY
(Electronics & Communication)

SUBMITTED BY

VIKRAM MUTNEJA

G.Z.S. COLLEGE OF ENGINEERING & TECHNOLOGY, BATHINDA

PTU REGIONAL CENTRE NO. 3

APRIL 2008

PUNJAB TECHNICAL UNIVERSITY


JALANDHAR (Punjab), INDIA
CANDIDATES DECLARATION

I hereby certify that the work which is being presented in the thesis entitled MODELING
AUTONOMOUS NAVIGATION OF A NON-HOLONOMIC VEHICLES PARKING
USING TYPE-II FUZZY SETS in partial fulfillment of requirement for the award of the
degree of Master of Technology (Electronics & Communication Engineering) submitted in the
Department of Electronics & Communication Engineering at Giani Zail Singh College of
Engineering & Technology, Bathinda under Punjab Technical University, Jalandhar is an
authentic record of my own work carried out during a period from March, 2007 to April, 2008
under the supervision of Er. Neeraj Gill and co-supervisor Er. Satvir Singh Sidhu. The matter
presented in this thesis has not been submitted in any other University/Institute for the award of
M.Tech Degree.

(Vikram Mutneja)
(Uni. Roll No.: 316049619)

This is to certify that the above statement made by the candidate is correct to the best of my
knowledge and belief.

(Er. Neeraj Gill) (Er. Satvir Singh Sidhu)


Assistant Professor, Assistant Professor & Head,
Department of Electronics & Comm. Engg., Department of Electronics & Comm. Engg.,
GZS College of Engg. & Tech., Bathinda. SBS College of Engg. & Tech., Ferozepur.
(Supervisor) (Co-Supervisor)

The M.Tech viva-voce examination of Vikram Mutneja has been held on and
accepted.

(Signature of Internal Examiners) (Signature of External Examiner)

(Signature of Head of Department)

i
ABSTRACT

This work describes the implementation, in simulation environment, of a navigation strategy


for a non holonomic robotic vehicle to a parking space using special class of type-II
(interchangeably used with term type-2 syntactically) fuzzy sets, which are interval type-II
fuzzy sets to design a fuzzy automatic navigation control system. A Graphical User Interface
(GUI) in MATLAB has been designed to aid the simulation of navigation to a designated
parking place, starting from any random position in a designated area. The simulation
parameters include fuzzy t-norm method, trajectory traversing algorithm, initial position,
customized trace display of front & rear wheels and vehicles boundary etc.

Only the starting and end points are specified, and the robot itself works out the trajectory. Two
trajectory-traversing algorithms namely, Linear Paths Approximation (LPA) and Continuous
Curves Approximation (CCA) for non-holonomic motions have been integrated in the design of
systems graphical user interface.

The fuzzy logic system uses two input variables and one output variable relevant to the steering
process. The variables take on linguistic values for invoking the rule-base to deliver decisions
to steer the vehicle to reach its final position. The Fuzzy logic system was originally developed
by using type-1 fuzzy sets (T1 FS), and then modified to interval type-2 fuzzy logic system by
making use of interval type-2 fuzzy sets (IT2 FS) to handle uncertainty in the representation of
input variables by linguistic means.

The response of interval type-2 fuzzy logic system (IT2 FLS) becomes equivalent to that of
type-1 fuzzy logic system as the extent of uncertainty is reduced by reducing the Footprint of
Uncertainty (FOU) to zero. The simulation results of autonomous navigation system based on
interval type-2 fuzzy sets definitely improve as the FOU increases up to a limit, beyond which
a kind of aliasing of variable values tends to invoke the rule-base such that even non-desirable
rules tend to fire.

Apart from the automatic motion simulation, manual controls for motion simulations have also
been integrated in the graphical user interface, which are helpful to evaluate vehicles
navigation in different conditions including successful as well as unsuccessful cases. Two types

ii
of manual controllers have been designed, first one is mouse operated and second one is
keyboard operated.

The response of the system has been studied by taking into account navigational error which
marks a case as unsuccessful if vehicles trajectory is non-converging and positional errors
which accounts for orientation or distance error in final parking position. Apart from simulation
parameters, important conclusions have been withdrawn by studying the response of the system
w.r.t maximum possible variations in the FOU width, by taking different initial positions
varying along the x-axis to draw D vs. W plots.

iii
ACKNOWLEDGEMENTS

I would like to place on record my deep sense of gratitude to Dr. Savina Bansal, Head of
Department of Electronics & Communication Engineering, GZSCET, Bathinda, for her
generous guidance, help and useful suggestions.

I express my sincere gratitude to my guide, Mr. Neeraj Gill, Assistant Professor, Department of
Electronics & Communication Engineering, GZSCET, Bathinda for his stimulating guidance &
continuous encouragement and supervision throughout the course of thesis work.

I greatly acknowledge the great help rendered by my co-guide, Mr. Satvir Singh Sidhu, AP &
HOD, Department of Electronics & Communication Engineering, SBSCET, Ferozepur, for his
continuous encouragement & providing me deep insights into the various details of this
research work.

I am extremely thankful to Dr. H. B. Sharda, Principal, SBSCET, Ferozepur, for giving me


support to accomplish my thesis work.

I wish to extend my thanks to Er. R. K. Bansal, Assistant Professor, Department of Electronics


& Communication Engineering, GZSCET, Bathinda, for his valuable suggestions regarding
thesis work.

I also wish to extend my thanks to all those faculty members & other staff members of
GZSCET, Bathinda & SBSCET, Ferozepur, who have directly or indirectly helped me to
complete this research work.

I express my sincere thanks to my family, who supported me whole heartedly with great
patience during the completion of my research work.

Finally, I acknowledge my deepest gratitude to Almighty, this omnipresent power who always
gave me courage to accomplish this task.

(VIKRAM MUTNEJA)

iv
LIST OF FIGURES

Page No.
FIGURE 1.1: TYPE-1 FUZZY LOGIC SYSTEM 2

FIGURE 1.2: EXAMPLE TYPE-1 MEMBERSHIP FUNCTIONS 3

FIGURE 1.3: TYPE-1 MEMBERSHIP FUNCTION VS INTERVAL TYPE-2 MEMBERSHIP FUNCTION 4

FIGURE 1.4: TYPE-2 FLC BLOCK DIAGRAM 5

FIGURE 1.5: BLURRED VERSION OF T1 FS 5

FIGURE 1.6: CLEANING UP OF BLURRED BOUNDARIES OF MF 6

FIGURE 1.7: IT2-FS GENERATION 6

FIGURE 1.8: MATLAB SOFTWARE DEVELOPMENT ENVIRONMENT 8

FIGURE 2.1: CURVATURE PATH OF CAR MOTION 13

FIGURE 2.2: FLS VARIABLES FOR GOLF CART AUTONOMOUS NAVIGATION PROBLEM 16

FIGURE 3.1: BASIC SYSTEM BLOCKS 21

FIGURE 3.2: LINEAR PATHS APPROXIMATION BASED SYSTEM BLOCK DIAGRAM 22

FIGURE 3.3: LINEAR PATHS APPROXIMATION METHOD FOR TRAJECTORY TRACING 23

FIGURE 3.4: CONTINUOUS CURVES BASED SYSTEM BLOCK DIAGRAM 26

FIGURE 3.5: TRAJECTORY CALCULATION USING CONTINUOUS CURVES PATH TRACING 27

FIGURE 3.6: PARAMETERS TRANSFORMATIONS IN CONTINUOUS CURVES PATH TRACING 28

FIGURE 4.1: DIVISION OF COMPLETE NAVIGATIONAL SPACE BY MFS OF INPUT VARIABLES 34


( X_POS, Y_POS )

FIGURE 4.2: DIVISION OF OVERALL NAVIGATIONAL SPACE IN BLOCKS BY MFS OF INPUT 34


VARIABLE X POSITION

FIGURE 4.3: TRAJECTORY SIMULATION FOR A UNSUCCESSFUL CASE 35

FIGURE 4.4: MEMBERSHIP FUNCTIONS OF X_POSITION 36

v
FIGURE 4.5: MEMBERSHIP FUNCTIONS OF AXIS ANGLE 36

FIGURE 4.6: MEMBERSHIP FUNCTIONS OF STEER 37

FIGURE 4.7: FUZZY SETS OF T2 BASED FLC 38

FIGURE 4.8: FUZZY INFERENCING 39

FIGURE 4.9: TYPE REDUCTION & DE-FUZZIFICATION 40

FIGURE 5.1: NON-HOLONOMIC WHEELED MOBILE ROBOT MODEL. 42

FIGURE 5.2: VEHICLES GEOMETRICAL CALCULATIONS 43

FIGURE 6.1: SNAPSHOT OF GUIDE ( MATLAB TOOL TO DESIGN GUIS ) 49

FIGURE 6.2: TRAILING MOTION SIMULATION & DETAILS OF GUI OPTIONS 51

FIGURE 8.1: SIMULATION OUTPUT FOR VARIOUS TRAILS SELECTIONS 66

FIGURE 8.2: PATH TRACES FOR MIN & PRODUCT T-NORMS (A) & (B) 67,68

FIGURE 8.3: PATH TRACES FOR TRAJECTORY TRAVERSING ALGORITHMS (A) & (B) 69

FIGURE 8.4: TYPE-1 VS. INTERVAL TYPE-2 OUTPUT 70

FIGURE 8.5: SIMULATION OUTPUT FOR DIFFERENT IT2-FS WIDTH VALUES (0-200) 67

FIGURE 8.6: D VS W PLOTS FOR VARYING X POSITION (A & B) 73,74

vi
LIST OF TABLES

Page No.
TABLE 2.1: A FUZZY STEERING CONTROL SYSTEMS INPUT & OUTPUT VARIABLES 17

TABLE 3.1: KINEMATICS EQUATIONS DESCRIBED BY LPA ALGORITHM 25

TABLE 3.2: KINEMATICS EQUATIONS FOR CCA ALGORITHM 30

TABLE 4.1: FUZZY I/O VARIABLES FOR CASE-1 33

TABLE 4.2: FUZZY I/O VARIABLES FOR CASE-2 34

TABLE 4.3: MEMBERSHIP FUNCTIONS OF X_POS 35

TABLE 4.4: MEMBERSHIP FUNCTIONS OF PHI 36

TABLE 4.5: MEMBERSHIP FUNCTIONS OF STEER 37

TABLE 4.6: FUZZY RULE MATRIX 37

TABLE 8.1 : DISTANCE D FOR T-NORM SELECTIONS FOR DIFFERENT IPS 68

TABLE 8.2 : COMPARISON OF DISTANCE D FOR TRAJECTORY TRAVERSING ALGORITHM 70


SELECTIONS (LPA & CCA)

vii
NOMENCLATURE

(X,Y,) REAR AXLE MID POINT LOCATION (X POSITION, Y POSITION,


AXIS ANGLE(PHI))

(X,Y,) UPDATED VALUES OF (X, Y, )

(XA,YA) FRONT AXLE MID POINT CO-ORDIANTES

(XA,YA) UPDATED VALUES OF (XA,YA)

ANGLE_T FRONT TYRES ANGLE W.R.T VEHICLES AXIS

ANGLE_V VEHICLES ANGLE W.R.T HORIZONTAL

CCA CONTINUOUS CURVES APPROXIMATION

COA CENTRE OF AREA

COG CENTRE OF GRAVITY

D DISTANCE D TO REACH THE TARGET

DE DISTANCE ERROR

DELTA WIDTH OF IT2 FUZZY SETS

DOM DEGREE OF MEMBERSHIP

DR DISTANCE RANGE

FIS FUZZY INFERENCE SYSTEM

FLC FUZZY LOGIC CONTROLLER

FLS FUZZY LOGIC SYSTEM

FOU FOOTPRINT OF UNCERTAINTY

FS FUZZY SETS

IP INITIAL POSITION

IT2 INTERVAL TYPE-2

LMF LOWER MF

viii
LPA LINEAR PATHS APPROXIMATION

MD MINIMUM DISTANCE D TO TRAVEL

MIN MINIMUM T-NORM

MU MEMBERSHIP FUNCTION

NCC NON CONVERGING CASE

NU NUMBER OF UNSUCCESSFUL CASES

OE ORIENTATION ERROR

OFWV OPTIMIZED FOU WIDTH VALUES

ONF/ONA OVERALL NAVIGATIONAL FIELD/AREA

PRO PRODUCT T-NORM

STEER_T TYRES STEERING ANGLE

STEER_V VEHICLES STEERING ANGLE

TYPE-2 TYPE-II

T1 TYPE -1

T2 TYPE -2

TC TRAJECTORY CONTROLLER

TF TUNING FACTOR

TR TURNING RATIO

UC UNSUCCESSFUL CASE

UMF UPPER MF

V VELOCITY AT FRONT AXLE MID POINT

V_REAR VELOCITY AT REAR AXLE MID POINT

W FOU WIDTH

MEMBERSHIP FUNCTION

T TYRE ANGLE

ix
CONTENTS

Page No.
Candidates Declaration i
Abstract ii-iii
Acknowledgments iv
List of Figures v-vi
List of Tables vii
Nomenclature viii-ix
Contents x-xiv

CHAPTER 1 : INTRODUCTION 1

1.1 Autonomous Navigation 1

1.2 Conventional Fuzzy Logic Systems (T1) 2


1.2.1 Fuzzifier 2
1.2.2 Rule-Base 3
1.2.3 Inference Engine 3
1.2.4 De-Fuzzifier 4

1.3 Type-2 Fuzzy Logic Systems 4


1.3.1 Type Reducer 5
1.3.2 Type-1 to Type-2 Conversion 5

1.4 Development Environment: MATLAB 7


1.4.1 Development Environment 8
1.4.2 Mathematical Function Library 8
1.4.3 The MATLAB Language 9
1.4.4 Graphics 9
1.4.5 MATLAB Application Program Interface 9

1.5 Need & Significance 9

1.6 Objective of Thesis 10

1.7 Implementation process Steps 10


1.7.1 Overall Navigational Field & Goal Setting 11
1.7.2 Vehicles Model 11

x
1.7.3 Design of Simulation Module 11
1.7.4 Design of Type-1 Based FLC 11
1.7.5 Design of GUI 11
1.7.6 Programmed Version of T1 Based System 11
1.7.7 Type-1 to Interval Type-2 Conversion 12
1.7.8 Modification of GUI 12
1.7.9 Waveforms Generation 12

1.8 Organization of Thesis 12

CHAPTER 2 : LITERATURE REVIEW 13

2.1 Trajectory-Traversing 13

2.2 Non-Fuzzy Autonomous Navigation 14

2.3 Type-1 Fuzzy Based Autonomous Navigation 16

2.4 Type-2 Fuzzy Based Autonomous Navigation 18

2.5 Hardware & Software Co-Designs 19

CHAPTER 3 : DESIGN OF TRAJECTORY


TRAVERSING ALGORITHMS 21

3.1 Linear Paths Approximation 22

3.2 Continuous Curves Approximation 26

CHAPTER 4 : FUZZY AUTOMATIC STEERING


CONTROL SYSTEM 31

4.1 Type-1 Fuzzy Logic Design Tool 31


4.1.1 FIS Editor 31
4.1.2 Membership Function Editor 31
4.1.3 Rule Editor 32
4.1.4 Rule Viewer 32
4.1.5 Surface Viewer 32

4.2 Selection of FLS I/O Variables 32


4.2.1 Case 1 33
4.2.2 Case 2 34

xi
4.2.3 Comparison of Case 1 and Case 2 35

4.3 Input Parameters 35


4.3.1 X position 35
4.3.2 Axis Angle 36

4.4 Output Parameters 36


4.4.1 Steer 36

4.5 Design of Rule Base 37

4.6 Type-2 Fuzzy Sets 38

4.7 Fuzzy Inferencing 38

4.8 Type Reduction & De-Fuzzification 40

CHAPTER 5 : DESIGN OF SIMULATION SYSTEM 42

5.1 The Mobile Robot 42

5.2 Plotting of Vehicles Boundary 43


5.2.1 Point P0 43
5.2.2 Point P1 44
5.2.3 Point P2 44
5.2.4 Point P3 44

5.3 Front Wheels 44

5.4 Rear Wheels 45

5.5 Parking Position Boundary 46

5.6 Positional & Navigational Errors 46


5.6.1 Orientation Error (OE) 47
5.6.2 Distance Error (DE) 47
5.6.3 Non-Converging Case (NCC) 48

5.7 Iterative Position Calculation 48

CHAPTER 6 : DESIGN OF GRAPHICAL


USER INTERFACE 49

6.1 GUIDE 49
6.1.1 Laying Out GUI 50

xii
6.1.2 Programming GUI 50

6.2 GUI Controls 50


6.2.1 Simulation Parameters 50
6.2.1.1 x 50
6.2.1.2 y 50
6.2.1.3 Angle_V 51
6.2.1.4 Angle_T 51
6.2.1.5 Velocity 51
6.2.1.6 Conf 51
6.2.1.7 Show trails 52
6.2.1.8 Start simulation 52
6.2.1.9 Pause simulation 52
6.2.1.10 Clear window 52
6.2.2 Fuzzy System Parameters 52
6.2.2.1 IT2 FS width 52
6.2.2.2 Fuzzy t-norms 52
6.2.3 Manual Controller Interface 53
6.2.3.1 Initialize: mouse based control 53
6.2.3.2 Keyboard control 53

CHAPTER 7 : SOFTWARE ARCHITECTUR E 54

7.1 Steering Control System 54


7.1.1 dom_xpos.m 54
7.1.2 dom_phi.m 55
7.1.3 steering.m 55
7.1.4 fire_rule.m 56
7.1.5 inference.m 57
7.1.6 init_rule_matrix 57

7.2 Automatic Motion Simulation Programs 57


7.2.1 Initialization of Vehicle Parameters 58
7.2.2 Plotting Target Boundary 58
7.2.3 Vehicle Tracing w.r.t Reference Point 58
7.2.4 Front & Rear Wheels Tracing 58
7.2.5 Trajectory Calculation Algorithm 58

xiii
7.2.6 Normalizing of vehicle orientation angle 59
7.2.7 Navigational Data Logging 59
7.2.8 Tuning of Steer Angle 59
7.2.9 Turning Ratio (TR) 60
7.2.10 Trails 61

7.3 Manual Motion Simulation Programs 62


7.3.1 Steering 62
7.3.2 Acceleration 63
7.3.3 Initialization of Persistent Variables 63
7.3.4 Resetting Flags 63
7.3.5 initialize_vehicle_parameters.m 63
7.3.6 check_boundary.m 64

7.4 Graphical User Interface 64


7.4.1 start_system.fig 64
7.4.2 start_system.m 65

CHAPTER 8 : RESULTS & DISCUSSION 66

8.1 Trails Selections 66

8.2 Fuzzy T-Norm Selections 67

8.3 Trajectory Traversing Algorithm 69

8.4 Type-1 vs. Interval Type-2 Output 70

8.5 IT2 FS Width Variation 71

8.6 D Versus W plots 71

CHAPTER 9 : CONCLUSIONS & FUTURE SCOPE 75

9.1 Conclusions 75

9.2 Future Scope 76

Publications 77
References 78-80
Appendix I : List of Systems Software Files 81
Appendix II : Matlab Code 82-99

xiv
CHAPTER 1

1 INTRODUCTION
The chapter first contains the basic introductory part which includes introduction to
autonomous navigation, holonomic & non-holonomic types of vehicles, type-1 & type-2 based
fuzzy logic systems, development environment i.e. MATLAB. Further it discusses objectives
of the thesis, steps undertaken for accomplishment of this work & finally briefing of
organization of the thesis.

1.1 Autonomous Navigation


Autonomous navigation can be defined as:

Purposeful navigation of a mobile robot without human intervention to achieve a target


position with the required orientation

Autonomous navigation is a benchmark research area because of its vast majority of


applications, be it in industrial automation, social or civil, precision agriculture or space
exploration works. The type of the robotic vehicle, its physical & kinematics parameters are
decided as per the requirements of the application area. The different constraints on their
motion together with the physical constraints like size and maximum speed are known as the
Robots Kinematics Constraints. Mobile robots come in two categories as far as the type of the
motion is concerned which are holonomic and non-holonomic.

A. Holonomic Robots

Some of commercial and research robots are holonomic. Such vehicles have decoupled
translation and rotation motion. Holonomic robots are able to vary each component of their
position and orientation in-dependently. By turning on the spot they can move in any direction
regardless of their orientation. Therefore they can easily reach the final orientation-angle by
means of a single rotation, once the 2D position has been attained.

1
It is very difficult to design a true holonomic vehicle as there are always some limitations
imposed by the physical design of the vehicle on its kinematics. The design of the holonomic
vehicles requires the intensive study of the carriage unit, the specialized design of the wheels,
their rotational & control mechanism.

B. Non-Holonomic Robots

They may not be able to change their orientation without changing position and/or may only be
able to move in limited number of directions depending on their shape & orientation of
wheels/legs. Therefore Non-holonomic vehicles are forced to translate their motion for turning
to a final orientation. Thus non-holonomic vehicles require a much finer and intelligent control
strategy than holonomic ones. Examples of non-holonomic four wheelers are robots such as
ROJO, which has been successfully used in area of agriculture, others are four wheeler
commercial vehicles such as cars, trucks etc.

1.2 Conventional Fuzzy Logic Systems (T1)


Fuzzy logic has rapidly become one of the most successful of todays technologies for
developing sophisticated control systems. With its aid, complex requirements may be
implemented in amazingly simple, easily maintained, and inexpensive controllers. The fuzzy
technology is abstracted in the form of fuzzy rule base exhibiting approximate reasoning, which
is most suitable in most of the control applications as compared to conventional precise system
modeling. Fig. (1.1) shows basic blocks of a Fuzzy Logic System (FLS). The conventional fuzzy
logic systems have been termed in literature as type-1 because they contain conventional
precisely defined type-1 fuzzy sets. Type-1 fuzzy sets are 2-D in nature as shown in Fig (1.2).

FIGURE 1.1: TYPE-1 FUZZY LOGIC SYSTEM

1.2.1 Fuzzifier

This unit named fuzzifier converts each of the input data to degrees of membership by a lookup
in one or several membership functions. The fuzzifier in fact matches the input data with the
2
conditions of the rules to determine how well a particular input instance matches with the
conditions of each rule.

1.2.2 Rule-Base

This is basically a linguistic controller containing rules in the if-then-and or if-then-or format.
Every element in the Universe of Discourse (complete range of input variable) is a member of a
fuzzy set to some grade, known as Degree of Membership, may have value between 0 to 1. This
function that ties a number (0-1) to each input instance, is called the membership function. e.g.
Fig. (1.2) shows examples of type-1 membership functions mf1 to mf7.

FIGURE 1.2: EXAMPLE TYPE-1 MEMBERSHIP FUNCTIONS

1.2.3 Inference Engine

With the definition of the rules and membership functions in hand, we now need to know how
to apply this knowledge to specific values of the input variables to compute the values of the
output variables. The output is obtained from the Inference Engine in form of output fuzzy sets,
one from each of the rules for each input instance. This process is referred to as Inferencing
and subunit referred to as Inference Engine. The fuzzy sets from different rules are aggregated
to form a single output fuzzy set. This process is called as Composition. After the aggregation
process, there is a fuzzy set for each output variable that needs de-fuzzification.

Thus the process of fuzzy inference involves all of the pieces that are: Membership Functions,
Fuzzy Logic operators, and if-then rules. There are two types of fuzzy inference systems:
Mamdani-Type & Sugeno-Type. These two types of inference systems vary somewhat in the
way outputs are determined. Sugeno type systems expect the output to be of crisp type while
Mamdani type inference expects the output membership functions to be of fuzzy sets. It is
possible, and in many cases much more efficient, to use a single spike as the output
membership-function rather than a distributed fuzzy set. This is sometimes known as a
Singleton Output Membership Function, and it can be thought of as a pre-defuzzified fuzzy set.
It enhances the efficiency of the defuzzification process because it greatly simplifies the

3
computation required by the more general Mamdani method, which finds the Centroid of a
two-dimensional function.

1.2.4 De-Fuzzifier

The resulting output fuzzy set must be converted to a crisp number that can be sent to the
process as a control signal, which is known as de-fuzzification. There are different methods of
de-fuzzification, most common are Centroid and Maximum methods. In the Centroid
method, output crisp value is computed by finding the center of gravity (COG) of the
membership function of output fuzzy set. In the Maximum method, one of the variable values
at which the fuzzy subset has its maximum truth-value is chosen as the crisp value for the
output variable. There are several variations of the Maximum method that differ only in what
they do when there is more than one variable value at which this maximum truth-value occurs.
One of these, the Average-of-Maxima method, returns the average of the variable values at
which the maximum truth-value occurs.

1.3 Type-2 Fuzzy Logic Systems


Type-2 FLSs are characterized by the use of type-2 fuzzy sets. Type-1 fuzzy sets being
precisely defined cannot be used to model the real world environment parameters as there is
always a scope of the uncertainties and incomplete knowledge, while type-2 fuzzy sets are
specially designed to handle such uncertainties and to model the words (as words mean
different to different people). Type-2 fuzzy sets are imprecisely defined and can be 2-D or 3-D
in nature. The generalized T2 fuzzy sets are three dimensional because of their expansion into
all three dimensions that accounts for all around uncertainty inherent in the real world
environment. By putting the reasonable constraints on the dimensions so that generality is not
adversely affected, researchers have also used two dimensional version of T2 fuzzy sets. One
category belonging to this class is, Interval Type-2 Fuzzy Sets (IT2-FS) as shown in Fig. (1.3).

FIGURE 1.3: TYPE-1 VS. INTERVAL TYPE-2 MEMBERSHIP FUNCTION

4
A type-2 FLS has similar blocks as that of type-1 except one additional block, which is called
as Type-Reducer named so as it reduces the fuzzy set from type-2 to type-1 as shown in block
diagram in Fig. (1.4).

1.3.1 Type Reducer

This unit lies in between Inference Engine and De-fuzzification unit in case of T2 based fuzzy
logic systems as shown in Fig. (1.4). It converts the type-2 fuzzy output from the inference
engine to the type-1 before being applied to the de-fuzzifier. De-fuzzifier cannot directly work
on type-2 output as it has to produce the crisp output which it can produce from type-1 only.

FIGURE 1.4: TYPE-2 FLS BLOCK DIAGRAM

1.3.2 Type-1 to Type-2 Conversion

Transformation of system from Type-2 to Type-1 involves transforming the fuzzy sets of the
system variables. Fig. (1.5) represents the transformation at basic level from T1 to T2. Blurring
of the boundaries can be thought of as moving a triangular MF to the left-right & up-down in a
non-uniform manner. So we get the three dimensional blurred version of T1 FS. The blurring
accounts for the presence of uncertainties in the measurement operations being performed by
sensors & accompanied circuitry. A Tilde Symbol over the name of the fuzzy set signifies that it
is a type-2 FS.

FIGURE 1.5: BLURRED VERSION OF T1 FS

5
Next in the process of generation of T2 FS is cleaning things up, so as to get the sharp
boundaries of the T2-FS which can be used further for the inferencing process (see Fig. 1.6).

FIGURE 1.6: CLEANING UP OF BLURRED BOUNDARIES OF MF

"Clean things up" means using well-defined geometric shapes for the upper and lower bounds
of the blurred MF. Here we use a trapezoid to clean up the upper bound of the blurred MF, and
a triangle to clean up the lower bound of the blurred MF. Fig. (1.6) above explains the cleaning
up process for IT2-FS.

FIGURE 1.7: IT2-FS GENERATION


6
Calculations are very intensive with the general 3-dimensional T2-FS. Therefore 2-D Interval
Type-2 Fuzzy sets (IT2 FS) have been selected to design T2-FS based system. This generation
of IT2-FS is based upon assumption of uniform possibilities. How we come at the conclusion
of obtaining interval type-2 FS, is as shown in Fig. (1.7) above.

1.4 Development Environment : MATLAB


Next talking about the software development tool & language, which is MATLAB in this work,
is a high-performance language for technical computing. The name MATLAB stands for matrix
laboratory. MATLAB was originally written to provide easy access to matrix software
developed by the LINPACK and EISPACK projects. Today, MATLAB engines incorporate the
LAPACK and BLAS libraries, embedding the state of the art software for matrix computation.
MATLAB has evolved over a period of years with input from many users. In university
environments, it is the standard instructional tool for introductory and advanced courses in
mathematics, engineering, and science.

MATLAB is an interactive system whose basic data element is an array that does not require
dimensioning. This facilitates solving many technical computing problems, especially those
with matrix and vector formulations which are harder to implement in other non-interactive
languages such as C or FORTRAN. It integrates computation, visualization, and programming
in an easy-to-use environment where problems and solutions are expressed in familiar
mathematical notation. Typical uses include:

A. Math and computation

B. Algorithm development

C. Data acquisition

D. Modeling, simulation, and prototyping

E. Data analysis, exploration, and visualization

F. Scientific and engineering

G. Graphics

H. Application development, including graphical user interface building

In industry, MATLAB is the tool of choice for high-productivity research, development, and
analysis. MATLAB features a family of add-on application-specific solutions called toolboxes.
Very important to most users of MATLAB, toolboxes allow you to learn and apply specialized

7
technology. Toolboxes are comprehensive collections of MATLAB functions (M-files) that
extend the MATLAB environment to solve particular classes of problems. Areas in which
toolboxes are available include signal processing, control systems, neural networks, fuzzy
logic, wavelets, simulation, and many others. The MATLAB system consists of five main parts:

1.4.1 Development Environment

This is the set of tools and facilities that help you use MATLAB functions and files. Many of
these tools are graphical user interfaces. It includes the MATLAB desktop, command window, a
command history, an editor and debugger, and browsers for viewing help, the workspace, files,
and the search path. Figure (1.8) below shows snapshot of MATLAB development environment.

FIGURE 1.8: MATLAB SOFTWARE DEVELOPMENT ENVIRONMENT

1.4.2 Mathematical Function Library

This is a vast collection of computational algorithms ranging from elementary functions like
sum, sine, cosine, and complex arithmetic, to more sophisticated functions like matrix inverse,
matrix eigen values, bessel functions, fast fourier transforms & lot more.

8
1.4.3 The MATLAB Language

This is a high-level matrix/array language with control flow statements, functions, data
structures, input/output, and object-oriented programming features. It allows both
"programming in the small" to rapidly create quick throw away programs, and "programming
in the large" to create large and complex application programs.

1.4.4 Graphics

MATLAB has extensive facilities for displaying vectors and matrices as graphs, as well as
annotating and printing these graphs. It includes high-level functions for two-dimensional and
three-dimensional data visualization, image processing, animation, and presentation graphics. It
also includes low-level graphics control functions for full customization of the appearance..

1.4.5 MATLAB Application Program Interface

This is a library that allows you to write C and Fortran programs that interact with MATLAB. It
includes facilities for calling routines from MATLAB (dynamic linking), calling MATLAB as a
computational engine, and for reading & writing MAT-files.

1.5 Need & Significance


Auto-Navigation: Vast majority of the vehicles and robots are non-holonomic. It is always
important to navigate autonomously a vehicle to obtain a precise final location & orientation in
applications such as precision agriculture, horticulture, gardening, forestry, industrial works,
social or civil works, space works, geo studies and a lot more applications. Auto navigation is
also applicable to many hazardous or tedious navigation tasks which can be both more
efficiently accomplished and more environmental & human respectful, such as in pesticide
spraying or de-mining operations etc. Driving and parking of non-holonomic vehicles require a
high degree of expertise, as non-trivial and often complex maneuvering are needed to reach a
close location with a final orientation when it is highly deviated from the initial one. Therefore
it is important that a study should be conducted on the navigation techniques of non-holonomic
robots.

FLS & T2: A Fuzzy controller can be specially suited to embed the human knowledge to
manually drive a vehicle without having a complete analytical model. Much of the research has
been carried out in implementing the type-1 fuzzy rule based controllers to handle the problem
of automatic navigation. Type-2 fuzzy sets is quite novice research area, being preferred than
type-1 fuzzy sets to better handle the uncertainties and noise in the inputs because of its two or

9
three dimensional expansion. Only recently some attempts have been made to use type-2 fuzzy
sets to handle this problem. For this research work, a special class of type-2 fuzzy sets i.e.
interval type-2 fuzzy sets have been chosen without any significant loss to the generality of the
solution.

Simulator: A simulator for autonomous navigation is required to test different navigational


behaviors in a mobile robot. The simulator facilitates the emergence of aspects of navigational
behavior not accounted for or never imagined by the human designer under particular sensorial
and computational conditions. It gives the possibility to work at a higher granularity level in the
development of behaviors, without bothering about low-level implementation details.

1.6 Objective of Thesis


The objective of this research work is development of interval type-2 fuzzy logic based model
in MATLAB environment for a non-holonomic car like vehicle to navigate autonomously to the
final parking position from a selectable initial position. The model has to be developed as
simulator that account for real kinematics restrictions of car like non-holonomic robotic
vehicles, to aid testing and optimization of perceptual and navigational behaviors of non-
holonomic vehicles under different conditions. Developed model is anticipated to have
following capabilities:

A. Model should be able to accept different parameters such as trajectory traversing


algorithm, various fuzzy preferences such as fuzzy t-norm, width of interval type-2
fuzzy sets & other positional & navigational parameters.

B. Visualization of simulation in different views such as trailing or non-trailing motion,


customized simulation of trajectory of front & rear tyres.

C. Display of instantaneous navigational & positional parameters such as x, y co-ordinates


of position, orientation angle (Phi), tyre angle etc.

D. Logging of navigational & positional parameters in files for later analysis.

E. Manual control of steering & velocity for analysis of breakdown conditions.

1.7 Implementation Process Steps


The task of auto-navigation requires the vehicle to steer its wheels autonomously to achieve the
required vehicles steering so as to finally reach the target position & orientation iteratively.
Non-fuzzy techniques uses precise mathematical modeling while fuzzy based techniques

10
involve artificial intelligence based reasoning to steer the vehicle to achieve its target. Stepwise
details of the tasks undertaken to accomplish this work has been given below:

1.7.1 Overall Navigational Field & Goal Setting

Clearly defining the goal i.e. decided the area for which the system has to be designed. To
study this problem, the area 200 * 200 units i.e. 40000 square units on the screen had been
selected as Overall Navigational Area (ONA), in which simulation has been performed.

1.7.2 Vehicles Model

Decided the model of the vehicle to be simulated. To study this problem, dimensions of the car
ALTO : 2005 model, Make : Maruti were measured. All the measurements related to its
geometry e.g. length, width, tyre size, tyre radius, position of the front and rear axle, distance
between front and rear axle etc. were taken. The vehicle drawn in the simulation has geometry,
which is in proportion to this selected model. The geometrical variables have been scaled
accordingly for proper viewing on the simulation screen.

1.7.3 Design of Simulation Module

Design of the simulation module, to position the vehicle at a specified position and give it
motion in the required orientation by designing a suitable trajectory traversing algorithm, which
can accept various user preferences such as initial pose, trails selections, fuzzy parameters etc.

1.7.4 Design of Type-1 Based FLC

Initially Type-1 based system had been developed which could be converted into Type-2 based
system. The system was designed in the form of FIS (Fuzzy Inference System) file using type-
1 based fuzzy logic toolbar available in MATLAB.

1.7.5 Design of GUI

Designing of graphical user interface (GUI) to interface & interlink simulation module i.e.
Trajectory Controller(TC) & the fuzzy logic based steering control system module, which
could enable passing the various positional, navigational and fuzzy preferences to the system to
visualize simulations in different modes.

1.7.6 Programmed Version of T1 Based System

Programmed the complete type-1 based control system without using inbuilt fuzzy logic toolbar
of MATLAB for further conversion into type-2 based system, as no toolbar is available in

11
MATLAB for type-2 based system development. All operations had to be programmed from
scratch.

1.7.7 Type-1 to Interval Type-2 Conversion

Programmed the complete type-2 Based system from the type-1 based system software. It
incorporated the introduction of the parameter Delta , which is for the expansion of the T1
fuzzy sets so as to realize their interval T2 version.

1.7.8 Modification of GUI

Modified GUI to incorporate the parameters of Type-2 based system such as width of interval
Type-2 FS.

1.7.9 Waveforms Generation

Developed the simulator to study the response of the system w.r.t the variations in the width of
the interval type-2 fuzzy sets. It generates the waveform of distance to travel (D) vs. FOU
width (W) for a selected set of observational parameters and initial position.

1.8 Organization of Thesis


Organization of thesis can be divided into three main parts as:

I. First part covers introduction and literature survey, which includes chapters 1 & 2.

II. Second part covers the overall work done to develop the complete model. This part
includes chapters 3 to 7.

III. Third part is the conclusive one containing two chapters which are results & discussion
and last one i.e. conclusions & future scope.

12
CHAPTER 2

2 LITERATURE REVIEW
This chapter includes literature review on trajectory traversing techniques, non-fuzzy & fuzzy
autonomous navigation techniques, type-1 fuzzy techniques, type-2 fuzzy logic systems and
navigational techniques using type-2 fuzzy logic systems, use of matlab/simulink to design
simulators and finally use of low cost sensors and camera for autonomous navigation.

2.1 Trajectory Traversing


Scheuer et al [1] in 1996, presented continuous-curvature path planner (CCPP), one of the first
planners for car-like robots which could compute the collision free path consisting of straight
segments connected with tangential circular arcs. The discontinuities constrained the motion in
respect that car would have to stop at these points and reorient its front wheels in the desired
direction.

FIGURE 2.1: CURVATURE PATH OF CAR MOTION

Scheuer et al [2] in 1997 extended their earlier work [1] to remove the motion constraint at
discontinuities by designing a path comprising of pieces, each piece being a line segment, a
circular arc of maximum curvature or a clothoid arc, called as simple continuous curvature
paths(SCC). The earlier limitation was removed by adding the continuous curvature constraint
and a constraint on the curvature derivative to imply that car like vehicle could orient its front

13
wheels with a small finite velocity. Result was a first path planner for a car like vehicle to
generate collision free path with continuous curvature and maximum curvature derivative
which was experimentally verified.

2.2 Non-Fuzzy Autonomous Navigation


I. Paromtchik et al [3] in 1997, studied the autonomous maneuver of a non-holonomic vehicle
in a structured dynamic environment, focused on motion generation and control methods to
autonomously perform lane following/ changing and parking maneuver. The parallel parking
involved a controlled sequence of motions to localize a sufficient parking space, to obtain a
convenient start location and perform parking maneuver. The approach was based on the design
of a global analytic trajectory and then designing the control process to follow this trajectory.
The developed method was tested on LIGIER electric car. The vehicle was equipped with a
Motorola VME162-CPU based control unit, ultrasonic range sensors and linear CCD camera.
The developed steering and velocity control was implemented using ORCCAD software and
transmitted via Ethernet to CPU board. Effective autonomous parking maneuvers were
experimentally verified.

Th. Fraichard et al [4] in 1998, presented the first path planner taking into account both non-
holonomic and uncertainty constraints. He proposed the algorithm to compute feasible and
robust path, assuming the existence of the landmarks to allow the robot to re-localize itself.
While navigating, control and sensing errors were supposed to remain within bounded sets. The
solution featured a robot independent global planner relying on robot specific local path
planner, adaptable to a wide variety of robots and uncertainty models.

Minguez et al [5], in 2002, addressed the problem of applying reactive navigation methods to
non-holonomic robots. Rather than embedding the motion constraints when designing a
navigation method, they introduced the robots kinematic constraints directly in the spatial
representation by applying a transform to the conventional workspace model or configuration-
space model. In this space - the Ego-Kinematic Space the robot moves as a free-flying
object, thus facilitating the application of majority of research of free-flying reactive
navigation algorithms to non-holonomic robots. This methodology can be used with a large
class of constrained mobile platforms e.g. differential-driven robots, car-like robots, tri-cycle
robots etc. They demonstrated experiments involving non-holonomic robots with two reactive
navigation methods whose original formulation did not take the robot kinematic constraints into
account ( Nearness Diagram Navigation and a Potential Field method).

14
Igor E. Paromtchik [6], in 2004, addressed planning control commands of the steering angle
and velocity for low-speed autonomous parking maneuvers in a constrained traffic
environment, by making use of conformity between the control commands and resulting shape
of the path. The path shape required for a parking maneuver was evaluated from the
environmental model. The corresponding control commands were selected and parameterized
to provide motion within the available space, to be executed by the car servo systems to drive
the vehicle into the parking place. The approach was tested on a CyCab automated vehicle. The
experimental results on a perpendicular parking maneuver were described; the obtained results
proved the effectiveness of autonomous perpendicular and parallel parking maneuvers.

M.Yousef Ibrahim et al [7], in 2004, discussed on various autonomous navigation techniques.


The problem of mobile robot navigation is a wide and complex one. The environments, which a
robot can encounter, vary from static indoor areas with a few fixed objects, to fast-changing
dynamic areas with many moving obstacles. The goal of the robot may be reaching a prescribed
destination or following as closely as possible a pre-defined trajectory or exploring and
mapping an area for a later use. In most cases, this task is broken down into several subtasks as:

A. Identifying the current location of the robot, and the current location of objects in its
environment.

B. Avoiding any immediate collisions facing the robot i.e. reactive behavior.

C. Determining a path to the objective.

D. Resolving any conflicts between the previous two subtasks, taking into account the
kinematics of the robot.

They discussed different Navigation methodologies such as Simultaneous Localization and


Mapping (SLAM) which involves clubbing of two techniques, Localization techniques i.e. the
problem of identifying the robots position in the environment with respect to known features,
& Map building techniques i.e. to construct an internal model of any unknown features in the
environment. Line segment techniques which extract line segments from adjacent collinear
range measurements to develop a line segment map & then using a fast matching algorithm to
compare this local line-segment map to a global map, the robot can reduce any position error
developed from slippage and drift. Another novice technique Artificial Potential Field based
which involves modeling the robot as a particle in space, acted on by some combination of
attractive and repulsive fields. In this technique obstacles and goals are modeled as charged
surfaces, and the net potential generates a force on the robot. These forces push the robot away

15
from the obstacles, while pulling it towards the goal. The robot moves in the direction of
greatest negative gradient in the potential. Despite its simplicity this method can be effectively
used in many simple environments.

2.3 Type-1 Fuzzy Based Autonomous Navigation


James A. Freeman [8] in 1994, presented simulation work based upon T1 FLS that
automatically backs up a truck to a specified point on a loading-unloading dock. He worked on
two fuzzy input variables vehicle orientation (Phi) and x position (xpos) to generate output
steer to steer the vehicle towards the final parking position. The velocity of the vehicle was
kept at fixed value which was used to compute the next iterative position of the vehicle from
the FLS output.

Ollero et al. [9] in 1997, proposed a fuzzy explicit path tracking method, applied to mobile
robots RAM-1 and AURORA. They used a fuzzy rule based system to track a pre-computed
path for a non-holonomic small size robot which was intended to handle complex and non-
linear kinematics and dynamics, and to model the interaction between wheels and ground. They
concluded that fuzzy controllers cope well with the incomplete and uncertain knowledge
inherent to the subsystem interactions and non-linearities & are specially suited to embed the
human intelligence in the form of fuzzy rule base.

Koay Kah Hoe [10], in 1998, developed a fuzzy expert system for the golf cart navigation
control problem, for golf cart to navigate to final destination avoiding the known obstacles.
FLC was simulated on PC as well as implemented in hardware. The problem of navigation has
been depicted in Fig. (2.2).

FIGURE 2.2: FLS VARIABLES FOR GOLF CART AUTONOMOUS NAVIGATION PROBLEM

16
Model had been tested and simulated in the block diagram based simulation environment using
Simulink. Simulated results were quite satisfactory as the cart could navigate to final
destination with any of the initial set position and orientation. Fuzzy input/output variables used
by the control system are as tabulated in table (2.1).

TABLE 2.1: A FUZZY STEERING CONTROL SYSTEMS INPUT & OUTPUT VARIABLES

L. Garca-Prez et al [11], in 2001, developed a fuzzy logic based simulation environment as a


software tool to aid in the design and development of both virtual sensors and worlds to mimic
real environments and robots to accommodate for complexity and uncertainty inherent to the
real environments and sensing systems in motion autonomy. The exhibited kinematics model of
the mobile robot could be defined through a set of equations to map the driving variables of the
robot to 2D relative co-ordinates. ROBOT was modeled as a rigid solid to move on a flat
surface with four points of contact with the ground i.e. four wheels. The kinematics model
could map the steering angle of the front wheels, distance between the four wheel contact
points and the velocity of the robot.

Th. Fraichard & Ph. Garnier [12] in 2001, worked on the reactive component of motion
autonomy by designing a fuzzy controller named as Execution monitor, to generate
commands to servo systems of the vehicle so as to follow a nominal trajectory while reacting in
real time to unexpected events. The logic of EM was based on fuzzy logic, which incorporated
Fuzzy rules encoding the reactive behavior of the vehicle, aggregating the several basic
behaviors of motion of such vehicles. Each of the basic behavior was encoded into specific set
of the rules. Weighing coefficients could be added to different rules. Experiments results
carried were quite satisfactory to perform the trajectory following and obstacle avoidance in
real outdoor environment.

L. Garca-Prez et al [13], in 2003, implemented FLS for an approaching oriented maneuver


with a car-like vehicle in outdoor environments. An FLC was implemented using minimum
number of input variables in a set of rules to take the decisions iteratively for the autonomous

17
steering of an agricultural utilities-based robot ROJO, to reach a final position and orientation
from an initial one. The system was developed based upon the knowledge extraction from the
experts and presented in the form of fuzzy sets and rule-base to make the decisions for the
steering and velocity controls of the vehicle. The System was implemented in hardware as well
as simulated to check the navigational behaviors. Complete maneuvering process was divided
into three zones:

(1) Approximation zone Active if vehicle is quite far from goal, steering commands lead
vehicle just to approach the goal without minding the orientation.

(2) Preparation zone Steering commands drive the robot to opposite direction to that of goal
orientation to anticipate the goal orientation in shorter distance.

(3) Orientation zone Meant to achieve the final orientation, in which steering commands lead
to shortening of longitudinal as well as angular distance from the goal. Switching on the
behavior between three zones depends upon the absolute value of orientation angle of vehicle
with respect to goal orientation.

2.4 Type-2 Fuzzy Based Autonomous Navigation


Zadeh [14], in 1975, extended the concept of Type-1 fuzzy set to Type-2, reasoning that use of
uncertain parameters like words to model Type-1 fuzzy sets, is no appropriate. Here words are
said to be uncertain because words mean different to different people. Something uncertain
cannot be used to model something that is certain i.e. Type-1 FS.

Dongming Wang and Levent Acar [15] in 1999, compared the type-2 fuzzy sets preliminaries
with the ordinary type-1 fuzzy sets, proved two theorems, one to generate the general form of
the type-2 operations, and second to transfer the type-1 fuzzy uncertainties to a type-2 fuzzy
uncertainties. They worked on fuzzy operations like union, intersection & complement, and on
fuzzy relations. Second theorem related the uncertainties of the noise in the variables as
collections of membership functions assigned to nominal values of the variables. They
concluded that a type-2 fuzzy system could handle the uncertainties in the rules, in the system
parameters and in the system inputs.

Mendel in [16]-[21], 2000-04, extended the same concept in various dimensions and raised the
use of interval type-2 fuzzy sets (IT2 FS) to a more general case, i.e., T2 FS to handle
uncertainties due to at least four sources in T1 FLS: (1) The words that are used in the
antecedents and consequents of rules can be uncertain (words mean different things to different
18
people), (2) Consequents may have a histogram of values associated with them, especially
when knowledge is extracted from a group of experts, who do not agree at all, (3)
Measurements that activate a T1 FLS may be noisy and, therefore, uncertain and (4) The data
that are used to tune the parameters of a T1 FLS may also be noisy. All of these uncertainties
translate into uncertainties about fuzzy set membership functions.

Hani Hagras [22], [23], in 2004 used T2 FLS to implement different robotic behaviors on
different robotic platforms for indoor and outdoor unstructured and challenging environments.
This resulted in a very good performance that outperformed the T1 FLS whilst using smaller
rule-base. Architecture was based on IT2 FS to implement the basic navigation behaviors and
the coordination between these behaviors produced a T2 HFLC (Hierarchal Fuzzy Logic
Controller), which further, simplified the design and reduced the rule-base size determined to
have the real time operation of the robot controller.

2.5 Hardware & Software Co-Designs


Chaves et al [24], in 2001, described the use of matlab/simulink environment to simulate and
validate in real time the results concerning the guidance, navigation and control techniques
applied to low cost mobile platform. They used a CPU running the matlab/simulink
environment to handshake the signals with the hardware mobile platform. The objective of the
work was to show the preliminary results of capability of the development environment in real
time for the mobile platforms control designing.

K. Rudzinska et al [25], in 2005, examined the validity & performance of the virtual
reality(VR) simulation/control system in an experimental environment. The corresponding
models of the space consisting of several rooms connected by a narrow space hallway and the
robot were created using three-dimensional VR graphics. The robot task was to navigate from a
given start to a selected target. For each trip, called a mission, a collision-free feasible
trajectory was generated by DRPP algorithm (Dijkstras algorithm adapted to robot path
planning) or determined by the human operator. However, the purpose of the system was not
only to simulate the robot motion in three-dimensional world of virtual reality, but also to
create a human interface system for tele-operation of a robot.

Vahid Rostami et al [26], in 2005, developed fuzzy control to correct three wheel omni-
directional robot motion to catch the target. Project was implemented for a middle sized robot
soccer team. Results of implementation of precise mathematical logic based controller (PID)
with fuzzy controller were compared. PID controller was found to have overshoot in the x

19
position & y position as well as settling time of 0.08 seconds. Concept of feedback was used to
remove these errors. Results also simulated in matlab/simulink fuzzy logic toolbox, showed
quite good improvement on overshoot as compared to conventional PID controller.

F. Cupertino et al [27], in 2006, addressed research on reactive navigation strategies to allow


autonomous units, equipped with relatively low-cost sensors and actuators, to perform complex
tasks in uncertain or unknown environments like exploration of inaccessible or hazardous
environments & industrial automation. They used fuzzy logic (FL) to overcome the difficulties
of modeling the unstructured, dynamically changing environment, which is difficult to express
using mathematical equations. They developed a flexible and modular hardware platform based
upon mobile robot Khepera* and dSPACE(DS1104)** micro-controller board & a USB
camera attached to PC USB port to provide the visual information to control system. The
behavior based control scheme was based upon three fuzzy controllers as Reach the target
(FLC1), Avoid obstacles (FLC2) and Explore the environment (FLC3). The aggregation
of three behaviors, named in general, could enable the final Fuzzy Supervisor System to
control the autonomous navigation of the mobile robot.

* Khepera is a differential drive robot, comes with the simulator(Linux version only), serial link capability, two
wheels and eight infra red sensors, particularly useful for rapid initial testing in real world environments.
**DS1104 is a general-purpose rapid prototyping control board fully programmable in matlab/simulink
environment using Real Time Workshop routine

20
CHAPTER 3

3 DESIGN OF TRAJECTORY
TRAVERSING ALGORITHMS
This chapter discusses design of two types of trajectory traversing techniques: Linear Paths
Approximation (LPA) & Continuous Curves Approximation (CCA), & their integration with
fuzzy logic based steering control system while LPA or CCA being the algorithm implemented
in trajectory controller (TC).

In trajectory traversing module, given the initial position, next position has to be calculated in
terms of the variables x, y and . Plotting of the vehicle is done w.r.t the mid point of the rear
axle which also defines the position of the vehicle as: ( x, y, ) .

( x, y ) : The Cartesian co-ordinates of the rear axle mid point

: Angle of the vehicles axis w.r.t horizontal axis.

As shown in Fig. (3.1), by passing the arguments ( x, y, ) to Trajectory Controller (TC), we


get the updated position of the vehicle as ( x' , y ' , ' ) . Iterative motion is generated by
calculating the next position of the vehicle in each iteration by applying the suitable trajectory
traversing algorithm in Trajectory Controller (TC). Two of the variables i.e. x position &
vehicle axis angle are fed back from TC to FLS.

FIGURE 3.1: BASIC SYSTEM BLOCKS

21
3.1 Linear Paths Approximation
In this method, motion of the vehicle is divided into two parts: - main component at front axle
and its effect in turn at rear axle. For this two geometrical points are considered:

( xa, ya ) : Front axle mid point


( x, y ) : Rear axle mid point

Both the points are subjected to a small linear motion. Let point ( xa, ya ) is subjected to a small
linear motion in the direction parallel to the direction of front wheels. As shown in the Fig.

(3.2), points ( x, y ) & ( xa, ya ) are subject to transformation ( x' , y ' ) & ( xa ' , ya ' ) respectively.

This transformation in T is taken as input to our trajectory calculation algorithm to get the
outcome transformations as shown in the block diagram representation in Fig. (3.2).

FIGURE 3.2: LINEAR PATHS APPROXIMATION BASED SYSTEM BLOCK DIAGRAM

Where v : Vehicles velocity being exhibited by front axle mid point.

v _ rear : Resultant velocity exhibited by rear axle mid point.

As per Fig.(3.3), following transformations have to be calculated to completely define the new
position of the vehicle:

( x, y , )  ( x' , y ' , ' )

( xa, ya )  ( xa ' , ya ' )

v  v _ rear

22
FIGURE 3.3: LINEAR PATHS APPROXIMATION METHOD FOR TRAJECTORY TRACING

As per Fig. (3.3),

gamma = = T + , where

: Angle of the front wheels w.r.t. horizontal axis. Therefore it is also subject to transformation
as:

 '

Let us say a small linear motion d is applied at ( xa, ya ) . If we have to perform every iteration
after time interval t ,

d = v t ,

For the unit time interval,

d = v

So transformation of ( xa, ya ) can be formulated as:

xa ' = xa + v. sin( ' ) ----------(3.1)

ya' = ya + v. sin( ' ) ----------(3.2)

From Fig. (3.3), transformation of ( x, y ) can be formulated as:

x' = x + v _ rear. cos( ' ) ----------(3.3)

23
y ' = y + v _ rear. sin( ' ) ----------(3.4)

As per the geometry of the vehicle, points ( x, y ) & ( xa, ya ) can also be calculated as:

xa = x + d . cos( )
----------(3.5)

ya = y + d . sin( )
----------(3.6)

xa ' = x'+ d . cos( ' )


----------(3.7)

ya ' = y '+ d . sin( ' )


----------(3.8)

From equations (3.1, 3.5 & 3.7)

xa ' = xa + v. cos( ' ) i.e. x'+ d . cos( ' ) = [ x + d . cos( )] + v. cos( ' )

From equation (3.3)

[{x + v _ rear. cos( ' )} + d . cos( ' )] = [ x + d . cos( )] + v. cos( ' )

(v _ rear + d ). cos( ' ) = d . cos( ) + v. cos( ' )


----------(3.9)

Similarly from equations (3.2, 3.4, 3.6 & 3.8)

(v _ rear + d ).sin( ' ) = d . sin( ) + v. sin( ' )


----------(3.10)

Dividing equation (3.9) by (3.10) and rearranging we get

d .[sin( ' ). cos( ) cos( ' ). sin( )] = v.[sin( ' ). cos( ' ) cos( ' ). sin( ' )]
----------(3.11)

=> d .[sin( ' )] = v.[sin( ' ' )]

Where ' = Vehicles Steer = Steer_V

and ' ' = T '

So equation can be re-written as:

24
d [sin(Steer _ V )] = v[sin(T ' )]

v
=> Steer _ V = sin 1 . sin( T '
d

v
' = + sin 1 . sin( T '
d ----------(3.12)

From equation (3.10)

(v _ rear + d ). sin( ' ) = d . sin( ) + v. sin( ' )

d . sin( ) + v. sin( ' ) d . sin( ' )


v _ rear =
sin( ' ) ----------(3.13)

v _ rear. sin( ' ) = d . sin( ) + v. sin( ' ) d . sin( ' )


----------(3.14)

From equation (3.9)

(v _ rear + d ). cos( ' ) = d . cos( ) + v. cos( ' )

i.e. v _ rear. cos( ' ) = d . cos( ) + v. cos( ' ) d . cos( ' )


----------(3.15)

From (3.3), (3.4), (3.14) and (3.15)

x' = x + d . cos( ) + v. cos( ' ) d . cos( ' )


----------(3.16)

y ' = y + d . sin( ) + v. sin( ' ) d . sin( ' )


----------(3.17)

Finally kinematics equations can be tabulated for LPA as:

TABLE 3.1: KINEMATICS EQUATIONS DESCRIBED BY LINEAR PATHS APPROXIMATION ALGORITHM

25
3.2 Continuous Curves Approximation
In this algorithm, path is considered to be made up of the continuous curves each with the
radius decided by the angle of front tyres w.r.t vehicle. The total path is calculated step by step
with the every iteration based upon the current value of the tyre angle w.r.t vehicle axis. Angle
of the front tyres is being calculated by the underlying fuzzy logic based control system. Unlike
LPA, in CCA point (x, y) is subject to same velocity as that of (xa, ya) i.e. velocity v for both as
set by GUI control.

FIGURE 3.4: CONTINUOUS CURVES APPROXIMATION BASED SYSTEM BLOCK DIAGRAM

Where T = Front Tyres angle w.r.t. vehicles axis. &

d = Distance between front and rear axle.

Observe the Fig.(3.5), where a curved section of the motion is shown with its start ( x, y, xa, ya )

and end point ( x' , y ' , xa ' , ya ' ) .

Radius of the curvature, from Figs. (3.5 & 3.6) can be given as:

d
R=
Tan( T ) ----------(3.18)

As shown in Fig. (3.5 and 3.6) showing parameters transformation, equation of the curve can
be given as:

26
( X a ) 2 + (Y b) 2 = R 2
----------(3.19)

FIGURE 3.5: TRAJECTORY CALCULATION USING CONTINUOUS CURVES PATH TRACING ALGORITHM (CCA)

As ( x, y ) is start point of the curve and ( x' , y ' ) is the end point of the curve so both are
supposed to be present on the curve as per following equations :

( x a ) 2 + ( y b) 2 = R 2
----------(3.20)

( x' a ) 2 + ( y 'b) 2 = R 2
----------(3.21)

From the start position triangle CKS, Fig. (3.6), Center of the curvature (a, b) is given as:

a = x R.Sin( )
----------(3.22)

b = y + R.Cos ( )
----------(3.23)

27
Similarly from the new position triangle CKE, see Fig. (3.6), transformed point ( x' , y ' ) is
given as:

x' = a + R.Sin( ' )


----------(3.24)

y ' = b R.Cos ( ' )


----------(3.25)

FIGURE 3.6: PARAMETERS TRANSFORMATIONS IN CONTINUOUS CURVES PATH TRACING

From equations (3.22) & (3.23),

x' = x R. sin( ) + R. sin( ' )


----------(3.26)

y ' = y + R. cos( ) R. cos( ' )


----------(3.27)

From Fig. (3.6), arc length moved by the vehicle is decided by the velocity of the vehicle. Let

v : Velocity of the vehicle.

28
t : Smallest time interval, taken as the step size for each Iteration.

Arc length or the distance moved per iteration can be given as :

d = v.t

If = angle moved by vehicle in time t

arc _ length d
= =
radius R

For the unity time interval

d v.t v
= = =
R R R

From equation (3.18)

v
= . tan( T )
d

But = ' , i.e.

v
' = + . tan( T ) ----------(3.28)
d

SPECIAL CASE ( T = 0)

d
As R=
Tan( T )

in MATLAB terminology, division by zero is handled as:

R = NaN i.e. Not a Number

From equations (3.26) and (3.27), as ( x' , y ' ) are in terms of R , MATLAB will return as:

x' = NaN &

y' = NaN

29
There will be an error in trajectory algorithm. To avoid this it is appropriate to apply the linear
approximation algorithm in this special case.

From equation (3.28),

' =

Applying linear motion equations on (x, y)

x' = x + v. cos( ' )

y ' = y + v. cos( ' )

In the simulation, we are drawing the vehicle with respect to the rear axle mid point with the
given orientation . So the set of these three parameters i.e. ( x, y, ) completely defines the
position of the vehicle. So the complete trajectory calculation for CCA can be defined by
following set of equations:

TABLE 3.2: KINEMATICS EQUATIONS FOR CONTINUOUS CURVES APPROXIMATION ALGORITHM

30
CHAPTER 4

4 FUZZY AUTOMATIC STEERING


CONTROL SYSTEM
This chapter discusses use of type-1 FLS tool of matlab to design steering control system,
selection of fuzzy input output variables for desirable path traversing, type-1 fuzzy inputs &
outputs, their range & membership functions, design of rule-base, type-2 fuzzy sets for inputs,
process of fuzzy inferencing & finally techniques used for type reduction i.e. from type-2 to
type-1 and de-fuzzification method.

4.1 Type-1 Fuzzy Logic Design Tool


This is inbuilt design tool available in MATLAB to design & test type-1 fuzzy logic based
systems. We can build the system using the graphical user interface (GUI) tools provided by
the fuzzy logic toolbox. Fuzzy Logic Toolbox can be used graphically as well as from command
line. There are five primary GUI tools for building, editing, and observing Fuzzy Inference
Systems (FIS) in the fuzzy logic toolbox. These GUIs are dynamically linked, in that the
changes you make to the fuzzy inferences system using one of them, can affect what you see on
any of the other open GUIs. You can have any or all of them open for any given system. Output
file generated by this tool is called as fis file and carries extension fis.

4.1.1 FIS Editor

The FIS Editor handles the high-level issues for the system such as: How many inputs and
output variables?, What are their names? etc. The fuzzy logic toolbox doesn't limit the
number of inputs. However, the number of inputs may be limited by the available memory of
machine. If the number of inputs is too large, or the number of membership functions is too big,
then it may also be difficult to analyze the FIS using the other GUI tools.

4.1.2 Membership Function Editor

The Membership Function Editor is used to define the shapes & range of values of all the
membership functions associated with each variable. The alteration can be done either by using
31
range setting text box or by graphically dragging the membership function arms using mouse
based control.

4.1.3 Rule Editor

The Rule Editor is for editing the list of rules that defines the behavior of the system.
Antecedent (input) variables or their negated version can be connected by using and or or
operator for a particular consequent (output) variable or its negated version. Rule thus made
will be of the form such as:

If X_Pos is LE and Phi is RB then Steer is PS (1)

X_Pos & Phi are antecedents and Steer is consequent, LE & RB are corresponding membership
functions, bracketed 1 signifies the weight of the corresponding rule. In this way we can add as
many rules as our system needs. However there is limitation of this rule-editor that it doesnt
check for error of duplication of any of the rules.

4.1.4 Rule Viewer

The Rule Viewer and the Surface Viewer are used for looking at, as opposed to editing, the
FIS. They are strictly read-only tools. The Rule Viewer is a MATLAB based display of the
fuzzy inference diagram shown at the end of the last section. Used as a diagnostic, it can show
for example which rules are active, or how individual membership function shapes are
influencing the results.

4.1.5 Surface Viewer

The Surface Viewer is used to display the dependency of one of the outputs on any one or two
of the inputs i.e. it generates and plots an output surface map for the system. The surface
generated by the rules can be viewed in 3D also for better visualization. Surface viewer can
give important information regarding stability and accuracy of the system. There should be
smooth variations in consecutive rules, which generate a smooth surface. Therefore smoother
the variations in the surface, better performance can be expected from the system. However if
the surface is not showing smooth variations i.e. there are sharp edges, system is expected to be
less stable & accurate and our rules need to be revised.

4.2 Selection of FLS I/O Variables


As an output from the system, we need the required steering value to be applied to the front
wheels. For this task, we have to select the input parameters which can deliver the required

32
output. The steering is applied to the vehicle, which is obtained from output of FLS, as the
updated value of front wheels angle.

i.e. if Steer = output value of the fuzzy control system,

then T ' = Front wheels new angle = Steer

This step was tested and tried by taking different number & types of parameters. However
selection of the parameters is limited by some restrictions on number & properties of
input/output variables. Number of input variables has to be kept to minimum to achieve the
required objective, as there has to be smoothness of the variations in the input & output
variables from one rule to next rule. It is difficult to maintain the smoothness in case number of
variables is large. It means the output of one rule may interfere with the output of the other rule
in case there are too many input variables. Two of the cases have been studied as follows.

4.2.1 Case 1

Following tabulates input/output variables in this case.

TABLE 4.1: TABLE OF FUZZY I/O VARIABLES FOR CASE I

Number of variables on input side is more in this case. It may give more accurate results as it
divides the Overall Navigational Field(ONF) into more number of blocks as shown in Fig.
(4.1). Therefore more number of rules and consequently more control over the vehicles motion
is expected. However it was observed that it was not feasible to maintain the smoothness in
variations in the output variables in consecutive rules. Because of this, unexpected behavior in
the motion of the vehicle was observed in simulation. It was found to stuck at number of places
because of interference between the rules of consecutive blocks. Hence it was found that in
CASE 1, it is not possible to obtain the desired objective of achieving the target parking
position.

33
FIGURE 4.1: DIVISION OF COMPLETE NAVIGATIONAL SPACE BY MFS OF INPUT VARIABLES ( X_POS, Y_POS )

4.2.2 Case 2

Following tabulates the fuzzy input/output variables in this case which are lesser than those in
case 1.

TABLE 4.2: FUZZY I/O VARIABLES FOR CASE 2

In case 2, the number of variables is less, therefore the overall navigational area is divided into
lesser number of blocks as shown in Fig. (4.2). So lesser number of rules will control the
vehicles motion, therefore looser control over the vehicles motion is expected. However it
was observed to be more practical solution with certain limitations. It was found as a more
feasible solution to maintain the smoothness of variations of the output variable, so as to reduce
the inferential effects. Smooth motion was observed in CASE 2.

FIGURE 4.2: DIVISION OF OVERALL NAVIGATIONAL SPACE IN BLOCKS BY MFS OF INPUT VARIABLE X POSITION
34
4.2.3 Comparison of Case 1 and Case 2

From above study, it is clear that CASE 2 is clear selection to go ahead to solve the problem
however there are certain limitations on the initial pose of the vehicle. It is not possible to
achieve the desired objective in all the initial poses because of requirement of more complex
maneuver such as negative velocity in such cases. e.g. for initial pose (40,180,135), Fig. (4.3)
shows the simulation results for an unsuccessful case of path tracing, in which the final target
position couldnt be achieved.

FIGURE 4.3: TRAJECTORY SIMULATION FOR A UNSUCCESSFUL CASE

4.3 Input Parameters


4.3.1 X Position: X _ Pos

It is divided into five horizontal regions as given below in tabular & pictorial representations.

TABLE 4.3: MEMBERSHIP FUNCTIONS OF X_POS

35
FIGURE 4.4: MEMBERSHIP FUNCTIONS OF X_POS

4.3.2 Axis Angle: Phi

It is divided into seven angular regions as defined below in tabular & pictorial representations.

TABLE 4.4: MEMBERSHIP FUNCTIONS OF PHI

FIGURE 4.5: MEMBERSHIP FUNCTIONS OF AXIS ANGLE (PHI)

4.4 Output Parameters

4.4.1 Steer Angle: Steer

This steer value obtained from fuzzy system is set as front wheels angle. Vehicle steer is
derived from the front wheels angle. It is divided into seven angular regions as defined below
in fuzzy system.

36
TABLE 4.5: MEMBERSHIP FUNCTIONS OF STEER

FIGURE 4.6: MEMBERSHIP FUNCTIONS OF STEER

4.5 Design of Rule Base


Following 35 rules have been extracted as per experts knowledge.

TABLE 4.6: FUZZY RULE MATRIX

Rules are read as e.g.

If X_Pos is LE & Phi is RB then Steer is PS

37
4.6 Type-2 Fuzzy Sets
FLC has been designed on the basis of input type-1 fuzzy sets being transformed into type-2 by
adding the uncertainty through the variable delta to flatten T1 fuzzy sets. However output
variable Steer has been handled by T1 fuzzy sets only. (see Fig. 4.7).

FIGURE 4.7: FUZZY SETS OF T2 BASED FLC

4.7 Fuzzy Inferencing


Fuzzy inference is the process of formulating the mapping from a given input to an output
using fuzzy logic. The mapping then provides a basis from which decisions can be made, or
patterns discerned. The process of fuzzy inference involves all of the pieces that are:
Membership Functions, Fuzzy Logic operators, and if-then rules. Steps which signify flow
through T2 FLS to implement the fuzzy inferencing can be formulated as: (see Fig. 4.8).

I. Finding degree of membership of X_Pos & Phi inputs, which returns continuous range
of values between its points of intersection with its LMF (lower membership function)
& UMF (upper membership function).
38
II. Thereafter calculation of firing interval is done. Fuzzy rules are fired twice for each
single crisp input, firstly, for LMF and secondly, for UMF that leads to two level
clipping of consequent T1 FS, as shown by dark shaded regions in Fig. (4.8) for two
fired rules.

FIGURE 4.8: FUZZY INFERENCING

III. The mathematics of interval T2 fuzzy logic system reveal that instead of computing a
single Type-1 rule output FS, we have to compute two such fuzzy sets for each fired
rule: LMF & UMF. Each involves separate Type-1 FS calculations, one for the LMF
and one for the UMF of the fired rule-output fuzzy sets. The result is a fired-rule-output
interval T2 FS, or FOU, shown shaded in Fig. (4.8) for two rules separately i.e. rule #1
& rule#2.

IV. Composition i.e. aggregation of all of the output fuzzy sets from fired rules to get the
combined FOU (Footprint of Uncertainty) see Fig. (4.8). Aggregate resultant output FS
for all fired rules is achieved by using MAX operator (s-norm).

39
V. Each of aggregated LMF and UMF is then computed for the centroid as Steer_L and
B~ ( yi ) B~ ( yi )
Steer_H. If and are the aggregated output UMF and LMF
corresponding to ith fired rule from total N (=35) number of rules, then Steer_L &
Steer_H can be given as:

iN= 1 y ~ ( y )
i B i
Steer _ L =
iN= 1 B~ ( yi )

&

iN= 1 y ~ ( y )
Steer _ H = i B i
iN= 1 B~ ( yi )

4.8 Type Reduction & De-Fuzzification


Rather than integrating across the two-dimensional function to find the centroid, we use the
weighted average of data points. COG (Centre of Gravity) or COA (Center of Area) method
has been used to obtain type reduced fuzzy set in which weighted average is taken of the data
points obtained by implication of the input over the output fuzzy sets. This method is
implemented to exhibit type reduction for each of the membership grade i.e. lower as well as
higher.

FIGURE 4.9: TYPE REDUCTION & DE-FUZZIFICATION

40
Output steer is composed of two parts Steer_L & Steer_H (see fig. 4.9) which have been
obtained by type-1 operations on LMF & UMF respectively. The values are calculated by
finding COA (Center of Area) in each of the case as:

35

( Ri _ XL _ 1 + Ri _ XL _ 2) Ri _ YL
i =1
Steer _ L = 35

Ri _ YL
i =1

Where Ri_XL_1 & Ri_XL_2 (see Fig. 4.8) are points of intersection of lower bound of ith
rules firing interval with corresponding output fuzzy set of Steer.

Similarly Steer_H is obtained as:

35

( Ri _ XH _ 1 + Ri _ XH _ 2) Ri _ YH
i =1
Steer _ H = 35

Ri _ YH
i =1

Where Ri_XH_1 & Ri_XH_2 (see fig. 4.8) are points of intersection of upper bound of ith
rules firing interval with corresponding output fuzzy set of steer. Output de-fuzzified crisp
value is obtained as (see fig. 4.9):

Steer _ L + Steer _ H
Steer =
2 .0

41
CHAPTER 5

5 DESIGN OF SIMULATION SYSTEM


This chapter discusses the different parts of the simulation system which includes mobile robot
model & its dimensions, plotting of vehicles boundary on screen by calculating its corner
points p0 to p3, plotting of front & rear wheels by calculating their centre points and start &
end points, plotting of target parking locations boundary, various positional & navigational
errors & finally the algorithmic steps for simulating the vehicles motion.

5.1 The Mobile Robot


The robot model considered here is a car-like four-wheeler as shown in Fig. (5.1).

FIGURE 5.1: NON-HOLONOMIC WHEELED MOBILE ROBOT MODEL.


42
The space for the vehicle navigation is 200 x 200 sq. units and the angle of the vehicle is

w.r.t. horizontal axis. The angle T is the angle of the front tyres w.r.t the vehicles axis that
can steer between [-40 +40]. The vehicle length (L=30 units) to width (W=12.8 units) ratio is
kept same as of majority car-like vehicles.

5.2 Plotting Of Vehicles Boundary


The simulation of vehicle in GUI has been done through the plotting commands of the
MATLAB. To draw the complete vehicles boundary on the screen, all of its four corner points
have to be calculated in terms of the mid point of the rear axle mid point and thereafter the
vehicles boundary is drawn by plotting the lines joining these corner points. However the
vehicles axis angle is required to calculate the four corner points as shown in Fig. (5.1).

5.2.1 Point P0

w
x0 = x t _ ofsl * cos( Angle _ V ) + sin( Angle _ V )
2

w
y 0 = y t _ ofsl * sin( Angle _ V ) cos( Angle _ V )
2

FIGURE 5.2: VEHICLES GEOMETRICAL CALCULATIONS

43
5.2.2 Point P1

w
x1 = x t _ ofsl * cos( Angle _ V ) sin( Angle _ V )
2

w
y1 = y t _ ofsl * sin( Angle _ V ) + cos( Angle _ V )
2

5.2.3 Point P2

w
x 2 = x t _ ofsl * cos( Angle _ V ) + sin( Angle _ V ) + l cos( Angle _ V )
2

w
y 2 = y t _ ofsl * sin( Angle _ V ) cos( Angle _ V ) + l sin( Angle _ V )
2

5.2.4 Point P3

w
x3 = x t _ ofsl * cos( Angle _ V ) + l * cos( Angle _ V ) * sin( Angle _ V )
2

w
y3 = y t _ ofsl * sin( Angle _ V ) + l * sin( Angle _ V ) + * cos( Angle _ V )
2

5.3 Front Wheels


Like vehicle boundaries, tyres are also plotted as line drawing. Therefore we need starting and
end point of the each of the tyres. We can find the co-ordinates of the center point of each of
the four tyres using simple trigonometric relations for triangles from Fig. (5.2) as:

t 2 _ x = x0 + t _ ofsu * cos( Angle _ V )

t 2 _ y = y 0 + t _ ofsu * sin( Angle _ V )

&

t 3 _ x = x1 + t _ ofsu * cos( Angle _ V )

t 3 _ y = y1 + t _ ofsu * sin( Angle _ V )

Now finding the starting point of each of the tyres as:

t 2 _ sx = t 2 _ x t _ halflen * cos( Angle _ Fi )

44
t 2 _ sy = t 2 _ y t _ halflen * sin( Angle _ Fi )

&

t 3 _ sx = t 3 _ x t _ halflen * cos( Angle _ Fi )

t 3 _ sy = t 3 _ y t _ halflen * sin( Angle _ Fi )

Similarly finding the end point of the tyres in current iteration.

t 2 _ ex = t 2 _ x + t _ halflen * cos( Angle _ Fi )

t 2 _ ey = t 2 _ y + t _ halflen * sin( Angle _ Fi )

&

t 3 _ ex = t 3 _ x + t _ halflen * cos( Angle _ Fi )

t 3 _ ey = t 3 _ y + t _ halflen * sin( Angle _ Fi)

Where t_halflen is half the length of the tyre.

5.4 Rear Wheels


Rear Wheels are aligned with the vehicles axis. These are also plotted as lines. So firstly we
will have to find their centre point and then starting & end points so as to draw these in the
form of thick lines. Co-ordinates of their center points can be easily visualized from the Fig.
(5.2) as:

t 0 _ x = x0 + t _ ofsl * cos( Angle _ V )

t 0 _ y = y 0 + t _ ofsl * sin( Angle _ V )

&

t1 _ x = x1 + t _ ofsl * cos( Angle _ V )

t1 _ y = y1 + t _ ofsl * sin( Angle _ V )

Equations for starting points:

t 0 _ sx = t 0 _ x t _ halflen * cos( Angle _ V )


45
t 0 _ sy = t 0 _ y t _ halflen * sin( Angle _ V )

&

t1 _ sx = t1 _ x t _ halflen * cos( Angle _ V )

t1 _ sy = t1 _ y t _ halflen * sin( Angle _ V )

Equations for ending points:

t 0 _ ex = t 0 _ x + t _ halflen * cos( Angle _ V )

t 0 _ ey = t 0 _ y + t _ halflen * sin( Angle _ V )

&

t1 _ ex = t1 _ x + t _ halflen * cos( Angle _ V )

t1 _ ey = t1 _ y + t _ halflen * sin( Angle _ V )

5.5 Parking Position Boundary


Parking position boundaries are drawn as thick lines of red color. The width of this boundary
corresponds to the width of the central membership function of fuzzy input variable X_Pos.
The range for this central membership function named as Vertical(VE) has been chosen as (90-
110). Width of the parking position boundary has been selected as same as that of VE- MF as:

Line 1: (90,200) to (90,195)

Line 2: (110,200) to (110,195)

There are some errors taken into account while parking named as: Distance Error(DE) &
Orientation Error(OE) which falls under the category of Positional Errors.

5.6 Positional & Navigational Errors


The response of the system has been studied by taking into account different possible errors.
On the basis of these errors, we can declare whether it is possible to reach the final target
position or not with current set of parameters, thereafter declaring corresponding case as
Successful (SC) or Unsuccessful Case (UC). Following errors have been taken into account:

46
5.6.1 Orientation Error (OE)

Orientation error is taken as the deviation from required final orientation i.e. 90 degrees.
Therefore it is specified as:

OE = 90 Angle _ V

Because angle _ v specifies current vehicles orientation w.r.t horizontal. There is certain
maximum limit put on this error which accounts for the bearable uncertainty in final parking
position and orientation. This maximum permissible limit has been taken as:

OE _ MAX = MAXIMUM (absolute(OE )) = 16 deg rees

So final permissible orientation range is from (90-16) to (90+16) i.e. Angle_V falling in range
from 74 to 106 degrees beyond which it can be declared as unsuccessful case (UC) which
means that system is not able to approach the final parking position with current set of
navigational and positional parameters.

5.6.2 Distance Error (DE)

Distance error is taken as the deviation from the central vertical axis aligning with the goal
location i.e. w.r.t x=100. Therefore it is specified as:

DE = (100 x)

The maximum permissible value of DE has been calculated to be a function of OE _ MAX &
length (l ) of the vehicle as:

l
DE _ MAX = [ cos(90 OE _ MAX )] + x _ m arg in
2

Where x _ m arg in is the permissible margin between vehicles boundary and parking place
boundary and its value has been fixed as 2.5. Therefore the maximum range of the x position at
final parking location can be given as:

(100 DE _ MAX ) to (100 + DE _ MAX )

Unsuccessful cases due to unbearable orientation or distance error are shown as dark -
symbols on the D_W plots in Fig. (8.10), which gives the visual effect of thick line along the
plot.

47
5.6.3 Non-Converging Case (NCC)

This error belongs to the category of navigational error, occurs when the vehicle has adopted a
completely non converging path and therefore not even has been able to approach the y
component of the goal position. Unsuccessful cases due to this error are shown as vertical lines
in the final D-W plots.

5.7 Iterative Position Calculation


As already discussed, path traversing in this work is done by iterative next position calculation.
After getting the user input from GUI for the initial position, following steps have been
implemented for iterative path traversing:

I. Position is defined in terms of three variables: x, y & Angle_V (or Phi).

II. Initial position is obtained from the main GUI file.

III. Initial position is passed to other MATLAB file auto_car.m which simulates the
motion.

IV. Next position is calculated using selected trajectory traversing algorithm.

V. Fuzzy control system is invoked to obtain the updated value of vehicles steering angle.

VI. Steering angle is taken as updated value of the front wheels angle i.e. T ' .

VII. Updated value of the vehicles axis angle i.e. Angle_V is calculated from the
mathematical equation as per the selected trajectory traversing algorithm.

VIII. The iterative process repeats itself till the time y co-ordinate of the position i.e. Y_Pos
value is less than (Y_Max-5) i.e. (200-5) = 195.

48
CHAPTER 6

6 DESIGN OF GRAPHICAL
USER INTERFACE
This chapter discusses use of GUIDE, a matlab based tool to design graphical user interfaces,
various GUI controls implemented which includes simulation parameters such as initial
position, wheels angle, configuration string, trails selections, Start/Pause/Resume simulation,
fuzzy system parameters such as t-norm selection, width of interval type-2 fuzzy sets and
finally manual steering controls.

6.1 GUIDE
GUIDE (Graphical User Interface Development Environment), provides a set of tools for
creating graphical user interfaces. These tools greatly simplify the process of designing and
building GUIs.

FIGURE 6.1: SNAPSHOT OF GUIDE ( MATLAB TOOL TO DESIGN GUIS )

49
To start GUIDE, guide command is entered at the MATLAB prompt. This displays the
GUIDE quick start dialog box (See Fig. 6.1).From the quick start dialog we can create a new
GUI from one of the GUIDE templates pre built GUIs that we can modify for our own
purposes or open an existing GUI.

6.1.1 Laying out GUI

Using the GUIDE layout editor, we can lay out a GUI easily by clicking and dragging GUI
components such as panels, buttons, text fields, sliders, menus, and so on, into the layout area.

6.1.2 Programming GUI

GUIDE automatically generates an M-file that controls how the GUI operates. The M-file
initializes the GUI and contains a framework for all the GUI callbacks, which are the
commands that are executed when a user clicks a GUI component. Using the M-file editor, we
can add code to the callbacks to perform the functions we want them to. Therefore GUI can be
executed by running this .m i.e. MATLAB file associated with GUI.

6.2 GUI Controls


GUI controls are divided into three categories and therefore shown on different panels in the
output window as (see Fig. 6.2):

I. Simulation parameters

II. Fuzzy system parameters

III. Manual controller parameters

6.2.1 Simulation Parameters

Simulation parameters includes positional parameters, velocity, configuration string, vehicle &
tyres angle & trails selections.

6.2.1.1 x

x co-ordinate of the initial position.

6.2.1.2 y

y co-ordinate of the initial position.

50
FIGURE 6.2: TRAILING MOTION SIMULATION & DETAILS OF GUI OPTIONS

6.2.1.3 Angle_V

Angle of the vehicles axis with respect to horizontal axis at initial position.

6.2.1.4 Angle_T

Angle of the front wheels with the vehicles axis at initial position.

6.2.1.5 Velocity

velocity component at front axle mid point in case of LPA, otherwise in general velocity of the
vehicle.

6.2.1.6 Conf

It signifies initial positional configuration of the vehicle. This information is stored in the log
file as title showing the initial configuration E.g. LE-LB means initially the vehicle is in the
region with X position in the region left and Phi in the region left below.

51
6.2.1.7 Show trails

This is the check box to show/hide the trails of moving vehicle. If selected than following of
the trails can be visualized

A. Trailing front tyres: Check box to show/hide the trailing front tyres.

B. Trailing rear tyres: Check box to show/hide the trailing rear tyres.

C. Trailing Vehicle Boundary: Check box to show/hide trailing vehicles boundary

D. If none of the above three options is selected to be shown as trails, only the trailing dot
on the center of the rear axle is found to be visible.

6.2.1.8 Start simulation

Starts the simulation of vehicles autonomous navigation to achieve the target parking position.

6.2.1.9 Pause simulation

This control pauses simulation when switched from de-selected to selected state while
simulation is running. & resumes the paused simulation if switched from selected to de-selected
state.

6.2.1.10 Clear window

Clears the axis window & Clears all the variables including the persistent variables to restart
the simulation from starting position.

6.2.2 Fuzzy System Parameters

It discusses fuzzy parameters being used to control system which are FOU width & t-norm
selections.

6.2.2.1 IT2 FS width (delta)

It is the uncertainty content of Interval Type-2 fuzzy sets which can be set by the user through
this GUI option. If the width is equal to zero, system is equivalent to Type-1 fuzzy system. If
the width is non-zero, the fuzzy set is said to belong to Type-2.

6.2.2.2 Fuzzy t-norms

It selects the t-norm for combining multiple antecedents to constitute fuzzy rules. MIN
corresponds to minimum t-norm, and PRO corresponds to product of two fuzzy sets during
implications.

52
6.2.3 Manual Controller Interface

Apart from the automatic motion simulation, manual controls for motion simulations have also
been provided in the GUI. Two types of manual controllers have been designed, first one is
mouse operated and second one is keyboard operated.

6.2.3.1 Initialize: mouse based control

This button is used to start the mouse based manual controller. Four of the buttons controls the
operation as:

Controls Name Function Controls Name Function


VPLUS Increases the velocity LEFT Gives left steering to vehicle
VMINUS Decreases the velocity RIGHT Gives right steering to vehicle

6.2.3.2 Key board based control

Starts the keyboard based manual controller. Keys assignment is done for various functions as:

Key Assigned Function Key Assigned Function


ARROW UP Velocity Plus LEFT ARROW Left steer
ARROW DOWN Velocity Minus. RIGHT ARROW Right Steer

53
CHAPTER 7

7 SOFTWARE ARCHITECTURE
This chapter discusses details of the matlab files & functions implemented for complete system
belonging to their function based category: steering control system, automatic motion
simulation programs, manual motion simulation programs & GUI. It discusses tasks being
performed by each file, its usage, arguments being passed, return types & its interlinking with
other files. This chapter also introduces some new terms such as tuning factor & turning ratio.
A convention has been adopted in this chapter that names of the files in headings have been
shown in italics.

7.1 Steering Control System


Steering control system is fuzzy based control system. So it includes the files for all of the
fuzzy operations such as finding degree of membership of inputs with all rules defined in rule
base, defining rule-base, firing the rule, inferencing process, type reduction and de-
fuzzification.

7.1.1 dom_xpos.m

This function program handles the x position input, finds its degree of membership (dom) with
the activated membership function of x position.

Usage

function match = dom_xpos (input, loc, delta)


Return variables

match: (1*1) variable, holding degree of membership with activated MF.


Arguments

input: x position input


loc: Membership function to select, a numeric value as
LE' = 1, 'LV' = 2, 'VE'=3, 'RV'=4, 'RI'=5

54
delta: Width of Interval Type-2 fuzzy set, representing noise associated with the measurement
of the x position.

Membership function is of type interval type-2 fuzzy set. So it is composed of two boundaries
defined as LMF (lower member ship function) & UMF (upper membership function). So
degree of membership is obtained as a range of values bounded by interception with the LMF
and UMF. If delta = 0 , LMF and UMF will coincide, hence the variable will work as type-1
variable.

7.1.2 dom_phi.m

Phi is the variable name for the vehicles axis angle with the horizontal axis. This function
computes the degree of membership of input Phi with activated fuzzy set of the fuzzy
variable Phi.

Usage

function match = dom_phi (input, loc, delta)


Return variables

match: (1*1) element vector, degree of membership with activated fuzzy set.
Arguments

input: Phi input


loc: Membership function selected by a numeric value as:
1 = LB, 2 = LU, 3= LV, 4 = VE, 5 = RV, 6 = RU, 7= RB
delta: Width of the Interval Type-2 fuzzy set.
If delta = 0, the fuzzy set corresponds to Type-1 category.

7.1.3 steering.m

This function calculates the steering value outputs corresponding to a particular rule. The
function is called from another function fire_rule.m for a corresponding rule.

Usage

function x = steering (z, range)


Return variables

x: (1*2) element vector, steer value for the rule.


Arguments

z: Degree of matching with the rule, calculated in fire_rule.m.

55
range: Membership function selected, a numeric value as:
1 = NB, 2 = NM, 3= NS, 4 = ZE, 5 = PS, 6 = PM, 7= PB .

Same file is used in type-1 and type-2 operations, in type-1, it is called only once by the
fire_rule for the given rule, however it is called twice in type-2 system, once for LMF and
secondly for the UMF.

7.1.4 fire_rule.m

This program performs following tasks:

a) Calls the program init_rule_matrix to initialize the rule matrix.


b) Calls dom_xpos and dom_phi for both of the inputs.
c) Performs the implication to find degree of matching with specified rule number.
d) Calls the program steering by passing the rule matching value, and receives in return two
element vector of matching values of steering named as x_2.
e) Returns steering output STEER and rule matching value match.
Usage

function [x_2 mach_rule] = fire_rule(rule_number,inp1,inp2,mf,delta,and_method)


Return Variables

x_2: Two element vector returning matching with the steering.


mach_rule: Degree of matching with the particular rule.
Arguments

mf: Selects the type of the membership function.


1 : LMF 2 : UMF
delta: FOU width
and_method: 1 => min, 3 => product.
rule_mat: Contains the rule matrix (35 *3).
rule_number: Rule number from rule matrix which has to be fired.
inp1: First input X_Pos.
inp2: Second input, i.e. Phi.

56
7.1.5 inference.m

It performs the inference, performs the rule firing from rule #1 to rule #35 i.e. all rules.
Performs the defuzzification to calculate the final steering value. The defuzzification technique
being used is COG (center of gravity).

Usage

function stear= inference(xpos, Phi, delta, and_method)


Return Variables

Stear : Final crisp steering value after defuzzification.


Arguments

x position input, Phi input, delta, and_method

7.1.6 init_rule_matrix

This program creates the rule matrix from the rule base of the fuzzy system. It is (35*3) matrix
owing to following parameters of fuzzy system:

Number of rules : 35
Number of input variables : 2
Number of output variables : 1
Total Number of I/O variables : 3
=> rows of rule matrix : 35
columns of rule matrix : 3

Rules can be decoded from the rule matrix as rule #1 data from the rule matrix is:

So rule can be stated as :

If (xpos is LE) and (Phi is RB) then (Steer is PS)

7.2 Automatic Motion Simulation Programs


This includes the files involved in simulating the motion of the vehicle on screen with the help
of drawing it after each iteration. Calculations for next position are calculated in each iteration
and corresponding geometrical calculations are performed for drawing the vehicle within
navigational area. The main file for this task is auto_car.m, including the routines for motion

57
which interacts with GUIs matlab file. All the parameters from the graphical user interface
(GUI) are passed to this main file for performing autonomous navigation. This program is
performing following tasks :

7.2.1 Initialization of Vehicle Parameters

Initializes the parameters of the vehicle by calling the program file


initialize_vehicle_parameters.m.

7.2.2 Plotting Target Boundary

Plots the boundary of the target location which is (100, 200) point on the plot. The target
boundary is shown in the red color.

7.2.3 Vehicle Drawing w.r.t Reference Point

Traces the points of the vehicle w.r.t. the reference point using the given angle with horizontal.
Reference point is the mid point at the rear axle. Its initial position is passed from the GUI and
named as (x, y) point in the program. The reference point is highlighted with some specific
color. The color selected for showing the reference point depends upon

if velocity v is positive color is red, if v is negative color is cyan.

Width of the fuzzy sets passed by GUI.

Selection of the and_method from GUI in fuzzy parameters.

7.2.4 Front & Rear Wheels Drawing

Traces the points of the four tyres from the given tyre angle named as Angle_T in the program,
and from the geometrical parameters of the vehicle specified. Front tyres are plotted as red and
rear tyres as green. As it is apparent that initial value of Angle_T passed from GUI is applied at
front tyres while rear tyres are parallel to the axis of the vehicle.

7.2.5 Trajectory Calculation Algorithm

Calculates the new position based upon the selection of trajectory algorithm. Two of the
trajectory algorithms are available.

a) Linear Paths Approximation

b) Continuous Curves Approximation.

58
7.2.6 Normalizing of Vehicles Orientation Angle

Normalizing the Angle_V ( angle of vehicles axis w.r.t horizontal) .The range of this angle as
specified by the fuzzy system is 100 to +300. The normalizing of the angle is done as:

if (Angle_V > 300) then Angle_V=Angle_V-360


if (Angle_V < -100) then Angle_V=360+Angle_V

7.2.7 Navigational Data Logging

A log file is created to log the records corresponding to each iteration in trajectory
tracing. The name of the log file is generated from three parameters:

i) Initial x position (passed by GUI) : of reference point.


ii) Initial y position (passed by GUI) : of reference point.
iii) Configuration (passed by GUI) : configuration string is set by the user ; it corresponds
to the initial position of the vehicle.

e.g. if the user sets the x=10, y=20, then x position corresponds to LE (left) fuzzy set.
Different parameters per record which are being logged in the log file are:

i) Configuration string is used as the heading of the log file.


ii) X position
iii) Y position
iv) Angle_V
v) Angle_T
vi) Vehicle Steer
vii) Tyre Steer
viii) Original Steer (before applying tuning factor)

7.2.8 Tuning of Steer Angle

Tuning of steer angle means amplifying the steer angle to tune the steering to the geometrical
parameters of the Overall Navigational Field (ONF) and vehicle so that vehicle can
successfully approach the target. If the steer is too small or too large per iteration then vehicle
may not get steered to target location. So steering angle obtained from the fuzzy system is
multiplied by a factor called as Tuning Factor(TF). The selection of value of TF depends
upon ONF & vehicles geometry as:

59
i) ONF

TF depends on the length and width of the ONF. Larger the area of the ONF looser will
be the constraint on the steering. So larger the area of ONF, lesser the value of TF.

ii) Vehicles Geometry

Length of the vehicle effects its steering. From the equations of the vehicle steer in both
of the algorithms, vehicle steer is related to length of the vehicle as:

1
vehicle _ steer
d

So more the length of the vehicle, lesser will be the vehicles steering obtained from same
amount of wheels steering angle. Therefore large tuning factor is required for vehicles with
large length . This factor can be highlighted by an another term called as Turning Ratio.

7.2.9 Turning Ratio (TR)

It can be defined for any vehicle as ratio of vehicular steering angle to required wheels steering
angle.

Vehicle' s steering angle


Turning Ratio =
Required Wheels steering angle

It can be easily inferred from both of the trajectory calculation algorithms :

Turning Ratio (d)

1
Turning Ratio
d

Where d : Incremental Distance moved per iteration.

d : Length between front and rear axle. ( approximately = ) length l of vehicle.

It is required to maintain suitable value of turning ratio to successfully approach the target
location. Therefore appropriate tuning of Turning Ratio is performed by selecting the
appropriate value of Tuning Factor by trials.

60
7.2.10 Trails

Program handles four types of settings of trails

Trails: if OFF, none of the trails is shown.

if ON , trails are shown as per selection of different trails, which are as:

a) Trailing Front Tyres

b) Trailing Rear Tyres

c) Trailing Vehicle Boundary

A flag variable is passed from GUI to program as argument corresponding to each of the trails
selection tabulated as:

Action Flag Variable Name


Show Trails Status_trails
Trailing Front Tyres TFT
Trailing Rear Tyres TRT
Trailing Vehicle Boundary TVB

Color Selection of Trails

Color selection of trailing dot on mid point of rear axle is done on the basis of following
conditions:

a) Sign of velocity : if velocity v < 0 => color is cyan.

b) if velocity v > 0, color is decided by the selection of and_method from the fuzzy
parameters.

and_method : Minimum, color base is Blue.


Product, color base is Red.
Further variations of width of IT2 fuzzy set makes its color variations.
Color of vehicles different physical parts of simulated model are given as:
Front Tyres : Red Color
Rear Tyres : Green Color
Vehicle Boundary : Blue

61
Vehicle Rear : Magenta

7.3 Manual Motion Simulation Programs


This includes the files which controls two of the manual motion controlling interfaces: mouse
based and key board based. Main file in this section is hum_cnt.m which interacts with GUI
and other programs. This matlab file handles the human controller interface from GUI. Its
structure is quite similar to that of auto_car.m in performing following tasks:

a) Initialization of vehicle parameters.

b) Plotting target boundary.

c) Plotting vehicle w.r.t. reference point.

d) Plotting front and rear wheels.

e) Trails handling.

f) Trajectory algorithm handling.

g) Normalizing vehicles angle.

h) color selection of trails.

i) Limiting front wheels angle.

Apart from the controlling technique, there are some other major differences between two
which are:

a) There is no persistent data in auto_car.m while all the navigational variables like x, y,
Angle_T, Angle_V, steer, velocity and distance traveled are persistent in hum_cnt.m.

b) Navigation in case of auto_car.m is performed inside a infinite while loop iteratively


while in case of hum_cnt, the function hum_cnt is being called iteratively from the GUI
matlab file start_system.m.

Following other tasks are performed by hum_cnt.m:

7.3.1 Steering

Vehicle is steered left or right based upon the values of the following parameters passed from
GUI

a) left: if left = 1, steer left, Front wheels angle is modified as:


tyre_angle=tyre_angle+1

62
b) right: if right =1, steer right, Front wheels angle is modified as:
tyre_angle=tyre_angle-1

7.3.2 Acceleration

Vehicle is accelerated up or down based the values of the following parameters passed from
GUI

a) vplus: if vplus = 1, velocity is increased as: v = v + 1

b) vminus: if vminus = 1, velocity is decreased as: v = v - 1

7.3.3 Initialization of Persistent Variables

Persistent variables are initialized from the parameters passed from the GUI at the first call
from GUI. They are checked for their values, if empty, which is true for the first time call from
the GUI, they are initialized from the values passed from GUI, otherwise the previous values of
these variables are retained being the persistent storage class.

7.3.4 Resetting Flags

Four of the flag variables are used as return variables from the function to the GUI. These flags
are used to avoid the similar action to be repeated over and over again. Following four flag
variables are being used :

rf/lf : Right/Left steer setting flag : Indicates that right/left steering has been performed. This
variable is returned from the hum_cnt to start_system function to acknowledge status that
right/left steering has been performed as was commanded from GUI.

vpf/vmf : Velocity plus/minus setting flag : Indicates that velocity plus/minus has been
performed. This variable is returned from the hum_cnt to start_system function to
acknowledge status that plus/minus velocity has been performed as was commanded from GUI.

7.3.5 initialize_vehicle_parameters.m

Initializes following vehicles geometrical variables:

a) Length (l)

b) Width (w)

c) Tyres length(t_len)

d) Tyre width (t_wid)

63
e) Vehicle boundary line width(l_wid)

f) Vehicle front axle position w.r.t vehicle rear boundary(t_ofsu)

g) Vehicle rear axle position w.r.t vehicle rear boundary(t_ofsu)

h) Distance between front and rear axle (d)

7.3.6 check_boundary.m

Checks if the point (x, y) is outside the boundary of the ONF (overall navigational field). If
point lies outside the ONF, then error message is displayed in command window and no further
navigation is performed:

Error Messages : not a valid position in x

not a valid position in y

7.4 Graphical User Interface


It is the main entry file which helps to simulate the system on PC. It integrates the fuzzy
navigation control system with the simulation module, allows user to set the different
configuration related and initialization related parameters through the GUI interface. These
parameters are passed automatically from GUI to other modules for changes to take place at
various points.

7.4.1 start_system.fig

start_system.fig file is the main figure file which has been created using GUIDE
(Graphical User Interface Development Environment). Different types of controls which have
been used in this file are:

a) Panels

b) Push button

c) Check box

d) List box

e) Edit box

f) Axes

g) Labels

64
Figure file can be edited in the GUIDE software. The creation of the figures format, placement
of different controls and setting of their properties is done in figure file.

7.4.2 start_system.m

The matlab file i.e. start_system.m file is generated automatically by the GUIDE, when its
figure file is saved. The matlab file holds different functions, which are created automatically
corresponding to different controls available on the GUI. These functions are further altered to
handle the actions being performed through corresponding controls. Programming of action
being performed through different controls, passing of data between different functions of GUI
controls, calling of required simulator & control system files with the appropriate parameters is
done through matlab file of the main figure file.

65
CHAPTER 8

8 RESULTS & DISCUSSION


This chapter presents & discusses simulation results for various preferences such as trails
selection options, fuzzy t-norms i.e. and method selection: minimum or product, width of
interval type-2 fuzzy sets through the parameter delta, trajectory traversing algorithm selection
LPA or CCA, finally distance to travel(D) vs. FOU width(W) plots have been drawn for nine
initial positions varying along x-position each after the increment of 25 units so as to cover
whole range of 200 units of overall navigational field (ONF) along the x-axis.

8.1 Trails Selections


Figure (8.1) below shows the simulation results for five different trails selections.

FIGURE 8.1: SIMULATION OUTPUTS FOR VARIOUS TRAILS SELECTIONS

66
Simulation I All trails on, initial position, (IP) taken as (10, 180, 270).
Simulation II Trailing Front tyres only, plotted in red in actual simulation, IP here is
(10, 40, 0).
Simulation III No trails.
Simulation IV Trailing Rear tyres, plotted in green in actual simulation, IP here is
(80, 10, 0).
Simulation V Trailing Vehicles boundary, rear boundary in magenta and rest of the sides
plotted in blue in actual simulation, IP here is (190, 190, 270).

To view the trails of the vehicles motion, we have to make the selections as per our
requirements in the simulation parameters. In each case, trailing dot on the mid point of rear
axle is always visible. Vehicles rear boundary has been shown as thick line. Instantaneous
values of the position & navigational parameters such as x & y co-ordinates, distance D,
steering angle & front tyres angle etc. are being displayed at the top of the graphical window. It
is very convenient to study the kinematics of the vehicle by having the clear & customized
view of trailing motion such as front wheels & rear wheels etc.

8.2 Fuzzy T-Norm Selections


Fig. (8.2 (A & B)) shows the simulation outputs for two methods of anding i.e fuzzy t-norms
minimum & product. Simulations I to XI have been taken for different initial positions.

(A) PATH TRACES FOR MIN T-NORM


67
(B) PATH TRACES FOR PRODUCT T-NORM

FIGURE 8.2: PATH TRACES FOR MIN & PRODUCT T-NORMS (A) & (B)

Observations for distance traveled D are being tabulated as:

TABLE 8.1 : DISTANCE D FOR T-NORM SELECTIONS FOR DIFFERENT IPS

Distance Dmin Distance Dpro Difference


Simulation IP
MIN t-norm PRO t-norm Dmin - Dpro
I (0,100,0) 178.6937 178.6641 0.0296
II (20,80,0) 178.6941 178.6632 0.0309
III (40,60,0) 178.6944 178.663 0.0314
IV (60,40,0) 178.862 178.7052 0.1568
V (80,20,0) 190.5759 191.0017 -0.4258
VI (100,0,90) 195 195 0
VII (120,20,180) 190.5554 190.9984 -0.443
VIII (140,40,180) 178.728 178.2766 0.4514
IX (160,60,180) 178.1876 183.162 -4.9744
X (180,80,180) 183.1872 183.1622 0.025
XI (200,100,180) 183.1869 183.1627 0.0242

68
From Table (8.1) & Figs. (8.2 (A) & (B)), it can be observed that simulation outputs for both of
the t-norms i.e. min & product, are almost similar. Difference in distances (Dmin - Dpro), is
negligible, with maximum value of 4.9744 units in simulation IX in current set of observations.

8.3 Trajectory Traversing Algorithm


Figure (8.3 (A) &(B)) shows the path traces by the system, in three different cases separately
for trajectory traversing algorithm selections: LPA & CCA.

(A) PATH TRACES FOR LPA

(B) PATH TRACES FOR CCA


FIGURE 8.3: PATH TRACES FOR TRAJECTORY TRAVERSING ALGORITHM SELECTIONS (A) & (B)
69
From the plots, we can infer that both of the traversing algorithms generate almost similar
response. Following tabulates the distance D in each case for some of the observational points.

TABLE 8.2 : COMPARISON OF DISTANCE D FOR TRAJECTORY TRAVERSING ALGORITHM SELECTIONS

Simulation IP LPA CCA Distance Difference


I (10,20,30) 245.1865 248.6587 3.4722
II (180,10,60) 240.3118 244.8802 4.5684
III (180,100,270) 200.9017 209.996 9.0943

As per observations from Table (8.2), CCA algorithm takes little more distance because of the
constraint of path being composed of circular arcs.

8.4 Type-1 Vs. Interval Type-2 Output


Following shows the simulation output of type-1 and one of the interval type-2 fuzzy sets. If
width of the fuzzy set is zero, it is type-1 fuzzy set, while the finite non-zero value of fuzzy set
makes it interval type-2 fuzzy set. Trajectory traversing for type-1 & interval type-2 with
FOU=100 has been plotted in Fig. (8.4) below.

FIGURE 8.4: TYPE-1 VS. INTERVAL TYPE-2 OUTPUT

70
The response of the system has been observed to be smoother in T2. There is considerable
saving in the distance to travel to reach the goal by using interval type-2 fuzzy sets as shown in
the simulation above for the default initial position (10, 20, 30).

I. Distance traveled in T1 selection (FOU width 0) = 245.1865 Units

II. Distance traveled in T2 selection (IT2-FS width 100) = 216.5417 units.

8.5 IT2 FS Width Variation


Fig. (8.5) shows response of the system for different widths of interval type-2 fuzzy sets, which
is being set by the user through the parameter delta. The width of the interval type-2 fuzzy set
signifies the uncertainty associated with the measurements from the sensors. System takes
minimum distance to travel at FOU width set at around 100. Beyond that, as shown in Fig.
(8.5), for W=100 to 200, the response of the system deviates from the best possible (W=100).

FIGURE 8.5: SIMULATION OUTPUT FOR DIFFERENT IT2-FS WIDTH VALUES (0-200)

8.6 D Versus W plots


D is the distance vehicle has to travel to reach the final target location while W is width of the
IT2 fuzzy sets i.e. FOU width. The width W of IT2 fuzzy sets affects the distance to be traveled
71
by the vehicle to reach the target location. Fig. (8.6 A & B) shows plots of D Vs W for different
starting positions with x-position variation. Plotting has also taken into account possible
positional & navigational errors. On the basis of these errors, we can declare whether it is
possible to reach the final target position or not with current set of parameters, thereafter
declaring corresponding case as successful or unsuccessful case (UC). Thick lined portion in
the plots shows unsuccessful cases because of any of the positional errors in final parking
position. Different parameters which have been displayed for each of plots are as:

IP : Initial Position as (x, y, Phi)

DR : Range of distance to travel (D) from minimum to maximum.

NU : Number of unsuccessful cases out of total 201 cases starting with


W=0 to W=200.

MD & OFWV: Minimum value of D realized for particular values of FOU width
W called as Optimized FOU width values (OFWV).

Following observations have been taken from D-W plots of Fig. (8.6 A & B).

I. There is a regular pattern of variations of D, a staircase decrease in the value of D up to


certain range, for which value of D is minimum, shown as Optimized FOU Width
Values (OFWV) for each plot, afterwards there is staircase increase in the value of D.

II. Closer the initial position of the vehicle to central vertical line corresponding to x=100,
lesser is the dependency of value of D on W. Value of DR (Distance Range) is
decreasing as x component of IP (Initial Position) is approaching 100 from each side,
DR finally approaching zero at x=100.

III. Plots I, II, III & IV are quite similar to plots VI, VII, VIII & IX respectively. It shows
that D Vs W is mainly the function of absolute value of x deviation of initial position
taken w.r.t final parking position (PP). x deviation can be given as:

x deviation = IP(x) PP (x) where PP(x) = 100

IV. The variations in plots I & IX are more as compared to variations in plots II & VIII..
This observation leads to conclusion that number of variations vary proportionately to
the x deviation. That is why at zero x deviation number of variations in D are also zero
i.e. D is constant for whole range of W in plot (V) for x=100.
72
(A)

73
(B)

FIGURE 8.6: D VS W PLOTS FOR VARYING X POSITION (A) & (B)

74
CHAPTER 9

9 CONCLUSIONS & FUTURE SCOPE


The objective of the thesis work, i.e. to model T2 fuzzy sets based automatic navigation control
system for a non-holonomic vehicles parking, by integrating it with a trajectory controller that
can take instantaneous decision for the steering of robotic vehicle to reach a target position
from selectable initial one, has been achieved by using interval type-2 fuzzy sets. One can
simulate the vehicles motion by selecting various parametric options from the GUI. Simulation
results have confirmed the superiority of maneuvering effort of interval type-2 FLS over the
type-1 FLS. Manual steering controls, for the analysis of vehicles navigation in different cases
for any of the initial position, have also been implemented in the developed simulator.

9.1 Conclusions
Conclusions withdrawn on the basis of results of simulations performed & D-W plots (see Fig.
8.6 (A) & (B)) follow as:

I. Fuzzy t-norm selections i.e. minimum & product generate similar response except
minor difference in value of D. See Fig. (8.2) & Table (8.1).

II. CCA algorithm has been observed to take more distance (D) then LPA algorithm. This
observation acknowledges the fact that CCA decomposes path into circular arcs while
LPA does into linear segments. See Fig. (8.3) & Table (8.2).

III. For FOU width W beyond OFWV, rule-base cannot provide useful information to the
FLS because aliasing of variable values tend to invoke the rule-base such that even
non-desirable rules tend to fire, i.e. response of the system gets deformed. This
observation acknowledges the fact that only up to a certain level of uncertainty can be
tolerated in the measurement processes, which can be used for intelligent decisions of
interval type-2 based FLS. Beyond that, the output gets deviated from the desired one
i.e. either of the positional errors increases beyond its maximum limit or navigational
error leads it to a non-converging case.

75
IV. Response of the system depends upon absolute value of x deviation as: higher the value
of x-deviation more will be the variations in value of D and larger will be the value of
distance range (DR).

9.2 Future Scope


The response of the system is significantly function of different control and input parameters
such as FOU width (W), initial positional parameters (x, y, Phi), trajectory traversing method
(LPA & CCA), fuzzy t-norm methods (product & minimum), tuning factor (TF) etc. Therefore
there is definitely scope of study of variations of these parameters upon the response of the
system in terms of outputs such as distance (D), positional & navigational errors (OE & DE)
and smoothness of response, which can help to find an optimized set of control parameters. In
this way an adaptive control can be added to the existing system. Apart from this, some of the
other extensions to this work can be suggested such as:

I. Further optimization of the fuzzy control system in regards such as: rules reduction,
shape of membership functions, fuzzy i/o variables, de-fuzzification techniques, using
general T2 FS or variation of any of the other fuzzy system parameters.

II. Presently, the vehicle is made to move in forward direction only. One can improve it by
integrating backward movement also. Incorporating the logic to generate the negative
velocity by FLC so as to exhibit more realistic autonomous navigation can do further
improvement in the steering control system and help reduce the number of unsuccessful
cases.

III. Increasing the resolution of the available navigational space by addition of another
input variable, y-position of the vehicle, to fuzzy steering control system. Y position
variable will help define the position more precisely, so rule-base can be modified to
have more precise control of the navigational parameters such as Steer & Velocity.

IV. Various other path-tracing options can be explored, such as autonomous navigation in
known or unknown environments consisting of obstacles.

V. To be integrated with virtual reality based interface and / or hardware control system.

VI. To optimize the FLS, by fusion of other intelligent techniques like Genetic Algorithms
(GA), Artificial Neural Networks (ANN), Particle Swarm Optimization (PSO) etc.

76
PUBLICATIONS

Mutneja, Vikram & Sidhu, Satvir Singh & Gill, Neeraj & Saini, J. S. (2008), Mobile Robot
Navigation using IT2 FLS, Proceedings of IEEE National Conference on Applications of
Intelligent Systems (AIS 2008), March 2008, HCE Sonepat, Haryana, India, pp 18-23.

77
REFERENCES

[1] Scheuer, A. and Fraichard, Th. (1996), Planning Continuous-Curvature Paths for Car Like
Robots, International Conference on Intelligent Robots and Systems, Osaka, Japan, vol. 3,
1996, pp 1304-1311.

[2] Scheuer, A. and Fraichard, Th. (1997), Continuous-Curvature Path Planning for Car-Like
Vehicles, Proceedings of International Conference on Intelligent Robots and Systems
(IEEE-RSJ), vol. 2, 1997, pp 997-1003.

[3] Paromtchik, I. and Garnier, Ph. and Laugier, C. (1997), Autonomous Maneuvers of a Non-
Holonomic Vehicle, International Symposium on Experimental Robotics, Barcelona,
Spain, June, 1997, pp 276-288.

[4] Fraichard, Th. and Mermond R., Path Planning with Uncertainty for Car-Like Robots,
Proceedings of IEEE International Conference on Robotics and Automation, May, 1998, pp
27-32.

[5] Minguez, Javier and Montano, Luis and Jose, Arid and Santos, Victor (2002), Reactive
Navigation for Non-Holonomic Robots using the Ego-Kinematic Space, Proceedings of the
IEEE International Conference on Robotics and Automation, vol. 3, 2002, pp 3074-3080.

[6] Igor E. Paromtchik (2004), Steering and Velocity Commands for Parking Assistance,
Proceedings of the 10th IASTED International Conference on Robotics and Applications,
2004.

[7] Yousef Ibrahim, M. and Fernmdes, Allwyn (2004), Study on Mobile Robot Navigation
Techniques, IEEE International Conference on Industrial Technology, vol. 1, 2004, pp
230-236.

[8] Freeman, James. A. (1994), Fuzzy Systems for Control Applications: The Truck Backer-
Upper, The Mathematica Journal, Miller Freeman Publications, 1994, pp 64-69.

[9] Ollero, A. and Garca-Cerezo A. and Martnez, J. L. and Mandow A. (1997), Fuzzy
Tracking Methods for Mobile Robots, Applications of Fuzzy Logic: Towards High
Machine Intelligence Quotient Systems, Prentice-Hall Publishers, New Jersey, 1997, pp
346-364.
78
[10] Hoe, Koay Kah (1998), Fuzzy Expert System for Navigation Control, Project Paper,
University of Technology, Malaysia, 1998.

[11] Garca-Prez, L. and Garca-Alegre, M.C. (2001), A Simulation Environment to Test


Fuzzy Navigation Strategies, 10th IEEE International Conference on Fuzzy Systems,
Melbourne, Australia, vol. 2, 2001, pp 590-593.

[12] Fraichard, T. and Garnier, P. (2001), Fuzzy Control to Drive Car-Like Vehicles,
Robotics and Autonomous Systems, Vol. 34, 1, 2001, pp 1-22.

[13] Garca-Prez, L. and Garca-Alegre and M.C., Ribeiro and A. and Guinea, D. (2003),
Fuzzy Control for an Approaching_Orienting Maneuver with a Car-Like Vehicle in
Outdoor Environments, IV Workshop de Agentes Fsicos (WAF03), Alicante, 2003, pp
87-98.

[14] Zadeh, L. A. (1975), The Concept of a Linguistic Variable and its Application to
Approximate Reasoning-1, Journal of Information Science, vol. 8, 1975, pp 199-249.

[15] Wang, Dongming and Acar, Levent (1999), An Analysis of Type-1 and Type-2 Fuzzy
Logic Systems, Proceedings of IEEE International Symposium on Intelligent Control
Systems and Semiotics, 1999, pp 353-358.

[16] Karnik, N. N. and Mendel, J. M. and Liang, Q. (1999), "Type-2 Fuzzy Logic Systems",
IEEE Transactions on Fuzzy Systems, vol. 7, December 1999, pp 643-658.

[17] Liang, Q. and Mendel, J. M. (2000), "Interval Type-2 Fuzzy Logic Systems: Theory and
Design", IEEE Transactions on Fuzzy Systems, vol. 8, 2000, pp 535-550.

[18] Mendel, J. M. (2000), "Uncertainty, Fuzzy Logic, and Signal Processing", International
Journal of Signal Processing, vol. 80, 2000, pp 913-933.

[19] Mendel, J. M. and John, R. I. (2002), "Type-2 Fuzzy Sets Made Simple", IEEE
Transactions on Fuzzy Systems, vol. 10, April 2002, pp 117-127.

[20] Mendel, Jerry M. (2003), Type-2 Fuzzy Sets: Some Questions & Answers, Newsletter
of IEEE Neural Networks Society, August, 2003.

[21] Mendel, Jerry M. (2004), "Fuzzy Sets for Words: Why Type-2 Fuzzy Sets Should be
Used and How They Can be Used", IEEE-FUZZ, 2004.

79
[22] Hagras, Hani A. (2004), A Type-2 Fuzzy Logic Controller for Autonomous Mobile
Robots, IEEE-FUZZ, July, 2004, pp 965-970.

[23] Hagras, Hani A. (2004), A Hierarchical Type-2 Fuzzy Logic Control Architecture for
Autonomous Mobile Robots, IEEE Transactions on Fuzzy Systems, vol. 12, 4, August
2004, pp 524-539.

[24] Chaves, L.F. and Spiller, P.A and Scolari, A.G. and Conte, R.N. and Pereira, L.F.A.
(2001), A MATLAB/SIMULINK-Based Platform for Real-Time Planning and Execution of
Control Techniques Applied to Mobile Robots, Proceedings of 2001 IEEE International
Symposium on Computational Intelligence in Robotics and Automation, July 29-August 1,
2001, pp 530-535.

[25] Rudzinska, K. and Carlini, M. and Abenavoli, R.I. and Kormanski, H. (2005), An
Interactive System for Mobile Robot Navigation, Proceedings of Fifth International
Workshop on Robot Motion and Control, 2005, pp 343-348.

[26] Rostami, Vahid and Sojodishijani, Omid and Ebrahimijam, Saeed and
Mohsenizanjaninejad, Ali (2005), "Fuzzy Error Recovery in Feedback Control for Three
Wheel Omnidirectional Soccer Robot", Proceedings of World Academy of Science,
Engineering & Technology, vol. 9, November, 2005, pp 91-94.

[27] Cupertino, F. and Giordano, V. and Naso, D. and Delfine L. (2006), Fuzzy Control of a
Mobile Robot Using a Matlab-based Rapid Prototyping System, IEEE Robotics and
Automation Magazine, 2006, pp 74-81.

80
APPENDIX-I
LIST OF SYSTEMS SOFTWARE FILES

Function Based File name Brief Description


Category

Steering Control dom_xpos.m Handles x position (X_Pos) input.


System dom_phi.m Handles Phi input

steering.m Calculates the steer output (Steer).

fire_rule.m Fires the specified rule number for given inputs.

inference.m Calls fire_rule.m & performs defuzzification.

init_rule_matrix.m Initializes the rule matrix.

Simulator auto_car.m Performs the simulation of vehicle motion &


Programs accepts the commands from the fuzzy logic
control system.

hum_cnt.m Performs the simulation of vehicle motion &


accepts the commands from the manual controls.

initialize_vehicle Initializes the vehicles parameters such as


_parameters.m length, width, tyres relative position, tyres
length, tyres width etc.

check_boundary.m Checks if the point (x, y) of rear axle mid point


is within the boundary.

Graphical start_system.m GUI controls programming and passing of data


User between different GUI controls.

Interface start_system.fig This is figure file for the GUI. Holds the
placement and configuration of GUI controls.
This file opens in tool GUIDE of the matlab
for GUI file editing.

81
APPENDIX-II
MATLAB CODE

File : auto_car.m

function dist = auto_car(x,y,angle_v,angle_t,conf,v,status_cb,tft,trt,tvb,delta,and_method,traj_algo)

% this is program which takes commands from gui for displaying the
% simulation of the vehicle's motion. Significance of the parameters is as
%{
x : x co-ordinate of the rear axle mid point of the vehicle's initial position.
y : y co-ordinate of the rear axle mid point of the vehicle's initial position.
v : Velocity of the front axle mid point.
v_rear : Velocity of the rear axle mid point, same as that of "v" in case of the CCA.
l : Length of the model vehicle.
w : Width of the model vehicle.
t_len : Tyre length.
t_halflen: Half of tyre length.
t_wid : Width of the tyre.
l_wid : Width of the vehicle boundary as being shown on simulation.
t_ofsl : Length between rear axle w.r.t vehicle rear boundary.
t_ofsu : Length between front axle w.r.t vehicle rear boundary.
d : Distance between rear and front axle.
angle_gamma: Angle of front wheels w.r.t horizontal = (angle_v+angle_t).
angle_t : Tyre angle w.r.t vehicle's axis.
angle_v : Angle of vehicle's axis w.r.t horizontal.
conf : Read as "configuration", Used as heading in the log file which stores the records of iterations.
status_cb: Flag passed by GUI, to show/hide the trails.
steer : Steer output provided by fuzzy inference system being taken as updated value of the angle_t
tft : Flag passed by gui to show/hide trailing front tyres, work only if status_cb is set.
trt : Flag passed by gui to show/hide trailing rear tyres, work only if status_cb is set.
tvb : Flag passed by gui to show/hide trailing vehicle boundary itself, work only if status_cb is set.
delta : This is the width of the type-2 fuzzy set which is sent by gui. Zero means type-1 fuzzy set.
and_method : This is the fuzzy t-norm, i.e. and_method which is being used by fuzzy inference system
1 => MIN ( select the minimum of two)
3 => PRO ( select the product of two values)
traj_algo : Trajectory calculation algorithm to be used, value being sent by GUI.
1 => Continuous curves approximation
2 => Linear Paths Approximation
dist : Holds the total distance travelled , value being returned by the function
tf : Tuning Factor for the steering for exact path tracing.
%}

count=0; % holding the number of iterations to reach the target.


if (check_boundary(x,y)) % checks if the initial position is within range of visibility.
return;
end
fn=strcat('pos',num2str(x),'_',num2str(y),conf,'.log');
% creating the file name of the log file to record the data of iterations
fid = fopen(fn,'w'); % opening the file in write mode, will create the new file if doesn't exist.
fwrite(fid,conf); % heading of the file as configuration of the initial position.
status = fclose(fid); % closing the file
% initialization of vehicle's parameters
initialize_vehicle_parameters;
angle_gamma=angle_t+angle_v;
82
tf=2; % tuning factor initialization
dist=0; % initializing distance travelled to zero
steer=0; % initializing steer
v_rear=5; % initializing v_rear
%________________________________
%
fid = fopen(fn,'a'); % file being opened in the append mode.

while(1) % indefinite loop.


count=count+1; % updating the count to reflect the new value of the number of iterations performed so far.
% clearing the plot of the previous iteration from axes if user has selected not to show the trails.
if ~status_cb
cla; % clears axes data
end

%--------Drawing Parking or Target Position boundaries----


h1=line([90 90],[200 195]);
h2=line([110 110],[200 195]);
set(h1,'linewidth',5,'color','r');
set(h2,'linewidth',5,'color','r');

%-------XN,YN--Finding Points of vehicle---------,N=0 to 3


x_=x-t_ofsl*cosd(angle_v); % (x, y) = mid point of the vehicle rear boundary (widthwise)
y_=y-t_ofsl*sind(angle_v);
x0=x_+(w/2*sind(angle_v)); % (x0, y0),(x1,y1) = Points of vehicle's rear boundary
y0=y_-(w/2*cosd(angle_v));
x1=x_-(w/2*sind(angle_v));
y1=y_+(w/2*cosd(angle_v));
p=x_+l*cosd(angle_v); % (p, q) = mid point of vehicle's front boundary (widthwise)
q=y_+l*sind(angle_v);
x2=p+(w/2*sind(angle_v)); % (x2, y2), (x3, y3) = Points of vehicle's rear boundary
y2=q-(w/2*cosd(angle_v));
x3=p-(w/2*sind(angle_v));
y3=q+(w/2*cosd(angle_v));

%--------TN_X,TN_YCentral points of tyres-------,N=0 to 3


t0_x=x0+t_ofsl*cosd(angle_v); % t0 and t1 , rear tyres
t0_y=y0+t_ofsl*sind(angle_v);
t1_x=x1+t_ofsl*cosd(angle_v);
t1_y=y1+t_ofsl*sind(angle_v);
t2_x=x0+t_ofsu*cosd(angle_v); % t2 and t3, front tyers
t2_y=y0+t_ofsu*sind(angle_v);
t3_x=x1+t_ofsu*cosd(angle_v);
t3_y=y1+t_ofsu*sind(angle_v);

%--------TN_SX,TN_SY----Starting points of tyres----, N=0 to 3


t0_sx=t0_x-t_halflen*cosd(angle_v);
t0_sy=t0_y-t_halflen*sind(angle_v);
t1_sx=t1_x-t_halflen*cosd(angle_v);
t1_sy=t1_y-t_halflen*sind(angle_v);
t2_sx=t2_x-t_halflen*cosd(angle_gamma);
t2_sy=t2_y-t_halflen*sind(angle_gamma);
t3_sx=t3_x-t_halflen*cosd(angle_gamma);
t3_sy=t3_y-t_halflen*sind(angle_gamma);

%--------TN_EX,TN_EY----Ending points of tyres-----, N=0 to 3


t0_ex=t0_x+t_halflen*cosd(angle_v);
t0_ey=t0_y+t_halflen*sind(angle_v);
t1_ex=t1_x+t_halflen*cosd(angle_v);

83
t1_ey=t1_y+t_halflen*sind(angle_v);
t2_ex=t2_x+t_halflen*cosd(angle_gamma);
t2_ey=t2_y+t_halflen*sind(angle_gamma);
t3_ex=t3_x+t_halflen*cosd(angle_gamma);
t3_ey=t3_y+t_halflen*sind(angle_gamma);

%--------Tyres Lines Drawing----------


if status_cb % if trailing on
if trt % if trailing rear tyres on
t0=line([t0_sx t0_ex],[t0_sy t0_ey]);
t1=line([t1_sx t1_ex],[t1_sy t1_ey]);
set(t0,'linewidth',t_wid,'color','m');
set(t1,'linewidth',t_wid,'color','m');
end
else % if trailing off
t0=line([t0_sx t0_ex],[t0_sy t0_ey]);
t1=line([t1_sx t1_ex],[t1_sy t1_ey]);
set(t0,'linewidth',t_wid,'color','m');
set(t1,'linewidth',t_wid,'color','m');
end

if status_cb % if trailing on
if tft % if trailing front tyres on
t2=line([t2_sx t2_ex],[t2_sy t2_ey]);
t3=line([t3_sx t3_ex],[t3_sy t3_ey]);
set(t2,'linewidth',t_wid,'color','r');
set(t3,'linewidth',t_wid,'color','r');
end
else % if trailing off
t2=line([t2_sx t2_ex],[t2_sy t2_ey]);
t3=line([t3_sx t3_ex],[t3_sy t3_ey]);
set(t2,'linewidth',t_wid,'color','r');
set(t3,'linewidth',t_wid,'color','r');
end

if status_cb % if trailing on
if tvb % if trailing vehicle boundary on
l0=line([x0 x1],[y0 y1]);
l1=line([x1 x3],[y1 y3]);
l2=line([x2 x3],[y2 y3]);
l3=line([x0 x2],[y0 y2]);
set(l0,'linewidth',l_wid,'color','m');
set(l1,'linewidth',l_wid,'color','b');
set(l2,'linewidth',l_wid,'color','b');
set(l3,'linewidth',l_wid,'color','b');
end
else % if trailing off
l0=line([x0 x1],[y0 y1]);
l1=line([x1 x3],[y1 y3]);
l2=line([x2 x3],[y2 y3]);
l3=line([x0 x2],[y0 y2]);
set(l0,'linewidth',l_wid,'color','m');
set(l1,'linewidth',l_wid,'color','b');
set(l2,'linewidth',l_wid,'color','b');
set(l3,'linewidth',l_wid,'color','b');
end

l4=line([x-1 x+1],[y y]); %Trailing dot of vehicle rear axle mid point (RAMP)
l5=line([x x],[y-1 y+1]);

84
c=delta/100; %Color setting of RAMP based upon selection of width of T2-FS.
switch and_method
case 1
if c<=1
c1=0;
c2=0;
c3=c;
else
c1=c-1;
if c1>=0.9
c1=0;
end
c2=1;
c3=1;
end
case 2
c1=0;
c3=0;
if delta<=0
c2=1;
else
c2=1/delta;
end
case 3
c2=0;
c3=0;
if delta<=0
c1=1;
else
c1=1/delta;
end
end

if v<0 % color setting of RAMP based upon if velocity is positive or negative


set(l4,'linewidth',3,'color','c'); % cyan if velocity is negative.
set(l5,'linewidth',3,'color','c');
else
set(l4,'linewidth',3,'color',[c1 c2 c3]); % selected by delta value if positive.
set(l5,'linewidth',3,'color',[c1 c2 c3]);
end

% Building string for graph title showing changing values of steer,


% angle_t, x ,y, distance travelled.
graph_title=strcat('Steer : ',num2str(steer),' Tyre Angle : ',num2str(angle_t),' x : ',
num2str(x),' y : ',num2str(y), 'Distance : ',num2str(dist));
title(graph_title,'FontSize',15);
drawnow;
% For smooth motion simulation of the moving vehicle, setting the drawing mode to 'EraseMode'
set(l4,'EraseMode');
% it is sufficient to put erase mode on one of the object of current figure, more erase commands we put,
% lesser becomes the speed of animation, hence it is advisable to put erase mode once only.

% condition when to stop,


if(y>=195)
break;
end

% calling fuzzy inference system to compute steer, passing arguments x


% position, vehicle angle w.r.t horizontal, width of the t2-fs, and and_method

85
steer=inference(x,angle_v,delta,and_method);
ori_steer=steer;
steer=tf*steer; % applying tuning factor
if abs(steer)>40 % limiting the absolute value of the steer to maximum value i.e. 40 in this case.
if steer>0
steer=40;
else
steer=-40;
end
end
angle_tn=steer; % steer being applied to vehicle by passing it to new value of tyre angle.

switch traj_algo % selecting trajectory calculation algorithm.


case 1 % CCA
r=d/tand(angle_tn);
steer_v=50*(v/r);
angle_vn=angle_v+steer_v;
angle_gamma=angle_tn+angle_vn;
a=x-r*sind(angle_v);
b=y+r*cosd(angle_v);
x_t=x;
y_t=y;
% new position of rear axle mid point
x=a+r*sind(angle_vn);
y=b-r*cosd(angle_vn);
D_delta=sqrt((x-x_t)*(x-x_t) + (y-y_t)*(y-y_t)); % distance traveled in this iteration

case 2 % LPA
steer_v=asind( (v/d)*sind(angle_tn) );
angle_vn=angle_v+steer_v;
angle_gamma=angle_tn+angle_vn;
var_B=d*cosd(angle_v)+v*cosd(angle_gamma)-d*cosd(angle_vn);
var_C=cosd(angle_vn);
if (var_C==0)
var_C=eps;
end
v_rear=var_B/var_C;
if v_rear==0
pause;
end
x_t=x;
y_t=y;
% new position of rear axle mid point
x=x+v_rear*cosd(angle_vn);
y=y+v_rear*sind(angle_vn);
D_delta=sqrt((x-x_t)*(x-x_t) + (y-y_t)*(y-y_t)); % distance traveled in this iteration
end

steer_t=angle_tn-angle_t;
angle_v=angle_vn;
angle_t=angle_tn;
dist=dist+D_delta; % updating the value of distance traveled so far

% normalizing the angle_v within range -100 to +300


if (angle_v>300)
angle_v=angle_v-360;
end
if (angle_v<-100)
angle_v=360+angle_v;

86
end

% recording the information regarding this iteration to file in append mode for successive writing.
a=sprintf('\n');
fwrite(fid,a);
qp=strcat('X_POS : ',num2str(x),' Y_POS : ',num2str(y),' ANGLE_V : ',num2str(angle_v),' ANGLE_T : ',
num2str(angle_t),' V_REAR : ',num2str(v_rear),' V_FRONT : ',num2str(v),' STEER_V : ',
num2str(steer_v),' STEER_T : ',num2str(steer_t),' ORI_STEER : ',num2str(ori_steer));
fwrite(fid,qp);
angle_gamma=angle_v+angle_t;
end

status = fclose(fid); % closing the log file

File : check_boundary.m

function [break_status] =check_boundary(x,y)

break_status=0;

if x<0 | x>200
disp('not a valid position in x');
break_status=1;
end

if y<0 | y>200
disp('not a valid position in y');
break_status=1;
end

File : fire_rule.m

function [x_2 mach_rule]=fire_rule(rule_number,inp1,inp2,mf,delta,and_method)

%{
x_2 : two element vector returning matching with the steering.
mf : selects the type of the membership function.
1 : LMF
2 : UMF
delta : the width of the fuzzy set.
and_method : 1 => min, 2 => max, 3 => product.
rule_mat : contains the rule matrix (35 *3).
rule_number : rule number from rule matrix which has to be fired.
%}

init_rule_matrix; % initializing the rule matrix rule_mat.


mach_xpos=xpos(inp1,rule_mat(rule_number,1),delta);
mach_phi=phi(inp2,rule_mat(rule_number,2),delta);

if and_method==1
mach_rule=min(mach_xpos(mf),mach_phi(mf));
elseif and_method==2
mach_rule=max(mach_xpos(mf),mach_phi(mf));
else
mach_rule=(mach_xpos(mf))*(mach_phi(mf));
end
x_2=steering(mach_rule,rule_mat(rule_number,3));
87
File : hum_cnt.m

function [lf rf vpf vmf] =


hum_cnt(x_init,y_init,angle_v_init,angle_t_init,v_init,status_trails,tft,trt,tvb,left,right,vplus,vminus)

%{
lf : Flag that vehicle steered left.
rf : Flag that vehicle steered right.
vpf : Flag that Velocity plus => increased the velocity.
vmf : Flag that Velocity minus => decreased the velocity.
x_init : Initial value of x being passed by gui.
y_init : Initial value of y being passed by gui.
angle_v_init : Initial value of angle_v being passed by gui.
angle_t_init : Initial value of angle_t being passed by gui.
v_init : Initial value of velocity v being passed by gui.
status_trails : Flag sent by GUI, to show(if 1)/hide(if 0) the trails.
tft : Flag sent by gui to show/hide trailing front tyres, work only if status_trails is set.
trt : Flag sent by gui to show/hide trailing rear tyres, work only if status_trails is set.
tvb : Flag sent by gui to show/hide trailing vehicle boundary, work only if status_trails is set.
left : Command to steer left.
right : Command to steer right.
vplus : Command to increase the velocity.
left : Command to decrease the velocity.
%}

% initialization of flags to zero


lf=0;
rf=0;
vpf=0;
vmf=0;

%persistent storage of some variables.


persistent x;
persistent y;
persistent angle_v;
persistent angle_t;
persistent v;
persistent steer;
persistent distance;
conf='humanCntlr';

% initializing x,y,angle_v,angle_t and v with the values passed from gui.


if ( isempty(x) | isempty(y) | isempty(angle_v) | isempty(angle_t) | isempty(v) )
x=x_init;
y=y_init;
angle_v=angle_v_init;
angle_t=angle_t_init;
v=v_init;
distance=0;
steer=0;
end

count=0;
initialize_vehicle_parameters;
angle_gamma=angle_t+angle_v;
tf=4;
v_rear=2;
dist=0;

88
if ~status_trails
cla;
end

if right==1
angle_t=angle_t-2;
steer=steer-2;
rf=1;
return;
elseif left==1
angle_t=angle_t+2;
steer=steer+2;
lf=1;
return;
else
angle_tn=angle_t;
steer=0;
end
if vplus==1
v=v+1;
vpf=1;
return;
elseif vminus==1
v=v-1;
vmf=1;
return;
end
if (abs(angle_tn)>35)
if angle_tn>0
angle_tn=35;
else
angle_tn=-35;
end
end

steer_v=asind( (v/d)*sind(angle_tn) );
angle_vn=angle_v+steer_v;
angle_gamma=angle_tn+angle_vn;
var_B=d*cosd(angle_v)+v*cosd(angle_gamma)-d*cosd(angle_vn);
var_C=cosd(angle_vn);
v_rear=var_B/var_C;
steer_t=steer;
angle_v=angle_vn;
angle_t=angle_tn;
disp(angle_t);
distance=distance+v;
dist=distance;
% normalizing the angle_v within range -100 to +300
if (angle_v>300)
angle_v=angle_v-360;
end
if (angle_v<-100)
angle_v=360+angle_v;
end

% LPA
x=x+v_rear*cosd(angle_v);
y=y+v_rear*sind(angle_v);
qp=strcat('X_POS : ',num2str(x),' Y_POS : ',num2str(y),' ANGLE_V : ',num2str(angle_v),

89
' ANGLE_T : ',num2str(angle_t),' V_REAR : ',num2str(v_rear),' V_FRONT : ',
num2str(v),' STEER_V : ',num2str(steer_v),' STEER_T : ',num2str(steer_t));
disp(qp);
angle_gamma=angle_t+angle_v;

% rest of code for parking boundaries, vehicle boundary, tyres displaying same as in auto_car.m

File : inference.m

function stear =inference(xpos,phi,delta,and_method)

if xpos < 100 & phi >= 270 % normalizing the vehicles angle range for proper results
phi=phi-360;
end
for i=1:35 % rules 1 to 35
[r y(i)]=fire_rule(i,xpos,phi,1,delta,and_method); %getting matching values for LMF
for j=1:2
stear_l(i,j)=r(j)*y(i); % output value * weight (for COG or COA de-fuzzification)
end
end

% Type Reduction & Defuzzification


sy=sum(y);
if sy==0
sy=eps;
end
stear_l=sum(stear_l); % performing addition column wise (for rules 1-35), 35 * 2 reduced to 1 *2
stear_l=stear_l/sy; % weighted average
stear_l=mean(stear_l); % 1*2 reduced to 1*1
% repeating same procedure for UMF to find stear_h
for i=1:35
[r y(i)]=fire_rule(i,xpos,phi,2,delta,and_method); ; %getting matching values for UMF
for j=1:2
stear_h(i,j)=r(j)*y(i);
end
end
sy=sum(y);
if sy==0
sy=eps;
end
stear_h=sum(stear_h);
stear_h=stear_h/sy;
stear_h=mean(stear_h);
% mean of defuzzified output from lmf and umf to find the single crisp value
stear=(stear_l+stear_h)/2.0;

File : init_rule_matrix.m

rule_mat=[
1 7 5 % If (xpos is LE) and (phi is RB) then (Steer is PS) (1)
1 6 3 % If (xpos is LE) and (phi is RU) then (Steer is NS) (1)
1 5 2 % If (xpos is LE) and (phi is RV) then (Steer is NM) (1)
1 4 2 % If (xpos is LE) and (phi is VE) then (Steer is NM) (1)
1 3 1 % If (xpos is LE) and (phi is LV) then (Steer is NB) (1)
1 2 1 % If (xpos is LE) and (phi is LU) then (Steer is NB) (1)
1 1 1 % If (xpos is LE) and (phi is LB) then (Steer is NB) (1)
2 7 6 % If (xpos is LV) and (phi is RB) then (Steer is PM) (1)
90
2 6 5 % If (xpos is LV) and (phi is RU) then (Steer is PS) (1)
2 5 3 % If (xpos is LV) and (phi is RV) then (Steer is NS) (1)
2 4 2 % If (xpos is LV) and (phi is VE) then (Steer is NM) (1)
2 3 2 % If (xpos is LV) and (phi is LV) then (Steer is NM) (1)
2 2 1 % If (xpos is LV) and (phi is LU) then (Steer is NB) (1)
2 1 1 % If (xpos is LV) and (phi is LB) then (Steer is NB) (1)
3 7 6 % If (xpos is VE) and (phi is RU) then (Steer is PM) (1)
3 6 6 % If (xpos is VE) and (phi is RB) then (Steer is PM) (1)
3 5 5 % If (xpos is VE) and (phi is RV) then (Steer is PS) (1)
3 4 4 % If (xpos is VE) and (phi is VE) then (Steer is ZE) (1)
3 3 3 % If (xpos is VE) and (phi is LV) then (Steer is NS) (1)
3 2 2 % If (xpos is VE) and (phi is LU) then (Steer is NM) (1)
3 1 2 % If (xpos is VE) and (phi is LB) then (Steer is NM) (1)
4 7 7 % If (xpos is RV) and (phi is RB) then (Steer is PB) (1)
4 6 7 % If (xpos is RV) and (phi is RU) then (Steer is PB) (1)
4 5 6 % If (xpos is RV) and (phi is RV) then (Steer is PM) (1)
4 4 6 % If (xpos is RV) and (phi is VE) then (Steer is PM) (1)
4 3 5 % If (xpos is RV) and (phi is LV) then (Steer is PS) (1)
4 2 3 % If (xpos is RV) and (phi is LU) then (Steer is NS) (1)
4 1 2 % If (xpos is RV) and (phi is LB) then (Steer is NM) (1)
5 7 7 % If (xpos is RI) and (phi is RB) then (Steer is PB) (1)
5 6 7 % If (xpos is RI) and (phi is RU) then (Steer is PB) (1)
5 5 7 % If (xpos is RI) and (phi is RV) then (Steer is PB) (1)
5 4 6 % If (xpos is RI) and (phi is VE) then (Steer is PM) (1)
5 3 6 % If (xpos is RI) and (phi is LV) then (Steer is PM) (1)
5 2 5 % If (xpos is RI) and (phi is LU) then (Steer is PS) (1)
5 1 3 % If (xpos is RI) and (phi is LB) then (Steer is NS) (1)
];

File : initialize_vehicle_parameters.m

l=30;
w=l/(2.4444);
t_len=l/3.3;
t_ofsl=l/7.33;
d=l/1.435;
t_ofsu=t_ofsl+d;
t_halflen=t_len/2;
t_wid=6;
l_wid=2;
angle_fi=angle_t+angle_v;

File : dom_phi.m

function match=dom_phi(input,loc,delta)

switch loc
case 1
p=[170 225 280];
case 2
p=[120 155 190];
case 3
p=[90 112.5 135];
case 4
p=[80 90 100];
case 5
p=[45 67.5 90];
91
case 6
p=[-10 35 60];
case 7
p=[-100 -45 10];
end

% LMF
if (input<=p(1)) | (input>=p(3))
match1=0;
elseif (input>p(1)) & (input<p(2))
m=1.0/(p(2)-p(1));
c=-m*p(1);
match1=m*input+c;
elseif (input>p(2)) & (input<p(3))
m=-1.0/(p(3)-p(2));
c=-m*p(3);
match1=m*input+c;
else
match1=1;
end

% UMF
p(4)=p(3)+delta;
p(3)=p(2)+delta;
p(2)=p(2)-delta;
p(1)=p(1)-delta;

if (input<=p(1)) | (input>=p(4))
match2=0;
elseif (input>p(1)) & (input<p(2))
m=1.0/(p(2)-p(1));
c=-m*p(1);
match2=m*input+c;
elseif (input>=p(2)) & (input<=p(3))
match2=1.0;
else
m=1.0/(p(3)-p(4));
c=-m*p(4);
match2=m*input+c;
end
match(1)=match1;
match(2)=match2;

File : start_system.m

function varargout = start_system(varargin)

gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @start_system_OpeningFcn, ...
'gui_OutputFcn', @start_system_OutputFcn, ...
'gui_LayoutFcn', [], ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout

92
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% --- Executes just before start_system is made visible.
function start_system_OpeningFcn(hObject, eventdata, handles, varargin)

% Choose default command line output for start_system


handles.output = hObject;

% Update handles structure


guidata(hObject, handles);

% UIWAIT makes start_system wait for user response


% uiwait(handles.figure1);
handles.x=10;
handles.y=20;
handles.angle_v=30;
handles.angle_t=30;
handles.conf='LE';
handles.v=5;
handles.status_cb=0;
handles.tft=0;
handles.trt=0;
handles.tvb=0;
handles.delta=0;
handles.right=0;
handles.left=0;
handles.vplus=0;
handles.vminus=0;
guidata(hObject, handles); %saving the data to the structure handles

function varargout = start_system_OutputFcn(hObject, eventdata, handles)


varargout{1} = handles.output;

function xposition_Callback(hObject, eventdata, handles)


handles.x=str2double(get(hObject,'String'));
guidata(hObject,handles);

function yposition_Callback(hObject, eventdata, handles)


handles.y=str2double(get(hObject,'String'));
guidata(hObject,handles); ;saving data to structure handles

function anglev_Callback(hObject, eventdata, handles)


handles.angle_v=str2double(get(hObject,'String'));
guidata(hObject,handles);

function anglet_Callback(hObject, eventdata, handles)


handles.angle_t=str2double(get(hObject,'String'));
guidata(hObject,handles);

function velocity_Callback(hObject, eventdata, handles)


handles.v=str2double(get(hObject,'String'));
guidata(hObject,handles);

function conf_Callback(hObject, eventdata, handles)


handles.conf=get(hObject,'String');
guidata(hObject,handles);
% --- Executes on button press in StartSim.

93
function StartSim_Callback(hObject, eventdata, handles)
x=handles.x;
y=handles.y;
angle_v=handles.angle_v;
angle_t=handles.angle_t;
v=handles.v;
conf=handles.conf;
status_cb=handles.status_cb;
tft=handles.tft;
trt=handles.trt;
tvb=handles.tvb;
delta=handles.delta;
and_method=get(handles.andmethod,'Value');
traj_algo=get(handles.trajalgo,'Value');
distance=auto_car(x,y,angle_v,angle_t,conf,v,status_cb,tft,trt,tvb,delta,and_method,traj_algo);

% --- Executes on button press in ClearWindow.


function ClearWindow_Callback(hObject, eventdata, handles)
cla;
clear all; %clears all the variables including the persistent variables.

% --- Executes on button press in showtrails.


function showtrails_Callback(hObject, eventdata, handles)
handles.status_cb=get(hObject,'Value');
guidata(hObject,handles);

% --- Executes on button press in tfronttyres.


function tfronttyres_Callback(hObject, eventdata, handles)
handles.trt=get(hObject,'Value');
guidata(hObject,handles);

% --- Executes on button press in treartyres.


function treartyres_Callback(hObject, eventdata, handles)
handles.tft=get(hObject,'Value');
guidata(hObject,handles);

% --- Executes on button press in tvehicleb.


function tvehicleb_Callback(hObject, eventdata, handles)
handles.tvb=get(hObject,'Value');
guidata(hObject,handles);

% --- Executes on button press in pausesim.


function pausesim_Callback(hObject, eventdata, handles)
if get(hObject,'Value')
% UIWAIT makes start_system wait for user response (see UIRESUME)
uiwait(handles.figure1);
else
uiresume(handles.figure1);
end

function deltaval_Callback(hObject, eventdata, handles)


handles.delta=str2double(get(hObject,'String'));
guidata(hObject,handles);

% --- Executes on button press in Initialize.


function Initialize_Callback(hObject, eventdata, handles)
% this function is used to control manually the motion of the vehicle using mouse buttons
x=handles.x;
y=handles.y;

94
angle_v=handles.angle_v;
angle_t=handles.angle_t;
v=handles.v;
status_cb=handles.status_cb;
tft=handles.tft;
trt=handles.trt;
tvb=handles.tvb;

while(1)
handles=guidata(hObject);
left=handles.left;
right=handles.right;
vplus=handles.vplus;
vminus=handles.vminus;
[lf rf vpf vmf]=hum_cnt(x,y,angle_v,angle_t,v,status_cb,tft,trt,tvb,left,right,vplus,vminus);
if lf==1
handles.left=0;
guidata(hObject,handles);
end
if rf==1
handles.right=0;
guidata(hObject,handles);
end
if vpf==1
handles.vplus=0;
guidata(hObject,handles);
end
if vmf==1
handles.vminus=0;
guidata(hObject,handles);
end
end

% --- Executes on button press in RightSteer.


function RightSteer_Callback(hObject, eventdata, handles)
handles.right=1;
handles.left=0;
handles.vplus=0;
handles.vminus=0;
guidata(hObject,handles);

% --- Executes on button press in LeftSteer.


function LeftSteer_Callback(hObject, eventdata, handles)
handles.right=0;
handles.left=1;
handles.vplus=0;
handles.vminus=0;
guidata(hObject,handles);

% --- Executes on button press in vplus.


function vplus_Callback(hObject, eventdata, handles)
handles.right=0;
handles.left=0;
handles.vplus=1;
handles.vminus=0;
guidata(hObject,handles);

% --- Executes on button press in vminus.


function vminus_Callback(hObject, eventdata, handles)

95
handles.right=0;
handles.left=0;
handles.vplus=0;
handles.vminus=1;
guidata(hObject,handles);

% --- Executes on button press in StartKeyHum.


function StartKeyHum_Callback(hObject, eventdata, handles)
x=handles.x;
y=handles.y;
angle_v=handles.angle_v;
angle_t=handles.angle_t;
v=handles.v;
status_cb=handles.status_cb;
tft=handles.tft;
trt=handles.trt;
tvb=handles.tvb;

while(1)
action_code=double(get(gcbf,'Currentcharacter')); % gets last key pressed code
left=0;
right=0;
vplus=0;
vminus=0;
if action_code==28
left=1;
right=0;
vplus=0;
vminus=0;
set(gcbf,'Currentcharacter','c');
elseif action_code==29
left=0;
right=1;
vplus=0;
vminus=0;
set(gcbf,'Currentcharacter','c');
elseif action_code==30
left=0;
right=0;
vplus=1;
vminus=0;
set(gcbf,'Currentcharacter','c');
elseif action_code==31
left=0;
right=0;
vplus=0;
vminus=1;
set(gcbf,'Currentcharacter','c');
elseif action_code==120
break;
end
hum_cnt(x,y,angle_v,angle_t,v,status_cb,tft,trt,tvb,left,right,vplus,vminus);
end

File : steering.m

%NB-1 --------- PB-7


function x = steering(z,range)

96
if (range==1) | (range==7)
switch range
case 1
a=-35;b=-17;
x1=-35;
m=-1.0/(b-a);
c=-m*b;
x2=(z-c)/m;
case 7
a=17;b=35;
m=1.0/(b-a);
c=-m*a;
x1=(z-c)/m;
x2=35;
end
else
switch range
case 2
a=-30;b=-17;c=-7;
case 3
a=-14;b=-7;c=-0;
case 4
a=-7; b=0; c=7;
case 5
a=0;b=7;c=14;
case 6
a=7;b=17;c=30;
end
m1=1.0/(b-a);
c1=-m1*a;
m2=-1.0/(c-b);
c2=-m2*c;
x1=(z-c1)/m1;
x2=(z-c2)/m2;
end
x(1)=x1;
x(2)=x2;

File : dom_xpos.m

function match=dom_xpos(input,loc,delta)

LE=1;
LV=2;
VE=3;
RV=4;
RI=5;
if (loc==1) | (loc==5) % if loc is left or right
switch loc
case 1
%UMF
p=[0 20 70];
if (input<p(1))
match2=0;
elseif (input>=p(1)) & (input<=p(2))
match2=1;
elseif (input>p(2)) & (input<=p(3))

97
m=-1.0/(p(3)-p(2));
c=-m*p(3);
match2=m*input+c;
else
match2=0;
end

%LMF
m=-1.0/(p(3)-p(2));
p(3)=p(3)-delta;
c=-m*p(3);
y_level=m*p(2)+c;

if (input<p(1)) | (input>p(3))
match1=0;
elseif ((input>=p(1)) & (input<=p(2)))
match1=y_level;
else
match1=m*input+c;
end

case 5

%UMF
p=[130 180 200];
if (input>p(3))
% disp('not a valid input');
match2=0;
elseif (input>=p(2)) & (input<=p(3))
match2=1;
elseif (input>p(1)) & (input<p(2))
m=1.0/(p(2)-p(1));
c=-m*p(1);
match2=m*input+c;
else
match2=0;
end

%LMF
m=1.0/(p(2)-p(1));
p(1)=p(1)+delta;
c=-m*p(1);
y_level=m*p(2)+c;
if (input<p(1)) | (input>p(3))
match1=0;
elseif ((input>=p(1)) & (input<=p(2)))
match1=m*input+c;
else
match1=y_level;
end
end
else
switch loc
case 2
p=[60 80 100];
case 3
p=[90 100 110];
case 4
p=[100 120 140];

98
end

%LMF
if (input<p(1)) | (input>p(3))
match1=0;
elseif (input>=p(1)) & (input<p(2))
m=1.0/(p(2)-p(1));
c=-m*p(1);
match1=m*input+c;
elseif (input>p(2)) & (input<=p(3))
m=1.0/(p(2)-p(3));;
c=-m*p(3);;
match1=m*input+c;
else
match1=1;
end

%UMF
p(4)=p(3)+delta;
p(3)=p(2)+delta;
p(2)=p(2)-delta;
p(1)=p(1)-delta;
if (input<=p(1)) | (input>=p(4))
match2=0;
elseif (input>p(1)) & (input<p(2))
m=1.0/(p(2)-p(1));
c=-m*p(1);
match2=m*input+c;
elseif (input>=p(2)) & (input<=p(3))
match2=1;
else
m=1.0/(p(3)-p(4));;
c=-m*p(4);;
match2=m*input+c;
end
end
match(1)=match1;
match(2)=match2;

99

You might also like