You are on page 1of 74

International Masters Thesis

Quadrocopter Fuzzy Flight Controller

Muhammad Saad Shaikh


Technology

Studies from the Department of Technology at rebro University 0


rebro 2011

Quadrocopter Fuzzy Flight Controller

Studies from the Department of Technology


at rebro University 0

Muhammad Saad Shaikh

Quadrocopter Fuzzy Flight Controller

Muhammad Saad Shaikh, 2011


Title: Quadrocopter Fuzzy Flight Controller
ISSN

1650-8580

Abstract
Quadrocopter is an aerial vehicle platform which has become very popular
among researchers in the recent past due to the advantages it offers over conventional helicopters. Quadrocopter is very simple and unique, but it is inherently unstable from aerodynamics point of view. In recent past researchers
have proposed many control schemes for quadrocopter. In this thesis we present
fuzzy logic controller for quadrocopter. After brief introduction brief hardware
details are given that is used in this thesis. After that design procedure for the
fuzzy controller is presented. Then the designed fuzzy controller is tested in
Hardware In Loop (HIL) setup. The experimentation to validate the functionality and applicability of the designed controller were performed in contrained
setup due to some technical problems. The results of the experiments were satisfactory and it is concluded that it is possible to stabilize quadrocopter with
fuzzy logic controller.

Acknowledgements
I would like to thank those who helped during my thesis work. Without their
support, I could have never accomplished this work.
I take this special occasion to thank my parents. I dedicate this work to my
parents. It would have been simply impossible to start, continue and complete
without the support of my parents who, unconditionally provided the resources
to me.
I am eternally indebted to my supervisor Ivan Kalaykov for all the help,
invaluable guidance and generous support throughout my thesis work. I have
been very fortunate to be associated with such a kind and good person and it
would take more than a few words to express my sincere gratitude.
I also like to thank Bo-lennart and Boyko Iliev for their enlightening suggestions and advices. Their professionalism, guidance, dedication and inspirations
will always serve me as an example in my professional life.

iii

Contents
1 Introduction
1.1 Objectives . . . . . . . . . . .
1.2 Concept of Quadrocopter . .
1.3 Brief History . . . . . . . . .
1.4 Modern Quadrocopters . . .
1.5 Advantages and disadvantages
1.6 Outline of this document . . .

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

1
1
2
3
3
4
5

2 Hardware Description
2.1 The Quadrocopter at Orebro University
2.2 Onboard System . . . . . . . . . . . . .
2.2.1 Micro-controller . . . . . . . . .
2.2.2 YGE motor controllers . . . . . .
2.2.3 Motors . . . . . . . . . . . . . .
2.2.4 Propellers . . . . . . . . . . . . .
2.2.5 Sensors on-board . . . . . . . . .

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

7
7
8
8
8
9
9
10

3 Background
3.1 Different control strategies used for quadrocopters . . . . . . .
3.2 Major Research/Educational Projects . . . . . . . . . . . . . .
3.2.1 European Aeronautic Defense and Space Company . .
3.2.2 Pennsylvania State University . . . . . . . . . . . . . .
3.2.3 Middle East Technical University . . . . . . . . . . . .
3.2.4 Australian National University . . . . . . . . . . . . .
3.2.5 University of British Columbia Vancouver, BC, Canada
3.2.6 Cornell University . . . . . . . . . . . . . . . . . . . .
3.2.7 Swiss Federal Institute of Technology . . . . . . . . . .
3.2.8 University of Technology in Compiegne, France . . . .
3.2.9 Stanford University . . . . . . . . . . . . . . . . . . . .

.
.
.
.
.
.
.
.
.
.
.

15
15
15
15
16
17
17
18
19
19
21
22

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

CONTENTS

vi

4 Controller design and Simulink model


4.1 Control Strategy . . . . . . . . . . . . . . . . . . . . . . . .
4.2 Quadrocopter fuzzy controller design . . . . . . . . . . . . .
4.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . .
4.4 Complete description of Simulink model for experimentation
4.4.1 Data acquisition . . . . . . . . . . . . . . . . . . . .
4.4.2 De-multiplexing . . . . . . . . . . . . . . . . . . . . .
4.4.3 Sensory data processing . . . . . . . . . . . . . . . .
4.4.4 Controllers . . . . . . . . . . . . . . . . . . . . . . .
4.4.5 Normalizing of controllers singnals for motors . . . .
4.4.6 Mixing of normalized controller signals . . . . . . . .
4.4.7 PWM signal generation for motors . . . . . . . . . .

.
.
.
.
.
.
.
.
.
.
.

27
27
27
30
31
31
32
32
34
35
35
36

5 Experimentation and results


5.1 Experimentation setup . . . . . . . . . . . . . . . . . . . . . . .
5.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.3 Limitations in experimentation . . . . . . . . . . . . . . . . . .

39
39
40
46

6 Conclusions and future work


6.1 Conclusions . . . . . . . . . . . . . . . . . . . . .
6.2 Future works . . . . . . . . . . . . . . . . . . . .
6.2.1 GPS integration . . . . . . . . . . . . . . .
6.2.2 Translation of Simulink model into C code
6.2.3 Wireless connections . . . . . . . . . . . .
6.2.4 On-board PWM signals generation . . . .

53
53
53
53
54
54
54

References

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

55

List of Figures
1.1 Quadrocopter dynamics. . . . . . . . . . . . . . . . . . . . . . .
1.2 Early Quadrocopters . . . . . . . . . . . . . . . . . . . . . . . .
1.3 Modern manned quadrocopters . . . . . . . . . . . . . . . . . .

2
3
4

2.1
2.2
2.3
2.4
2.5
2.6
2.7
2.8

The experiment installation . . . . . . . . . . . . . . . . . . . .


On-board computer . . . . . . . . . . . . . . . . . . . . . . . .
HMC6352 compass module . . . . . . . . . . . . . . . . . . . .
Timing diagrram of reading two bytes from the HMC6352 (slave)
ADXRS300 gyro sensors . . . . . . . . . . . . . . . . . . . . . .
RATEOUT Signal Increases with Clockwise Rotation . . . . . .
LIS3LV02DQ, a 3-DOF- acceleration sensor . . . . . . . . . . .
LIS3LV02DQ read and write operation timing diagram . . . . .

3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
3.10

Quadrocopter developed by European Aeronautic Defense and Space Company 16


Quadrocopter in Pennsylvania State University . . . . . . . . . . 17
Quadrocopter tracking with a camera . . . . . . . . . . . . . . . 18
Quadrocopter in Middle East Technical University . . . . . . . . 19
X4-Flyer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Experimental setup in University of British Columbia . . . . . . 21
Quadrocopter designed in Cornell University . . . . . . . . . . . 22
Quadrocopter designed in Swiss Federal Institude of Technology 23
Quadrocopter designed in University of Technology in Compiegne, France 24
Stanford University quadrocopter projects . . . . . . . . . . . . 24

4.1
4.2
4.3
4.4
4.5
4.6
4.7

Uniform membership functions for inputs . .


input variable roll angle with high input gains
input variable rate of angle change and angles
Output of roll controller . . . . . . . . . . . .
Fuzzy rules table . . . . . . . . . . . . . . . .
Rules surface . . . . . . . . . . . . . . . . . .
Simulink model for experimentation . . . . .
vii

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

7
9
10
11
11
12
12
13

29
30
30
31
32
33
34

LIST OF FIGURES

viii

4.8
4.9
4.10
4.11
4.12

Simulink model for processing gyro sensors readings . . . . .


Simulink model for processing accelearation sensors readings
Simulink model for processing heading sensor reading . . . .
Simulink model for roll and pitch controllers . . . . . . . . .
Simulink model for Yaw, X, Y and Z axes controllers . . . .

.
.
.
.
.

.
.
.
.
.

35
35
36
36
37

5.1
5.2
5.3
5.4
5.5
5.6
5.7
5.8
5.9
5.10
5.11
5.12
5.13

The experiment installation . . . . . . . . . . . . . . . . . . . . 39


Stabilization time without operating motors . . . . . . . . . . . 41
Disturbence test with 35 percent power and controller gain 1 . . 42
Disturbence test with 35 percent power and multiple controller gain 43
Disturbence test with 60 percent power and controller gain 1 . . 44
Disturbence test with 15 percent power and controller gain 1 . . 45
Disturbence test with 15 percent power and controller gain 2 . . 46
Disturbence test with 15 percent power and controller gain 2.5 . 47
Disturbence test with 25 percent power and controller gain 1 . . 48
Disturbence test with 25 percent power and controller gain 2 . . 49
Disturbence test with 25 percent power and controller gain 2.5 . 50
Disturbence test with 35 percent power and controller gain 2 . . 51
Disturbence test with 35 percent power and controller gain 2.5 . 52

