Professional Documents
Culture Documents
by
BACCALAUREUS INGENERIAE
in
at the
TABLE OF CONTENTS
DT Jordan 2008 i
List of Figures
LIST OF FIGURES
Figure 1-1 Remote Controlled UAV...................................................................................................... 1.2
Figure 1-2: Predator Medium Altitude Long Endurance UAV [17] ...................................................... 1.2
Figure 1-3: RQ-4 Global Hawk UAV [19] .............................................................................................. 1.3
Figure 1-4: Iterative development process [13] .................................................................................. 1.5
Figure 1-5: Incremental development process and prototyping [13] ................................................. 1.6
Figure 1-6: Design documentation framework [5].............................................................................. 1.7
Figure 2-1: Simulation environment .................................................................................................... 2.2
Figure 2-2: UAV fuzzy controller autopilot user interface ................................................................... 2.6
Figure 3-1: Human controlled process................................................................................................. 3.2
Figure 3-2: Fuzzy controller controlling a process ............................................................................... 3.3
Figure 3-3: Example of 15 membership functions: .............................................................................. 3.6
Figure 3-4: Graphical construction of control signal with a Matlab generated interface [12] ............ 3.7
Figure 3-5: One input, one output rule base with non-singleton output sets..................................... 3.9
Figure 3-6: Example of a Mamdani controller ..................................................................................... 3.9
Figure 3-7: Example FLS controller .................................................................................................... 3.10
Figure 3-8: Interpolation between two lines (a), in the interval of overlap of two membership
functions (b) ....................................................................................................................................... 3.11
Figure 3-9: Sugeno interface with singleton output .......................................................................... 3.11
Figure 3-10: Control surface that corresponds to the rule base in Figure 3-4 .................................. 3.12
Figure 3-11: Phase trajectory with matching fuzzy controller output ............................................... 3.12
Figure 3-12: Linear control surface that acts as a summation U=E+CE ............................................. 3.14
Figure 3-13: Fuzzy proportional controller ........................................................................................ 3.15
Figure 3-14: Fuzzy PD controller ........................................................................................................ 3.15
Figure 3-15: Fuzzy PID controller ....................................................................................................... 3.16
Figure 3-16: Fuzzy incremental control ............................................................................................. 3.17
Figure 3-17: Scaling of a FPD controller ............................................................................................. 3.18
Figure 3-18: The axis of movement of a fixed wing aircraft .............................................................. 3.19
Figure 3-19: Aircraft control surface .................................................................................................. 3.19
Figure 3-20: Aircraft yaw control ....................................................................................................... 3.20
Figure 3-21: Aircraft pitch control ..................................................................................................... 3.20
Figure 3-22: Aircraft roll control ........................................................................................................ 3.21
Figure 3-23: Inner loops of the autopilot ........................................................................................... 3.22
Figure 3-24: Outer loops of the autopilot .......................................................................................... 3.22
Figure 3-25: Simple Pitch-altitude hold autopilot .............................................................................. 3.22
Figure 3-26: More complex pitch-altitude hold autopilot ................................................................. 3.23
Figure 3-27: System configuration of a framework fuzzy based UAV navigation and control .......... 3.27
Figure 3-28: Altitude error membership functions Figure 3-29: Change in Altitude error
membership functions ....................................................................................................................... 3.29
Figure 3-30: Airspeed membership functions Figure 3-31: Elevator membership functions ....... 3.29
Figure 3-32: Throttle command membership functions.................................................................... 3.29
Figure 3-33: Change of heading error membership functions Figure 3-34: Heading error
membership functions 3.30
Figure 3-35: Roll angle membership functions .................................................................................. 3.30
Figure 3-36: Plane passing through a target point ............................................................................ 3.30
Figure 3-37: Change of altitude ......................................................................................................... 3.31
Figure 3-38: Forces acting on a plane during a turning ..................................................................... 3.32
Figure 3-39: Heading error membership functions Figure 3-40: Roll angle membership functions
3.33
Figure 3-41: change of roll angle membership functions .................................................................. 3.33
Figure 3-42: The control surface ........................................................................................................ 3.34
DT Jordan 2008 ii
Table of Contents
DT Jordan 2008 iv
List of Tables
LIST OF TABLES
Table 1-1: Deliverables......................................................................................................................... 1.7
Table 3-1: Relational based format of rule base .................................................................................. 3.4
Table 3-2: Linguistic based table of rule base ...................................................................................... 3.5
Table 3-3: Two input, single output FAM table: ................................................................................ 3.12
Table 3-4: Relationship between the linear fuzzy and PID gains ....................................................... 3.18
Table 4-1: Aerosonde UAV specifications ............................................................................................ 4.4
Table 4-2: Altitude Fuzzy Controller FAM 1 ....................................................................................... 4.11
Table 4-3: Altitude Fuzzy Controller FAM 2 ....................................................................................... 4.11
Table 4-4: Altitude Fuzzy Controller FAM 3 ....................................................................................... 4.11
Table 4-5: Latitude-Longitude Fuzzy Controller FAM ........................................................................ 4.13
Table 5-1: Altitude error membership function linguistic variables and their values ....................... 5.12
Table 5-2: Change in altitude error membership function linguistic variables and their values ....... 5.12
Table 5-3: Elevator membership function linguistic variables and their values ................................ 5.12
Table 5-4: Altitude Fuzzy Controller FAM .......................................................................................... 5.13
Table 5-5: Heading error membership function linguistic variables and their values ....................... 5.18
Table 5-6: Change in heading error membership function linguistic variables and their values ...... 5.18
Table 5-7: Roll angle membership function linguistic variables and their values.............................. 5.18
Table 5-8: Modified latitude-longitude fuzzy controller FAM ........................................................... 5.19
Table 6-1: Sustained forward flight mode test .................................................................................... 6.2
Table 6-2: Procedure to test the user interface................................................................................... 6.3
Table 6-3: Process to test the accuracy of the controller .................................................................... 6.5
Table 6-4: Process to test the response against different weather conditions ................................. 6.16
Table 6-5: Test results ........................................................................................................................ 6.21
Table 9-1: ECSA engineering outcomes [16] ........................................................................................ 9.1
Table 10-1: Logical operators symbols .............................................................................................. 10.4
DT Jordan 2008 v
List of symbols are abbreviations
DT Jordan 2008 vi
Chapter 1: Problem Statement
The invention of the unmanned aerial vehicle (UAV) has further expanded the use of the aircraft.
UAVs are typically controlled with the aid of programmed flight plans, and onboard control systems.
They are usually classified into the following main groups [7]:
1. Combat:
These aircraft are usually used to provide attacking ability for high-risk missions, where it
might be dangerous to use a manned aeroplane. This type of UAV is commonly referred to
as the unmanned combat air vehicle (UCAV).
4. Reconnaissance:
In this area, the UAVs are used to intelligently monitor and gather information in e.g.
military zones.
For the reasons mentioned above, UAVs are often said to perform the dull, dangerous and dirty jobs,
and UAV missions are often called 3-D missions. According to Col. John Burke, a UAV specialist in the
United States Army [8], UAVs can perform dull but sometimes necessary tasks like flying a specific
flying pattern for reconnaissance. They can go into certain dirty environments, where there are
possible threats of been exposed to dangerous environments like chemical, biological or nuclear
threats. They can further be sent on missions into dangerous environments.
The major advantage of these aircraft is that many limitations associated with manned aircraft are
no longer a constraint. With manned aircraft, the flight duration of many missions, as well as the
success of the mission is usually dependant more on operator constraints like pilot fatigue. Many
aircraft accidents are usually based on pilot error relating to fatigue [10]. Many fixed wing aircraft
accidents in the 1980s are related to pilots been awake for more than 12 hours prior to the accident.
For this reason, the US Federal Aviation Administration (FAA) has set out strict rules and regulations
relating the amount of rest that pilots should have, to the expected flight duration.
With more dull missions, fatigue is reached faster in comparison to other more exciting missions,
and human performance decreases as a function of flight hours. With UAV missions, the UAV is just
as alert in the first hour of flight as in the last. For this reason, the endurance of a UAV aircraft is
more dependent on the percentage of fuel burned as a function of total weight.
The size of the aircraft is also greatly reduced, since they do not have to have the pilot on board.
According to Dr Greg Addington, the air vehicles directorate program manager for propulsion
integration [9], the size of a UAV is dependent on three aspects, mainly:
Mission requirements, such as the range, speed etc.
The payload requirements, such as the weapon requirements etc.
The propulsion path flow length of the aircraft, which is responsible for providing lift for the
aircraft.
Current UAV research programs are focusing on developing small UAVs (2-5kg) that are capable of
taking off from a small truck. Typical remote controlled (RC) aircraft can be easily carried by a single
person.
The United States UAV programs are typically associated with using these types of aircraft for
surveillance purposes [11]. Using this type of technology is much cheaper than using satellites.
A number of air forces have UAVs as part of their fleet. The most popular of these include the
Predator and the Global Hawk.
The Predator has been used in the United States military since 1995, and is classified as been the
militaries medium-altitude long endurance (MALE) unmanned aircraft system. The Predator has
been used in combat in various zones such as Afghanistan, Iraq and Serbia. The aircraft can be used
for reconnaissance purposes, and is also capable of carrying two missiles for combat purposes. The
total USA military Predator programme consists of four aircraft, a satellite communication link, and a
ground control station. The total crew working on the programme consists of about 55 people. The
cost associated with the early development Predator is approximately $3.2 million per aircraft.
The United States military added the RQ-4 Global Hawk UAV to her fleet in 2006 as an improvement
of the Predator. This UAV has improved surveillance capabilities compared to its predator
predecessor, and is mainly used for surveillance purposes. It is also the first UAV to be certified by
the FAA to fly on its own. The aircraft has become so popular that many other air forces have shown
increasing interest in the UAV. Each Global Hawk costs approximately $132 million.
Although the aircraft advantages indicate that there is a vast scope for the uses of UAVs, they also
come with their disadvantages. These will usually result if the control system controlling the plane
fails, resulting in the possibility of the UAV crashing. This could put the lives of the general public at
jeopardy.
With the constant improvement of computer processing power, it can be said that the advantages
far outweigh the disadvantages of UAVs and that there is scope for developing a system that will
encapsulate the advantages.
For this reason, most of the current research in UAVs is focused on incorporating autonomy into the
aircraft. This is mainly focused on the ability of the aircraft to make decisions without any human
intervention. It is said that this is the bottleneck for future developments in the industry. Research
into autonomy is separated into the following fields [7]:
1. Communications:
Here, the core focus is handling communication between multiple agents.
2. Trajectory Generation:
Given a certain path from one point to the other, the focus here is to determine the best
control manoeuvre to follow the path.
3. Motion planning:
Determine the most optimal path, given certain constraints.
4. Sensor fusion:
This involves combining the information obtained from different sensors to use for further
analysis.
6. Cooperative tactics:
An optimal distribution of sequences between agents is addressed to increase the success of
a mission.
All of the above can ultimately lead to the ability of the aircraft control to mimic human behaviour.
This mini-dissertation will fall under the unmanned aerial vehicle research group at the University of
Johannesburg.
Classical control theory makes use of a mathematical model of the system, in the form of differential
or state space equations, to define a relationship that transforms the output of the system to that of
a desired state. The major drawback of classical control theory is that it requires a mathematical
model of the system. With larger systems, it is often extremely difficult to formulate the
mathematical model of the system, as the model is often nonlinear. Modelling the system can
become extremely expensive as the size and complexity of the system increases.
In most control systems, the common used controller is the proportional-integral-derivative (PID)
controller that adjusts the output of the system according to the following equation:
=
+
+
Where:
KP Proportional constant
KI Integral constant
KD Proportional constant
e: Error term
The main advantage of the PID controller is that it does not require a mathematical model of the
system, and the constants are easily tuneable using various formalised tuning techniques, however it
usually assumes that the system been modelled is linear.
Fuzzy controllers also do not require a mathematical model of the system, and rather replaces it
with a set of if-then rules. These rules generally only describe a small section of the whole system.
The main advantage of using a fuzzy controller is that the automatic process control mimics the
conscious behaviour of human operators, whether the process is linear or not. As Lotfi Zadeh, the
mathematician regarded to be the father of fuzzy logic, stated "In almost every case you can build
the same product without fuzzy logic, but fuzzy is faster and cheaper [20]."
In terms of automatic control of a UAV, the problem that arises is if it is possible to develop an
autopilot that mimics human behaviour. The controller should also be cheap enough, and should be
easy to integrate with the aircraft.
As mentioned in Section 1.2, the main advantages of using fuzzy controllers are
The mathematical modelling of the system need not be known
The controller mimics human behaviour
The objective of this project is thus to develop a fuzzy controller autopilot for a UAV fixed wing
aircraft. The fuzzy controller autopilot should be tested in a simulation environment that will mimic
the behaviour of the aircraft in real life.
If further time allows, the controller will be verified with hardware in the loop (HIL) simulation. If
further time allows, the controller will be physically implemented in the form of a single boarded
circuit (SBC).
Furthermore, the main part of the project should be limited to simulating the controller. As
mentioned in the section above, the implementation of the controller with a HIL simulation as well
as that of a SBC is a growth option of the controller dependant on time constraints.
This method focuses on the recursive development of increments throughout the lifecycle of the
project. Typical approaches involved with processes that use agile methodologies are shown in
Figure 3 and Figure 1-4.
In the agile process, each iterative phase consists of planning, design, implementation, testing as
well as the documentation of a system increment. Activities involved during each iteration phase
should be completed 100% by the end of the process. The main advantage of this is that after
completing each phase, it is clearer to see the overall progress of the project.
Frequent contacts with the client enable the engineer to have a clear understanding of the
requirements of the project. These can range from the initial high level user requirements acquired
in the initial phase of the project, to emergent requirements acquired further on in the development
process.
Traditional design methodologies focus on the initial goal of capturing all the known requirements
early in the development process. The main reason for this is because systems are often very
difficult to modify after requirements immerge later on in the development process. With agile
processes, the requirements evolve during the system development phase. However, the timescale
allocated for a project does not change. The requirements for each phase are captured in the most
minimal form possible i.e. just enough to allow the development of each phase to be tested
efficiently.
For any agile development process to work, it is crucial to start development with the core, most
important features. These features should be developed as early as possible in the development
process. It can be said that the agile method is the constant cycle of the analysing, developing and
testing steps. Using this methodology will result in reducing the risk of the overall project, since the
engineer is constantly aware of the parts of the project have been completed.
The development process often leads to an increased value of the overall product. This is because
incremental development results in the possibility of releasing a product when it is deemed well
enough, rather than waiting for the entire product to be released. The budget is used more efficient
with agile methodology, then with other methodologies. This is because there is still a possibility of
releasing an early version of the product, even if the budget is exceeded. Other design
methodologies often lead to the scrapping of the entire project if allocated costs are exceeded.
Part of the purpose of this project is to prove that the student has achieved the first five outcomes
as set out by the Engineering council of South Africa (ECSA) [16]. For this reason, attention will be
placed on each of these five outcomes during the project life cycle phase.
1.6 DELIVERABLES
The deliverables as given in Table 1-1 will be submitted for evaluation:
Table 1-1: Deliverables
ACTIVITY WHEN DATE
Hand in chapter 1 and the project As soon as possible 3 March 2008
management plan
Hand in chapter 2,3 7 April 2008
Deliver first seminar Conference date to be TBA
announced
Hand in chapter 4 Last day of block week 30 May 2008
Hand in chapter 5,6 First Friday day of fourth term 12 September 2008
Each phase for the design will consist of the following areas:
During the project management process, the required management processes are set to
successfully complete the design process. Throughout this process, risks are identified and
planned, as well as monitoring plans and contingency plans set. The plan will further contain
financial considerations, as well as any equipment procurement processes.
In the problem statement phase, the problem is introduced. The objectives of the design
project are addressed, as well as the context it falls under. The scope of the project is further
included in this section.
The requirements analysis phase follows up the problem statement phase. Here, the
problem is further analysed. The project requirements are listed, as well as the quality and
performance specifications.
Next, the Literature review phase follows up on the problem statement. Here, the issues
involved are further understood, as well as available knowledge collected.
For the design phase, all the previous gained knowledge is used to create design options for
the solution. Designs are weighed against the requirements, and one design is chosen as the
final design.
In the implementation phase, the final chosen design is implemented and made to work.
The results phase consists of a critical evaluation of the chosen design, with constant
reference to the requirements.
Finally in the conclusion phase, the success of the project is critically judged.
To accomplish all of the above project requirements, the document is to be split up into seven
chapters. These will consist as follows:
Chapter 1 will introduce the reader to the work to be presented. The reasons for the project are
explained, such as the actual problem and why it is a problem. The extent to which the problem is
going to be addressed is further addressed, as well as the benefits of solving the problem.
Next, the requirements analysis phase will be represented in Chapter 2. This will consist of analysing
the problem in more detail. Here, it will be addressed how the problem is intended to be solved, as
well as any known constraints that will affect the solution.
The literature review will address the current state of technology surrounding the project. This will
be represented in Chapter 3. This will entitle the collection of anything that will help in solving the
problem.
Facts that were collected during the design phase will be used to design the proposed solution. This
is to be presented in Chapter 4. Tests to be later performed are also included in this section.
A design is chosen, and this is to be implemented during the implementation phase. This section is
to include steps in implementing the design, as well as issues that were encountered. This is
presented in Chapter 5.
The results of the implemented solution are then discussed in Chapter 6. These include indicating
that the proposed design actually works.
Finally, Chapter 7 is the conclusion of the project, which ties the whole project together, from
beginning to end.
1.8 CONCLUSION
Fixed wing UAVs have become a part of the aviation family, and are well suited to perform the dull,
dangerous and dirty work that is often needed. For this reason, a lot of research is focused on
improving their capability and areas of usage.
The ultimate goal of all UAV research fields is to eventually get the aircraft to fly without any human
intervention. This would minimise human constraints typically associated with manned aircraft
missions, like fatigue. However, the trade-off lies in accomplishing the plane to fly with the accuracy
of a human, but without having the constraints typically associated with manned flight.
Classical as well as modern control system theory allows for the development on an autopilot.
However, the design of most control systems requires a mathematical equation relating the input to
the output of the system. With larger systems it is extremely difficult to find such an equation.
The power in PID and fuzzy controllers are that a mathematical model of the system is not needed.
Although the PID controller is the easiest to tune and is the most common controller used in
industry, it does not fully mimic the human way of thinking. Fuzzy controllers are based on the
theory of fuzzy logic, and represent the human way of thinking. With the aid of a fuzzy controller, it
is possible to model a complex system with a few if-then rules. Fuzzy controllers are often cheaper
compared to other controllers.
The design of a fuzzy controller autopilot will achieve the requirements of keeping a fixed wing
aircraft in sustained forward flight. For the purpose of the project, the initial design will be limited to
a simulation based project. If further time allows, the controller will be expanded in terms of
implementing the controller with a HIL and SBC.
To achieve the objectives of the project, a suitable design methodology has to be in place. In this
project, the agile design methodology will be used, which focuses on the iterative process of
integrating increments into the project. Attention will also be placed on achieving the first five ECSA
outcomes.
Furthermore, the documentation part of the project will be separated into seven chapters. These
range from the initial problem statement, to the conclusion of the project.
This mini-dissertation will fall under the unmanned aerial vehicle research group at the University of
Johannesburg department of electrical and electronic engineering science.
2.1 INTRODUCTION
The purpose of this chapter is to analyse the problem presented in Chapter 1 in further detail. This
will be done by identifying the issues and the constraints associated with the project. These issues
will have to be addressed in the design.
The first type of constraint that will be identified is the technical constraints associated with the
project. This will be done by discussing all the issues and constraints associated with the project. The
financial and economic constraints will then be addressed which will focus on how the economic
environment will impact the project.
Since every engineering project will impact the social environment in some form, the social aspects
and constraints of the project will have to be addressed. The legal framework of the project will then
be further addressed. Safety aspects of the project will also be addressed.
The impact on the environment by any engineering project can result in serious legal consequences.
The environmental constraints of the project will be addressed.
One of the ECSA outcomes is the appropriate application of ethical aspects to projects. For this
reason, ethical considerations associated with the project are to be addressed. Usability
considerations and limitations are also to be addressed.
Since every project makes use of certain assumptions, the limitations of the assumptions to be made
will be addressed.
Furthermore, the requirements of the projects will be identified and listed. Quality and performance
specifications will be set in this chapter.
Although it was stated in Chapter 1 that the agile method will be followed that focuses on the
constant incremental development of requirements, it is often better to understand all the issues
associated with the project at the beginning to ensure that the project life cycle runs smoothly. This
will also lead to a better understanding of the project.
This document will also set the high-level user requirements. The emergent requirements will be
made visible during the project life-cycle phase.
Since the agile process will be used, the requirements stated in this chapter are likely to change
during the project life cycle phase.
2.2.1 Technical
The success of many projects is often related to the technical constraints and the availability of
adequate technology to support the project. For this reason the identified issues and constraints are
as follows:
For this project, the software constraint will be limited to making use of open source software, and
software that the electronic and electrical engineering department has already purchased. Software
already purchased by the department includes Matlab and Microsoft Visual Studio.
The main purpose of the network connection is to send controller commands between the fuzzy
controller and the aircraft simulator, as well as to send current information of the aircraft to the
fuzzy controller. The two sub-systems can be run either on the same computer, or be separated on
different computers as shown in Figure 2-1.
Also, with autopilots on manned aircraft, the pilot is able to disengage the autopilot in cases of
emergencies. With UAVs, the fuzzy controlled autopilot will have to respond to dangerous situations,
or alert staff on the ground control station that a problem has been encountered.
Asymptotic analysis [21] on the algorithm used will have to be performed on the algorithm
implemented to analyse the run time of the algorithm.
Furthermore, the network connection speed will have to be fast enough to make sure that there is
no significant delay in the system.
The model should also accurately simulate the dynamics of the aircraft in order for the controller to
simulate real life response. However, the equations governing the model are not necessary, as fuzzy
controllers do not require them. The model is only needed to simulate the response.
2.2.3 Social
Allowing computers to perform tasks that are usually allocated to humans has numerous social
considerations [22]. These include the constant question that the designer has to ask, mainly: Where
is the limitation and borderline on what computers are allowed to do?
With autopilots replacing the need for a human controller, the question to ask is whether replacing
the human controller with an automatic one will have any social implications?
Parties arguing for the use of artificial intelligence [24] comment that the availability of intelligent
systems will make expert knowledge available to a wider range of the population. In terms of UAVs,
this will mean that trained experts will no longer be needed to keep the UAV in sustained flight, and
the UAVs can lead to the beneficiation of society.
Experts also argue that artificial intelligent systems will allow humans to focus more on activities
that are natural to human nature. In modern society, many people spend too much time working,
and do not have time to focus on themselves and their family. However current political and
economical situations does not allow for this type of utopian life.
On the other hand, many people are against the use of using artificial intelligence systems. Replacing
the human operator with that of a machine might lead to the potential economic destruction in the
form of how society thinks about work, and many people think that a stable economic society
cannot exist if only a small fraction of society performs productive work.
2.2.4 Legal
The Civil Aviation Authority (CAA) is responsible for ensuring a safe civil aviation environment in
South Africa [25]. The CAA sets rules that must conform to those set by International Civil Aviation
Organisation (ICAO) which is based in Canada.
T here are only very few structured standards set by the CAA for UAVS in South Africa, the standards
set by the ICAO will be referenced, mainly the standards set by the United Kingdom [26]. These
include legal constraints in terms of the minimum allowed communication link speed between the
ground and the UAV, as well as certification procedures. For more information, refer to [26].
The scope of this project is mainly simulation based, and as a result, most of the certification
processes associated with certifying the controller will be ignored.
2.2.5 Safety
In sustained forward flight, there is a possibility that the aircraft may encounter detrimental
situations e.g. engine failure or severe weather conditions. Human pilots are trained to deal
professionally with these situations, and thus an equivalent autopilot will have to also.
Although UAVS do not have passengers on board, they still pose a safety threat to the general
public. This might include hazardous payloads which might pose a significant threat to the general
public if the UAV crashes. Even UAVS without payloads are dangerous as they can cause significant
injury to the general public if they crash. For this reason, the controller will have to safely control the
aircraft.
As stated in section 2.2.5 the plane also poses a significant threat to damaging the environment if it
crashes.
However, many people argue that it is impossible to develop an autopilot that has the accuracy of a
human operator.
As stated in Section 2.2.3, the general public is a major stakeholder, as the development of any
autopilot will influence and affect the economic stability of country.
Another alternative is to use a traditional controller that makes use of classical control theory
methods. With this approach, the equations representing the dynamics of the UAV will be needed
i.e. each type of UAV will have a different type of equation.
A PID controller can also be used. This type of controller does not require equations representing the
mathematical model of the system, and is commonly use in many control solutions. The
disadvantage of this type of controller is that it does not mimic the human approach of controlling
systems.
Due to time constraints, the model of a UAV will not be investigated. The use of a simulation
platform will be used, and will be assumed that the model is accurate in mimicking true aircraft
dynamics.
2.4.1 Introduction
Although it was stated in Chapter 1 that an agile methodology will be used for this project, the
baseline requirements that are needed to successfully complete the project need to be addressed.
During the results phase, the degree to which the requirements are to be filled will be discussed. To
perform this, the flowing requirements will be addressed:
Functional and data requirements
Usability and humanity requirements
Performance requirements such as
o Speed and latency
o Safety critical requirements
o The precision and accuracy requirements
o Reliability and availability requirements
The operational requirements such as:
o Expected physical environment requirements
o Expected technological environment requirements
o Maintainability and support requirements
Security requirements
Cultural and political requirements
Legal requirements
1. The controller should be accurate to 1.5m and/or 1.5 in accordance with the planned flight
path. These values were randomly chosen and their suitability for the job will only be
discussed in Chapter 6. Since the agile design methodology was used for this project,
changing these requirements later in the project will not inhibit the success of the project.
The majority of resources that will be used to complete this project will be book based, as well as
previous dissertations and academic journals based. The use of internet based resources will be kept
to a minimum, as these are not usually peer reviewed or edited, and thus their accuracy is
questionable. To complete this chapter, the relevant background theory and methods will be
discussed. Only the theory that has a direct impact on the mini-dissertation will be addressed.
Since the implementation of the project will be hardware and software based, these aspects
relevant to the project will also have to be discussed. This will also include the availability of the
tools, as well as any procurement procedures and problems. An overview of similar work is to be
discussed and addressed. This will include a comparison between the previous/existing products and
what the dissertation is trying to achieve.
3.2.1 Standards
Since this mini-dissertation is simulation based, standards and legal constraints are not applicable to
this project. However, if the fuzzy controller autopilot to be developed was to be used to control a
real aircraft, the standards as set by the CAA of South Africa [25] as well as that set by the CAA
regarding the guidance of UAV flight rules and regulations [26] are applicable.
3.3.1 Introduction
The purpose of this section is to thoroughly discuss all the background theory that will be needed to
successfully complete the project. For simplification purposes, only the theory which does not form
part of the control theory course syllabus at the University of Johannesburgs electronic and
electrical engineering department will be discussed.
1
=
+
+
Where:
KP Proportional gain
Integral time
Derivative time
e: Error term
u Controller output
1
1
=
+
+
The main advantage of the PID controller is that it does not require a mathematical model of the
system, and the constants are easily tuneable with the aid of standardised procedures. For
information regarding PID controllers, refer to [40].
3.3.3.1 Introduction
The main purpose of fuzzy-controllers is to try and make machines understand the natural language
associated with human reasoning, and behave similar to a human operator [12]. They have been
used since the mid 1970s with their first implication been controlling cement kilns and steam
engines. Their main advantage is that they are proven quite effective when trying to control
nonlinear systems that are difficult to model and are often accompanied by some uncertainties [33].
Fuzzy controllers make use of fuzzy logic developed by Zadeh [36].This uses if-then rules to describe
how a human will reasons. A typical diagram of a control process that makes use of a human
controller is given in the Figure 3-1:
With fuzzy control, the human operator is replaced with an equivalent fuzzy-controller. A simplified
version of this is shown in Figure 3-2:
The method proposed by Jantzen [12] in developing a fuzzy controller consists of the following steps:
1. Design a PID controller
2. Replace the PID controller with a linear fuzzy controller
3. Make the controller nonlinear
4. Fine-tune it
There are at least four chief methods for finding controller rules [37]. These are:
1. Expert experience and control engineering knowledge:
In this approach, trained experts and operators are questioned in the form of a carefully set
out questionnaire. This approach has been used on the cement kiln described in Section
3.2.3.1.
4. Based on learning:
This is a self organising controller that determines the rules itself.
Typical fuzzy controllers, like the one presented in Figure 3-2, consists of four overall stages and
elements [35]:
1. A rule based:
This consists of if-then rules that describe a human experts natural language description
on how to achieve good control of a process.
2. An interface mechanism:
This is also sometimes referred to as the interface engine or the fuzzy interface module.
This mimics a human experts decision on how to best control the process making use of
the available knowledge.
3. A fuzzification interface:
This part of the controller converts the inputs that the controller has into information that
the interface mechanism can interpret and use to activate and apply the available rules.
4. A defuzzification interface:
This converts the outputs of the interface mechanism into inputs for the process.
In Table 3-1, the two left most columns represent inputs to the controller, while the on the right the
controller output. Each row represents a rule. Table 3-1 can be compacted even further in the form
of a linguistic table given in Table 3-2. This is sometimes also referred to as a fuzzy associate memory
table (FAM).
In Table 3-2, the axis represents the inputs; while the values inside the table represent the outputs.
The linguistic variables and or or are always defined in pairs. Two common definitions of and
and or are given in the relationships bellow:
min x, x
max x, x
Or
x x
x + x x x
Another important aspect is to define the entire universe that contains all acceptable
measurements. This might include scaling the measured input to a specific interval
The choice of the standard universe to be used is based on the range of the expected inputs to the
controller.
As stated in Section 3.2.2.2, membership functions can take many forms and shapes. The designer is
then left to the task of choosing an appropriate membership function.
Generic rules of thumb that apply when choosing membership functions are [12]:
The membership function should have an appropriate range that accommodates the
expected range of noise that might be included in the measurement
Overlap of membership functions is desirable
There should be no gap between membership functions
The number of sets in a family is dependent on the width of the membership function
1 13 4
-./0 1 =
1 2 7
26 4
Where:
1 13 4/ ?@
-89:: 1 = ;1 + < = >
6
A is a usually positive extra value that affects the width of the membership function, as well
Where:
Figure 3-4: Graphical construction of control signal with a Matlab generated interface [12]
For each rule, the fuzzy interface engine looks up the vertical line where the vertical line interests
the membership function. The firing strength indicates the degree of fulfilment of the rules present.
In the case of Figure 3-4, the firing strength is given by:
BC = - ,C
DDD -,C EAG
H
DDD
Depending on the firing strength, one can determine the activation of a rule. This is typically
weighing factor IC [0, 1] which is the degree of confidence (this is determined by the designer).
determined by making use of the multiplication operator * or min. A rule k can be weighted by a
BC = IC BC
In the accumulation phase, all the activated conclusions are activated, making use of the max
operator.
The Centre of Gravity (COG) method uses the centre of gravity value of the fuzzy set. This is given in
the following equation for the discrete case:
-1 1
=
-1
In the continuous case, the summation sign is replaced by the integral operation.
The centre of gravity method for singletons (COGS) can be used in the case when the conclusions are
singletons. This is given by the following equation:
-O O
=
-O
The bisector of area (BOA) method makes use of the abscissa of the vertical line that divides the area
under the curve into two equal lines.
S R/S
= P1Q -11 = -11 U
RT S
In the mean of maxima method (MOM), an initiative choice is made to choose the point with the
strongest possibility. The leftmost maximum (LM) and the rightmost maximum (RM) method
chooses the left most or right most maximum respectively. An example of a one input, one output
rule base with non-singleton output set is given in Figure 3-5:
Figure 3-5: One input, one output rule base with non-singleton output sets.
With a SISO fuzzy controller, there are the following essential rules:
It can be seen that the SISO system has the basic form of a fuzzy proportional controller, as the
controller output action has the same sign as the controller input.
In Figure 3-6, each rule corresponds to one row. A particular instance of error corresponds to the
doted vertical line, while the firing strength is indicated by vertical dashed lines. In the Mamdani
controller, the activation function min is applied. For defuzzification, the COGS method is used.
The difference between the Mamdani controller and the FLS controller is the activation function
product is used, which results in a scaling of the conclusion sets. The real FLS controller uses the
BOA method for defuzzification, although the one given in Figure 3-7 uses COGS method.
WX X
@ HO Y@ ,
4 HO Y4 , ,
C HO YC
[ = G
@ ,
4 , ,
C
In the example:
Figure 3-8 shows the rules interpolating between the two lines, in the interval where the
membership functions overlap. The Sugeno fuzzy controller for these rules is shown in Figure 3-9. In
this example the controller applies singleton conclusions, where the accumulation operation is +
and the defuzzification method is COGS, where the rules interpolate between the two lines:
Figure 3-8: Interpolation between two lines (a), in the interval of overlap of two membership functions (b)
Sugeno controllers thus differs from Mamdani controllers in their defuzzification characteristics.
With Sugeno controllers, the output is either linear or constant. This type of controller is used when
linear or constant controller outputs are acceptable in terms of the controllers requirements. This
reduction of controller complexity when compared to the Mamdani controller also leads to faster
controller performance due to simplicity in terms of the number of executions required during each
execution loop.
With a two-input-two-output FAM table, the control surface is a mesh plot of the relationship
between error and change in error, with the control action on the conclusion side, and the inputs on
the premise side. This is given in Figure 3-10
Figure 3-10: Control surface that corresponds to the rule base in Figure 3-4
With an overshoot response, after a positive step in the reference, a plot of the point (error, change
in error) will follow a trajectory in the table, which spirals clockwise from the lower left corner of the
table towards the centre. This is similar to a phase plane trajectory, which is a plot of a variable
against its own derivative.
It is important for the designer to make sure that the resolution of the table is not too coarse. If
this is the case, then limit cycles might occur, which is oscillations about the reference.
The table also allows the error to drift away from the centre cell until it jumps into a neighbouring
cell with a non-zero control action. To prevent this, bilinear interpolation can be made use of.
Consider a two-dimensional table, where the computed error E falls between two neighbouring
discreet values in the universe, Ei and Ei+1, such that Ei < E < Ei+1 and the change in error CE falls
between two neighbouring discrete values in the universe such that CEj < CE < CEj+1
The resulting control signal is found by interpolating linearly in the E axis direction between the first
pair:
= G_\; @ , 4
And in the CE axis direction,
Where the function g is linear interpolation, and Fij is the fuzzy lookup table (I, j=1,2,)
Jantzen[12] states that limit cycles are unique to non-linear systems. A typical example might be if
there is a deadzone such that the plant drifts away from its equilibrium position until a certain point,
where the controller takes action to move its back towards its equilibrium. In the phase plane, the
limit cycle is defined as a closed and isolated curve. The trajectory must be closed, indicating its
periodic nature, and isolated indicating that nearby trajectories converge towards it or diverge from
it.
When dealing with fuzzy controllers, there are mainly three sources of nonlinearity [12], mainly the
rule base, the membership functions as well as the nonlinear input scaling. The rules themselves
characteristics. If the connectives and for the min and max respectively, then this introduces
might lead to nonlinear characteristics. Secondly the interface engine can cause nonlinear
nonlinear characteristics into the system. Thirdly, several defuzzification methods are nonlinear.
The designer should make sure that the premise universes are large enough for the inputs to
stay within the limits. This must be done to make sure that saturation does not occur. Each
premise family should contain a number of terms, with an overlap such that the sum of the
membership values for any particular input instance is 1. This is performed by making use of
duplicates of symmetric, triangular sets that cross their neighbour sets at the membership
value =0.5
When using conclusion singletons, it is often an advantage. This is because the rule base becomes
equivalent to a plain summation of the inputs.
The following conditions are needed to achieve a fuzzy controller = ^\, _\ equivalent to the
summation = \ + _\, the following conditions have to be fulfilled:
=
The noticeable difference between the two controllers is that the FP (Fuzzy Proportional) is that the
FP controller has two tuning gains GE and GU, while the crisp one only has 1
b = Xcd\
e db
Where the function f denotes the rule based mapping. It is generally nonlinear, but with the linear
approximation:
Xcd\
e d\
The control signal is thus given by:
b = d\
db = d\ db
The gains of the fuzzy controller correspond to the gains of the linear controller by the following
d\ db =
equation:
1
=
+
b = Xd\
, d_\
g db
This time, the function f is a rule base mapping, and its surface depends on two variables. When
making use of the linear approximation:
Xd\
, d_\
g d\
+ d_\
g
d_\
b = d\ db
+
g
d\
d\ db =
d_\
=
d\
The linear approximation is only valid for the case when the fuzzy control surface is a plane acting
like a summation
b = hXcd\
, d_\
g e + dW\
k db
ij@
Making use of the linear approximation, the control signal now becomes:
T
d_\ dW\
b = d\ db h
+
g +
k
d\ d\
ij@
The comparing the gains of the fuzzy PID controller with that of a crisp PID controller, the gains now
become:
d\ db =
d_\
=
d\
dW\ 1
=
d\
The incremental controller adds a change in control signal to the current control signal. This is
3.3.4.4 Fuzzy incremental control
done by:
1 1
= +
with = 0. A block diagram of a fuzzy incremental controller (FINC) is given in Figure 3-16:
It can be seen that this was taken from the equation representing the output of a PID controller,
The fuzzy incremental controller is very similar to the FPD controller. As a result, the conclusion in
GPU, since the control signal b is the sum of all the previous increments, then the control signal
the rule base is now called the change in output (cu), and thus the gain of the output is accordingly
given by:
T
b = Xcd\
, d_\
g e d_b
ij@
Since the mapping here is usually nonlinear, with a favourable choice of design there can be a linear
approximation. This is given by:
T
d\
b d_\ d_b h
+
k
d_\
ij@
The Table 3-4 gives the relationship between the linear fuzzy and the PID gains:
Table 3-4: Relationship between the linear fuzzy and PID gains
Controller Kp 1/Ti Td
FP GE*GU
FInc GCE*GCU GE/GCE
FPD GE*GU GCE/GE
FPD+I GE*GU GIE/GE GCE/GE
3.3.4.6 Scaling
simple example of this is as follows: Suppose that the controller gain has been tuned to d\ = 100
Saturation of the input signal leads to the upsetting on the linearity of the fuzzy controller [12]. A
for a particular plant. If d\ is set to d\ = 400 and tune all the other gains in accordance to Table 3-
4, and keep the proportional gain, differential time, as well as the integral time the same, then the
controller saturates.
To avoid this, and keeping to Table 3-4, a scaling term setting is added:
cd\
+ d_\
g e db
To
1
cB d\
+ B d_\
g e db
B
Where is the scaling factor. This results in the block diagram given in Figure 3-17:
It can be seen that the aircraft is free to move in six degrees of freedom [41]. Simple aircraft are
controlled by making use of the three control surfaces. These are typically the aileron, the rudder as
well as the elevator. Their respective locations on the fixed wing aircraft are given in Figure 3-19. The
main function of the control systems is to modify the flow of the air around the aircraft. This is turn
twists the aircraft to allow it to rotate around the centre of gravity.
The force is applied behind the centre of gravity, and as a result the response of the aircraft is
movement in the yaw direction. Yaw control is not commonly used as the primary means of
changing direction, except when the aircraft is very close to the ground surface.
If the elevator is deflected upwards, the angle of attack of the wing is increased. This results in the
airflow around the elevator forcing the rear of the aircraft down, and as a result the pitch angle of
the aircraft is increased. Similarly, deflecting the elevator downwards results in the pitch of the
aircraft decreasing, and the aircraft begins to dive.
The ailerons are operated differentially i.e. as the one goes up, the other one goes down. The roll
movement is caused by the difference in lift caused on the two wings. If the right aileron goes up
and the right one goes down, the left wing will have a greater lift coefficient, and as a result the
aircraft will roll to the right.
3.3.6 Autopilots
The functions of an autopilot of an aircraft can be divided into the following two groups [45]:
Guidance:
These are used to determine the course and speed of the aircraft based on the inputs of
some reference system to be followed by the aircraft
Control:
This is the application of appropriate forces and movements to the vehicle that will
establish a form of equilibrium state of the aircraft, as well as restore the disturbed aircraft
to an equilibrium state. This is to be done within the aircraft desired limits.
The control loops must ensure that there is a fast and stable response to the commands. They
should eliminate the effects of any disturbances. The basic autopilot structure can be divided into
two sections, mainly the inner-loop and the outer-loop. The inner loop is presented in Figure 3-28,
while the outer loop is presented in Figure 3-29.
The control function is done by the inner loop. This controls the pitch as well as the roll altitude of
the aircraft. The outer loop guides the aircraft along the desired path.
It is very important to take into consideration the way in which the autopilot is engaged and
disengaged [42]. Incorrect use of this can result in the aircraft having dangerous transient responses.
Where:
e is the voltage applied to the controller
v is the voltage applied to the control surface
e is the incremental elevator angle
is the resulting change in pitch
The block diagram of a more complex pitch- altitude hold autopilot is given in Figure 3-31 [42]
o =p+B
The controller does not hold the flight angle p constant as this changes with the flight conditions.
The dynamic compensation block Gc(s) is needed if the requirements are a small steady-state error
and a good transient response. The inner loop feedback provides additional feedback and promotes
good short period damping.
3.4 TOOLS
3.4.1 Introduction
The purpose of this section is to research any tools that will possibly be needed to complete the
project. This will include software, hardware and other additional tools. The availability as well as
the constraints associated with each tool will also be discussed.
Matlabs basic element is the array, and is used across universities as well as in the industry. It also
consists of many libraries in the form of toolboxes, which contain functions and methods to solve
specific problems. These include the signal processing, control systems, neural networks, fuzzy logic,
as well as many other toolboxes.
The typical Matlab environment consists of the following sections:
The development environment
o This is the tools that allows the developer to create Matlab functions and files
The Matlab mathematical function library
o This is a vast collection of computational algorithms
3.4.2.2 Simulink
Simulation is a section of Matlab that enables the designer to model, simulate as well as analyse
dynamic systems. The designer firstly creates a block diagram that depicts the relationship between
the systems inputs, outputs and states. The user can then simulate the dynamic system for a finite
amount of time.
The c++ language extends on the c language by allowing for object orientated programming. c++ is a
hybrid language i.e. the programmer can design software in either a c-like style, an object orientated
style or both.
The environment has a code-editor, IntelliSense as well as an integrated debugger. Other tools
include design tools for designing GUIs. The main languages supported by Visual studio include c/c++
(in Visual c++), VB.NET (in Visual Basic.NET) as well as c# (in Visual c#).
The University of Johannesburg has acquired licences to use Visual studio on campus, as well as on
students personal computers. The only requirement is that the student is registered at the
University. From February 2008, Bill Gates initiated project DreamSpark that allows student to
obtain Microsoft Visual Studio 2008 for free [51]. However, this service is not yet available to
students in South Africa.
3.4.2.10 Dev-C++
Dev-C++ is an open source IDE that can be used to programming in c/c++ [52]. This runs extensively
in Microsoft windows.
3.4.3.1 X-Plane
X-Plane developed by Laminar research is the worlds most realistic flight simulator [53]. This
simulator can be used on personal computers. This includes realistic models of real weather
conditions as well as over 40 types of aircraft. Real terrain is also simulated.
The software package performs the following steps to propagate the flight [53]:
1. Element break down :
2. Velocity determination
3. Coefficient determination
4. Force build-up
5. Back to step 2
All of the above steps are performed at a rate of 15 times per second.
The major drawback of the simulator is the difficulty on obtaining open source add-ons. The
simulator itself is also not free.
3.4.4.3 FlouLib
FlouLib contains tools to develop fuzzy systems in Simulink [62]. It was developed by three
professors at the Universit de Savoie. The toolbox contains a number of tools for developing fuzzy
logic systems using the Mamdani fuzzy interface system, or the Takagi-Sugeno fuzzy interface
system.
3.5.1 Introduction
The purpose of this section is to identify similar products that have been developed. This will include
work done both in the commercial as well as academic environment. The identified work will serve
as a bench mark for this mini-dissertation.
3.5.2 A Framework for Fuzzy Logic Based UAV Navigation and Control
3.5.2.1 Background
The purpose of this paper is to develop a fuzzy logic based autonomous navigation and control for a
UAV [63]. The system configuration is given in Figure 3-28
Figure 3-27: System configuration of a framework fuzzy based UAV navigation and control
The tools used to complete this project are entirely based in the Matlab environment, while the
aircraft is simulated with Aerosim aeronautical simulation block set. The control module is
composed of the altitude module, the latitude-longitude module, and the error calculating block.
Figure 3-28: Altitude error membership functions Figure 3-29: Change in Altitude error membership functions
Figure 3-30: Airspeed membership functions Figure 3-31: Elevator membership functions
Figure 3-33: Change of heading error membership functions Figure 3-34: Heading error membership functions
Although the results shown in Figure 3-37 are based on the latitude and longitude setpoints it is not
sure where the results shown in Figure 3-38 originated, as the paper does not give any indication of
the initial altitude and the set point altitude. However, assuming that the set point altitude is
approximately 1240m, Figure 3-38 clearly has oscillations around the altitude set point with a peak
to peak amplitude of approximately 25m. It is thus assumed that the heading controller works, while
the altitude controller clearly results in too many oscillations. The authors of the paper claim that
these oscillations are based on the fact that the controller design was based on human pilots
experience rather than observations on actual flight performance. As a result, the authors of the
paper decided to perform research into developing algorithms for membership functions tuning
based on evolutionary genetic methods.
Another difference to the project to be implemented is the limitation of the controller in the
Simulink environment only. The controller to be developed will probably use an external program to
simulate the aircraft in a more visual way.
3.5.3.1 Introduction
The purpose of this paper is to provide an intelligent approach to the roll control problem associated
with UAVs [64]. This is done by assuming that the altitude of the UAV remains relatively constant
during the roll transition. In terms of the roll angle movement, there are three different types of
motion, namely:
A motion with zero roll angle
A right turn (with a non zero roll angle)
A left turn (with a non zero roll angle)
A diagram of the forces acting on a plane during a turn are given in Figure 3-39:
In this paper, the NEARCHOS UAV was used. This is a high payload, medium range and endurance,
multi-role inhabitant aerial vehicle. The authors first developed a model of the ideal trajectory. They
then ran exhaustive physical tests on the UAV in order to obtain data that will lead to information
about ideal UAV trajectories. Next, they designed and implemented the fuzzy controller. The goal of
the fuzzy controller is to mimic the ideal UAV trajectory.
Controller inputs:
The linguistic variables that represent the controller inputs are as follows:
For the roll angle
o Right big (rb)
o Right medium (rm)
o Right small (rs)
o Zero
o Left big (lb)
o Left medium (lm)
o Left small
For the heading error:
o Negative big (nb)
o Negative medium (nm)
o Negative small (ns)
o Zero
o Positive big (pb)
o Positive medium (pm)
o Positive small (ps)
Controller outputs:
The linguistic variables that represent the controller outputs are as follows:
For the roll command:
o Right big (rb)
o Right medium (rm)
o Right small (rs)
o Zero
o Left big (lb)
o Left medium (lm)
o Left small
Figure 3-39: Heading error membership functions Figure 3-40: Roll angle membership functions
Three other test results showed that the controller also follows the trajectory. The results also
conclude that the controller is able to handle sharp variations in roll angle, and has very small
declinations. Further research of this project includes the optimisation of the rule base using
evolutionary algorithms. This will create a robust fuzzy logic controller leading to a better
approximation of the ideal trajectory.
The design method in this paper uses a unique approach by first creating an ideal trajectory model,
and then trying to mimic the model with the aid of the fuzzy controller. An alternative approach
might be first creating a model based on observing pilots execution of the trajectory, and then
basing the fuzzy model on this approach. This approach was effectively applied to roll control.
However, in order to have a fully autonomous navigation system, some sort of control in the
longitudinal plane is needed.
Simulation results have shown that the controller is very accurate when compared to the most
realistic model available. There are plans to take the controller further by designing the Takagi-
Sugeno regulator.
3.6 CONCLUSION
The use of previously written literature is vital to the success of any project, as this provides a firm
foundation for the design and implementation phases that are to follow. Although most projects
require some form of legal boundary, this does not really relevant to this mini-dissertation. This is
because this project is to be mostly simulation based, and as a result legal standards are not really
needed.
Fuzzy logic has been used to develop fuzzy controllers since the early 1970s, with the first
implication been the controlling of cement kilns. The controller makes use of fuzzy sets, membership
functions, linguistic variables as well as if-then rules for the decision process. The major advantages
of these controllers are that they do not require a mathematical model of the system to be
controlled, and mimic human behaviour very closely. These type of controllers generally consist of
four stages, mainly the rule base, the interface mechanism, the fuzzification interface as well as the
defuzzification interface.
There is not set method or standard for developing a fuzzy controller. The method proposed by
Jantzen consists of four steps in designing the controller, mainly designing a PID controller for the
process, replacing the controller with a linear fuzzy controller, making the fuzzy controller non-
linear, and then finally fine tuning the controller. Although this method exists, the overall design
process still entitles trial and error.
Simple aircraft are typically controlled by making use of three control surfaces. The ailerons, rudder
and elevator control the roll, yaw and pitch movements respectively. The autopilot to be developed
will be an altitude and heading hold autopilot.
The Matlab environment has many tools that will aid in the implementation as well as experimental
process. This includes various internal toolboxes such as the control systems and fuzzy logic
toolboxes. A GUI environment that can be used to visualise dynamic systems is also available. Other
libraries in Matlab include the aerospace Blockset, as well as the real time workshop. External
libraries are also available that can be added to Matlab. Fuzzy support tools include the FISMAT as
well as the Floulib toolboxes. External aircraft simulation blocks include the Aerosim Blockset, the
FDC toolbox as well as the DUBSI toolbox.
Visual flight simulator programs include the X-plane, Microsoft flight simulator, and Flightgear flight
simulator packages. High level programming languages include c, c++ and the c# languages. These
are usually developed in IDE environments such as Microsoft Visual studio, or the freeware Dev C++.
Numerous research has focused on applying fuzzy logic and fuzzy controllers to UAVs. Three similar
papers to the project are A framework for fuzzy based navigation and control, Roll control of
unmanned aerial vehicles using fuzzy logic and Combining fuzzy and PID control for an unmanned
helicopter.
All of the above found literature and tools can aid in the successful completion of the project, and as
a result Chapter 4 will focus on the design of the fuzzy controller autopilot for the fixed wing UAV.
4 CHAPTER 4: DESIGN
Each functional block in the high level diagram will then be further discussed and described in the
form of its specifications, purpose, expected inputs and expected outputs. The detailed design of
each component is also to include the maths and physical science describing the component, as well
as the use of software and hardware tools that will be used to implement the project.
Since it was stated in Chapter 1 that the agile design methodology will be used, that focuses on the
rapid develop of system increments, the design of the individual components will not be thoroughly
completed in this phase.
Since the paper by Doitsidis et al [63] discussed in Section3.5.2 had similar goals to this project, the
design as well as the implementation phase will be focused on improving their results obtained.
To effectively design the fuzzy controller autopilot for a fixed wing UAV, the following components
will be needed:
Standard Simulink blocks including:
o Scopes
o Addition blocks
o Multiplication blocks
o Etc.
Adequate model of a UAV in Simulink that has the following inputs:
o Rudder control input
o Aileron control input
o Elevator control input
o Throttle control input
Adequate model of a UAV in Simulink with the following block outputs:
o Outputs of various UAV sensor inertial navigation system (INS) readings
indicating UAV position, orientation and velocity
Adequate model of various physical environments and constraints that the UAV will
experience, in the form of Simulink block sets such as:
o Atmosphere model
o Earth model
Fuzzy controller support in the form of Simulink Blocksets that will consist of interfaces
for specifying:
o Controller inputs
o Controller outputs
o Controller membership functions and linguistic variables
o The fuzzy if-then rule base
Simulink blocks to allow the UAV to be seen graphically in an external flight simulator
e.g. Flightgear, X-Plane, Microsoft flight simulator
The Blockset library also includes the model of two aircrafts, mainly the Aerosonde UAV given in
Figure 4-1, as well as the Navion general aviation airplane given in Figure 4-2 [66].
Since one of the requirements of the project is that a model of the UAV will not be investigated, the
Aerosonde UAV will be used as provided by the Blockset. It will be assumed that this included model
is accurate and correct. The Simulink block of the UAV as well as its inputs and outputs is given in
Figure 4-3:
Euler = the 31 vector of the attitude of the aircraft given in Euler angles [ ]T , in the
units of radians
AeroCoeff = the 61 vector of aerodynamic coefficients [CD CY CL Cl Cm Cn ]T , in the units of
rad1
EngCoeff = the 51 vector of engine coefficients [MAP tg/u tgv09: BSFC P]T given in the
PropCoeff = the 31 vector of propeller coefficients [J CT CP ]T
A simplified internal structural model of all aeroplane models within the Aerosim Blockset is given in
Figure 4-4 [66]. This also applies to the Aerosonde UAV.
Figure 4-4: Internal structure of an aeroplane model within the Aerospace Blockset
From Figure 58, it can be seen that the Aerosonde model takes into consideration the atmosphere
and the earth model, as a function of wind velocities, and thus provides an accurate simulation
environment.
It is also important to note the following important specifications of the Aerosonde UAV [68]:
Standard Instrumentation
Temperature, Pressure, 2 Vaisala RSS901 Sondes for temperature, pressure and
Humidity, Wind humidity, and a proprietary wind system.
In 1998, the Aerosonde UAV also became the first UAV to cross the Atlantic [69]. The UAV was
planned to encounter wind speeds up to a maximum value of 0.5m/s during the mission. The time
variation of the altitude of the UAV during the mission is shown in Figure 4-5:
Figure 4-5: Time variation of the altitude of the UAV during the transatlantic flight
With the Aerosim Blockset, it is possible to connect to connect to the Flightgear. The Blockset allows
the user to connect to Flightgear versions 0.92, 0.9.4, 0.9.6 and 0.9.8. The Simulink block to connect
to Flightgear 0.9.8 is given in Figure 4-6. The block communicates with Flightgear by making use of
the UDP protocol. However, with the Aerosim Blockset it is not possible to obtain data from
Flightgear to be used within Matlab and Simulink.
The Blockset inputs most concerned with for this project are the first three, mainly:
Position = the 31 vector of geographic position [Lat Lon Alt] in the units of [rad rad m]
Euler = the 31 vector of Euler angles [ ]T in the units of radians
Airspeed = the current aircraft airspeed, in the units of m/s
The only output of the block is a visual representation of the aircraft within Flightgear flight
simulator.
Although most of the literature discussed in Chapter 3 does not use altitude control and latitude-
longitude control as typical autopilots, the paper used by Doitsidis et al [63] uses this approach.
Since the goal of this project is to improve their results, the same approach is used.
All of the system blocks above will be implemented with the Aerosim Blockset, except Flightgear,
which is a separate external application. The choice of the tools to be used is not necessarily fixed,
since one of the features of the agile methodology is that the design often changes with emerging
requirements. Although the choice of tools for the fuzzy controller is likely to remain fixed, the
robustness of the controller can only be tested when integrating it with different UAV models and
different environments, such as the X-Plane XPDS developed by Sam Claasen.
The controller will be a Mamdani type controller, and has the following properties as given in Figure
4-12:
The membership functions for the inputs are given in Figure 4-13 to Figure 4-15, where the altitude
error is measured in meters, and the airspeed is measured in meters per second.
Figure 4-13: Altitude error membership function Figure 4-14: Change of altitude error membership function
The membership functions for the controller outputs are given in Figure 4-16 and Figure 4-17, where
the elevator is measured in radians. The meaning of the abbreviations of the linguistic variables can
be found in Section 3.5.2.2
Figure 4-16: Throttle membership function Figure 4-17: Elevator membership function
The fuzzy rule base chosen for the altitude controller are:
1. If Altitude error is AEN and Change of altitude error is NC then Elevator is PE and Throttle is
HT
2. If Altitude error is AEN and Change of altitude error is S then Elevator is PE and Throttle is
MT
3. If Altitude error is AEN and Change of altitude error is PC then Elevator is PE and Throttle is
LT
4. If Altitude error is AES and Change of altitude error is NC then Elevator is PE and Throttle is
MT
5. If Altitude error is AES and Change of altitude error is S then Elevator is S and Throttle is MT
6. If Altitude error is AES and Change of altitude error is PC then Elevator is NE and Throttle is
MT
7. If Altitude error is AEP and Change of altitude error is NC then Elevator is NE and Throttle is
LT
8. If Altitude error is AEP and Change of altitude error is S then Elevator is NE and Throttle is
MT
9. If Altitude error is AEP and Change of altitude error is PC then Elevator is NE and Throttle is
HT
10. If Airspeed is SA then Throttle is HT
11. If Airspeed is MA then Throttle is MT
12. If Airspeed is BA then Throttle is LT
The rules in terms of a FAM, where the altitude error and change of altitude error are the inputs,
and elevator the output is given in Table 4.2:
The FAM where the altitude error and change of altitude error are the inputs, and the Throttle the
output is given in Table 4.3:
The FAM where the airspeed is the input, and the Throttle the output is given in Table 4.4:
SA HT
Airspeed MA MT
BA LT
The values for the elevator controller output were based on experimentation, and was chosen to
prevent the UAV from stalling.
Figure 4-18: Fuzzy latitude longitude controller with inputs and outputs
Similar to the fuzzy altitude controller, a Mamdani type controller will also be used for the latitude-
longitude controller, with the same controller properties as given in Figure 4-12.
The membership functions for the inputs are given in Figure 4-19 and Figure 4-20, where the
heading error is measured in radians, and the airspeed is measured in meters per second.
The output membership function is given in Figure 4-21, where the roll angle is measured in degrees.
The meaning of the abbreviations of the linguistic variables can be found in Section 3.5.2.2
The rules in terms of a FAM, where the heading error and change of heading error are the inputs,
and roll angle the output is given in Table 4.5:
To start Flightgear in external mode, the following command line arguments are used, assuming that
a Windows operating system is used:
Use the command prompt to navigate the folder where Flightgear is installed
Using the command prompt, navigate to the following folder within the Flightgear directory
..\bin\win32
Type in the following command into the command prompt:
Figure 4-23: Starting Flightgear in external mode to accept connections from Matlab
4.4 CONCLUSION
Commonly used tools in the control systems environment as well as the aviation environment will be
used to successfully complete this project. In the control systems environment this will entitle
Simulink for the overall system framework and the fuzzy logic toolbox for the altitude and latitude-
longitude fuzzy logic controllers. In the aviation environment, the Aerosim Blockset will be used to
represent a mathematical model of the Aerosonde UAV and the external environment, while the
Flightgear flight simulation package will be used to visually see the UAV and the fuzzy controller
autopilot in place.
The Altitude fuzzy control system will consist of the altitude error, change of the altitude error, and
the airspeed as the controller inputs; while the elevator angle and the throttle firing strength will be
the controller outputs. The heading fuzzy control system will consist of the heading error and the
change of heading error as the controller inputs, while the roll angle will be the controller outputs.
The design of the altitude fuzzy controller, heading fuzzy control system and their respective
membership functions are heavily based on the paper titled A Framework for Fuzzy Logic Based UAV
Navigation and Control [6]. The fuzzy rule base will consist of 12 rules for the altitude fuzzy
controller, and 21 rules for the latitude-longitude controller.
Although a solid foundation in terms of the initial design is set, the controller design is likely to
change and will have to be fine-tuned until adequate performance is met. This will be accomplished
by following a recursive process between the design, implementation and testing phase.
5 CHAPTER 5: IMPLEMENTATION
As a result, the initial design as given in Chapter 4 is inevitable to change. These might range from
changing the individual components to changing the entire system. The changes in the original
design often aid someone who would like to further expand on the project, and thus all documented
changes are very helpful. Since it was stated that the agile design methodology is used for this
project, the implementation phase of this project will lead to emergent requirements. Another
property of the agile methodology is that each small system increment is recursively added to the
system. How each increment is added to the entire system will be brought forward during this
implementation phase.
The Simulink diagram given in Figure 5-1 has the following properties:
The blue Aerosonde UAV block is the actual model of the Aerosonde UAV shown in Figure
4-1, with the various inputs and outputs
The green R2D block is used to convert the radians UAV Euler angle output to degrees
The red Stop Simulation when A/C on the ground is used to stop the currently running
Simulink simulation as soon as the UAV touches the ground
The three brown Airspeed, Bank Angle and Heading angle blocks are used to indicate the
current UAV airspeed, bank angle and heading angle given in the units of m/s, degrees and
degrees respectively
Furthermore, the initial properties of the UAV Blockset are set up as shown in Figure 5-2:
The setup properties of the FlightGear 0.9.8 Interface block is shown in Figure 5-4:
Due to availability constraints, the same computer was used for executing Flightgear as well as the
overall Simulink file. However, this can be easily changed by specifying the Host Name parameter
to the IP address of the computer where Flightgear is installed. Any free port can also be used. For
this project, the port 5500 is used. To set up the Flightgear interface to accept connections from the
Simulink file, the same procedure was followed as given in Section 4.2.3.3.
However, Flightgear produces the following output when executing this command as shown in
Figure 5-5:
Figure 5-5: Invoking Flightgear to accept UDP connections using the command in the Aerosim User guide
As a result, the command has to be expanded to include the path where Flightgear is installed.
Assuming that it is installed in the C:\Program Files directory, the command used has to be
extended to:
To incorporate these changes, the Simulink file was expanded as shown in Figure 5-6. The Altitude
fuzzy logic controller input parameter calculator subsystem block is responsible for calculating the
inputs required for the Altitude fuzzy logic controller. The outputs of the controller are directly
connected to the Elevator and Throttle input control command respectively. The block diagram of
the Altitude fuzzy logic input parameter calculator subsystem block is shown in Figure 5-7.
Figure 5-6: Obtaining inputs and outputs for the Altitude fuzzy logic controller
The parameter setup of the orange Altitude Fuzzy logic controller block is given in Figure 5-8:
Where the FIS matrix field indicates the fuzzy interface structure that the block must use. The FIS
matrix must currently exist in the MATLAB workspace to prevent Matlab from throwing an error.
Implementing the altitude controller without some sort of aileron control in place would result in
the UAV either rolling to the left or right. This will in turn result in the altitude of the UAV dropping.
As a result, the altitude controller cannot be designed without some sort of aileron controller in
place. The purpose of this temporary controller will be to maintain a 0 UAV bank angle. The
aerosonde_demo5 demo that is included in the Aerosim Blockset has this controller in the form of a
PI controller. This controller has the desired bank angle as it setpoint, and outputs an aileron control
command. Testing this controller, it was found that the performance was adequate, and thus the
controller was inserted without any modification [66].
From Figure 5-9, it can be seen that the output of the Bank Angle to PID controller subsystem block
is connected directly to the aileron UAV control input. The block diagram of the Bank Angle to PID
controller subsystem is given in Figure 5-10:
These values were taken directly from the aerosonde_demo5 Simulink diagram and were assumed
to be tuned.
MinMax does not accept 'boolean' signals. The input and output
signal(s) of 'initial_implementation/ Altitude Fuzzy Logic
Controller/FIS Wizard/Defuzzification2/Max (COA)' must be one of the
MATLAB 'uint8', 'uint16', 'uint32', 'int8', 'int16', 'int32',
'single', or 'double' data types, or one of the Fixed-point data
types
It was found that when including fuzzy interference systems into Simulink models, the configuration
parameters shown in Figure 5-12 has to be edited:
Under the Optimization tab of the configuration parameters, the default selection of Implement
logic signals as Boolean data (vs. double) has to be unselected as shown in Figure 5-13. This is due
to the way that Matlab internally represents fuzzy system. The Matlab help files also state that this
modification is a necessity when dealing with fuzzy controllers.
Figure 5-13: Editing the configuration parameters to allow for the execution of FIS systems
Optimising the execution speed is also an issue encountered. As a result, the originally designed
Mamdani controller was changed to a Sugeno type controller. This type of controller has constant
membership functions as its controller output, and thus execution speed is increased. This is
because there is no need to execute the defuzzification algorithms associated with Mamdani type
controllers. The Sugeno controller used has different controller properties to that of the Mamdani
controller shown in Figure 5-14. The default properties of the Sugeno controller are shown in Figure
5-15:
Figure 5-15: The controller properties block of the new Sugeno type controller
For the Sugeno controller, the default Sugeno controller properties were used. While testing the
membership functions of the originally designed controller, it was found that the controller had an
overshoot and/or undershoot of about 10m. This was far from the specifications stated in Chapter 2,
and change was needed. When dealing with airspeed and altitude control of UAVs, the following
issues were encountered:
The throttle cannot be used to single handily control the airspeed. In order to do this, a
combination of both the throttle control as well as the elevator angle control is needed.
However, the elevator is needed to control the altitude of the UAV. As a result it was
decided that the originally designed fuzzy if-then rules regarding airspeed had to be
changed, and the elevator angle was now only used to control the altitude.
During the experimentation phase it was also found that firing the throttle at half of its firing
strength also results in further undershoot. It was thus decided to only use the throttle only at its
maximum firing strength, and thus the throttle membership function was eliminated from the
controller, and replaced by a constant input. This again led to faster execution as less CPU time is
needed during each controller execution loop. The modified Simulink diagram taking these new
modifications into consideration is given in Figure 5-16:
Figure 5-16: Modified Simulink diagram with optimised Altitude controller inputs and outputs
During the trial and error phase of tuning the controller it was decided that more linguistic variables should be added to the Elevator membership function
given in Figure 4-16, as well as tune the other existing membership functions. Through experimentation, it was found that the most optimised membership
functions for the Altitude error and Change of altitude membership functions was tuned as shown in Figure 5-17 and Figure 5-18 respectively.
From Figure 5-17 it can be seen that the altitude fuzzy logic controller allows for inputs in the range
of 400m of the current altitude. The exact values of linguistic variables for the modified altitude
error and change of altitude error membership functions are given in Tables 5-1 and Tables 5-2
respectively:
Table 5-1: Altitude error membership function linguistic variables and their values
Linguistic variable Type Value
AEN Trapezodial [-400 -400 -100 -4]
AES Triangular [-5 0 5]
AEP Trapezodial [4 100 400 400]
Table 5-2: Change in altitude error membership function linguistic variables and their values
Linguistic variable Type Value
NC Trapezodial [-100 -100 -0.2]
S Triangular [-0.3 0 0.3]
PC Trapezodial [0.2 100 100]
Since a Sugeno type fuzzy controller was used, the Elevator output membership function was simply
constants. The value of the constants representing each linguistic variable is given in Table 5-3:
Table 5-3: Elevator membership function linguistic variables and their values
Linguistic variable Type Value
PPPE Constant 0.045
PPE Constant 0.02
PE Constant 0.0025
S Constant 0
NE Constant -0.005
NNE Constant -0.05
NNNE Constant -0.09
The rules in terms of a FAM, where the altitude error and change of altitude error is the input, and
elevator the output is given in Table 5.4:
Since the airspeed was no longer considered for the Altitude fuzzy logic controller, the modified
Altitude fuzzy logic controller input parameter calculator subsystem is shown in Figure 5-19:
Figure 5-19: Modified Altitude fuzzy logic input parameter calculator subsystem
The tuning method proposed by Jantzen [12] was also used to tune the Fuzzy controller. This was
done by placing gains at the controller inputs and output, and tuning them until adequate
performance was met. This tuning process was performed with the aid of sliders that is included as
part of the standard Simulink library. The tuning process revealed that a gain of 4 at the elevator
control output resulted in the best performance. The control surface of the altitude controller is
shown in Figure 5-20:
To incorporate these changes, the Simulink file was expanded as given in Figure 5-21.The Latitude-
Longitude fuzzy logic input parameter calculator subsystem block is responsible for calculating the
inputs for the Latitude-Longitude fuzzy logic controller block. The heading angle setpoint was
calculated using basic trigonometry, after taking into consideration the current latitude and
longitude coordinates, as well as the desired latitude and longitude coordinates.
A detailed diagram of the Latitude-Longitude fuzzy logic input parameter calculator subsystem
block is shown in Figure 5-22:
Figure 5-21: Obtaining inputs and outputs for the heading fuzzy logic controller
The purpose of green MOD maths function block is to convert all possible desired heading angle
inputs to the range [0, 360]. The parameter setup of orange Latitude-Longitude fuzzy logic
controller block is given in Figure 5-23:
Where the FIS matrix field indicates the fuzzy interface structure that the block must use. The FIS
matrix must currently exist in the MATLAB workspace to prevent Matlab from throwing an error. The
block diagram for the Bank angle to aileron PID controller is similar to that shown in Figure 5-10.
The only difference is that the roll angle output of the Heading controller is now used as the Bank
angle setpoint. A diagram of this is shown in Figure 5-24:
Figure 5-24: Converting the Roll angle command to an aileron command with a PI controller
Again, Matlabs FIS editor that is provided with the fuzzy logic toolbox was used to construct the
Fuzzy inference system. The initial controller properties, inputs/outputs as well as membership
functions were set up as designed in Figure 4-18 to Figure 4-20. Furthermore, the fuzzy if-then rules
as given in the FAM table of Table 4-4 were also implemented with the aid of the FIS editor. The
entire FIS system was again loaded into the Matlab workspace, as shown in Figure 5-11.
When testing the originally designed controller, it was found that there was an overshoot and/or
undershoot of approximately 10. As a result, both the heading fuzzy controller as well as the bank
angle to aileron PI controller had to be tuned. Through trial and error, it was found that the heading
error membership function had to be tuned, and that the change in heading error membership
functions remained unchanged. The membership functions of both the heading error as well as the
change of heading error are given in Figure 5-25 and Figure 5-26 respectively.
The exact values of linguistic variables for the modified altitude error and change of altitude error
membership functions are given in Tables 5-5 and Tables 5-6 respectively:
Table 5-5: Heading error membership function linguistic variables and their values
Linguistic variable Type Value
C1 Triangular [-6.283 -6.283 -6.257]
TR Trapezodial [-6.28 -6.184 -4.204 -3.142]
R Trapezodial [-3.142 -2.094 -0.1047 -0.00873]
C Triangular [-0.0262 0 0.0262]
L Trapezodial [0.00873 0.1047 2.094 3.142]
TL Trapezodial [3.142 4.204 6.184 6.283]
C2 Triangular [6.257 6.283 6.283]
Table 5-6: Change in heading error membership function linguistic variables and their values
Linguistic variable Type Value
N Triangular [-1 -1 -0.1284]
S Triangular [-0.15 0 0.15]
P Triangular [0.1284 1 1]
Since a Sugeno type fuzzy controller was used, the Roll angle output membership function was
simply constants. The value of the constants representing the linguistic variables are given in Table
5-7:
Table 5-7: Roll angle membership function linguistic variables and their values
Linguistic variable Type Value
TTR Constant 16
TR Constant 8.5
R Constant 2
A Constant 0
L Constant -2
TL Constant -8.5
TTL Constant -16
17. If Heading error is C1 and Change of heading error is S then Roll angle is A
18. If Heading error is C1 and Change of heading error is P then Roll angle is L
19. If Heading error is C2 and Change of heading error is N then Roll angle is R
20. If Heading error is C2 and Change of heading error is S then Roll angle is A
21. If Heading error is C2 and Change of heading error is P then Roll angle is L
The modified rules in terms of a FAM, where the heading error and change of heading error is the
input, and roll angle the output is given in Table 5.8:
The electrical and electronic engineering department at the University of Johannesburg has already
acquired licences for the first three, while Flightgear is open source. The Aerosim Blockset is also
available freely when used for academic research and non-commercial use. As a result no additional
money was spent on this project.
1. Install an adequate version of Matlab on the computer that is going to be used. The Matlab
version should include Simulink as well as the Fuzzy logic toolbox
2. Run the Aerosim setup file and follow the instructions. The files might have to be unzipped
first
3. Run the Flightgear setup file and follow the instructions
1. Copy the entire Fuzzy controller autopilot for a fixed Wing UAV directory to an appropriate
folder on the computer to be used e.g.: C:\Fuzzy controller autopilot for a fixed Wing UAV
2. Invoke a new instance of Matlab
3. Change the Matlab current directory to point to the directory of the copied Fuzzy controller
autopilot for a fixed Wing UAV directory e.g. C:\Fuzzy controller autopilot for a fixed Wing
UAV
4. Invoke the altitude fuzzy logic controller by typing the following command into the Matlab
command prompt:
fuzzy Altitude_fuzzy_logic_controller_sugeno
5. Export the FIS structure to the Matlab work space as shown in Figure 5-11. The workspace
variable must be called Altitude_fuzzy_logic_controller_sugeno
6. Check that the FIS structure is in the Matlab workspace
7. Invoke the heading fuzzy logic controller by typing the following command into the Matlab
command prompt:
fuzzy Latitude_Longitude_fuzzy_logic_controller_sugeno
8. Export the FIS structure to the Matlab work space as shown in Figure 5-11. The workspace
variable must be called Latitude_Longitude_fuzzy_logic_controller_sugeno
9. Check that the FIS structure is in the Matlab workspace
10. Open up the Fuzzy_controller_for_UAV.mdl Simulink file. This will open up the following
Simulink file
11. The three circled UAV latitude setpoint, UAV longitude setpoint and UAV altitude
setpoint blocks are the three setpoints that can be changed. The altitude setpoint can be
any value in the units of meters up to a range of 400m above or below the current altitude.
The initial altitude is 1000m. The latitude and longitude setpoints can be any value in
degrees, taking into consideration that the initial values are the coordinates of the Electrical
and electronic engineering department at the University of Johannesburg.
12. If the user would not like to view the UAV in Flightgear, then the Simulink simulation can
simply be started, and various readings can be read from the numerous displays or scopes.
If the user would like to see a visual model of the UAV in Flightgear, the following steps have to be
followed:
6. Flightgear is now set up to accept connections from Simulink. The Simulink simulation can
now be started, and there is a visual model of the aircraft executing the control manoeuvres
within Flightgear.
NB: Depending on the Computer setup, a firewall might prevent the UDP connection from taking
place. This can be fixed by turning off the firewall.
1. The configuration settings within Flightgear might result in the Aircrafts surroundings been
dark, and visualisation difficult. The Time of day settings can be changed as shown in 5-
29:
2. One can also toggle the view within Flightgear by making use of the v key. For most cases,
the helicopter view is the best view.
5.6 CONCLUSION
As was inevitable, the initial design had to be changed resulting from unexpected issues. Since the
agile methodology was used for this project, it was found that most of the problems were
discovered in the implementation of the individual system increments. The first problem
encountered was making the network connection between Simulink and Flightgear. This was
because the initial command taken directly from the Aerosim user guide was incomplete and took
assumptions into place. As a result, this command was changed.
The designed controller had three controller setpoints, mainly altitude, heading angle and airspeed.
However, during the implementation phase it was found that there it was very difficult to control
both the airspeed as well as the altitude simultaneously. As a result, it was decided to eliminate the
airspeed from the controller. The throttle controller output was also eliminated as this lead to an
increase in overshoot and undershoot. This meant that a constant throttle input of the maximum
firing strength was used for the UAV. The Mamdani controller for both the altitude and latitude-
longitude controller was replaced by a Sugeno controller to allow for faster execution speed.
Furthermore, the designed linguistic variables, membership functions and if-then rules had to be
tuned to allow for an optimised performance. The tuning process was done on a trial and error basis.
To convert the roll angle output of the heading controller to an aileron UAV command input, a bank
angle to aileron PI controller was used, where the gains were taken from the aerosonde_demo5
demo of the Aerosim Blockset. This PI controller was tested first and the results show that it is
working correctly.
Matlabs real time workshop is used to convert Simulink files to that of a high-level language such as
C/C++. The main reason for this is faster execution speed. When trying to use Matlabs real time
workshop, it was found that conversion process failed. Although Matlab never communicated a
detailed error message, it was assumed that the reason for this failed conversion process was
because the Aerosim Blockset was used, that does no form part of standard Matlab libraries. The
conversion process is definitely a growth option of the project. Although all the issues were
addressed, it can be said that the implementation phase was a successful after testing the project.
The testing phase is the next phase in the project, and the entire test process will be documented in
Chapter 6.
6 CHAPTER 6: RESULTS
Although it is very likely that not all of the planned tests will be passed, the results will still give an
indication if the implementation was successful or not. These results will be given in the form of
tables as well as graphs. This raw test data will then be processed to obtain vital information about
the implemented system. Since this project was heavily based on previously done work, a thorough
comparison between this implemented project as well and the results of the previously done work
will also be documented. Finally the information obtained from the test results will be summarised
in the conclusion of this chapter.
In this section, the requirements that were set in Section 2.4 will be tested. The tests will be
performed as described below. For all the tests, the initial latitude, longitude and altitude positions
were set to the following coordinates:
Latitude: -26.180
Longitude: 27.998
Altitude: 1000m
The latitude and longitude coordinates were set to the coordinates of the Electrical and Electronic
department at the University of Johannesburgs Auckland Park Kingsway campus. This information
was read directly from Google Earth. The Simulink file shown in Figure 5-28 was used during this
testing phase. The file used is the Fuzzy controller autopilot for a fixed Wing UAV.mdl file found on
the CD that came with this document. All the setup steps as discussed in Section 5.5 were performed
prior to performing any tests.
o The test will be performed by inserting a constant control input in the UAV
The following test as given in Table 6-2 was setup to test this requirement:
Table 6-2: Procedure to test the user interface
Test failing
Test Test setup Test passing requirements
requirements
Temporary disconnect the controller inputs of the Flightgear should indicate a visual model of the UAV banking Any other results other
User blue Aerosonde UAV block of Figure 5-29 and to the left. The Current Altitude scope should indicate that than that of the test
interface replace it by a constant 71 matrix input set to [0 the current altitude decreasing, while the Current bank Passing Requirements
test -0.1 0 0 0.4 13 1]T. Run the Simulink file for 100s. angle scope should indicate that the UAV is banking to the
left
While the readings of the Current Altitude and Current bank angle scopes are shown in Figure 6-3 and Figure 6-4 respectively:
Figure 6-3: Altitude plot for user interface test Figure 6-4: Bank angle plot for user interface test
From Figure 6-2, a visual model of the UAV banking to the left can be seen, which functioned as predicted. The plots given in Figure 6-3 and Figure 6-4 also
confirm this. As result, it can be concluded that the interface seems to be working, and that the requirements are met. However, it is clear that the aircraft
shown in Flightgear does not resemble the Aerosonde UAV model. This is because Flightgear does not have built in libraries of the Aerosonde UAV, and thus
the Cessna Skyhawk model is used. However the purpose of the Flightgear interface is focused on visualising the aircrafts response to different setpoints,
rather than having an exact replica of the UAV used in Simulink.
6.3.3 The precision, accuracy, speed and latency test setup and methodology
a speed of 29m/s. To test these requirements, the following tests were performed. For this entire test, the wind input to the blue Aerosonde UAV block
was set to [0 0 0]T i.e. no background wind present. The initial UAV latitude, longitude and altitude setpoints were set to, -26.180, 27.998 and 1000m
respectively- the GPS coordinates of the University of Johannesburg obtained from Google earth. The test setup used is given in Table 6-3:
Set up the set points of the latitude- -21.18 36.658 1000 The Current Heading scope in Either the UAV
longitude controller so that the resulting Figure 5-28 should indicate the heading angle does
Lat-long heading angle setpoint is 300 to the right UAV heading angle increase from not increase to 60
controller 5 of the current position of the UAV i.e. - 0 to 60 with an accuracy of 1.5. and/or the accuracy
test 300, and an altitude setpoint of 1000m. The Current airspeed scope exceeds 1.5. The
Run the Simulink file for 1800s (1/2 hour) waveform should 29m/s UAV speed exceeds
29 m/s
Set up the set points of the latitude- 0 27.998 1000 The Current Heading scope in Either the UAV
longitude controller so that the resulting Figure 5-28 should indicate the heading angle does
Lat-long heading angle setpoint is the same as the UAV heading angle remaining at 0 not remain at 0
controller 6 current position of the UAV i.e. 0, and an with an accuracy of 1.5. The and/or the accuracy
test altitude setpoint of 1000m. Run the Current airspeed scope exceeds 1.5. The
Simulink file for 1800s (1/2 hour) waveform should 29m/s UAV speed exceeds
29m/s
Set up the set points of the latitude- -31.18 41.735 1000 The Current Heading scope in Either the UAV
longitude controller so that the resulting Figure 5-28 should indicate the heading angle does
Lat-long heading angle setpoint is 110 to the left of UAV heading angle increase from not increase to 110
controller the current position of the UAV i.e. 110, 0 to 110 with an accuracy of 1.5. and/or the accuracy
7
test and an altitude setpoint of 1000m. Run the The Current airspeed scope exceeds 1.5. The
Simulink file for 1800s (1/2 hour) waveform should 29m/s UAV speed exceeds
29 m/s
Set up the set points of the latitude- -21.18 19.338 100 The Current Heading scope in Either the UAV
longitude controller so that the resulting Figure 5-28 should indicate the heading angle does
Lat-long heading angle setpoint is 300 to the left of UAV heading angle decrease from not decrease to 300
controller 8 the current position of the UAV i.e. -300, 360 to 300 with an accuracy of and/or the accuracy
test and an altitude setpoint of 1000m. Run the 1.5. The Current airspeed scope exceeds 1.5. The
Simulink file for 1800s (1/2 hour) waveform should 29m/s UAV speed exceeds
29 m/s
The purpose for the tests in this section were to test both the altitude controller as well as the heading controller. These were tested in tests 1-3 and tests
3-8 respectively. The parameters were set up as to cover all possible scenarios in terms of moving from the current state of the UAV to that set by the
setpoints.
Zooming into Figure 6-5, it can be seen that the altitude stabilises at 1046m. Test 1 was set to prove
that the contoller is capable of moving the UAV to an altitude higher than the current position of the
UAV. The results that were obtained from Test 1 shown in Figure 6-5 indicates that the altitude
controller moves the altitude of the UAV from its initial value of 1000m, and stabilises it at 1046m.
This is a -4m shift away from the specified setpoint of 1050m. The reason for this is as follows. One
of the problems when using fuzzy controllers to control non-linear systems is the formation of
oscillations around the setpoint often referred to as limit cycles. This unique phenomenon is
discussed on Page 3-13.This means that there is interpolation between the equilibrium point and a
non-equilibrium point. In order to prevent this, the control surface shown in Figure 5-20 should thus
have a wide enough settling band region that will eventually allow the control variable to settle
resulting from only one rule been fired. This means that for the implemented controller, a condition
must be eventually met where only rule 5 is fired. This means that the linguistic variables AES and S
of the altitude error and change of altitude error membership functions respectively has to cover a
wider range. The problem with this is that the larger these are made, the further away the UAV
altitude settles from the desired setpoint. It was found that the chosen range for the implemented
membership function resulted in the best performance in terms of the smallest range that
prevented oscillations. The slider gain of 4 for the elevator output of the altitude controller also
helped to minimise these oscillations. As a result an alternative design could have been
implemented that resulted in oscillations. This would have meant that the settling band is much
smaller, resulting in the altitude of the UAV been closer to the desired setpoint. In terms of the
accuracy requirements, this is -4m off the required setpoint. However, the question is asked if this
requirement was ever realistic?
Taking into consideration typical INS altitude sensors such as GPS have an accuracy of approximately
15m, it is clear that the initial requirements are unrealistic. Both the current latitude, longitude,
heading angle and altitude controller inputs are fed directly from the real states of the UAV. These
states are obviously unavailable in the real Aerosonde UAV and are instead based on INS readings,
with each sensor having their own specified accuracy. As a result, a more realistic approach would
have been to use the states obtained from a simulated INS sensor readings, and the initial
requirements were never realistic, and an altitude controller accuracy of 10m is more realistic, and
the results are definitely in range. Figure 6-6 indicates the airspeed of the UAV settling at
approximately 28m/s. Since the airspeed requirements are that the airspeed should remain bellow
29m/s, the results confirm this and thus the requirements are met for Test 1.
For Test 2 stated in Table 6-3, the altitude and airspeed waveforms of the UAV are shown in Figure
6-7 and Figure 6-8 respectively, where the altitude waveform stabilises at 954m. The setpoint in this
test was set to prove that the controller is capable of moving the UAV to an altitude setpoint lower
than the current position of the UAV. In this particular test, a setpoint of 50m bellow the current
position of the UAV was chosen. Figure 6-7 indicates that the altitude settles at 954m, which is 4m
above the desired setpoint. However, similar to the discussion for Test 1, the initial accuracy
requirements of 1.5m was not realistic and appropriate, and the results obtained are in the range of
the modified requirements of 10m. The airspeed waveform shown in Figure 6-8 indicates that the
airspeed eventually settle at 28m/s. However, during the descend; the UAV reaches a maximum
speed of 36 m/s. This is far above the maximum allowed range and as a result the original airspeed
requirements are not met for this particular test. Although the specifications of the Aerosonde UAV
given in Table 4-1 limit the maximum speed of the UAV to 32 m/s, the altitude controller still
manages to settle the UAV at the desired altitude setpoint. Thus, the original requirements were not
realistic and can thus be changed. However, tests on the real Aerosonde UAV will have to be
performed to see in the UAV can safely handle this velocity/
Test 3 deals with the most common case when dealing with autopilots- maintaining the current
heading angle and setpoints. This will mean that the altitude will have to maintain the current
altitude of 1000m. The result shown in Figure 6-9 depicts the altitude of the UAV initially fall to
996m, and then increase till 1004m. This result obtained is again realistic when taking into
consideration the accuracy of the INS sensor readings and as a result the modified requirements are
met. The airspeed waveform shown in Figure 9-10 also indicate that the airspeed settles to 28.1 m/s
and as a result the airspeed test is passed.
Since all the altitude controller test results were discussed, attention is now turned to the latitude-
longitude controller test results and discussion, set out in Test 4-Test 8. The latitude and longitude
setpoints in Test 4 was chosen that will result in a heading angle setpoint of -110. The system
should thus interpret this as 250. Figure 6-11 confirms this, where the heading angle stabilises to
249.5. This is in the specified tolerance range and as a result the requirements for this test were
met. With the latitude-longitude controller, there are four linguistic variables responsible for the
settling band in Figure 5-25 and Figure 5-26. These are linguistic variables C, C1 and C2 of the
heading error membership function, and S of the change of heading error membership function.
The if-then rules that will result in the settling band been fired are rules 8, 17 and 20. Similar to the
altitude controller, narrowing the settling band will result in the UAV heading angle reaching closer
values to the setpoint. However, this will again result in oscillations, which increase wear and tear
on the aileron servos. The airspeed waveform shown in Figure 6-12 shows the airspeed stabilise at
28.1m/s, remaining in the specification range of 29 m/s. Thus, the airspeed requirements for this
test are fulfilled.
Test 5 was set to gain insight into the controller response. In this case, the latitude and longitude
setpoints were chosen that would result in a heading angle set point of 60. For this test, it is
expected that the UAV will roll to the left. The heading angle waveform shown in Figure 6-13
confirms this, where it is found that the controller results in the heading angle settling at 59.5. This
in the tolerance range and thus it can be concluded that the accuracy requirements are met.
Investigating the airspeed plot shown in Figure 6-14, the maximum airspeed is again 28.1m/s, which
is within the tolerance range of 29m/s.
The common latitude-longitude autopilot case is now tested in Test 6. This is setting the latitude and
longitude setpoint that will result in the heading angle setpoint as the same value as the current UAV
heading angle. Since the initial UAV heading angle is 0, the latitude and longitude setpoints for Test
6 were chosen that resulted in a heading angle setpoint of 0. The results depicted in Figure 6-15
shows the heading angles stabilise at 359.8 i.e. -0.2 from the setpoint. This is in the tolerance range
and as a result the passing requirements for this test are met. The airspeed waveform of Figure 6-16
indicates the airspeed of the UAV settle at 28m/s which is in the requirements range of 29m/s, and
thus the airspeed test requirements are fulfilled.
The remaining two tests investigate the response of the heading controller to set point values
symmetrical to the ones of Test 4 and Test 5. For Test 7, the resulting heading angle setpoint was set
to 110. The quickest way to reach this setpoint value will be rolling to the left, which the results
shown in Figure 6-17 substantiate. This figure shows the heading angle waveform stabilise at 109.5
i.e. -0.5 off the desired setpoint i.e. within the desired accuracy range and the requirements are
met. Since the airspeed waveform in Figure 6-17 shows the UAV airspeed stabilise at 28.1m/s i.e.
within the tolerance range, it can be said that both the heading controller accuracy requirements are
fulfilled.
The final test used latitude and longitude setpoints that resulted in a heading setpoint of 300. As
expected, the heading angle waveform given in Figure 6-19 shows the UAV taking the shortest
possible path to reach this point i.e. rolling to the right, and eventually settling at 299.6 i.e. -0.4 off
the desired setpoint. The airspeed also settles at 28.1m/s i.e. within the accuracy requirements of
29m/s. As a result both the heading controller as well as the airspeed accuracy requirements are
fulfilled for this test.
6.3.4 The operation of the UAV in different physical environments test setup and methodology
Table 6-4: Process to test the response against different weather conditions
Setpoints/ Constants
Test Test Passing Test failing
Test Test Setup Long Alt
# Lat () Wind (m/s) requirements requirements
() (m)
Response 1 Set up the set point of the altitude controller 0 27.998 1050 [0 0 -0.5] The Current altitude Either the UAV
to to be 50m above the current position of the scope in Figure 5-28 does not reach
different UAV i.e. 1050m. The longitude and latitude should indicate the UAV the altitude
weather setpoints are chosen to result in a heading altitude increase to the setpoint and/or
conditions angle setpoint of 0. Run the Simulink file for setpoint with an the accuracy
1800s (1/2 hour) accuracy of 10m exceeds 10m
Response 2 Set up the set point of the altitude controller 0 27.998 1050 [0 0 -0.4] The Current altitude Either the UAV
to to be 50m above the current position of the scope in Figure 5-28 does not reach
different UAV i.e. 1050m. The longitude and latitude should indicate the UAV the altitude
weather setpoints are chosen to result in a heading altitude increase to the setpoint and/or
conditions angle setpoint of 0. Run the Simulink file for setpoint with an the accuracy
1800s (1/2 hour) accuracy of 10m exceeds 10m
Response 3 Set up the set point of the altitude controller 0 27.998 1050 [0 0 -0.3] The Current altitude Either the UAV
to to be 50m above the current position of the scope in Figure 5-28 does not reach
different UAV i.e. 1050m. The longitude and latitude should indicate the UAV the altitude
weather setpoints are chosen to result in a heading altitude increase to the setpoint and/or
conditions angle setpoint of 0. Run the Simulink file for setpoint with an the accuracy
1800s (1/2 hour) accuracy of 10m exceeds 10m
Response 4 Set up the set point of the altitude controller 0 27.998 1050 [0 0 -0.2] The Current altitude Either the UAV
to to be 50m above the current position of the scope in Figure 5-28 does not reach
different UAV i.e. 1050m. The longitude and latitude should indicate the UAV the altitude
weather setpoints are chosen to result in a heading altitude increase to the setpoint and/or
conditions angle setpoint of 0. Run the Simulink file for setpoint with an the accuracy
1800s (1/2 hour) accuracy of 10m exceeds 10m
Response 5 Set up the set point of the altitude controller 0 27.998 1050 [0 0 -0.1] The Current altitude Either the UAV
to to be 50m above the current position of the scope in Figure 5-28 does not reach
different UAV i.e. 1050m. The longitude and latitude should indicate the UAV the altitude
weather setpoints are chosen to result in a heading altitude increase to the setpoint and/or
conditions angle setpoint of 0. Run the Simulink file for setpoint with an the accuracy
1800s (1/2 hour) accuracy of 10m exceeds 10m
Response 6 Set up the set point of the altitude controller 0 27.998 1050 [0 0 0.1] The Current altitude Either the UAV
to to be 50m above the current position of the scope in Figure 5-28 does not reach
different UAV i.e. 1050m. The longitude and latitude should indicate the UAV the altitude
weather setpoints are chosen to result in a heading altitude increase to the setpoint and/or
conditions angle setpoint of 0. Run the Simulink file for setpoint with an the accuracy
1800s (1/2 hour) accuracy of 10m exceeds 10m
Response 7 Set up the set point of the altitude controller 0 27.998 1050 [0 0 0.2] The Current altitude Either the UAV
to to be 50m above the current position of the scope in Figure 5-28 does not reach
different UAV i.e. 1050m. The longitude and latitude should indicate the UAV the altitude
weather setpoints are chosen to result in a heading altitude increase to the setpoint and/or
conditions angle setpoint of 0. Run the Simulink file for setpoint with an the accuracy
1800s (1/2 hour) accuracy of 10m exceeds 10m
Response 8 Set up the set point of the altitude controller 0 27.998 1050 [0 0 0.3] The Current altitude Either the UAV
to to be 50m above the current position of the scope in Figure 5-28 does not reach
different UAV i.e. 1050m. The longitude and latitude should indicate the UAV the altitude
weather setpoints are chosen to result in a heading altitude increase to the setpoint and/or
conditions angle setpoint of 0. Run the Simulink file for setpoint with an the accuracy
1800s (1/2 hour) accuracy of 10m exceeds 10m
Response 9 Set up the set point of the altitude controller 0 27.998 1050 [0 0 0.4] The Current altitude Either the UAV
to to be 50m above the current position of the scope in Figure 5-28 does not reach
different UAV i.e. 1050m. The longitude and latitude should indicate the UAV the altitude
weather setpoints are chosen to result in a heading altitude increase to the setpoint and/or
conditions angle setpoint of 0. Run the Simulink file for setpoint with an the accuracy
1800s (1/2 hour) accuracy of 10m exceeds 10m
Response 10 Set up the set point of the altitude controller 0 27.998 1050 [0 0 0.5] The Current altitude Either the UAV
to to be 50m above the current position of the scope in Figure 5-28 does not reach
different UAV i.e. 1050m. The longitude and latitude should indicate the UAV the altitude
weather setpoints are chosen to result in a heading altitude increase to the setpoint and/or
conditions angle setpoint of 0. Run the Simulink file for setpoint with an the accuracy
1800s (1/2 hour) accuracy of 10m exceeds 10m
Response 11 Set up the set point of the altitude controller -31.18 56.354 1000 [-0.5 -0.5 0] The Current heading Either the UAV
to to be the same as the current position of the scope in Figure 5-28 does not reach
different UAV i.e. 1000m. The longitude and latitude should indicate the UAV the heading angle
weather setpoints are chosen to result in a heading heading angle increase setpoint and/or
conditions angle setpoint of 100. Run the Simulink file to the setpoint with an the accuracy
for 1800s (1/2 hour) accuracy of 1.5 exceeds 1.5
Response 12 Set up the set point of the altitude controller -31.18 56.354 1000 [-0.4 -0.4 0] The Current heading Either the UAV
to to be the same as the current position of the scope in Figure 5-28 does not reach
different UAV i.e. 1000m. The longitude and latitude should indicate the UAV the heading angle
weather setpoints are chosen to result in a heading heading angle increase setpoint and/or
conditions angle setpoint of 100. Run the Simulink file to the setpoint with an the accuracy
for 1800s (1/2 hour) accuracy of 1.5 exceeds 1.5
Response 13 Set up the set point of the altitude controller -31.18 56.354 1000 [-0.3 -0.3 0] The Current heading Either the UAV
to to be the same as the current position of the scope in Figure 5-28 does not reach
different UAV i.e. 1000m. The longitude and latitude should indicate the UAV the heading angle
weather setpoints are chosen to result in a heading heading angle increase setpoint and/or
conditions angle setpoint of 100. Run the Simulink file to the setpoint with an the accuracy
for 1800s (1/2 hour) accuracy of 1.5 exceeds 1.5
Response 14 Set up the set point of the altitude controller -31.18 56.354 1000 [-0.2 -0.2 0] The Current heading Either the UAV
to to be the same as the current position of the scope in Figure 5-28 does not reach
different UAV i.e. 1000m. The longitude and latitude should indicate the UAV the heading angle
weather setpoints are chosen to result in a heading heading angle increase setpoint and/or
conditions angle setpoint of 100. Run the Simulink file to the setpoint with an the accuracy
for 1800s (1/2 hour) accuracy of 1.5 exceeds 1.5
Response 15 Set up the set point of the altitude controller -31.18 56.354 1000 [-0.1 -0.1 0] The Current heading Either the UAV
to to be the same as the current position of the scope in Figure 5-28 does not reach
different UAV i.e. 1000m. The longitude and latitude should indicate the UAV the heading angle
weather setpoints are chosen to result in a heading heading angle increase setpoint and/or
conditions angle setpoint of 100. Run the Simulink file to the setpoint with an the accuracy
for 1800s (1/2 hour) accuracy of 1.5 exceeds 1.5
Response 16 Set up the set point of the altitude controller -31.18 56.354 1000 [0.1 0.1 0] The Current heading Either the UAV
to to be the same as the current position of the scope in Figure 5-28 does not reach
different UAV i.e. 1000m. The longitude and latitude should indicate the UAV the heading angle
weather setpoints are chosen to result in a heading heading angle increase setpoint and/or
conditions angle setpoint of 100. Run the Simulink file to the setpoint with an the accuracy
for 1800s (1/2 hour) accuracy of 1.5 exceeds 1.5
Response 17 Set up the set point of the altitude controller -31.18 56.354 1000 [0.2 0.2 0] The Current heading Either the UAV
to to be the same as the current position of the scope in Figure 5-28 does not reach
different UAV i.e. 1000m. The longitude and latitude should indicate the UAV the heading angle
weather setpoints are chosen to result in a heading heading angle increase setpoint and/or
conditions angle setpoint of 100. Run the Simulink file to the setpoint with an the accuracy
for 1800s (1/2 hour) accuracy of 1.5 exceeds 1.5
Response 18 Set up the set point of the altitude controller -31.18 56.354 1000 [0.3 0.3 0] The Current heading Either the UAV
to to be the same as the current position of the scope in Figure 5-28 does not reach
different UAV i.e. 1000m. The longitude and latitude should indicate the UAV the heading angle
weather setpoints are chosen to result in a heading heading angle increase setpoint and/or
conditions angle setpoint of 100. Run the Simulink file to the setpoint with an the accuracy
for 1800s (1/2 hour) accuracy of 1.5 exceeds 1.5
Response 19 Set up the set point of the altitude controller -31.18 56.354 1000 [0.4 0.4 0] The Current heading Either the UAV
to to be the same as the current position of the scope in Figure 5-28 does not reach
different UAV i.e. 1000m. The longitude and latitude should indicate the UAV the heading angle
weather setpoints are chosen to result in a heading heading angle increase setpoint and/or
conditions angle setpoint of 100. Run the Simulink file to the setpoint with an the accuracy
for 1800s (1/2 hour) accuracy of 1.5 exceeds 1.5
Response 20 Set up the set point of the altitude controller -31.18 56.354 1000 [0.5 0.5 0] The Current heading Either the UAV
to to be the same as the current position of the scope in Figure 5-28 does not reach
different UAV i.e. 1000m. The longitude and latitude should indicate the UAV the heading angle
weather setpoints are chosen to result in a heading heading angle increase setpoint and/or
conditions angle setpoint of 100. Run the Simulink file to the setpoint with an the accuracy
for 1800s (1/2 hour) accuracy of 1.5 exceeds 1.5
For simplicity reasons, the test result obtained were documented in the form of a table. The results for the tests described in Table 6-4 are found in Table 6-
5. All aircraft are subjected to varying wind conditions while flying, and thus the effect of wind on the controllers performance has to be investigated. Even
large aircraft are not designed to operate in the most severe weather conditions possible, and thus there will be a limitation on the largest wind speed that
the aircraft can safely handle, and that the designed controller can withstand. The purpose of this test phase was to investigate the effect of wind blowing
from different directions on the UAV. The results obtained will hopefully lead to discovering which directional wind has the greatest effect on the UAV. For
this reason, it is important to note what the 13 wind input matrix represents, mainly [WN WE WD ]T in the units of m/s. During the Aerosonde UAV
transatlantic flight of 1998, the planners expected the UAV to encounter wind speeds up to 0.5 m/s, and thus the tests were designed to take into
consideration all values up to this range.
An altitude setpoint of 1050m was chosen, and the latitude and longitude setpoints were chosen that resulted in a heading angle setpoint of 0. These were
used for the first ten tests. This was chosen because the average UAV climb rate is the smallest when the altitude set point is higher than the current
altitude. Since the z-axis directional wind will have the greatest effect on the UAV in terms of the UAV climbing and descending capability, these will be
investigated under various WD wind speeds for the first 10 tests. Test 1 sets the input wind vector to [0 0 -0.5]. This meant that there is a vertical wind
speed of 0.5m/s moving away from the ground. The altitude setpoint is 1050m, which should result in the UAV reaching its altitude setpoint much faster
compared to the time taken with no wind present. The results for the first test shown in Table 6-5 show that the undesirable case of oscillations present.
Although this is the case, the peak values of the altitude during the oscillation phase remains in the tolerance range. However, the constant switching of the
elevator control will clearly lead to an increased wear and tear of the servos. Another limitation with Simulink is that there is a step change between the
different elevator commands. With a real UAV, there is a switching time constraint. However, for the Simulink simulation, it can concluded that the altitude
controller is capable of controlling the altitude in for all WD wind speeds in the -0.5m/s and 0.5m/s range, with the side effects of oscillations. This covers
the designed wind speed range.
Table 6-5: Test results
Test # Scope/ Display Setpoint Oscillations Oscillation Oscillation Additional comments
reading used reached present max value min value
1 Current altitude scope 1055m 1054.7m
2 Current altitude scope 1055m 1054.7m
3 Current altitude scope 1054.95m 1054.65m
4 Current altitude scope 1054.9m 1054.5m
5 Current altitude scope X NA NA The altitude settles at 1054.5m
6 Current altitude scope 1045.8m 1045.3m
7 Current altitude scope 1045.6m 1045.2m
8 Current altitude scope 1045.45m 1045.15m
9 Current altitude scope 1045.35m 1045.1m
10 Current altitude scope 1045.35m 1045.05m
11 Current Heading scope 99.5 99.48
12 Current Heading scope X NA NA The heading angle settles at 99.5
13 Current Heading scope X NA NA The heading angle settles at 99.5
14 Current Heading scope X NA NA The heading angle settles at 99.5
15 Current Heading scope X NA NA The heading angle settles at 99.5
16 Current Heading scope X NA NA The heading angle settles at 99.5
17 Current Heading scope 99.52 99.51
18 Current Heading scope 99.515 99.5
19 Current Heading scope 99.51 99.5025
20 Current Heading scope 99.53 99.52
Attention is now turned to the effects of the WN WE winds on the UAV. These two directional winds
will have the greatest effect on the heading angle controllers response, and thus their effect will be
investigated in Tests 11-20. This was done by setting the input wind matrix to [X X 0]T, where the
initial X value was set to -0.5m/s and was increased by 0.1m/s during tests 11-20. The setpoints of
the altitude, latitude and longitude controller were chosen so resulting in an altitude and heading
setpoint of 1000m, and 100 respectively. The results of Table 6-5 show that the heading controller
has a better performance remaining in the settling band compared to the altitude controller. Out of
the 10 tests performed, only half of them resulted in oscillations. The maximum and minimum
values of the oscillations also indicate that the peak to peak values are very small. It can thus
conclude that the heading controller is much more robust compared to the altitude controller.
Attention is first drawn to the paper by Doitsidis et al [63] that was discussed in Section 3.5.2. The
initially implemented design in Chapter 4 was very similar to this, as the main purpose of the
implementation phase of the project was to improve their results obtained. The authors of this
paper mentioned that they had a problem with the altitude controller in terms of the presence of
oscillations around the setpoint. Figure 3-38 shows that that they managed to achieve oscillations of
about 25m peak to peak around the setpoint. Although the authors fail to mention anything about
the wind conditions for this test, it can assumed that they took into consideration the wind
specification of 0.5 m/s, conditions similar to the first transatlantic Aerosonde UAV flight. The result
obtained by the improved altitude fuzzy controller discussed in Chapter 6 has the side effect of
oscillations in the presence of background wind. However, the peak to peak value of the oscillations
around the setpoint has a maximum value of 0.3m, which is much smaller than the previously
implemented work, and negligible when taking into consideration the accuracy of most UAV altitude
sensors. The only major effect of the oscillations is increased wear and tear on the elevator servos.
In Section 3.3.6.4 it was stated that a coordinated turn should make use of both the aileron as well
as the rudder control. This implemented solution does not make use of the latter. The main reason is
due to the requirements of a UAV model which will have to be investigated to find the control
rudder and aileron control actions that will result in the most optimal use of both. The tuning
method used for this project was rather based on a trial-and-error method. It is now asked if the
developed fuzzy autopilot is the most optimal in terms of controller performance? The answer for
this question is most definitely no. The paper Nikolos I.K et al [64] discussed in Section 3.5.3 used a
different approach in designing the controller. The method used first obtained the model of the
UAV, and then used the model to obtain an ideally desired trajectory. This ideal trajectory was then
used as a basis for designing the controller. The results obtained in the paper clearly show that the
controller trajectory closely followed the ideal one. This proves that the design method initially
based on model analysis yields a far better performance compared to a design method based on
pilots instinct.
As a result, the results obtained in this project can definitely be improved if the model of the UAV
was first obtained, although this was not an initial requirement of the project. However, if the
requirement of not investigating the model is maintained, then the controller can still be based on
the data obtained from a human pilot following an ideal trajectory. In this case, a self learning fuzzy
controller can be used. This is definitely a growth option for this project. The only constraint with
this approach is that the controller performance will be a function of the pilots experience, and thus
a suitable pilot will definitely be needed.
Although this controller was designed and implemented successfully by means of simulation in
Simulink and Flightgear, the simulation does not represent the maximum possible execution speed
of the controller. This is because there is a lot of background processing that MATLAB performs
during each execution loop, uncontrollable by the developer. Thus, the conversion to a higher level
programming language is definitely an advantage. Conversion to a language such as C/C++ would
result in faster execution since the complier converts the source code to assembly language. This is
the direct link between software and hardware when dealing with computers, and thus execution
will be faster. This is a growth option of the project that will have to be performed if the controller is
to be implemented on a real UAV.
6.6 CONCLUSION
Any implemented project can only be verified if adequate test strategies are in place. For this
particular project, this meant splitting up the tests into different scenarios i.e. in terms of the
relationship between the current state of the UAV and the setpoints. The first test that was
performed was set to investigate if the implemented system was working correctly i.e. the interface
between Flightgear and Simulink. The test results concluded that these requirements were met. The
tests were then further split up into the accuracy tests as well as the airspeed tests, initially with no
background wind present. For the accuracy tests, the altitude controller always caused the altitude
so settle 4m away from the setpoint, while the heading controller caused the heading angle to
settle 0.5 from the setpoint. This resulted on the widening of the settling band to prevent
oscillations. Since the accuracy of the heading controller is more important than that of the altitude
controller, the advantage of the agile methodology was used to change the accuracy requirement on
chapter 2 from 1.5m to 10m. This was found to be more realistic as most UAV altitude sensors have
an accuracy of approximately 10m. The modification of the initial altitude controller accuracy
requirements to make it more realistic resulted in all the accuracy test passing requirements to be
fulfilled. The airspeed tests were passed for all of the tests, except when the altitude setpoint was
below the current altitude. However, this does not jeopardise the controllers capability.
The robustness of the controller had to be tested. As a result the autopilots controlling capability
was tested in different wind conditions, taking into consideration the planned background wind
specification of the Aerosonde UAV during its first transatlantic flight in 1998. The results obtained
indicate that the addition of wind results in the inability of the altitude controller to remain in the
settling band, resulting in oscillations around the desired setpoint. This can be avoided by
broadening the settling band; However, this will also influence the accuracy of altitude controller in
the absence of wind. Oscillations also lead to an increased wear and tear on the servos, something
which should be avoided. The tests also proved that not only are the latitude-longitude controller
more accurate than the altitude controller, but it is also more robust in background wind.
Oscillations were only present in half of the tests for the latitude-longitude controller.
Although this controller improved immensely on the previously implemented work, the project can
definitely be improved. The constant switching of the elevator and aileron controls definitely leads
to increased wear and tear and this will have to be improved if the controller is to be used on a real
UAV. This is done by making sure that there are no limit cycles. The design method used here was
also based on a trial and error method rather than using a model to obtain an ideal trajectory, and
then basing the fuzzy controller on the results obtained. The previously done work discussed in
Chapter 3 proves that the latter method clearly leads to better performance. The only constraint is
that a model of the UAV is needed. The alternative method can still be used. This will mean that the
data obtained from a humans pilot flying an ideal trajectory will be used to design a controller.
However the results obtained will be a function of pilot experience. The execution speed of this
project can still be optimised if the Simulink diagram is converted to a higher level programming
language such as C/C++. This is definitely a growth option of this project.
7 CHAPTER 7: CONCLUSION
The dictionary defines engineering as The discipline dealing with the art or science of applying
scientific knowledge to practical problems. During the design and implementation phases of the
project, many engineers often forget that their main goal is to solve an engineering problem. Thus it
is often necessary to surface time and time again during the design and implementation phase to
make sure that one always has this chief goal in mind.
Chapter 1 introduced the problem as well as the background framework surrounding the project. It
discussed how UAVs have become increasingly popular in the last couple of years, resulting from
their ability to be used across many fields. Most modern day UAV research is focused around trying
to eventually reach a stage where the UAV can fly without any human intervention. This would be to
an advantage as this would minimise typical constraints associated with human flight, such a fatigue.
However, the controller should also allow the UAV to fly with the accuracy of a human operator. The
autopilot for the fixed wing UAV will be implemented with the aid of a control system. Fuzzy as well
as PID controllers have the advantage in that they do not require a mathematical model of the
system to be controlled. This model is often very difficult to obtain with larger non-linear systems.
Although PID controllers work very well, their main disadvantage is that they do not mimic human
operators way of thinking. Fuzzy controller on the other hand makes use of Fuzzy logic that was
developed by Lotfi Zadeh. This type of control is often referred to as controlling with words, where
the control of large systems is often executed with the aid of if-then rules. The main objective of this
project was thus to develop a controller that has the accuracy of a human operator, but does not
require a mathematical model of the system to be investigated.
During the literature study of Chapter 3, the basic theory behind fuzzy controllers, as well as similar
implemented work was discussed. The tools that will be used to successfully complete this project
were also discussed. The basic fuzzy logic controller consists of four overall stages, mainly a
fuzzification interface, a rule base, an interface mechanism as well as the defuzzification interface.
Two popular types of fuzzy controllers exist, mainly the Mamdani and Sugeno fuzzy controllers, with
the chief difference between the two been their defuzzification characteristics. The major problem
encountered with fuzzy controllers when controlling non-linear systems is the formation oscillations
around the setpoint, often referred to as limit cycles. This occurs when the settling band region is
not made wide enough, resulting in interpolation between the equilibrium state and the non-
equilibrium state. Three papers were found that are very similar to the scope of this project. This
included A Framework for Fuzzy Based UAV Navigation and Control [63], Roll Control of Unmanned
Aerial Vehicles using Fuzzy Logic [64], and Combining Fuzzy and PID Control for an Unmanned
Helicopter [65]. The first paper had had very similar goals for this project, and was thus used as the
chief foundation for this project. However, the results of this paper yielded very large oscillations
around the reference in terms of the altitude controller, and thus one of the goals of this project was
to improve these oscillations. The paper was also very vague when dealing with the details in how
the system was implemented, as well as the background circumstances surrounding the test setup.
This paper also limited the implementation to a Simulink based system, with the incorporation of the
Aerosim Blockset as well as the fuzzy logic toolbox into their solution. The UAV used in their solution
was the Aerosonde UAV. This model is included as part of the Aerosim toolbox.
Since the chief foundation for this project, the paper by Doitsidis et al [63] used an altitude as well as
a latitude-longitude controller autopilot, both of these were used were kept for this project. The
initial accuracy requirements of the altitude and latitude-longitude controllers were set to 1.5m and
1.5 respectively. Another requirement was that the autopilot should be able to control the UAV in
wind speeds up to 0.5m/s. This requirement was based on the expected wind conditions
encountered by the Aerosonde UAV during its first transatlantic flight in 1998.
The implemented solution used three set points, mainly the latitude, longitude and altitude given in
the units of degrees, degrees and meters respectively. The initial results obtained indicated that limit
cycles were present. This was overcome by widening the stable region of the membership functions.
However, this widening resulted in the control variable settling at an offset of 4m for the altitude
controller, and 0.5 for the latitude-longitude controller. Although this was not in the original
accuracy range, it was noted that most INS sensors on UAVs typically have an accuracy of 10-15m. As
a result, the original accuracy requirement was changed to 10m for the altitude controller. Testing
the autopilot in wind, it was found that the wind resulted in the limit cycles. Although these are
undesirable, the control variable still remained within the specifications.
Some of the initial requirements stated in Chapter 2 were not taken into consideration, such as an
option to engage/disengage the controller. This was not performed due to time constraints,
however the Aerosim Blockset is included with a Simulink-Joystick interface block that could be
used.
Other growth options for this project include the incorporation of a throttle fuzzy controller into the
autopilot. For this implementation, no throttle controller was included which resulted in an
inefficient autopilot. Numerous design methods are also available when designing fuzzy controllers.
For this project, a trial and error basis was used. However, a self learning fuzzy controller could be
used. This will not require a model, and will be based on the data obtained from letting a pilot follow
an ideal trajectory. Genetic algorithms can also be used to tune the membership functions, which
will result in a more efficient autopilot. A neural fuzzy controller could also be investigated. This will
result in a solution that incorporates the advantages of both fuzzy as well as neural network
controllers.
If the model is used, the equations representing the ideal trajectory can be obtained. This can in turn
be used to design the fuzzy controller. Investigating previously done work, it was found that this
approach yielded better results in comparison to designing the controller without a model. Another
advantage of this approach is that the model can be used to investigate if limit cycles will be present.
Although there is definite growth for this project, the implemented controller is still sufficient to
place on a real UAV. The procedure for this is as follows:
1. The Simulink file must be converted to a high level programming language such as C/C++,
and executed on a single board computer
2. Sliders are to be placed at the controller inputs and outputs and will have to be tuned in
order to adapt to the dynamics of the fixed wing UAV used (assuming that the Aerosonde
UAV is not used)
Since the major objectives have been met of the project, it can be concluded that the project was a
success and that there is definite growth options for anyone who would like to continue.
8 REFERENCES
[1] Wikipedia: Unmanned aerial aircraft,
http://en.wikipedia.org/wiki/Unmanned_aerial_vehicle,
Referenced on 23 February 2008
[4] Steeb Wili Hans, The Nonlinear Workbook, Chapter 17, World Scientific, Singapore 2005
[5] Clarke, W.A., Design Project Document Framework, Department of Electrical and
Electronic Engineering Science, Faculty of Engineering and the Built Environment, University
of Johannesburg, 2008
[6] Clarke, W.A., Project Investigation Study Guide, Department of Electrical and Electronic
Engineering Science, Faculty of Engineering and the Built Environment, University of
Johannesburg, 2008
[8] Sandy Riebeling, Unmanned aerial vehicles do dull, dirty, dangerous work,
The Huntsville Times
[11] Missy Frederick,UAV use growing worldwide, Space News, 23 January 2006
http://www.space.com/spacenews/archive06/UAV_012306.html
Referenced 4 March 2008
[13] Sommerville Ian, Software engineering ,8th edition, Chapter 17, Addison Wesley, England
2007
[16] Meyer, J., System Engineering and Design study guide, Department of Electrical and
Electronic Engineering Science, Faculty of Engineering and the Built Environment, University
of Johannesburg, 2007
[21] Michael T. Goodrich, Roberto Tamassia Data Structures and Algorithms in Java ,4th edition,
Chapter 4, John Wiley & Sons, United States of America 2006
[24] Margaret A. Boden, The Age of Intelligent Machines: The social impact of Artificial
Intelligence, The Age of Intelligent Machines 1990
http://www.kurzweilai.net/meme/frame.html?main=/articles/art0162.html
Referenced 26 March 2008
[27] The national institute of ethics (USA): Nine basic steps to personal ethical decision making,
http://www.niee.org/pd.cfm?pt=AECM
Referenced 26 March 2008
[33] Zhang Huaguang, Liu Derong, Fuzzy Modelling and Fuzzy Control, Birkhuser, Boston 2006
[34] Kovai Zdenko, Bogdan Stepan, Fuzzy Controller Design, Taylor & Francis group, 2006
[36] Zadeh LA, Fuzzy sets, Information and control, Chapter 8, 1965
[37] Jantzen Jan, Design of Fuzzy Controllers, Technical University of Denmark Department of
Automation, Tech. report no 98-E 864 (design), 19 Aug 1998.
[38] Takagi T and Sugeno M, Fuzzy identification and systems and its application to modelling and
control, IEEE transactions on Systems, man, and cybernetics, 116-132, 1985
[39] Hill, G., Horstkotte, E. and Teichrow, J, Fuzzy-C development- users Manuel
Togai Infralogic, 1990
[40] strm K, Hgglund T, PID controllers: theory, design and tuning 2nd edition, Instrument
Society of America, New-York 1995
[41] Barnard R.H., Philpott D.R., Aircraft Flight, Longman, Harlow 2000
[42] Stevens B.L, Lewis F.L, Aircraft control and simulation 2nd edition, John Wiley and Sons, New
Jersey 2003
[45] Rauw, M.O.: "A Simulink Environment for Flight Dynamics and Control analysis - Application
to the DHC-2 'Beaver' ".Part II: "Nonlinear analysis of the 'Beaver' autopilot". MSc-thesis,
Delft University of Technology, Faculty of Aerospace Engineering. Delft, The Netherlands,
1993
[47] Marais, E., Informatics 2b lecture notes: Chapter 2, Academy of Information Technology ,
Faculty of Science, University of Johannesburg, 2006
[49] Horstmann C, Computing Concepts with C++ Essentials 3rd Edition, John Wiley and Sons, New
Jersey 2003
[57] Fuzz-C
http://bytecraft.com/Fuzzy_Logic
Referenced 14 April 2008
[58] Lofti A, Fuzzy Interface Systems toolbox for Matlab (FISMAT), Department of Electrical and
Computer Engineering, University of Queensland, 1993
[60] FlightGear
http://www.flightgear.org/introduction.html
Referenced 15 April 2008
9 APPENDIX A
The first five outcomes as set by ECSA are as follows:
10 APPENDIX B
Traditional classical sets are defined as a collection of elements or objects 1 w which can be finite,
In order to understand fuzzy logic and fuzzy control, one has to first understand fuzzy sets.
countable or overcountable [4]. With classical sets, a single element can either belong to a set or
not. Here the degree of membership of an element belonging to a set is either true or false.
Zadeh, the founder of fuzzy logic, stated [12] : Clearly, the class of all real numbers that are greater
than one or the class of beautiful woman or the class of old men do not constitute classes or sets
in the usual mathematical sense of these terms.
For this reason, fuzzy sets were developed [4]. These extend the classical notation of binary
membership to accommodate various degrees of membership over the interval [0, 1]. Here, the end-
between the endpoint can represent the various degree of membership for an element 1 in some
point values 0 and 1 conform to no membership or full membership respectively. The values in
universe w.
Definition Fuzzy sets: Given a collection of objects x a fuzzy set in x is defined as a set of
y`x, xa | x x{
ordered pairs
Where -| 1 is called the membership function for the set of all objects 1 in
x.
For the above definition, the symbol stands for defined as The membership function relates to
each 1 a membership grade -| 1, a real number in the closed interval [0, 1].
It can also be seen that when working with fuzzy sets, it is necessary to work with pairs `x, xa.
This is known as a fuzzy singleton.
Consider the description of tall people. With classical set theory, people smaller than 1.75m might
be considered not tall, while people taller than 1.75m might be considered tall.
With fuzzy set theory, the degree of membership indicates how tall a person is.
Both the fuzzy and crisp sets are presented in the Figure 10.1:
Membership functions come in many forms. These include trapezoidal as well as triangular shapes.
Fuzzy sets have their own operations also [12]. Two fuzzy sets are equal is they have the same
membership function i.e.
= - 1 = - 1
For all x
- 1 - 1
For all x
Other set operations include the fuzzy union, intersection and compliment.
y`x, xa | x x and x = 1 x{
Fuzzy logic also makes use of linguistic variables. This takes a linguistic value, which is a fuzzy set that
is defined on a universe.
A hedge takes a linguistic value and modifies its meaning. Consider a membership function x
that describes a young person. Hedges of this might include the following membership functions:
x = 4 x
x = x
@/4
x = x
x = x
@/
The relation describes the relation between two sets and is typically written in the form 1[
= y`x, ya | x , [ {
The fuzzy binary relation is defined as: Let and be fuzzy sets defined on and respectively.
Then the fuzzy sets in with the membership function
The fuzzy Cartesian product is defined as: Let and be fuzzy sets defined on and
respectively. Then the fuzzy set in with the membership function
The fuzzy relational composition is defined as follows: Let and be two fuzzy relations defined on
and respectively. Then the fuzzy set in with the membership function:
In classical Boolean set theory, linguistic connection between sets use typical words like if, and
not and or. The symbols used are:
Not
And
Or
When dealing with fuzzy sets, the connective statements are similar to that of Boolean set theory.
The only difference is that the set values of the fuzzy sets might fall in the interval [0, 1].
An example comparison between a Boolean OR truth table and a fuzzy O truth table is given in the
left and right Figure 10.6 and Figure 10.7 respectively:
Figure 10-6: Fuzzy AND truth table Figure 10-7: Boolean AND truth table
The basic approach to interence is to reach some sort of conclusion taking into consideration the
facts and reasoning. In mathematical terms this might be:
[ ]
A backward approach to develop a fuzzy-system is given by Jantzen [12]. This approach consists of
the following steps:
1. Decide which laws (tautologies) are required
2. Define and, or, not, implication and equivalence
3. Check by means of a truth table whether the laws in step 1 hold
4. If not, return back to step 2