List of Tables

ix

List of Algorithms

xi

Chapter 1

Introduction
An unmanned aerial vehicle (UAV) is an unpiloted aircraft which can either fly
autonomously or it can be remotely controlled based on program downloaded
into on-board computers. Unmanned aerial vehicles have very vast area of applications in military for missions that are too dull, dirty, or risky for human
piloted aircraft. They are also used in a growing number of civil applications
such as aireal inspection.
UAVs can be divided basically into two categories, fixed wing UAVs and rotatory wing UAVs. Rotatory wing (or helicopter) UAVs have some advantages
over fixed wing UAVs that they can take off and land vertically, and that they
also can maintain their position at a fixed point in 3D space. Maintaining a position at a fixed point is called hovering. One very successful design for smaller
UAVs is an helicopter with four horizontal rotors with no tailrotor, such an
helicopter is called quadrocopter or quadrotor. Quadrocopters have some advantages over conventional single blade helicopter that they can be controlled
by changing the speed of the rotors and thus fixed-pitch blades are used that
simplifies the design and controlling of the quadrocopters. Secondly, the use of
four rotors allows each individual rotor to have a smaller diameter than the
equivally capable single blade conventional helicopter rotor, for a given vehicle
size, allowing them to attain less kinetic energy during flights. The most important advantage is that they can make manuevers that conventional helicopters
can not make.

1.1 Objectives
The objective of this thesis is to design a fuzzy flight controller for a quadrocopter that will control quadrocopter orientation in 3DOF namely; Pitch, Roll
and YAW. The controller is tested in Hardware In Loop (HIL) simulation. To
reach this objective:
Three gyros, one 3DOF accelerometer, a heading sensor and a GPS module have to interfaced with the on-board micro-controller
1

CHAPTER 1. INTRODUCTION

A simulink model for the fuzzy controller has to be developed and downloaded into dSPACE computer
A wired or wireless connection has to be made between on-board computer and dspace system
An Experiment setup has to be developed that is used to limit the 6DOFs
to 3DOFs namely; Pitch, Roll, and YAW

1.2 Concept of Quadrocopter


From the very first day in helicopter research, the quadrocopter configuration
was considered as an alternative. In a conventional helicopter layout the torque
produced by the main rotor is compensated by the tail rotor. When using two
rotor configuration the torques created by the rotors are counteracted by each
other. But two rotor configuration still has issues in control as the rotational
and translational motions are highly dependant to each other. In four rotor
configuration the control becomes simpler and the rotational motions are decoupled for the gyroscopic effects. Translational motions can be achieved by
tilting the vehicle.
In the most common design for quadrocopter, the two sets of rotors (1,
3) and (2, 4) rotate in opposite directions as shown in Fig. 1.1. By changing
the rotor speeds, lift forces can be changed and motion can be created in desired direction. Changing the speeds of all four rotors generate vertical motion.
Increasing or decreasing the speeds of rotor 2 and 4 conversely produces roll rotation coupled with lateral motion. Pitch rotation and the corresponding lateral
motion result from from changing the speed of rotors 1 and 3. Yaw rotation results from the difference in the counter-torque between the pairs of rotors [13].

Figure 1.1: Quadrocopter motion, the arrow width is proportional to propeller rotational speed

1.3. BRIEF HISTORY

1.3 Brief History


Breguet Brothers were the first people who built the quadrocopter in 1907.
they named their quadrocopter as Gyroplane. Their Gyroplane comprised of
four long girders fixed in the form of a horizontal cross. The flights of the
Gyroplane are considered to be the first human piloted flight of a helicopter,
but not a free or untethered flight. The Gyroplane never flew properly because
it lacked in stability and proper means of control.
The second attempt was made in 1922 when Georges de Bothezat built one
of the largest helicopters of the time which was also a quadrocopter. He named
his quadrocopter as Flying Octopus. His Flying Octopus flew successfully many
times, at low altitudes with slow moving speeds. However, the project was
cancelled because of low performance, high financial costs, and the increasing
military interest in autogiros at that time.
In the same year Etienne Oemichen built his quadrocopter, the Oemichen
No.2. It was equipped with four 2-blade paddle-shaped rotors of which the
angles could be varied by warping. Additional rotors that were necessary for
control and lateral movement, due to this the Oemichen No.2 exhibited, for its
time, a good degree of stability and control, and it made about a thousand test
flights during the early 1920s.

Figure 1.2: Early Quadrocopters

1.4 Modern Quadrocopters


After these early and initial attempts, engineers focus was shifted more on
the single rotor helicopter configuration, because of the stability issues with
the quadrocopter configuration. Interest in the quadrocopter configuration for
manned flight reviveded when knowledge on control systems increased. Also
the quadrocopter configuration with tiltable rotors became a choice to provide
more benefits and faster forward flight. Such a design was named as Convertawings Model.
Convertawings Model revived the concept of Oemichen and de Bothezat
tried out in 1922. A first prototype was built in 1956. Despite complete testing
and manufacturing, military support for the vehicle stopped after shortings in
defence budget. However, the design, particularly its control technique, was

CHAPTER 1. INTRODUCTION

a basis for current research on vertical-rising aircraft designs that incorporate


tiltable wings or a square configuration of four rotors or jets.
In order to develop a commercial passenger plane using four tilting rotors,
the Curtiss X-19 was developed. The first test flight took place in November
1963, but the vehicle never completed transition between hover and forward
moving flight because improper mechanical control characteristics [13].
On 14 September 2005 the team of Bell Helicopters and Boeing signed a
contract with the U.S. military to built the Quad Tilt Rotor (QTR) aircraft, to
fullfil the crucial need for long range, high speed, heavy lift without access to
runways.The QTR is a tandem-wing, four propeller plane with a large cargo
capacity.
Currently, the Moller company is working on several flying vehicles with
the intension of building a aircraft to replace the cars as the common way of
travelling and hover in a small areas. Their last invention is the M400 Skycar
with four ducted propellers. This aircraft has a capacity of four passengers, and
a cruise speed of around 400 km/h. However, they have still some issues with
validation, but it is highly expected that these issues will be removed next year
[1].

Figure 1.3: Modern manned quadrocopters

1.5 Advantages and disadvantages


As only rotors speed variation is used to change orientation and position, bladepitch control of the rotors is not required and thus rotor mechanics are become
easier, which makes the quadrocopter layout interesting for smaller sized Vertical/Short Take Off and Landing (V/STOL) UAVs. In addition to this, thrust

1.6. OUTLINE OF THIS DOCUMENT

is solely used to compensate for the gravity and not to counteract the torque,
because the four rotors neutralize the gyroscopic effect, so thrust is completely
used to produce the lift.
For micro quadrocopters, four rotors results in a very small rotor diameter,
which decreases the efficiency and increases energy requirment to get equal lift.
Also the dimensions and weight of a quadrocopter with equal payload is more
than a conventional helicopter. The simplifications in developing and control
which is offered by the design, makes it still a very favourable option for UAVs.

1.6 Outline of this document


In Chapter 2, brief details of hardware and software tools that are used in
project are provided. In Chapter 3, related work is presented briefly. In Chapter 4, the design of the controller is presented. In Chapter 5, details of the
experiment is provided and results are discussed. In Chapter 6, future works
ideas are given, and this chapter also contains concluding remarks.

Chapter 2

Hardware Description
2.1 The Quadrocopter at Orebro University
This thesis can be regarded as the sequel of previous thesis work at AASS on
quadrocopter titled as, "Modeling and Simulation of Quadrotor Aircraft" [7].
The purpose of that thesis at Orebro University and the Applied Autonomous
Sensor Systems Lab (AASS) was to establish an experiment installation, which
enables students of the program Automation Engineering to apply and test the
skills they have gained in control engineering courses. The experiment installation is depicted in Fig. 2.1. It is supposed to cover the development chain
in control engineering reaching from mathematical modelling and control parameter determination over a pure virtual simulation to hardware-in-the-loop
simulation and testing. This thesis is about the hardware-in-the-loop simulation.

Figure 2.1: The experiment installation with the quadrocopter helicopter

The Quadrocopter platform at Orebro University is a commercially available UAVP. The main features of the kit are:

CHAPTER 2. HARDWARE DESCRIPTION

a provided pre-programmed PIC micro-chip (saved for later use in further


experiments)
a 60cm full-carbon frame
four YGE-30i Quadrocopter motor speed controllers
four brushless motors AXI 2217/20
three gyro sensors Breakout ADXRS300 for measurement of angular velocities
one Breakout LIS3LV02DQ three-axis linear acceleration sensor
two CCW and two CW propellers
a pre-assembled circuit board

2.2 Onboard System


2.2.1

Micro-controller

PIC16F876A is used as the main processor on-board. All the sensors in the
project are interfaced with this controller. Controller reads sensory data from
sensors on every iteration of code burned into it. This data is sent to dspace
computer in the form of 12 bytes, two bytes for each sensor reading. The communication between on-board computer and dSPACE computer is initialized
by dSPACE.

2.2.2

YGE motor controllers

The YGE motor controllers are designed to convert the input value into an output PWM signal powering the motors and shifting phases on the motor inputs.
Each motor has its own YGE controller. Each YGE controller is powered with a
voltage 7.5-17V. The YGE controllers has the feature of undervoltage detection
resulting in a reduced power of the motors for safe landing in case the supply
voltage lies below a certain threshold.
The input PWM specification for the YGE controllers is 50Hz carrier frequency with pulses between 1.18ms and 1.8ms resembling zero throttle and
full throttle. The duty cycle therefore ranges between 0.059 and 0.09.
When switching on the motor controllers the throttle has to be set to zero
and the corresponding PWM values have to be send to the YGE. In this case
the YGE initializes correctly and gives 3 ascending beeps.
The YGE motor controlles feature also an I2 C bus input. This input can also
be used to communicate set values and also to programme the YGE controllers.
This is currently not used.

2.2. ONBOARD SYSTEM

Figure 2.2: On-board computer

The YGE motor controllers can be programmed by moving the throttle and
waiting for acknowledgement beeps of the YGE. The featured programming
modes and options can be looked up in the YGE manual.

2.2.3

Motors

Since the motors are brushless, the phases of the AC supply have to be shifted
circularly in the three supply wires in order to rotate the motor. Since the motor

features not only three poles but 14, the motor rotation per 2
3 = 60 phase

shift is 8.6 , which has the similar effect as a gear box.


The motors are equipped with neodymmagnets and feature high torques in
order to be used without gear box.
A motor carries out 840rpm per volt and is suitable for up to 3 LiPo cells resulting in a total voltage of 12.6V and a maximum rotation speed of 10080rpm.
The maximum current drainage to the battery is 18A, where the range for best
efficiency is 8-14A. The maximum torque is approximately 0.2Nm at 18A.

2.2.4

Propellers

The propellers in use are EPP1045 propellers by Maxx Ltd. out of composite material with a length of 10 inches and a pitch of 4.5 inches per revolution. Mounted are two sets of counter rotating propellers. The shaft diameter
is 3mm.

CHAPTER 2. HARDWARE DESCRIPTION

10

2.2.5

Sensors on-board

Following is the brief description of sensors on-board:


Heading Sensor
A compass sensor allows absolute flight direction measurement and a perfectly
long term stability of the yaw axis. For sensing exact heading position Honeywell HMC6352 compass module is used. The Honeywell HMC6352 is a
fully integrated compass module that combines 2-axis magneto-resistive sensors with the neccesary analog and digital support circuits, and algorithms for
heading computation. By combining the sensor elements, processing electronics, and firmware in to a 6.5mm by 6.5mm by 1.5mm LCC package, it offers a
complete, ready to use electronic compass.

Figure 2.3: HMC6352 compass module

The HMC6352 communicates via a two-wire I2 C bus system as a slave


device. All bus transactions begin with the master device issuing the start sequence followed by the slave address byte. The address byte contains the slave
address; the upper 7 bits (bits7-1), and the Least Significant bit (LSb). The LSb
of the address byte designates if the operation is a read (LSb=1) or a write
(LSb=0). At the 9 th clock pulse, the recieving slave device will issue the ACK
(or NACK). Following these bus events, the master will send data bytes for a
write operation, or the slave will transmit back data for a read operation. All
bus transactions are terminated with the master issuing a stop sequence.
The sensor is programmed to work on heading mode. In this mode HMC6352
the heading output data is sent to master device in tenths of degrees from zero
to 3599 and provided in binary format over the two bytes. Figure 2.4 shows
how to read two bytes from the HMC6352 (slave). The slave continues to hold
the SDA line low after the acknowledge bit because the first bit of the data
bytes is zero.

2.2. ONBOARD SYSTEM

11

Figure 2.4: Timing diagrram of reading two bytes from the HMC6352 (slave)

Gyro Sensor
A stable hovering control requires 3 gyro sensors: Pitch, Roll, and Yaw. ADXRS300
gyro sensors by Analog Devices are found to be most suitable for UAV application, but not usable without special soldering equipment. Therefore already
mounted sensors to break-out-PCBs are used.

Figure 2.5: ADXRS300 gyro sensors

ADXRS300 is an analog sensor. It outputs the rate of angle change as DC


voltage range from 0 to 5V, corresponds to -300 /sec to +300 /sec, where 2.5V
corresponds to 0. To read gyroscopic data from ADXRS300s, internal analog
to digital converter(ADC) of micro-controller is used.
Acceleration Sensor
For even more hovering stability, a 3-DOF- acceleration sensor is required, in
addition to the gyro sensors. The LIS3LV02DQ is a three axes digital output
linear accelerometer that includes a sensing element and an IC interface able
to take the information from the sensing element and to provide the measured
acceleration signals to the external world through an I2 C/SPI serial interface.

CHAPTER 2. HARDWARE DESCRIPTION

12

Figure 2.6: RATEOUT Signal Increases with Clockwise Rotation

Figure 2.7: LIS3LV02DQ, a 3-DOF- acceleration sensor

The LIS3LV02DQ has a user selectable full scale of 2g, 6g and it is


capable of measuring acceleration over a bandwidth of 640 Hz for all axes.
The device is programmed to sense accelaration in range of 2g, and communicates through SPI communication protocol. The micro-controller is programmed to get six bytes on every iteration of code, two bytes for each axis
acceleration reading.
The LIS3LV02DQ SPI is a bus slave. The SPI allows to write and read the
registers of the device using 4 wires: CS, SPC, SDI and SDO. The figure 2.8
shows the timing diagram of read and write operations. The device is interfaced
with micro-controller as per the information provided in figure 2.8.
GPS Sensor
To fly autonomously a navigation technique is required. Global Positioning
System (GPS) is found to be most simplest and appropriate for our application.
LEA-5H-008 in-door GPS module is selected for the project. An external usb to
UART converter is made to connect GPS module to on-board micro-controller.

2.2. ONBOARD SYSTEM

13

Figure 2.8: LIS3LV02DQ read and write operation timing diagram

the module can be configured to ubx or NMEA standards. However, it is configured to NMEA protocol. The C function downloaded into micro-controller
can translate one of the nine NMEA messages namely, GPGGA. GPGGA message gives sufficient information for autonomous flight, for example: Longitude, Latitude and hight.

Chapter 3

Background
3.1 Different control strategies used for
quadrocopters
For the control of UAVS there are several methodologies used in the literature.
Control systems that are used for the control of a helicopter type flying machine are: robust feedback controllers based on H techniques [14], fuzzy control, PD controllers [5], back-stepping controllers [5], Neural-Network Adaptive Flight Control [5]. For the experimentation done on the Stanford draganflyer UAVS, nonlinear control methods are used that uses discrete-time dynamic
inversion, under input saturation [10]. Another study done at the University
of Pennsylvania showed another control example, which used a vision based
control methodology for the control of UAVS [4].

3.2 Major Research/Educational Projects


In time the knowledge of control technology improved together with the advancement in computing power and sensors that allowed the designing of unmanned quadrocoptors. Several research labs and institutions started their reseach on quadrocoptors, but the development of complete autonomous flight
in dynamic environment is still a challenge.
Recently, there have been number of different projects in the literature about
quadrocoptors. These works used different control techniques, sensors and
materials. Following is the brief description of the research projects that contributed in quadrocopter research:

3.2.1

European Aeronautic Defense and Space Company

The quadrocopter in figure 3.1, named as Quattrocopter, is 65 cm electrically


powered V/STOL with the ability of flying about 20 minutes. It weighs half

15

CHAPTER 3. BACKGROUND

16

kilogram. It can fly with in the range of one kilometer. Its IMU (Inertial Measurment Unit) comprised of six inertial sensors for its six degrees of freedom. In
addition to these six sensors one GPS unit and air data sensors (gas sensors) is
also interfaced. Total IMU weighing 65 grams, consumes about three watts at
5 V. The system can be stored in a small space, as the motors can be detached
easily [20].

Figure 3.1: Quadrocopter developed by European Aeronautic Defense and Space Company

3.2.2

Pennsylvania State University

Pennsylvania State university have conducted two different studies on quadrocoptors [6] [4]. One is a master thesis work that was focused on a quadrocopter
test bench, shown in figure 3.2. The IMU for this quadrocopter was consist of
three gyro sensors and one accelerometer. Attitude of the quadrocopter was
controlled with PI control law.
Second work done in university of Pennsylvania used commercially available DraganFlyer as a testbed. This quadrocopter setup has an external pan-tilt
ground and on-board cameras in addition to the IMU. One camera was set on
the ground to capture the motion of five 2.5 cm colored pointers attached underneath the DraganFlyer, to obtain pitch, roll and yaw angles and the position
of the UAV by using a tracking algorithm. Algorithm routines ran in ground
computer. GPS or other accelerometers could not be interfaced to the system
due to the weight limitations. The controller used only cameras to obtain the
relative positions and velocities. Figure 3.3 shows the experiment setup for this
research.
Two control techniques were studied in this research, one using a series
of mode-based, feedback linearizing controllers and the other using a back-

3.2. MAJOR RESEARCH/EDUCATIONAL PROJECTS

17

Figure 3.2: Quadrocopter designed in Pennsylvania State University

stepping control law. Simulations performed on Simulink showed the capacity


of the proposed controller to perform output tracking control even when there
are errors on state estimates.

3.2.3

Middle East Technical University

Researchers at Middle East Technical University utilized three orthogonal piezoelectric gyros in their quadrocopter setup to control the attitude of the quadrocopter [2]. The attitude was controlled by a LQR (Linear Quadratic Regulator)
and PD controller. Frame was built of 45 cm rectangular aluminum profiles.
Figure 3.4 shows the experiment setup for this research.

3.2.4

Australian National University

The testbed used in Australian National University (ANU) was named as X4Flyer. The X4-Flyer [17] consists of a HC-12 a single board computer that
was used as the signal conditioning system. This card uses two HC-12 processors and outputs pulse width modulated (PWM) signals to control the speed
of motors directly, inputs PWM signals from an R700 JR Slimline RC receiver
allows direct plot input from a JP 3810 RF transmitter and has two separate
RS232 serial ports, one is used to communicate with the inertial measurement
unit (IMU) and the other is used as an asynchronous data linked to the ground
computer.
In IMU, the most suitable unit considered was the EiMU embedded inertial
measurement unit developed by the robotics group in QCAT, weighs 50 to 100

18

CHAPTER 3. BACKGROUND

Figure 3.3: Quadrocopter tracking with a camera

grams. Crossbow DMU-6 is also used in the prototype. It weighs about 500
grams
The pilot augmentation control system is used. A double lead compensator
is used for the inner loop. The final setup is shown in Figure 3.5.

3.2.5

University of British Columbia Vancouver, BC, Canada

The research on quadrocopter control in in University of British Columbia was


initiated in the Department of Electrical and Computer Engineering [14]. This
work was focused on the non-linear modelling of a quadrocopter. An experimental setup including a flying mill, a DSP system, a programmed microcontroller and a RF transmitter was used to test the flight controller. Based on
the nonlinear model, an H loop shaping controller was designed for attitude
stabilization, speed, throttle and yaw control.
A PIC micro-controller, PIC16F877, was programmed to communicate the
control data to a PWM signal in order to reduce significant CPU load which
otherwise would have been associated with the DS1102. This signal is further
used to control the motors of the quadrocopter via a 4 channel Futaba RF
transmitter working in training mode.
To conduct flight control experiments, an experimental rig including a custom designed flying mill, a personal computer, dSPACE DSP board, a microprocessor pulse modulator, a RF transmitter and the Draganflyer III was arranged.
A picture of the flying mill is shown in Figure 3.6. The steel base and carbon
fiber boom limit the flight route of the quadrocopter to a half sphericity of 1
meter radius.

3.2. MAJOR RESEARCH/EDUCATIONAL PROJECTS

19

Figure 3.4: Quadrocopter designed in Middle East Technical University

Based on the nonlinear model, a H loop shaping controller is developed


for attitude stabilization, speed, throttle and yaw control. A constraint model
based predictive controller (MBPC) was also implemented for longitudinal and
lateral trajectory control.

3.2.6

Cornell University

Cornell University conducted a research on the Autonomous Flying Vehicle


(AFV) project [15] to produce a reliable autonomous hovering vehicle.
To get enough thrust, MaxCim motors were used. The final vehicle weighed
about 6.23 kg.
In the begining an Extended Kalman Filter was designed to handle the estimation of both the state and the six inertial sensor bias parameters. This filter
found to be cumbersome to be implemented, due to extremely big and complex Jacobian terms and instead a square root implementation of a Sigma Point
Filter (SRSPF) was used. The figure 3.7shows the final picture the developed
UAV.

3.2.7

Swiss Federal Institute of Technology

In the research conducted at Swiss Federal Institude of Technology [18] the


mechanical design, mathematicl modelling, inertial sensing, and control of an

20

CHAPTER 3. BACKGROUND

Figure 3.5: The X4-Flyer developed in FEIT, ANU

indoor V/STOL autonomous quadrocopter OS43 is presented. The movements


of the quadrocopter were restricted to 3DOFs.
The quadrocopter was attached to PC through a standard RS232 port. The
RS232 to I2 C module was used to translate the serial signals to the I2 C bus motor modules. These modules integers a PID regulator on a PIC16F876 microcontroller and are capable of open or closed loop operation in position, speed
or torque control. The MT9-B8 IMU9 estimates with a Kalman filter the Inertial sensory data and give the calibrated data of acceleration and angular
velocity. It weights about 33g and communicates baudrate is 115kbps.
The cross is made up of carbon alloy profiles thus vehicle, the mass of which
is around 240gm, is lightweight.The quadrocopter has four propulsion group,
each composed of a 29g motor including magnetic encoders, a 6g-gear box and
a 6g propeller.
Before testing on the real-time system, multiple simulations were performed
on Simulink. The controller task was to stabilize the altitude while compensating the initial errors in the attitude of the vehicle. The real-time system had
some unwanted but unavoidable delays and actuator saturation issues. The delays were mainly due to serial communications and the actuator time constant.
To rectify these lacks, two Simulink discrete-step delay blocks were added in
the feedback loop and on the actuators. Saturation level depends on the chosen
actuators. Figure 3.8 depicts the experimental setup for this research.

3.2. MAJOR RESEARCH/EDUCATIONAL PROJECTS

21

Figure 3.6: Experimental setup in University of British Columbia

3.2.8

University of Technology in Compiegne, France

University of Technology in Compiegne used commercially available quadrocopter system, developed by the Draganfly Innovations Inc.for their research
on quadrocopters [16]. The four control signals were transmitted by a Futaba
Skysport 4 RF transmitter.
The transmitter and the ground computer were connected by data acquisition cards (ADVANTECH PCL-818HG and PCL-726). The connection in the
radio is directly made to the joystick potentiometers for the collective attitude
control. To simplify the tuning of the controller and for flight security , several
switches were added in the PC-transmitter interface so that each control input
can be operated either in manual mode or in automatic mode. Therefore the
control inputs that are generated manually were selected by the human operator while the other control inputs were generated by the ground PC.
The Polhemus was interfaced through RS232 to the PC. This type of sensor
was reported to be very sensitive to electromagnetic noise and it was install as
far as possible from the electric motors and their drivers. The quadrocopter had
3 onboard gyros that helped the vehicle stabilization.The proposed controller

CHAPTER 3. BACKGROUND

22

Figure 3.7: Quadrocopter designed in Cornell University

was based on Lyapunov analysis using a nested saturation algorithm. Figure 3.9
shows the experimental setup for this research.

3.2.9

Stanford University

In 1999, Stanford University started a quadrocopter research project, named


as Mesicopter [11, 12] that ended in 2001. The purpose of the research was to
study the feasibility of a centimetre scaled quadrocopter to use in huge numbers
to investigate large areas or even planets. In this research an extensive study
was done into the aerodynamics of a quadrocoptors. In the end a prototype
was developed of which the rotors could rotate, but no lift off was achieved.
Second, the Stanford Testbed of Autonomous Rotorcraft for Multi-Agent
Control (STARMAC) was started. This is a multi vehicle setup used to study
new theories in multi agent control on a real-world environment [8, 9]. STARMAC comprised of eight quadrocopters that are autonomously tracked and are
given waypoint trajectory.
The project is divided into three parts. In the first part the UAVs and testbed
were designed to verify the design, test fights were done. This part was successfuly finished in September 2004 with the development of STARMAC I. In part
two the complete vehicle and testbed is re-engineered to develpo a full functioning testbed. In the final part the multi agent control is demostrated. Figure 3.10
shows the different quadrocopters developed in Stanford University.

3.2. MAJOR RESEARCH/EDUCATIONAL PROJECTS

23

Figure 3.8: Quadrocopter designed in Swiss Federal Institude of Technology

STARMAC I
STARMAC I has a total of 1 kilogram of thrust and can hover for not more
than ten minutes at full throttle. The onboard electronics were replaced with
PCB to have complete control over motors, power supply and sensor readings.
An upgrade to lipo batteries has increased both flight payload capacity and
hovering time and has considerably enhanced the capacity of the system. For
inertial measurement the Microstrain 3DM-G motion sensor was used, with
3-axis gyro, accelerometer and heading sensor information. For velocity and
position measurement, a Trimble Lassen Low Power GPS receiver was used.
To improve altitude information the downward-pointing SOnic Detection And
Ranging (SODAR) the Devantech SRFO8 was used, specially for difficult tasks
such as take off and landing.All of the onboard sensing is controlled through
two Microchip 40 MHz micro-controllers. Position estimation uses both GPS
position and velocity measurements, as well as orientation information in a
Extended Kalman Filter (EKF) to update the position and velocity estimates at
10 Hz. The GPS data is used to compensate integration bias of the small angle
approximated accelerations derived from the information from gyro sensors.
Attitude of the vehicle is controlled on board at 50 Hz and communicated
to a base sta- tion on the ground, communicating via a Bluetooth Class II device
with a range of over 150 feets. Designed to replace serial cable and therefore operates at a bandwidth of 115200bps. This bandwidth of 115.2 kbps is shared
by all (of four) flyers. The base station on the ground performs Differential
GPS (DGPS) and waypoint tracking tasks for all four flyers, and sends appro-

24

CHAPTER 3. BACKGROUND

Figure 3.9: Quadrocopter designed in University of Technology in Compiegne, France

Figure 3.10: Stanford University quadrocopter projects

priate attitude values to the flyers for stable flight. Human piloted flight and
pre planned control is performed via the ground station laptop using Labview.
To control height a sliding mode control is designed and the attitude loop
was designed LQR techniques. Angular deviations were penalised more than
rate deviations. Also, the pitch and roll loops were penalised identically, with
a reduced penalty on the yaw deviations. On the STARMAC I platform also
more advanced controller types are tested, such as integral sliding mode and
reinforcement learning [21].
STARMAC II
The STARMAC II testbed is a sequel of first version with improvements at
several points:

3.2. MAJOR RESEARCH/EDUCATIONAL PROJECTS

25

Thrust capabilities: Old motors and propellers were replaced with Brushless motors and more rigid plastic propellers to double the output and
enhance the total thrust up to a total of 4 kilograms.
On-board computation resources: With the increased lift capabilities, it
became possible to increase onboard computing power. Computation and
control are managed at two separate levels. The low level control that
performs real-time control loop execution and control motor speeds, occurs on a micro-controller board based on the Atmega 128 processor.
The high level planning, estimation and control occurs on a lightweight
Cross- bow Stargate 1.0 single board computer (SBC) running embedded
Linux. Alternatively an Advanced Digital Logic ADL855 PC104 running
Kubuntu Linux can also be implemented, providing more computational
power, at the cost of additional weight and hence shortened flight times.
Communication reliability and bandwidth: The old Bluetooth was replaced with a WiFi network, enables much greater bandwidth and improved communication channel management through a wireless router at
the central ground station. This has shown considerable improvements
in communication between the ground computer and quadrocopters as
compared with the Bluetooth capabilities of first version.
Position measurement accuracy: Three-dimensional position and velocity
measurements are now done using a carrier phase differential Novatel
Superstar II GPS unit with a resulting position accuracy of less than 2cm.
For indoor flights, an overhead USB camera can be attached, with blob
tracking software, to provide position sensing without GPS. The camera
system gives less than 2 cm accuracy at 10 Hz rate, and provides a drop-in
replacement for GPS input to the EKF.
Instead of the LQR used in the STARMAC I in the STARMAC II ProportionalIntegral- Derivative (PID) control was implemented for attitude, altitude and
position control. Not only the hardware was improved but also the mathematical model of the quadrocopter. Three extra effects where quantified that relate
to motion of the vehicle relative to the free stream.

Chapter 4

Controller design and Simulink


model
4.1 Control Strategy
Quadrocopter has became very popular among researchers due to the advantages it offers. Like conventional helicopters it can take off and land vertically.
In addition to this, it can fly closer to obstacles than the conventional helicopters, and it can make manuevers that the conventional helicopters cannot
make. But from the aerodynamic point of view quadrocopter is inherently unstable. To control the quadrocopter, many control schemes have been proposed.
Robust feedback controllers based on H techniques [14], fuzzy control, PD
controllers [5], back-stepping controllers [5] and Neural-Network Adaptive
Flight Control [5] are just few examples of the control schemes proposed for
controlling quadrocopter. For the experimentation done on the Stanford draganflyer UAVs, nonlinear control methods were chosed that uses discrete-time
dynamic inversion, under input saturation [10]. Another study done at the University of Pennsylvania showed another control example, which used a vision
based control methodology for the control of UAVs [4].
All of the above stated control schemes expects the designers to have extensive understanding of the mathematical equations that governs the dynamics of
the quadrocopter. To avoid the design complexities associated with above mentioned control schemes, we decided to design the fuzzy controller for quadrocopter and analyze how it perform with quadrocopter as it has never been
tested on quadrocopter.

4.2 Quadrocopter fuzzy controller design


To design the fuzzy controller, we took article [3] as starting point. Article [3]
reports the design of fuzzy controller for two degrees of freedom, namely; pitch
and roll. The deigned fuzzy controller was then used on quadrocopter sim27

28

CHAPTER 4. CONTROLLER DESIGN AND SIMULINK MODEL

ulation. The article [3] reports the use of three inputs namely; acceleration,
velocities and accumulation of past commands around two horizontal axes X
and Y to maintain quadrocopter in hovering position. To design the fuzzy controller we adopted a different approach than the one proposed in article [3].
We took the quadrocopter angles and the rates of angle change as input to our
fuzzy controllers. And we did not use any third input as used in article [3]. And
unlike article [3] we tested our controller on quadrocopter in HIL simulation
setup.
In design process of fuzzy controller, designers usually try to inject the expertise of experienced human operator into their controller so that, their controller
control the plant in a same way as experienced human operator do. To design
the fuzzy controller for quadrocopter we found a set of guidelines presented
in article [3] that describe how human operators control the quadrocopter.
These guidelines were formulated after interviewing experienced quadrocopter
operators. These guidelines were written for how human operators perceive
the velocities and acceleration along different axes, and how they control the
quadrocopter based on their perception. Despite we are not using velocities
and accelerations as inputs, but we can use the same set of guidelines for our
controller with angles and the rates of angle of change as inputs as the velocities and accelerations are directly propotional to the angles and rates of angle
change respectively. So we can mold the presented guidlines for our controller
with angles and rates of angle change as inputs.
The molded guidelines are given below:
1. Control of quadrocopter is done by observing the bank angles and the
rate of change of bank angles of the vehicle from the point of view of the
observer.
2. Only qualitative information of the bank angles and the rate of change of
bank angles are available to the external pilot.
3. Except in high aerobatic maneuvers roll, pitch and yaw control of the
vehicle are handled separately and independently.
4. When the observed angles of the vehicle are small (i.e. near hovering
point) more attention is paid to the angles of the quadrocopter than the
rate of change.
5. When the observed angles of the quadrocopter are large more attention
is paid to the vehicle angle change rate and more effort goes in to compensating the rate than that to the angles.
6. Control commands issued by the human operator could be any of the
four quantitative commands namely roll, pitch, thrust and yaw.

4.2. QUADROCOPTER FUZZY CONTROLLER DESIGN

29

7. Observable angles and the rates of angle change are understood by the
human operator as either small, medium or big. Accumulation of control
commands is perceived as zero, small, medium and big.
We started designing the fuzzy controller for the quadrocopter in the light of
above stated guidelines. Guideline 1 defines the inputs of the controller, namely
the angles and the rate at which angles change. Guideline 7 suggest five membership functions for each input. We used triangular or trapezoidal shapes for
membership functions to avoid computational and programming complexities,
as there is a plan to translate the designed controller to C language in future.
We started with uniform distribution of membership functions as shown in
Fig. 4.1. Then in search of better performance we increased the input gains by
contracting the membership function closer to zero as shown in Fig. 4.2. But for
this setting we got oscillatory response, plus too high input gains also amplifies
the noise and can cause serious disturbances specially when the input values
are small. So, to rectify oscillations and avoid noise amplification we started reducing input gains by stretching membership functions gradually. After testing
the system with several membership functions settings, the input membership
functions setting presented in Fig. 4.3 were found best. The same procedure
was repeated for the second input and we got best results at the same settings
used for the first input.

Figure 4.1: Uniform membership functions for inputs

The same design process was repeated for output membership function.
Guideline 7 suggest seven membership functions for output of each controller.
We started with uniform distribution of all seven membership functions. Then
we increased output gains gradually to minmize the steady state error. But on
high output gains we got oscillatory response. So we had to find the settings
where the steady state error is minimized without oscillatory behavior. Figure 4.4 shows the settings for output membership functions where we found
such response.

30

CHAPTER 4. CONTROLLER DESIGN AND SIMULINK MODEL

Figure 4.2: input variable roll angle with high input gains

Figure 4.3: input variable rate of angle change and angles

The rule base of the controller was also designed in the light of the above
guidelines. Guidelines 5, 6 and 7 suggest a subset of the rule base for the fuzzy
logic controller. We used 25 rules in our rule base that are presented in Fig. 4.5
Figure 4.6 shows the control surface produced by the rules presented in Fig
4.5.
The implemented fuzzy controller is an equivalent of position PD controller
as clear from Fig. 4.5. But it can be seen how easily it is designed, even without
mathematical model of the quadrocopter. In addition to this it has a big advantage over conventional PD controller that it is non-linear. The same controller
can be regarded as equivalent to velocity PI controller.
Pitch and yaw axes controllers are designed in a same way as roll controller.

4.3 Implementation
The fuzzy logic controller and sensory data processing are modeled in Matlab
using Simulink. The Simulink model are then downloaded to dSPACE computer
before experimentation. We prefered to use Mamdani type fuzzy controller as it
is the simplest and more intuitive [19] specially when controller design is based
on a set of guidelines describing the human behavior. Guideline 3 suggests that

4.4. COMPLETE DESCRIPTION OF SIMULINK MODEL FOR


EXPERIMENTATION

31

Figure 4.4: Output of roll controller

the controller for each axes can be designed separately. So, we designed three
similar fuzzy controllers for the pitch, yaw and roll axis of the quadrocopter.

4.4 Complete description of Simulink model for


experimentation
The Simulink model for experimentation in Fig. 4.7 is divided into seven steps
as follows:
1. Data acquisition
2. De-multiplexing
3. Sensory data processing
4. Controllers
5. Normalizing of controllers singnals for motors
6. Mixing of normalized controller signals
7. PWM signal generation for motors
Following are the details of each steps:

4.4.1

Data acquisition

dSPACE RTI toolbox provides two blocks namely; "Serial setup" and "Serial
recieve" that are used to recieve sensory data from on-board computer. These
blocks recieve 12 bytes data in every program cycle. They keep the data into
buffer until all 12 bytes are recieved. When all 12 bytes are recieved the data is
forwarded serially as per FIFO scheme.

32

CHAPTER 4. CONTROLLER DESIGN AND SIMULINK MODEL

Figure 4.5: Fuzzy rules table

4.4.2

De-multiplexing

A very commonly used block "Demux" is used for de-multiplexing of data. The
block recieves 12 bytes serially, and it sends them forward in parallel fashion.

4.4.3

Sensory data processing

Gyro sensors data processing


Two subsystem blocks namely; "Roll gyro" and "Pitch gyro" are used to processes the data from roll and pitch gyro sensors, respectively. The internal woking of these two blocks are exactly same. Figure 4.8 shows the internal working
of one of these blocks. The gyro sensor reading is composed of two bytes which
are sent to these blocks. The significant byte is multiplied by 256 to shift 8 bits
left side then the second byte is added into it. The data represents voltages
from 0 to 5V. 10 bits are used in ADC process, so the readings are multiplied

4.4. COMPLETE DESCRIPTION OF SIMULINK MODEL FOR


EXPERIMENTATION

33

Figure 4.6: Rules surface

by 0.00488. As 0 value is represented by 2.5V we subtract 2.5 from the reading


in next step. And in the last step we multiply reading with 100 to get final rate
of angle change.
Accelearation sensor data processing
Three subsystem blocks namely; "X new", "Y new" and "Z new" are used to
process accelearation sensor data for x,y and z axes, respectively. The internal
woking of these three blocks are exactly same. Figure 4.9 shows the internal
working of one of these blocks. Same as gyro sensor reading, Accelearation
sensor reading is also composed of two bytes which are sent to these blocks.
The significant byte is multiplied by 256 to shift 8 bits left side then the second
byte is added into it. The data is represented as signed integer, so we use type
conversion block to convert signed integers to unsigned integers.
Heading sensor data processing
The subsystem block "heading" is used to process compass sensor data for
heading. Figure 4.10 shows the internal working of the block. Same as gyro
and Accelearation sensors reading, heading sensor reading is also composed of
two bytes which are sent to this blocks. The significant byte is multiplied by
256 to shift 8 bits left side then the second byte is added into it. As the data

34

CHAPTER 4. CONTROLLER DESIGN AND SIMULINK MODEL

Figure 4.7: Simulink model for experimentation

represents tenths of degrees, so data is divided by 10 to get heading from 0 to


359.9 degrees.

4.4.4

Controllers

Pitch and Roll controllers


In step 4, two fuzzy controllers are implemented in two subsystem blocks
namely; "Roll controller" and "Pitch controller" to control roll and pitch angles, respectively. The internal working of these two blocks are exactly same,
shown in Fig. 4.11. The processed output of gyros are fed to these blocks that
is rate of angle change which is directly fed to fuzzy controller as input. The
second input is the angle that is determined by passing the rate of angle change
through integral block.
Yaw, X, Y and Z axes controllers
Four fuzzy controllers are implemented in two subsystem blocks namely; "X
controller", "Y controller", "Z controller" and "Yaw controller" to control
X, Y, Z and yaw axes respectively. The internal working of all these blocks
are exactly same, shown in Fig. 4.12. The processed outputs of compass and
accelearation sensor are fed to yaw controller and x, y, z blocks respectively.

4.4. COMPLETE DESCRIPTION OF SIMULINK MODEL FOR


EXPERIMENTATION

35

Figure 4.8: Simulink model for processing gyro sensors readings

Figure 4.9: Simulink model for processing accelearation sensors readings

4.4.5

Normalizing of controllers singnals for motors

In step 5, only gains blocks are used with a value of 0.00031 to scale the output
of the controllers between the range of 0.059 and 0.09, because YGE motor
drivers takes 0.059 and 0.09 as stop and full throttle, respectively. That is the
reason every controller output is multiplied by a factor of 0.0031 to lie with in
range understood by YGE motor drivers. The controllers may generate signal
of value 20 at maximum. The remaining 80 percent of power is in user hands.

4.4.6

Mixing of normalized controller signals

All the outputs of the controllers and user inputs are mixed before generating
PWM signals for motors. As YGE motor controllers consider 0.059 as 0, a
direct input of 0.059 is fed to all the motors. In addition to this, user can give
input to the system to produce 80 percent of thrust through dSPACE GUI. The
output of Y controllers are fed to all motors as to control altitude all motors are
required to produce more thrust equally to increase altitude or reduce equally
to decrease altitude. The outputs of X controller and roll controllers are fed
to motors 2 and 4 with a sign change.The outputs of Y controller and pitch

36

CHAPTER 4. CONTROLLER DESIGN AND SIMULINK MODEL

Figure 4.10: Simulink model for processing heading sensor reading

Figure 4.11: Simulink model for roll and pitch controllers

controllers are fed to motors 1 and 3 with a sign change. And the output of
Yaw controller is fed to all motors, motor 1 and 3 are fed with opposite sign as
of motor 2 and 4.

4.4.7

PWM signal generation for motors

After mixing all the control signals and user input, PWM signals has to be generated for motors to operate them in a desired way. To generate PWM signals
"DS1103SL DSP PWM" block, provided by dSPACE RTI toolbox in simulink,
is used.

4.4. COMPLETE DESCRIPTION OF SIMULINK MODEL FOR


EXPERIMENTATION

Figure 4.12: Simulink model for Yaw, X, Y and Z axes controllers

37

Chapter 5

Experimentation and results


The installation of the experiment follows the scheme depicted in figure 5.1.
The wired connections between the dSPACE RTI and the QAP chassis have
been established and function correctly.

Figure 5.1: The experiment installation with the quadrocopter helicopter

5.1 Experimentation setup


Due to some major technical problems with the hardware in the last days of
thesis work, we are not able to perform experiments to the extent to satisfy
39

40

CHAPTER 5. EXPERIMENTATION AND RESULTS

the objectives of the thesis. The YGE controller for motor 1 has burned out, so
motor 1 cannot be operated. As motor 1 cannot be operated, we have to stop
motor 3. With remaining two motors it is certainly not possible to perform
experiments for any of 6 axes except roll axes. To perform experiment for roll
axis, we built an experiment setup with the intension to limit the DOF to only
one axis that is the roll axis. The setup we built for experimentation is shown
in Fig. 5.1 in which it can be seen the quadrocopter is tied with ropes from top
and from down. Only the roll axes is left free.

5.2 Results
As stated in the last section that due to the technical problems the experimentation plan was effected badly. With only two motors we could test our controller
for roll axis. We performed several tests to validate the functionality and applicability of our fuzzy controller. We are including some selected experiments
among the several we performed during thesis work.
The experimentation setup we built allows the quadrocopter to be stabilized without motors in few seconds, if it is disturbed along roll axis. Here we
can give the example of pendulum. If pendulum is disturbed from its point of
stability, it stabilized back to this point after some oscillations. But there is a
difference between our system and pendulum. The point of stability for pendulum is fixed, where pendulum attains minimum potential energy. But this is not
the case with our system. When we disturb the quadrocopter along roll axis,
the eight threads used to limit the movements around other axes change their
adjusments that results in a slight change in the angle of stability for the tied
quadrocopter.
We performed the first experiment to analyze, how much time it takes the
quadrocopter to get stabilized without motors. The results of this experiment
is shown in Fig. 5.2.
In Fig. 5.2, it is shown that the quadrocopter is destabilized by an external
force at around 11th second of the experiment. The quadrocopter became stabilized after around 8 seconds. Here we can see the difference between the angle
of stability before the occurence of external disturbence and after it. This slight
shift in the angle of stability for the quadrocopter is due to the re-adjustment
of the threads tied to quadrocopter, as stated earlier.
After performing experiment without motors we performed an experiment
with motors to analyze how the newly designed controller works to stabilize
the quadrocopter in our constrained experimentation setup. The results of this
experiment are shown in Fig. 5.3.
In Fig. 5.3 it is shown that when the experiment was started the roll angle
of the quadrocopter was around -4 degrees, means that the quadrocopter was
tilted -4 degrees towards motor 2. At around 4th second of the experiment the
motors were started with the power of 35 percent. The controller is started at
around 7th second. The activity of the motors can be seen in the second graph

5.2. RESULTS

41

Figure 5.2: Stabilization time without operating motors

of Fig. 5.3, where the red line represents the power plus controller signal to
motor 2 and blue line represents the power plus controller signal to motor 4.
At around 13th second we disturbed the quadrocopter along roll axis to 32
degrees.After that controller stabilized the quadrocopter in less than 4 seconds
that is the half of the time it took in last experiment.
The red line in the first graph of Fig. 5.3 represents the set point for the
roll angle. The controller should stabilize the quadrocopter at the set point.
But it can be seen in Fig. 5.3 that roll angle never reached to the set point.
On the other hand, we see in the second graph of Fig. 5.3 that the controller
continously tried to overcome the error by increasing the speed of motor 2 and
by decreasing the speed of motor 4, but still the roll angle remained unchanged.
This is due to the limitations associated with our experimentation setup. With
two motors we cannot perform experiments with high motor speeds, because
the torque produced by two motors destabilize the whole setup. And at lower
motor speeds we need high controller gains to stabilize the quadrocopter at

42

CHAPTER 5. EXPERIMENTATION AND RESULTS

set point. And when we use higher controller gains, it results in uncontrolled
oscillations.

Figure 5.3: Disturbence test with 35 percent power and controller gain 1

To support our arguments we performed an experiment. The results of


this experiment are shown in Fig. 5.4. In this experiment we operated motors with 30 percent of power. And we used multiple gains to find what value
for controllers gain is most suitable to overcome steady state error. The GUI we
designed on Control Desk for experimentation allow us to change the motor
speeds and controller gains during experiments.
In Fig. 5.4, it is shown that the roll angle was around -5 degrees when the
experiment was started. we powered up motors with 30 percent of maximum
power at around 6th second of the experiment that can be seen in second graph
of Fig. 5.4. The controller was activated at around 12th second of the experiment. To overcome the error the controller speeded up the motor 2 and reduced
the speed of motor 4, but the controller gain was insufficient to overcome the
error. Then we increased the controller gain to 2 at 19th second that resulted
in no change in roll angle. Then we gradually increased the controller gain till
11 at around 104th second of the experiment, but we did not observe any significant change in roll angle. Then quadrocopter suddenly started to oscillate
severly, so we stop our controller. The oscillations we saw in Fig 5.4 usually
happened at gains above 3 if quadrocopter is destabilized by an external force.

5.2. RESULTS

43

This experiment demonstrates the limitations of our experimentation setup and


the difficulties of experimentation with only two motors.

Figure 5.4: Disturbence test with 30 percent power and multiple controller gain

We made another argument that we cannot perform experiments at higher


speeds. If we do so, the torque produced by the motors destabilizes the whole
setup. To demonstrate this behaviour we are including the results of an experiment that we performed at 60 percent of maximum power with controller gain
eqaul to 1. Figure 5.5 shows the results for this experiment.
In Fig. 5.5, it can be seen that despite the right signals from the controller
the quadrocoter is keeps on tilting towards the motor 4. We observed such
behaviour whenever we operated motors at more than 40 percent of power.
This is due to the torque produced by motors. The torque produced by the
anti-clock wise motors is normaly cancelled out by the torque produced by
clock wise motors. But in our case the clock wise motors are not working. We

44

CHAPTER 5. EXPERIMENTATION AND RESULTS

Figure 5.5: Disturbence test with 60 percent power and controller gain 1

used threads to limit the movements around other axes other than the roll axis,
but this is not the real solution. These threads also interfare with the movement
along roll axis.
After performing several experiments with different power settings and controller gains, we found that operating motors at 35 percent power with controller gain of 1 results in best performance for our tightly constrained experimental setup. To find these settings, we performed several experiments. We
started from low power settings to high, with different values for gain. The
Fig. 5.6 show the results for 15 percent power and controller gain equals to 1.
As this was one the earliest experiment, we could not classify it as good or bad.
Then we tried higher gains at lower power settings. Fig. 5.7 is an example
of it. It represents the results for the experiment performed at 15 percent power
and gain value equals to 2.
Then we performed the experiment with 15 percent power with 2.5 controller gain. The results for this experiment are shown in Fig. 5.8. By comparing the results of the experiments performed at 15 percent power with different

5.2. RESULTS

45

Figure 5.6: Disturbence test with 15 percent power and controller gain 1

controller gain values, we found that higher gains at lower power settings cause
higher and more oscillations.
Then we increased power to 25 percent and test our controller with gain
equals to 1. The results for this experiment is shown in Fig. 5.9.
Then we performed experiment with same power settings but with different
controller gain values. Experiment shown in Fig. 5.10 was performed with 25
percent power with controller gain value equals to 2.
Then we performed another experiment with same power setting of 25 percent with controller gain value equals to 2.5. The results for this experiment
are shown in Fig. 5.11. We noticed the same trend with 25 percent power as
we noticed for 15 percent. But we found that the over all performance of the
system with 25 percent is better than performance with 15 percent power.
In the search of better power and gain settings for our system, we increased
the power to 35 percent. And we found that the power of 35 percent with
controller gain values equals to 1 result in best performance for our system.
The results of experiment with these power and gain settings are shown in
Fig. 5.3.

46

CHAPTER 5. EXPERIMENTATION AND RESULTS

Figure 5.7: Disturbence test with 15 percent power and controller gain 2

We tested higher gain values in combination with 35 percent powers. The


results for these experiments are shown in Fig. 5.12 and in Fig. 5.13. But we
noticed that higher gain values result in oscillatory behaviour.

5.3 Limitations in experimentation


The experiments we performed, we noticed that in all the experiments we had
a common issue that despite the right signals from the controller, the quadrocopter was never stabilized to set point. As stated earlier, we believe that this
issue is associated with our experimentation setup and harware problems. The
setup we built for limiting the movements along other axes also affect the motion along roll axis. In addition to this we cannot operate motors at high speed
to avoid having excess clock wise torque. We also have problems in setting
gains for controllers. With lower gains the quadrocopter cannot be stabilized
to the set point, simply because the controller signals are not enough to overcome the friction between the platform and the threads and to lift the one side
of quadrocopter. And with higher controller gain values we have uncontrolled

5.3. LIMITATIONS IN EXPERIMENTATION

47

Figure 5.8: Disturbence test with 15 percent power and controller gain 2.5

oscillations as demonstrated in experiments. But, after analyzing the controller


actions in several experiments, we can safely assume that if this newly designed
fuzzy controller is tested on the quadrocopter with all motors working and
no contrained experimentation setup, it will perform well to maintain quadrocopter in hovering position.

48

CHAPTER 5. EXPERIMENTATION AND RESULTS

Figure 5.9: Disturbence test with 25 percent power and controller gain 1

5.3. LIMITATIONS IN EXPERIMENTATION

Figure 5.10: Disturbence test with 25 percent power and controller gain 2

49

50

CHAPTER 5. EXPERIMENTATION AND RESULTS

Figure 5.11: Disturbence test with 25 percent power and controller gain 2.5

5.3. LIMITATIONS IN EXPERIMENTATION

Figure 5.12: Disturbence test with 35 percent power and controller gain 2

51

52

CHAPTER 5. EXPERIMENTATION AND RESULTS

Figure 5.13: Disturbence test with 35 percent power and controller gain 2.5

Chapter 6

Conclusions and future work


6.1 Conclusions
The objective of this thesis was to design the fuzzy flight controller for the
quadrocopter. Initially we were designing the fuzzy controller for all six degrees of freedom, but later the objective of the thesis was reduced to 3 degrees
of freedom. After interfacing all the required sensors and establishing communication between the dSPACE computer and on-board micro-controller, the
designed controller was tested in hardware in loop setup. The experiments to
validate the functionality of the designed controller were performed in highly
constrained experimentation setup because of major technical problems. Despite major technical problems we managed to perform experiments and we
got satisfactory results. By analyzing the results we conclude that it is possible
to control the quadrocopter with fuzzy controller. However, it is not possible
now to compare our results with other existing control approaches as the experimentation was done in highly constrained setup. There is no guarantee that
the designed controller is optimal. We strongly believe that the further tunning
will be required once the harware problems has been fixed.

6.2 Future works


6.2.1

GPS integration

As stated earlier, the initial goal of the thesis work was to develop the controller
for autonomous flying of quadrocopter. To achieve this objective, a ublox indoor GPS was bought. But unfortunately the indoor GPS does not catch satellite signals inside the lab. We tested the module in the university corridors and
found it works fine there. That is the reason the objective of the thesis was
changed from 6DOFs controller design to 3DOFs design. However, the GPS
module has been to configured to work as per NMEA protocol, and a C function is written and tested to translate the GPGGA message of NMEA protocol
that gives the sufficient information reqired for autonomous flying. Harware
53

54

CHAPTER 6. CONCLUSIONS AND FUTURE WORK

modification has also been done on the quadrocopter to interface GPS module.
These things are to be integrated in future.

6.2.2

Translation of Simulink model into C code

The controller designed in Simulink has to be translated into C code. This


would be a neccessary step to integrate all things together to have a complete
autonomous flight. And this would be a pre-requisite for GPS interfacing. This
can be done using available libraries in C.

6.2.3

Wireless connections

Currently we are using wired connections between dSPACE computer and onboard micro-controller for communicating sensor readings and . These wired
connections has to be replaced with wireless connections to operate quadrocopter freely. We configured the XBee communication module for wireless connection and tested them by sending test data, but modules are not integrated in
the project to avoid complexities of already complexed on-board electronics.

6.2.4

On-board PWM signals generation

To have all communication wireless, it is neccessary to communicate controller


signals to quadrocopter on-board micro-controller. But it is not possible to send
PWM signals wirelessly through XBee communication module due to the band
width limitation associated with XBee communication modules. So, the PWM
signals have to be generated on-board. To do this, the on-board software has
to be modified. The internal PWM modules of micro-controller could be useful
in this regard.

References
[1] skycar official website, 2011. (Cited on page 4.)
[2] B.Camlica. Demonstration of a stabilized hovering platform for undergraduate laboratory. 2004. (Cited on page 17.)
[3] S.A.A. Shakoor S.R. Munasinghe D.M.W . Abeywardena, L.A.K. Amaratunga. A velocity feedback fuzzy logic controller for stable hovering
of a quad rotor uav. Fourth Intemational Conf erence on Industrial and
Information Systems, IClIS, 2009. (Cited on pages 27 and 28.)
[4] E.Altug. Vision based control of unmanned aerial vehicles with applications to an autonomous four rotor helicopter, Quadrotor. PhD thesis,
University of Pennsylvania, 2010. (Cited on pages 15, 16, and 27.)
[5] E.N.Johnson. Uav research at georgia tech school of aerospace engineering, 2011. (Cited on pages 15 and 27.)
[6] Scott D. Hanford. A small semi-autonomous rotary-wing unmanned air
vehicle (uav). Masters thesis, 2005. (Cited on page 16.)
[7] Peter Hermannstadter. Modeling and simulation of a quadrotor aircraft,
2008. (Cited on page 7.)
[8] Rajnarayan D. Waslander S. Dostal D. Jang J. Hoffmann, G. and C. Tomlin. The stanford testbed of autonomous rotorcraft for multi agent control
(starmac). Proceedings of the 23rd Digital Avionics Systems Conference,
2004. (Cited on page 22.)
[9] Rajnarayan D. Waslander S. Jang J. Hoffmann, G. and C Tomlin. Quadrotor helicopter flight dynamics and control theory and experiment. 2007.
(Cited on page 22.)
[10] J. S. Jang. Nonlinear control using discrete-time dynamic inversion under
input saturation theory and experiment on the Stanford dragon fly UAVS.
PhD thesis, Stanford University, 2003. (Cited on pages 15 and 27.)
55

56

REFERENCES

[11] I. Kroo and F. Prinz. The mesicopter: A meso-scale flight vehicle - niac
phase i final report. technical report. Technical report, Stanford University, 2001. (Cited on page 22.)
[12] I. Kroo and F. Prinz. The mesicopter: A meso-scale flight vehicle - niac
phase ii technical proposal. technical report. Technical report, Stanford
University, 2001. (Cited on page 22.)
[13] J.G. Leishman. Principles of helicopter aerodynamics. Cambridge
aerospace series. Cambridge University Press, 2002. (Cited on pages 2
and 4.)
[14] M. Huzmezan M. Chen. A Behavior-Based Control System for Mobile
Manipulation. PhD thesis, University of British Columbia, 2003. (Cited
on pages 15, 18, and 27.)
[15] E. B. Nice. Design of a four rotor hovering vehicle. Masters thesis, Cornell University, 2003. (Cited on page 19.)
[16] A. Dzul P. Castillo and R. Lozano. Real-time stabilization and tracking
of a four rotor mini-rotorcraft. IEEE transactions on control systems
technology, 2003. (Cited on page 21.)
[17] P. Hynes J. Roberts P.Pounds, R.Mahony. Design of a four-rotor aerial
robot. Australiasian Conference on Robotics and Automation Auckland,
99, 2002. (Cited on page 17.)
[18] R. Siegwart S. Bouabdallah, P. Murrieri. Design and control of an indoor
micro quadrotor. 2003. (Cited on page 19.)
[19] S. N. Deepa S. N. Sivanandam, S. Sumathi. Chapter 6 - Introduction to
fuzzy logic using MATLAB. Springer 2007. (Cited on page 30.)
[20] P. Uhleman S.Sassen. Quattrocopter a unique micro-aerial vehicle. European Aeronautic Defense and Space Company Corporate research centre,
2003. (Cited on page 16.)
[21] Hoffmann G. M. Jang J. S. Waslander, S. L. and C. J. Tomlin. Multi-agent
quadrotor testbed control design: Integral sliding mode vs. reinforcement
learning. In Proceedings 2005 IEEE/RSJ International Conference Intelligent Robots and Systems, 2004. (Cited on page 24.)

You might also like