Quadrocopter Fuzzy Flight Controller - DiVA...

74
International Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad Saad Shaikh Technology Studies from the Department of Technology at Örebro University 0 örebro 2011

Transcript of Quadrocopter Fuzzy Flight Controller - DiVA...

Page 1: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

International Master’s Thesis

Quadrocopter Fuzzy Flight Controller

Muhammad Saad Shaikh

Technology

Studies from the Department of Technology at Örebro University 0

örebro 2011

Page 2: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad
Page 3: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

Quadrocopter Fuzzy Flight Controller

Page 4: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad
Page 5: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

Studies from the Department of Technologyat Örebro University 0

Muhammad Saad Shaikh

Quadrocopter Fuzzy Flight Controller

Page 6: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

© Muhammad Saad Shaikh, 2011

Title: Quadrocopter Fuzzy Flight Controller

ISSN 1650-8580

Page 7: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

Abstract

Quadrocopter is an aerial vehicle platform which has become very popularamong researchers in the recent past due to the advantages it offers over con-ventional helicopters. Quadrocopter is very simple and unique, but it is in-herently unstable from aerodynamics point of view. In recent past researchershave proposed many control schemes for quadrocopter. In this thesis we presentfuzzy logic controller for quadrocopter. After brief introduction brief hardwaredetails are given that is used in this thesis. After that design procedure for thefuzzy controller is presented. Then the designed fuzzy controller is tested inHardware In Loop (HIL) setup. The experimentation to validate the function-ality and applicability of the designed controller were performed in contrainedsetup due to some technical problems. The results of the experiments were sat-isfactory and it is concluded that it is possible to stabilize quadrocopter withfuzzy logic controller.

i

Page 8: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad
Page 9: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

Acknowledgements

I would like to thank those who helped during my thesis work. Without theirsupport, I could have never accomplished this work.

I take this special occasion to thank my parents. I dedicate this work to myparents. It would have been simply impossible to start, continue and completewithout the support of my parents who, unconditionally provided the resourcesto me.

I am eternally indebted to my supervisor Ivan Kalaykov for all the help,invaluable guidance and generous support throughout my thesis work. I havebeen very fortunate to be associated with such a kind and good person and itwould take more than a few words to express my sincere gratitude.

I also like to thank Bo-lennart and Boyko Iliev for their enlightening sugges-tions and advices. Their professionalism, guidance, dedication and inspirationswill always serve me as an example in my professional life.

iii

Page 10: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad
Page 11: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

Contents

1 Introduction 11.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Concept of Quadrocopter . . . . . . . . . . . . . . . . . . . . . 21.3 Brief History . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.4 Modern Quadrocopters . . . . . . . . . . . . . . . . . . . . . . 31.5 Advantages and disadvantages . . . . . . . . . . . . . . . . . . . 41.6 Outline of this document . . . . . . . . . . . . . . . . . . . . . . 5

2 Hardware Description 72.1 The Quadrocopter at Orebro University . . . . . . . . . . . . . 72.2 Onboard System . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.2.1 Micro-controller . . . . . . . . . . . . . . . . . . . . . . 82.2.2 YGE motor controllers . . . . . . . . . . . . . . . . . . . 82.2.3 Motors . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.2.4 Propellers . . . . . . . . . . . . . . . . . . . . . . . . . . 92.2.5 Sensors on-board . . . . . . . . . . . . . . . . . . . . . . 10

3 Background 153.1 Different control strategies used for quadrocopters . . . . . . . . 153.2 Major Research/Educational Projects . . . . . . . . . . . . . . . 15

3.2.1 European Aeronautic Defense and Space Company . . . 153.2.2 Pennsylvania State University . . . . . . . . . . . . . . . 163.2.3 Middle East Technical University . . . . . . . . . . . . . 173.2.4 Australian National University . . . . . . . . . . . . . . 173.2.5 University of British Columbia Vancouver, BC, Canada . 183.2.6 Cornell University . . . . . . . . . . . . . . . . . . . . . 193.2.7 Swiss Federal Institute of Technology . . . . . . . . . . . 193.2.8 University of Technology in Compiegne, France . . . . . 213.2.9 Stanford University . . . . . . . . . . . . . . . . . . . . . 22

v

Page 12: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

vi CONTENTS

4 Controller design and Simulink model 274.1 Control Strategy . . . . . . . . . . . . . . . . . . . . . . . . . . 274.2 Quadrocopter fuzzy controller design . . . . . . . . . . . . . . . 274.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . 304.4 Complete description of Simulink model for experimentation . . 31

4.4.1 Data acquisition . . . . . . . . . . . . . . . . . . . . . . 314.4.2 De-multiplexing . . . . . . . . . . . . . . . . . . . . . . . 324.4.3 Sensory data processing . . . . . . . . . . . . . . . . . . 324.4.4 Controllers . . . . . . . . . . . . . . . . . . . . . . . . . 344.4.5 Normalizing of controllers singnals for motors . . . . . . 354.4.6 Mixing of normalized controller signals . . . . . . . . . . 354.4.7 PWM signal generation for motors . . . . . . . . . . . . 36

5 Experimentation and results 395.1 Experimentation setup . . . . . . . . . . . . . . . . . . . . . . . 395.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405.3 Limitations in experimentation . . . . . . . . . . . . . . . . . . 46

6 Conclusions and future work 536.1 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536.2 Future works . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

6.2.1 GPS integration . . . . . . . . . . . . . . . . . . . . . . . 536.2.2 Translation of Simulink model into C code . . . . . . . . 546.2.3 Wireless connections . . . . . . . . . . . . . . . . . . . . 546.2.4 On-board PWM signals generation . . . . . . . . . . . . 54

References 55

Page 13: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

List of Figures

1.1 Quadrocopter dynamics. . . . . . . . . . . . . . . . . . . . . . . 21.2 Early Quadrocopters . . . . . . . . . . . . . . . . . . . . . . . . 31.3 Modern manned quadrocopters . . . . . . . . . . . . . . . . . . 4

2.1 The experiment installation . . . . . . . . . . . . . . . . . . . . 72.2 On-board computer . . . . . . . . . . . . . . . . . . . . . . . . 92.3 HMC6352 compass module . . . . . . . . . . . . . . . . . . . . 102.4 Timing diagrram of reading two bytes from the HMC6352 (slave) 112.5 ADXRS300 gyro sensors . . . . . . . . . . . . . . . . . . . . . . 112.6 RATEOUT Signal Increases with Clockwise Rotation . . . . . . 122.7 LIS3LV02DQ, a 3-DOF- acceleration sensor . . . . . . . . . . . 122.8 LIS3LV02DQ read and write operation timing diagram . . . . . 13

3.1 Quadrocopter developed by European Aeronautic Defense and Space Company 163.2 Quadrocopter in Pennsylvania State University . . . . . . . . . . 173.3 Quadrocopter tracking with a camera . . . . . . . . . . . . . . . 183.4 Quadrocopter in Middle East Technical University . . . . . . . . 193.5 X4-Flyer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203.6 Experimental setup in University of British Columbia . . . . . . 213.7 Quadrocopter designed in Cornell University . . . . . . . . . . . 223.8 Quadrocopter designed in Swiss Federal Institude of Technology 233.9 Quadrocopter designed in University of Technology in Compiegne, France 243.10 Stanford University quadrocopter projects . . . . . . . . . . . . 24

4.1 Uniform membership functions for inputs . . . . . . . . . . . . 294.2 input variable roll angle with high input gains . . . . . . . . . . 304.3 input variable rate of angle change and angles . . . . . . . . . . 304.4 Output of roll controller . . . . . . . . . . . . . . . . . . . . . . 314.5 Fuzzy rules table . . . . . . . . . . . . . . . . . . . . . . . . . . 324.6 Rules surface . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334.7 Simulink model for experimentation . . . . . . . . . . . . . . . 34

vii

Page 14: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

viii LIST OF FIGURES

4.8 Simulink model for processing gyro sensors readings . . . . . . . 354.9 Simulink model for processing accelearation sensors readings . . 354.10 Simulink model for processing heading sensor reading . . . . . . 364.11 Simulink model for roll and pitch controllers . . . . . . . . . . . 364.12 Simulink model for Yaw, X, Y and Z axes controllers . . . . . . 37

5.1 The experiment installation . . . . . . . . . . . . . . . . . . . . 395.2 Stabilization time without operating motors . . . . . . . . . . . 415.3 Disturbence test with 35 percent power and controller gain 1 . . 425.4 Disturbence test with 35 percent power and multiple controller gain 435.5 Disturbence test with 60 percent power and controller gain 1 . . 445.6 Disturbence test with 15 percent power and controller gain 1 . . 455.7 Disturbence test with 15 percent power and controller gain 2 . . 465.8 Disturbence test with 15 percent power and controller gain 2.5 . 475.9 Disturbence test with 25 percent power and controller gain 1 . . 485.10 Disturbence test with 25 percent power and controller gain 2 . . 495.11 Disturbence test with 25 percent power and controller gain 2.5 . 505.12 Disturbence test with 35 percent power and controller gain 2 . . 515.13 Disturbence test with 35 percent power and controller gain 2.5 . 52

Page 15: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

List of Tables

ix

Page 16: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad
Page 17: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

List of Algorithms

xi

Page 18: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad
Page 19: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

Chapter 1

Introduction

An unmanned aerial vehicle (UAV) is an unpiloted aircraft which can either flyautonomously or it can be remotely controlled based on program downloadedinto on-board computers. Unmanned aerial vehicles have very vast area of ap-plications in military for missions that are too dull, dirty, or risky for humanpiloted aircraft. They are also used in a growing number of civil applicationssuch as aireal inspection.

UAVs can be divided basically into two categories, fixed wing UAVs and ro-tatory wing UAVs. Rotatory wing (or helicopter) UAVs have some advantagesover fixed wing UAVs that they can take off and land vertically, and that theyalso can maintain their position at a fixed point in 3D space. Maintaining a po-sition at a fixed point is called hovering. One very successful design for smallerUAVs is an helicopter with four horizontal rotors with no tailrotor, such anhelicopter is called quadrocopter or quadrotor. Quadrocopters have some ad-vantages over conventional single blade helicopter that they can be controlledby changing the speed of the rotors and thus fixed-pitch blades are used thatsimplifies the design and controlling of the quadrocopters. Secondly, the use offour rotors allows each individual rotor to have a smaller diameter than theequivally capable single blade conventional helicopter rotor, for a given vehiclesize, allowing them to attain less kinetic energy during flights. The most impor-tant advantage is that they can make manuevers that conventional helicopterscan not make.

1.1 Objectives

The objective of this thesis is to design a fuzzy flight controller for a quadro-copter that will control quadrocopter orientation in 3DOF namely; Pitch, Rolland YAW. The controller is tested in Hardware In Loop (HIL) simulation. Toreach this objective:

• Three gyros, one 3DOF accelerometer, a heading sensor and a GPS mod-ule have to interfaced with the on-board micro-controller

1

Page 20: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

2 CHAPTER 1. INTRODUCTION

• A simulink model for the fuzzy controller has to be developed and down-loaded into dSPACE computer

• A wired or wireless connection has to be made between on-board com-puter and dspace system

• An Experiment setup has to be developed that is used to limit the 6DOFsto 3DOFs namely; Pitch, Roll, and YAW

1.2 Concept of Quadrocopter

From the very first day in helicopter research, the quadrocopter configurationwas considered as an alternative. In a conventional helicopter layout the torqueproduced by the main rotor is compensated by the tail rotor. When using tworotor configuration the torques created by the rotors are counteracted by eachother. But two rotor configuration still has issues in control as the rotationaland translational motions are highly dependant to each other. In four rotorconfiguration the control becomes simpler and the rotational motions are de-coupled for the gyroscopic effects. Translational motions can be achieved bytilting 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 changingthe rotor speeds, lift forces can be changed and motion can be created in de-sired direction. Changing the speeds of all four rotors generate vertical motion.Increasing or decreasing the speeds of rotor 2 and 4 conversely produces roll ro-tation coupled with lateral motion. Pitch rotation and the corresponding lateralmotion result from from changing the speed of rotors 1 and 3. Yaw rotation re-sults 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 rota-tional speed

Page 21: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

1.3. BRIEF HISTORY 3

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 offour long girders fixed in the form of a horizontal cross. The flights of theGyroplane are considered to be the first human piloted flight of a helicopter,but not a free or untethered flight. The Gyroplane never flew properly becauseit lacked in stability and proper means of control.

The second attempt was made in 1922 when Georges de Bothezat built oneof the largest helicopters of the time which was also a quadrocopter. He namedhis quadrocopter as Flying Octopus. His Flying Octopus flew successfully manytimes, at low altitudes with slow moving speeds. However, the project wascancelled because of low performance, high financial costs, and the increasingmilitary interest in autogiros at that time.

In the same year Etienne Oemichen built his quadrocopter, the OemichenNo.2. It was equipped with four 2-blade paddle-shaped rotors of which theangles could be varied by warping. Additional rotors that were necessary forcontrol and lateral movement, due to this the Oemichen No.2 exhibited, for itstime, a good degree of stability and control, and it made about a thousand testflights during the early 1920s.

Figure 1.2: Early Quadrocopters

1.4 Modern Quadrocopters

After these early and initial attempts, engineers focus was shifted more onthe single rotor helicopter configuration, because of the stability issues withthe quadrocopter configuration. Interest in the quadrocopter configuration formanned flight reviveded when knowledge on control systems increased. Alsothe quadrocopter configuration with tiltable rotors became a choice to providemore benefits and faster forward flight. Such a design was named as ’Con-vertawings Model’.

Convertawings Model revived the concept of Oemichen and de Bothezattried out in 1922. A first prototype was built in 1956. Despite complete testingand manufacturing, military support for the vehicle stopped after shortings indefence budget. However, the design, particularly its control technique, was

Page 22: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

4 CHAPTER 1. INTRODUCTION

a basis for current research on vertical-rising aircraft designs that incorporatetiltable 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 November1963, but the vehicle never completed transition between hover and forwardmoving flight because improper mechanical control characteristics [13].

On 14 September 2005 the team of Bell Helicopters and Boeing signed acontract with the U.S. military to built the Quad Tilt Rotor (QTR) aircraft, tofullfil the crucial need for long range, high speed, heavy lift without access torunways.The QTR is a tandem-wing, four propeller plane with a large cargocapacity.

Currently, the Moller company is working on several flying vehicles withthe intension of building a aircraft to replace the cars as the common way oftravelling and hover in a small areas. Their last invention is the M400 Skycarwith four ducted propellers. This aircraft has a capacity of four passengers, anda cruise speed of around 400 km/h. However, they have still some issues withvalidation, 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, blade-pitch control of the rotors is not required and thus rotor mechanics are becomeeasier, which makes the quadrocopter layout interesting for smaller sized Ver-tical/Short Take Off and Landing (V/STOL) UAVs. In addition to this, thrust

Page 23: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

1.6. OUTLINE OF THIS DOCUMENT 5

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 completelyused 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 morethan a conventional helicopter. The simplifications in developing and controlwhich 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 inproject are provided. In Chapter 3, related work is presented briefly. In Chap-ter 4, the design of the controller is presented. In Chapter 5, details of theexperiment is provided and results are discussed. In Chapter 6, future worksideas are given, and this chapter also contains concluding remarks.

Page 24: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad
Page 25: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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 onquadrocopter titled as, "Modeling and Simulation of Quadrotor Aircraft" [7].The purpose of that thesis at Orebro University and the Applied AutonomousSensor Systems Lab (AASS) was to establish an experiment installation, whichenables students of the program Automation Engineering to apply and test theskills they have gained in control engineering courses. The experiment instal-lation is depicted in Fig. 2.1. It is supposed to cover the development chainin control engineering reaching from mathematical modelling and control pa-rameter determination over a pure virtual simulation to hardware-in-the-loopsimulation and testing. This thesis is about the hardware-in-the-loop simula-tion.

Figure 2.1: The experiment installation with the quadrocopter helicopter

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

7

Page 26: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

8 CHAPTER 2. HARDWARE DESCRIPTION

• a provided pre-programmed PIC micro-chip (saved for later use in furtherexperiments)

• 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 ve-locities

• 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 theproject are interfaced with this controller. Controller reads sensory data fromsensors on every iteration of code burned into it. This data is sent to dspacecomputer in the form of 12 bytes, two bytes for each sensor reading. The com-munication between on-board computer and dSPACE computer is initializedby dSPACE.

2.2.2 YGE motor controllers

The YGE motor controllers are designed to convert the input value into an out-put 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 avoltage 7.5-17V. The YGE controllers has the feature of undervoltage detectionresulting in a reduced power of the motors for safe landing in case the supplyvoltage lies below a certain threshold.

The input PWM specification for the YGE controllers is 50Hz carrier fre-quency with pulses between 1.18ms and 1.8ms resembling zero throttle andfull 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 zeroand the corresponding PWM values have to be send to the YGE. In this casethe YGE initializes correctly and gives 3 ascending beeps.

The YGE motor controlles feature also an I2C bus input. This input can also

be used to communicate set values and also to programme the YGE controllers.This is currently not used.

Page 27: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

2.2. ONBOARD SYSTEM 9

Figure 2.2: On-board computer

The YGE motor controllers can be programmed by moving the throttle andwaiting for acknowledgement beeps of the YGE. The featured programmingmodes 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 shiftedcircularly in the three supply wires in order to rotate the motor. Since the motorfeatures not only three poles but 14, the motor rotation per 2π

3 = 60 ◦ phaseshift is 8.6 ◦ , which has the similar effect as a gear box.

The motors are equipped with neodymmagnets and feature high torques inorder to be used without gear box.

A motor carries out 840rpm per volt and is suitable for up to 3 LiPo cells re-sulting 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 bestefficiency 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 compos-ite material with a length of 10 inches and a pitch of 4.5 inches per revolu-tion. Mounted are two sets of counter rotating propellers. The shaft diameteris 3mm.

Page 28: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

10 CHAPTER 2. HARDWARE DESCRIPTION

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 perfectlylong term stability of the yaw axis. For sensing exact heading position Hon-eywell HMC6352 compass module is used. The Honeywell HMC6352 is afully integrated compass module that combines 2-axis magneto-resistive sen-sors with the neccesary analog and digital support circuits, and algorithms forheading computation. By combining the sensor elements, processing electron-ics, and firmware in to a 6.5mm by 6.5mm by 1.5mm LCC package, it offers acomplete, ready to use electronic compass.

Figure 2.3: HMC6352 compass module

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

device. All bus transactions begin with the master device issuing the start se-quence followed by the slave address byte. The address byte contains the slaveaddress; the upper 7 bits (bits7-1), and the Least Significant bit (LSb). The LSbof 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 awrite operation, or the slave will transmit back data for a read operation. Allbus transactions are terminated with the master issuing a stop sequence.

The sensor is programmed to work on heading mode. In this mode HMC6352the heading output data is sent to master device in tenths of degrees from zeroto 3599 and provided in binary format over the two bytes. Figure 2.4 showshow to read two bytes from the HMC6352 (slave). The slave continues to holdthe SDA line low after the acknowledge bit because the first bit of the databytes is zero.

Page 29: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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. ADXRS300gyro sensors by Analog Devices are found to be most suitable for UAV appli-cation, but not usable without special soldering equipment. Therefore alreadymounted 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 DCvoltage range from 0 to 5V, corresponds to -300 ◦/sec to +300 ◦/sec, where 2.5Vcorresponds to 0. To read gyroscopic data from ADXRS300s, internal analogto digital converter(ADC) of micro-controller is used.

Acceleration Sensor

For even more hovering stability, a 3-DOF- acceleration sensor is required, inaddition to the gyro sensors. The LIS3LV02DQ is a three axes digital outputlinear accelerometer that includes a sensing element and an IC interface ableto take the information from the sensing element and to provide the measuredacceleration signals to the external world through an I

2C/SPI serial interface.

Page 30: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

12 CHAPTER 2. HARDWARE DESCRIPTION

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 iscapable of measuring acceleration over a bandwidth of 640 Hz for all axes.

The device is programmed to sense accelaration in range of ±2g, and com-municates through SPI communication protocol. The micro-controller is pro-grammed to get six bytes on every iteration of code, two bytes for each axisacceleration reading.

The LIS3LV02DQ SPI is a bus slave. The SPI allows to write and read theregisters of the device using 4 wires: CS, SPC, SDI and SDO. The figure 2.8shows the timing diagram of read and write operations. The device is interfacedwith micro-controller as per the information provided in figure 2.8.

GPS Sensor

To fly autonomously a navigation technique is required. Global PositioningSystem (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 toUART converter is made to connect GPS module to on-board micro-controller.

Page 31: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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 con-figured to NMEA protocol. The C function downloaded into micro-controllercan translate one of the nine NMEA messages namely, GPGGA. GPGGA mes-sage gives sufficient information for autonomous flight, for example: Longi-tude, Latitude and hight.

Page 32: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad
Page 33: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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 ma-chine are: robust feedback controllers based on H∞ techniques [14], fuzzy con-trol, PD controllers [5], back-stepping controllers [5], Neural-Network Adap-tive Flight Control [5]. For the experimentation done on the Stanford dragan-flyer UAVS, nonlinear control methods are used that uses discrete-time dynamicinversion, under input saturation [10]. Another study done at the Universityof Pennsylvania showed another control example, which used a vision basedcontrol methodology for the control of UAVS [4].

3.2 Major Research/Educational Projects

In time the knowledge of control technology improved together with the ad-vancement in computing power and sensors that allowed the designing of un-manned quadrocoptors. Several research labs and institutions started their re-seach on quadrocoptors, but the development of complete autonomous flightin dynamic environment is still a challenge.

Recently, there have been number of different projects in the literature aboutquadrocoptors. These works used different control techniques, sensors andmaterials. Following is the brief description of the research projects that con-tributed in quadrocopter research:

3.2.1 European Aeronautic Defense and Space Company

The quadrocopter in figure 3.1, named as Quattrocopter, is 65 cm electricallypowered V/STOL with the ability of flying about 20 minutes. It weighs half

15

Page 34: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

16 CHAPTER 3. BACKGROUND

kilogram. It can fly with in the range of one kilometer. Its IMU (Inertial Mea-surment Unit) comprised of six inertial sensors for its six degrees of freedom. Inaddition to these six sensors one GPS unit and air data sensors (gas sensors) isalso interfaced. Total IMU weighing 65 grams, consumes about three watts at5 V. The system can be stored in a small space, as the motors can be detachedeasily [20].

Figure 3.1: Quadrocopter developed by European Aeronautic Defense and Space Com-pany

3.2.2 Pennsylvania State University

Pennsylvania State university have conducted two different studies on quadro-coptors [6] [4]. One is a master thesis work that was focused on a quadrocoptertest bench, shown in figure 3.2. The IMU for this quadrocopter was consist ofthree gyro sensors and one accelerometer. Attitude of the quadrocopter wascontrolled with PI control law.

Second work done in university of Pennsylvania used commercially avail-able DraganFlyer as a testbed. This quadrocopter setup has an external pan-tiltground and on-board cameras in addition to the IMU. One camera was set onthe ground to capture the motion of five 2.5 cm colored pointers attached un-derneath the DraganFlyer, to obtain pitch, roll and yaw angles and the positionof the UAV by using a tracking algorithm. Algorithm routines ran in groundcomputer. GPS or other accelerometers could not be interfaced to the systemdue to the weight limitations. The controller used only cameras to obtain therelative positions and velocities. Figure 3.3 shows the experiment setup for thisresearch.

Two control techniques were studied in this research, one using a seriesof mode-based, feedback linearizing controllers and the other using a back-

Page 35: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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 capacityof the proposed controller to perform output tracking control even when thereare errors on state estimates.

3.2.3 Middle East Technical University

Researchers at Middle East Technical University utilized three orthogonal piezo-electric gyros in their quadrocopter setup to control the attitude of the quadro-copter [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 X4-Flyer. The X4-Flyer [17] consists of a HC-12 a single board computer thatwas used as the signal conditioning system. This card uses two HC-12 proces-sors and outputs pulse width modulated (PWM) signals to control the speedof motors directly, inputs PWM signals from an R700 JR Slimline RC receiverallows direct plot input from a JP 3810 RF transmitter and has two separateRS232 serial ports, one is used to communicate with the inertial measurementunit (IMU) and the other is used as an asynchronous data linked to the groundcomputer.

In IMU, the most suitable unit considered was the EiMU embedded inertialmeasurement unit developed by the robotics group in QCAT, weighs 50 to 100

Page 36: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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 500grams

The pilot augmentation control system is used. A double lead compensatoris 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 wasinitiated in the Department of Electrical and Computer Engineering [14]. Thiswork was focused on the non-linear modelling of a quadrocopter. An exper-imental setup including a flying mill, a DSP system, a programmed micro-controller and a RF transmitter was used to test the flight controller. Based onthe nonlinear model, an H∞ loop shaping controller was designed for attitudestabilization, speed, throttle and yaw control.

A PIC micro-controller, PIC16F877, was programmed to communicate thecontrol data to a PWM signal in order to reduce significant CPU load whichotherwise would have been associated with the DS1102. This signal is furtherused to control the motors of the quadrocopter via a 4 channel Futaba RFtransmitter working in training mode.

To conduct flight control experiments, an experimental rig including a cus-tom designed flying mill, a personal computer, dSPACE DSP board, a micropro-cessor 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 carbonfiber boom limit the flight route of the quadrocopter to a half sphericity of 1meter radius.

Page 37: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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 developedfor attitude stabilization, speed, throttle and yaw control. A constraint modelbased predictive controller (MBPC) was also implemented for longitudinal andlateral 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 weighedabout 6.23 kg.

In the begining an Extended Kalman Filter was designed to handle the esti-mation of both the state and the six inertial sensor bias parameters. This filterfound to be cumbersome to be implemented, due to extremely big and com-plex Jacobian terms and instead a square root implementation of a Sigma PointFilter (SRSPF) was used. The figure 3.7shows the final picture the developedUAV.

3.2.7 Swiss Federal Institute of Technology

In the research conducted at Swiss Federal Institude of Technology [18] themechanical design, mathematicl modelling, inertial sensing, and control of an

Page 38: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

20 CHAPTER 3. BACKGROUND

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

indoor V/STOL autonomous quadrocopter OS43 is presented. The movementsof the quadrocopter were restricted to 3DOFs.

The quadrocopter was attached to PC through a standard RS232 port. TheRS232 to I

2C module was used to translate the serial signals to the I2C bus mo-tor modules. These modules integers a PID regulator on a PIC16F876 micro-controller and are capable of open or closed loop operation in position, speedor torque control. The MT9-B8 IMU9 estimates with a Kalman filter the In-ertial sensory data and give the calibrated data of acceleration and angularvelocity. It weights about 33g and communicates baudrate is 115kbps.

The cross is made up of carbon alloy profiles thus vehicle, the mass of whichis around 240gm, is lightweight.The quadrocopter has four propulsion group,each composed of a 29g motor including magnetic encoders, a 6g-gear box anda 6g propeller.

Before testing on the real-time system, multiple simulations were performedon Simulink. The controller task was to stabilize the altitude while compen-sating the initial errors in the attitude of the vehicle. The real-time system hadsome unwanted but unavoidable delays and actuator saturation issues. The de-lays were mainly due to serial communications and the actuator time constant.To rectify these lacks, two Simulink discrete-step delay blocks were added inthe feedback loop and on the actuators. Saturation level depends on the chosenactuators. Figure 3.8 depicts the experimental setup for this research.

Page 39: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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 quadro-copter system, developed by the Draganfly Innovations Inc.for their researchon quadrocopters [16]. The four control signals were transmitted by a FutabaSkysport 4 RF transmitter.

The transmitter and the ground computer were connected by data acquisi-tion cards (ADVANTECH PCL-818HG and PCL-726). The connection in theradio is directly made to the joystick potentiometers for the collective attitudecontrol. To simplify the tuning of the controller and for flight security , severalswitches were added in the PC-transmitter interface so that each control inputcan be operated either in manual mode or in automatic mode. Therefore thecontrol inputs that are generated manually were selected by the human opera-tor while the other control inputs were generated by the ground PC.

The Polhemus was interfaced through RS232 to the PC. This type of sensorwas reported to be very sensitive to electromagnetic noise and it was install asfar as possible from the electric motors and their drivers. The quadrocopter had3 onboard gyros that helped the vehicle stabilization.The proposed controller

Page 40: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

22 CHAPTER 3. BACKGROUND

Figure 3.7: Quadrocopter designed in Cornell University

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

3.2.9 Stanford University

In 1999, Stanford University started a quadrocopter research project, namedas Mesicopter [11, 12] that ended in 2001. The purpose of the research was tostudy the feasibility of a centimetre scaled quadrocopter to use in huge numbersto investigate large areas or even planets. In this research an extensive studywas done into the aerodynamics of a quadrocoptors. In the end a prototypewas developed of which the rotors could rotate, but no lift off was achieved.

Second, the Stanford Testbed of Autonomous Rotorcraft for Multi-AgentControl (STARMAC) was started. This is a multi vehicle setup used to studynew theories in multi agent control on a real-world environment [8, 9]. STAR-MAC comprised of eight quadrocopters that are autonomously tracked and aregiven waypoint trajectory.

The project is divided into three parts. In the first part the UAVs and testbedwere designed to verify the design, test fights were done. This part was success-fuly finished in September 2004 with the development of STARMAC I. In parttwo the complete vehicle and testbed is re-engineered to develpo a full function-ing testbed. In the final part the multi agent control is demostrated. Figure 3.10shows the different quadrocopters developed in Stanford University.

Page 41: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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 morethan ten minutes at full throttle. The onboard electronics were replaced withPCB to have complete control over motors, power supply and sensor readings.

An upgrade to lipo batteries has increased both flight payload capacity andhovering time and has considerably enhanced the capacity of the system. Forinertial measurement the Microstrain 3DM-G motion sensor was used, with3-axis gyro, accelerometer and heading sensor information. For velocity andposition measurement, a Trimble Lassen Low Power GPS receiver was used.To improve altitude information the downward-pointing SOnic Detection AndRanging (SODAR) the Devantech SRFO8 was used, specially for difficult taskssuch as take off and landing.All of the onboard sensing is controlled throughtwo Microchip 40 MHz micro-controllers. Position estimation uses both GPSposition and velocity measurements, as well as orientation information in aExtended Kalman Filter (EKF) to update the position and velocity estimates at10 Hz. The GPS data is used to compensate integration bias of the small angleapproximated accelerations derived from the information from gyro sensors.

Attitude of the vehicle is controlled on board at 50 Hz and communicatedto a base sta- tion on the ground, communicating via a Bluetooth Class II devicewith a range of over 150 feets. Designed to replace serial cable and therefore op-erates at a bandwidth of 115200bps. This bandwidth of 115.2 kbps is sharedby all (of four) flyers. The base station on the ground performs DifferentialGPS (DGPS) and waypoint tracking tasks for all four flyers, and sends appro-

Page 42: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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 andpre planned control is performed via the ground station laptop using Labview.

To control height a sliding mode control is designed and the attitude loopwas designed LQR techniques. Angular deviations were penalised more thanrate deviations. Also, the pitch and roll loops were penalised identically, witha reduced penalty on the yaw deviations. On the STARMAC I platform alsomore advanced controller types are tested, such as integral sliding mode andreinforcement learning [21].

STARMAC II

The STARMAC II testbed is a sequel of first version with improvements atseveral points:

Page 43: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

3.2. MAJOR RESEARCH/EDUCATIONAL PROJECTS 25

• Thrust capabilities: Old motors and propellers were replaced with Brush-less motors and more rigid plastic propellers to double the output andenhance the total thrust up to a total of 4 kilograms.

• On-board computation resources: With the increased lift capabilities, itbecame possible to increase onboard computing power. Computation andcontrol are managed at two separate levels. The low level control thatperforms real-time control loop execution and control motor speeds, oc-curs on a micro-controller board based on the Atmega 128 processor.The high level planning, estimation and control occurs on a lightweightCross- bow Stargate 1.0 single board computer (SBC) running embeddedLinux. Alternatively an Advanced Digital Logic ADL855 PC104 runningKubuntu Linux can also be implemented, providing more computationalpower, at the cost of additional weight and hence shortened flight times.

• Communication reliability and bandwidth: The old Bluetooth was re-placed with a WiFi network, enables much greater bandwidth and im-proved communication channel management through a wireless router atthe central ground station. This has shown considerable improvementsin communication between the ground computer and quadrocopters ascompared with the Bluetooth capabilities of first version.

• Position measurement accuracy: Three-dimensional position and velocitymeasurements are now done using a carrier phase differential NovatelSuperstar II GPS unit with a resulting position accuracy of less than 2cm.For indoor flights, an overhead USB camera can be attached, with blobtracking software, to provide position sensing without GPS. The camerasystem gives less than 2 cm accuracy at 10 Hz rate, and provides a drop-inreplacement for GPS input to the EKF.

Instead of the LQR used in the STARMAC I in the STARMAC II Proportional-Integral- Derivative (PID) control was implemented for attitude, altitude andposition control. Not only the hardware was improved but also the mathemat-ical model of the quadrocopter. Three extra effects where quantified that relateto motion of the vehicle relative to the free stream.

Page 44: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad
Page 45: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

Chapter 4

Controller design and Simulink

model

4.1 Control Strategy

Quadrocopter has became very popular among researchers due to the advan-tages 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 heli-copters, and it can make manuevers that the conventional helicopters cannotmake. But from the aerodynamic point of view quadrocopter is inherently un-stable. To control the quadrocopter, many control schemes have been proposed.Robust feedback controllers based on H∞ techniques [14], fuzzy control, PDcontrollers [5], back-stepping controllers [5] and Neural-Network AdaptiveFlight Control [5] are just few examples of the control schemes proposed forcontrolling quadrocopter. For the experimentation done on the Stanford dra-ganflyer UAVs, nonlinear control methods were chosed that uses discrete-timedynamic inversion, under input saturation [10]. Another study done at the Uni-versity of Pennsylvania showed another control example, which used a visionbased control methodology for the control of UAVs [4].

All of the above stated control schemes expects the designers to have exten-sive understanding of the mathematical equations that governs the dynamics ofthe quadrocopter. To avoid the design complexities associated with above men-tioned control schemes, we decided to design the fuzzy controller for quadro-copter and analyze how it perform with quadrocopter as it has never beentested 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; pitchand roll. The deigned fuzzy controller was then used on quadrocopter sim-

27

Page 46: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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 Xand Y to maintain quadrocopter in hovering position. To design the fuzzy con-troller 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 ourfuzzy controllers. And we did not use any third input as used in article [3]. Andunlike article [3] we tested our controller on quadrocopter in HIL simulationsetup.

In design process of fuzzy controller, designers usually try to inject the exper-tise of experienced human operator into their controller so that, their controllercontrol the plant in a same way as experienced human operator do. To designthe fuzzy controller for quadrocopter we found a set of guidelines presentedin article [3] that describe how human operators control the quadrocopter.These guidelines were formulated after interviewing experienced quadrocopteroperators. These guidelines were written for how human operators perceivethe velocities and acceleration along different axes, and how they control thequadrocopter based on their perception. Despite we are not using velocitiesand accelerations as inputs, but we can use the same set of guidelines for ourcontroller with angles and the rates of angle of change as inputs as the veloci-ties and accelerations are directly propotional to the angles and rates of anglechange respectively. So we can mold the presented guidlines for our controllerwith 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 therate of change of bank angles of the vehicle from the point of view of theobserver.

2. Only qualitative information of the bank angles and the rate of change ofbank angles are available to the external pilot.

3. Except in high aerobatic maneuvers roll, pitch and yaw control of thevehicle are handled separately and independently.

4. When the observed angles of the vehicle are small (i.e. near hoveringpoint) more attention is paid to the angles of the quadrocopter than therate of change.

5. When the observed angles of the quadrocopter are large more attentionis paid to the vehicle angle change rate and more effort goes in to com-pensating the rate than that to the angles.

6. Control commands issued by the human operator could be any of thefour quantitative commands namely roll, pitch, thrust and yaw.

Page 47: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

4.2. QUADROCOPTER FUZZY CONTROLLER DESIGN 29

7. Observable angles and the rates of angle change are understood by thehuman operator as either small, medium or big. Accumulation of controlcommands is perceived as zero, small, medium and big.

We started designing the fuzzy controller for the quadrocopter in the light ofabove stated guidelines. Guideline 1 defines the inputs of the controller, namelythe angles and the rate at which angles change. Guideline 7 suggest five mem-bership functions for each input. We used triangular or trapezoidal shapes formembership 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 inFig. 4.1. Then in search of better performance we increased the input gains bycontracting the membership function closer to zero as shown in Fig. 4.2. But forthis setting we got oscillatory response, plus too high input gains also amplifiesthe noise and can cause serious disturbances specially when the input valuesare small. So, to rectify oscillations and avoid noise amplification we started re-ducing input gains by stretching membership functions gradually. After testingthe system with several membership functions settings, the input membershipfunctions setting presented in Fig. 4.3 were found best. The same procedurewas repeated for the second input and we got best results at the same settingsused 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. Thenwe increased output gains gradually to minmize the steady state error. But onhigh output gains we got oscillatory response. So we had to find the settingswhere the steady state error is minimized without oscillatory behavior. Fig-ure 4.4 shows the settings for output membership functions where we foundsuch response.

Page 48: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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 aboveguidelines. Guidelines 5, 6 and 7 suggest a subset of the rule base for the fuzzylogic 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 Fig4.5.

The implemented fuzzy controller is an equivalent of position PD controlleras clear from Fig. 4.5. But it can be seen how easily it is designed, even withoutmathematical model of the quadrocopter. In addition to this it has a big advan-tage over conventional PD controller that it is non-linear. The same controllercan 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 Matlabusing Simulink. The Simulink model are then downloaded to dSPACE computerbefore experimentation. We prefered to use Mamdani type fuzzy controller as itis the simplest and more intuitive [19] specially when controller design is basedon a set of guidelines describing the human behavior. Guideline 3 suggests that

Page 49: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

4.4. COMPLETE DESCRIPTION OF SIMULINK MODEL FOREXPERIMENTATION 31

Figure 4.4: Output of roll controller

the controller for each axes can be designed separately. So, we designed threesimilar 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 stepsas 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 "Serialrecieve" that are used to recieve sensory data from on-board computer. Theseblocks recieve 12 bytes data in every program cycle. They keep the data intobuffer until all 12 bytes are recieved. When all 12 bytes are recieved the data isforwarded serially as per FIFO scheme.

Page 50: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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. Theblock 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 pro-cesses the data from roll and pitch gyro sensors, respectively. The internal wok-ing of these two blocks are exactly same. Figure 4.8 shows the internal workingof one of these blocks. The gyro sensor reading is composed of two bytes whichare sent to these blocks. The significant byte is multiplied by 256 to shift 8 bitsleft side then the second byte is added into it. The data represents voltagesfrom 0 to 5V. 10 bits are used in ADC process, so the readings are multiplied

Page 51: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

4.4. COMPLETE DESCRIPTION OF SIMULINK MODEL FOREXPERIMENTATION 33

Figure 4.6: Rules surface

by 0.00488. As 0 value is represented by 2.5V we subtract 2.5 from the readingin next step. And in the last step we multiply reading with 100 to get final rateof angle change.

Accelearation sensor data processing

Three subsystem blocks namely; "X new", "Y new" and "Z new" are used toprocess accelearation sensor data for x,y and z axes, respectively. The internalwoking of these three blocks are exactly same. Figure 4.9 shows the internalworking of one of these blocks. Same as gyro sensor reading, Accelearationsensor 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 secondbyte is added into it. The data is represented as signed integer, so we use typeconversion block to convert signed integers to unsigned integers.

Heading sensor data processing

The subsystem block "heading" is used to process compass sensor data forheading. Figure 4.10 shows the internal working of the block. Same as gyroand Accelearation sensors reading, heading sensor reading is also composed oftwo bytes which are sent to this blocks. The significant byte is multiplied by256 to shift 8 bits left side then the second byte is added into it. As the data

Page 52: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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 to359.9 degrees.

4.4.4 Controllers

Pitch and Roll controllers

In step 4, two fuzzy controllers are implemented in two subsystem blocksnamely; "Roll controller" and "Pitch controller" to control roll and pitch an-gles, 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 thatis rate of angle change which is directly fed to fuzzy controller as input. Thesecond input is the angle that is determined by passing the rate of angle changethrough integral block.

Yaw, X, Y and Z axes controllers

Four fuzzy controllers are implemented in two subsystem blocks namely; "Xcontroller", "Y controller", "Z controller" and "Yaw controller" to controlX, Y, Z and yaw axes respectively. The internal working of all these blocksare exactly same, shown in Fig. 4.12. The processed outputs of compass andaccelearation sensor are fed to yaw controller and x, y, z blocks respectively.

Page 53: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

4.4. COMPLETE DESCRIPTION OF SIMULINK MODEL FOREXPERIMENTATION 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 outputof the controllers between the range of 0.059 and 0.09, because YGE motordrivers takes 0.059 and 0.09 as stop and full throttle, respectively. That is thereason every controller output is multiplied by a factor of 0.0031 to lie with inrange understood by YGE motor drivers. The controllers may generate signalof 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 generatingPWM signals for motors. As YGE motor controllers consider 0.059 as 0, adirect input of 0.059 is fed to all the motors. In addition to this, user can giveinput to the system to produce 80 percent of thrust through dSPACE GUI. Theoutput of Y controllers are fed to all motors as to control altitude all motors arerequired to produce more thrust equally to increase altitude or reduce equallyto decrease altitude. The outputs of X controller and roll controllers are fedto motors 2 and 4 with a sign change.The outputs of Y controller and pitch

Page 54: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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 ofYaw controller is fed to all motors, motor 1 and 3 are fed with opposite sign asof 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 gen-erated 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.

Page 55: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

4.4. COMPLETE DESCRIPTION OF SIMULINK MODEL FOREXPERIMENTATION 37

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

Page 56: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad
Page 57: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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 havebeen 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 ofthesis work, we are not able to perform experiments to the extent to satisfy

39

Page 58: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

40 CHAPTER 5. EXPERIMENTATION AND RESULTS

the objectives of the thesis. The YGE controller for motor 1 has burned out, somotor 1 cannot be operated. As motor 1 cannot be operated, we have to stopmotor 3. With remaining two motors it is certainly not possible to performexperiments for any of 6 axes except roll axes. To perform experiment for rollaxis, we built an experiment setup with the intension to limit the DOF to onlyone axis that is the roll axis. The setup we built for experimentation is shownin Fig. 5.1 in which it can be seen the quadrocopter is tied with ropes from topand 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 experimenta-tion plan was effected badly. With only two motors we could test our controllerfor roll axis. We performed several tests to validate the functionality and ap-plicability of our fuzzy controller. We are including some selected experimentsamong the several we performed during thesis work.

The experimentation setup we built allows the quadrocopter to be stabi-lized without motors in few seconds, if it is disturbed along roll axis. Here wecan give the example of pendulum. If pendulum is disturbed from its point ofstability, it stabilized back to this point after some oscillations. But there is adifference between our system and pendulum. The point of stability for pendu-lum is fixed, where pendulum attains minimum potential energy. But this is notthe case with our system. When we disturb the quadrocopter along roll axis,the eight threads used to limit the movements around other axes change theiradjusments that results in a slight change in the angle of stability for the tiedquadrocopter.

We performed the first experiment to analyze, how much time it takes thequadrocopter to get stabilized without motors. The results of this experimentis shown in Fig. 5.2.

In Fig. 5.2, it is shown that the quadrocopter is destabilized by an externalforce at around 11th second of the experiment. The quadrocopter became sta-bilized after around 8 seconds. Here we can see the difference between the angleof stability before the occurence of external disturbence and after it. This slightshift in the angle of stability for the quadrocopter is due to the re-adjustmentof the threads tied to quadrocopter, as stated earlier.

After performing experiment without motors we performed an experimentwith motors to analyze how the newly designed controller works to stabilizethe quadrocopter in our constrained experimentation setup. The results of thisexperiment are shown in Fig. 5.3.

In Fig. 5.3 it is shown that when the experiment was started the roll angleof the quadrocopter was around -4 degrees, means that the quadrocopter wastilted -4 degrees towards motor 2. At around 4th second of the experiment themotors were started with the power of 35 percent. The controller is started ataround 7th second. The activity of the motors can be seen in the second graph

Page 59: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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 tomotor 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 32degrees.After that controller stabilized the quadrocopter in less than 4 secondsthat 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 theroll 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 controllercontinously tried to overcome the error by increasing the speed of motor 2 andby decreasing the speed of motor 4, but still the roll angle remained unchanged.This is due to the limitations associated with our experimentation setup. Withtwo motors we cannot perform experiments with high motor speeds, becausethe torque produced by two motors destabilize the whole setup. And at lowermotor speeds we need high controller gains to stabilize the quadrocopter at

Page 60: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

42 CHAPTER 5. EXPERIMENTATION AND RESULTS

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

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

To support our arguments we performed an experiment. The results ofthis experiment are shown in Fig. 5.4. In this experiment we operated mo-tors with 30 percent of power. And we used multiple gains to find what valuefor controllers gain is most suitable to overcome steady state error. The GUI wedesigned on Control Desk for experimentation allow us to change the motorspeeds and controller gains during experiments.

In Fig. 5.4, it is shown that the roll angle was around -5 degrees when theexperiment was started. we powered up motors with 30 percent of maximumpower at around 6th second of the experiment that can be seen in second graphof Fig. 5.4. The controller was activated at around 12th second of the experi-ment. To overcome the error the controller speeded up the motor 2 and reducedthe speed of motor 4, but the controller gain was insufficient to overcome theerror. Then we increased the controller gain to 2 at 19th second that resultedin no change in roll angle. Then we gradually increased the controller gain till11 at around 104th second of the experiment, but we did not observe any sig-nificant change in roll angle. Then quadrocopter suddenly started to oscillateseverly, so we stop our controller. The oscillations we saw in Fig 5.4 usuallyhappened at gains above 3 if quadrocopter is destabilized by an external force.

Page 61: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

5.2. RESULTS 43

This experiment demonstrates the limitations of our experimentation setup andthe 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 higherspeeds. If we do so, the torque produced by the motors destabilizes the wholesetup. To demonstrate this behaviour we are including the results of an experi-ment that we performed at 60 percent of maximum power with controller gaineqaul 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 controllerthe quadrocoter is keeps on tilting towards the motor 4. We observed suchbehaviour whenever we operated motors at more than 40 percent of power.This is due to the torque produced by motors. The torque produced by theanti-clock wise motors is normaly cancelled out by the torque produced byclock wise motors. But in our case the clock wise motors are not working. We

Page 62: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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 movementalong roll axis.

After performing several experiments with different power settings and con-troller gains, we found that operating motors at 35 percent power with con-troller gain of 1 results in best performance for our tightly constrained exper-imental setup. To find these settings, we performed several experiments. Westarted from low power settings to high, with different values for gain. TheFig. 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 exampleof it. It represents the results for the experiment performed at 15 percent powerand gain value equals to 2.

Then we performed the experiment with 15 percent power with 2.5 con-troller gain. The results for this experiment are shown in Fig. 5.8. By compar-ing the results of the experiments performed at 15 percent power with different

Page 63: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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 causehigher and more oscillations.

Then we increased power to 25 percent and test our controller with gainequals to 1. The results for this experiment is shown in Fig. 5.9.

Then we performed experiment with same power settings but with differentcontroller gain values. Experiment shown in Fig. 5.10 was performed with 25percent power with controller gain value equals to 2.

Then we performed another experiment with same power setting of 25 per-cent with controller gain value equals to 2.5. The results for this experimentare shown in Fig. 5.11. We noticed the same trend with 25 percent power aswe noticed for 15 percent. But we found that the over all performance of thesystem with 25 percent is better than performance with 15 percent power.

In the search of better power and gain settings for our system, we increasedthe power to 35 percent. And we found that the power of 35 percent withcontroller gain values equals to 1 result in best performance for our system.The results of experiment with these power and gain settings are shown inFig. 5.3.

Page 64: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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. Theresults for these experiments are shown in Fig. 5.12 and in Fig. 5.13. But wenoticed 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 hada common issue that despite the right signals from the controller, the quadro-copter was never stabilized to set point. As stated earlier, we believe that thisissue is associated with our experimentation setup and harware problems. Thesetup we built for limiting the movements along other axes also affect the mo-tion along roll axis. In addition to this we cannot operate motors at high speedto avoid having excess clock wise torque. We also have problems in settinggains for controllers. With lower gains the quadrocopter cannot be stabilizedto the set point, simply because the controller signals are not enough to over-come the friction between the platform and the threads and to lift the one sideof quadrocopter. And with higher controller gain values we have uncontrolled

Page 65: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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 controlleractions in several experiments, we can safely assume that if this newly designedfuzzy controller is tested on the quadrocopter with all motors working andno contrained experimentation setup, it will perform well to maintain quadro-copter in hovering position.

Page 66: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

48 CHAPTER 5. EXPERIMENTATION AND RESULTS

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

Page 67: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

5.3. LIMITATIONS IN EXPERIMENTATION 49

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

Page 68: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

50 CHAPTER 5. EXPERIMENTATION AND RESULTS

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

Page 69: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

5.3. LIMITATIONS IN EXPERIMENTATION 51

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

Page 70: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

52 CHAPTER 5. EXPERIMENTATION AND RESULTS

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

Page 71: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

Chapter 6

Conclusions and future work

6.1 Conclusions

The objective of this thesis was to design the fuzzy flight controller for thequadrocopter. Initially we were designing the fuzzy controller for all six de-grees of freedom, but later the objective of the thesis was reduced to 3 degreesof freedom. After interfacing all the required sensors and establishing com-munication between the dSPACE computer and on-board micro-controller, thedesigned controller was tested in hardware in loop setup. The experiments tovalidate the functionality of the designed controller were performed in highlyconstrained experimentation setup because of major technical problems. De-spite major technical problems we managed to perform experiments and wegot satisfactory results. By analyzing the results we conclude that it is possibleto control the quadrocopter with fuzzy controller. However, it is not possiblenow to compare our results with other existing control approaches as the ex-perimentation was done in highly constrained setup. There is no guarantee thatthe designed controller is optimal. We strongly believe that the further tunningwill 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 controllerfor autonomous flying of quadrocopter. To achieve this objective, a ublox in-door GPS was bought. But unfortunately the indoor GPS does not catch satel-lite signals inside the lab. We tested the module in the university corridors andfound it works fine there. That is the reason the objective of the thesis waschanged from 6DOFs controller design to 3DOFs design. However, the GPSmodule has been to configured to work as per NMEA protocol, and a C func-tion is written and tested to translate the GPGGA message of NMEA protocolthat gives the sufficient information reqired for autonomous flying. Harware

53

Page 72: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

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. Thiswould be a neccessary step to integrate all things together to have a completeautonomous flight. And this would be a pre-requisite for GPS interfacing. Thiscan be done using available libraries in C.

6.2.3 Wireless connections

Currently we are using wired connections between dSPACE computer and on-board micro-controller for communicating sensor readings and . These wiredconnections has to be replaced with wireless connections to operate quadro-copter freely. We configured the XBee communication module for wireless con-nection and tested them by sending test data, but modules are not integrated inthe 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 controllersignals to quadrocopter on-board micro-controller. But it is not possible to sendPWM signals wirelessly through XBee communication module due to the bandwidth limitation associated with XBee communication modules. So, the PWMsignals have to be generated on-board. To do this, the on-board software hasto be modified. The internal PWM modules of micro-controller could be usefulin this regard.

Page 73: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

References

[1] skycar official website, 2011. (Cited on page 4.)

[2] B.Camlica. Demonstration of a stabilized hovering platform for under-graduate laboratory. 2004. (Cited on page 17.)

[3] S.A.A. Shakoor S.R. Munasinghe D.M.W . Abeywardena, L.A.K. Ama-ratunga. A velocity feedback fuzzy logic controller for stable hoveringof a quad rotor uav. Fourth Intemational Conf erence on Industrial andInformation Systems, IClIS, 2009. (Cited on pages 27 and 28.)

[4] E.Altug. Vision based control of unmanned aerial vehicles with applica-tions 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 engineer-ing, 2011. (Cited on pages 15 and 27.)

[6] Scott D. Hanford. A small semi-autonomous rotary-wing unmanned airvehicle (uav). Master’s 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. Tom-lin. 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. Quadro-tor helicopter flight dynamics and control theory and experiment. 2007.(Cited on page 22.)

[10] J. S. Jang. Nonlinear control using discrete-time dynamic inversion underinput saturation theory and experiment on the Stanford dragon fly UAVS.PhD thesis, Stanford University, 2003. (Cited on pages 15 and 27.)

55

Page 74: Quadrocopter Fuzzy Flight Controller - DiVA portaloru.diva-portal.org/smash/get/diva2:567121/FULLTEXT01.pdfInternational Master’s Thesis Quadrocopter Fuzzy Flight Controller Muhammad

56 REFERENCES

[11] I. Kroo and F. Prinz. The mesicopter: A meso-scale flight vehicle - niacphase i final report. technical report. Technical report, Stanford Univer-sity, 2001. (Cited on page 22.)

[12] I. Kroo and F. Prinz. The mesicopter: A meso-scale flight vehicle - niacphase ii technical proposal. technical report. Technical report, StanfordUniversity, 2001. (Cited on page 22.)

[13] J.G. Leishman. Principles of helicopter aerodynamics. Cambridgeaerospace series. Cambridge University Press, 2002. (Cited on pages 2and 4.)

[14] M. Huzmezan M. Chen. A Behavior-Based Control System for MobileManipulation. PhD thesis, University of British Columbia, 2003. (Citedon pages 15, 18, and 27.)

[15] E. B. Nice. Design of a four rotor hovering vehicle. Master’s thesis, Cor-nell University, 2003. (Cited on page 19.)

[16] A. Dzul P. Castillo and R. Lozano. Real-time stabilization and trackingof a four rotor mini-rotorcraft. IEEE transactions on control systemstechnology, 2003. (Cited on page 21.)

[17] P. Hynes J. Roberts P.Pounds, R.Mahony. Design of a four-rotor aerialrobot. 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 indoormicro quadrotor. 2003. (Cited on page 19.)

[19] S. N. Deepa S. N. Sivanandam, S. Sumathi. Chapter 6 - Introduction tofuzzy logic using MATLAB. Springer„ 2007. (Cited on page 30.)

[20] P. Uhleman S.Sassen. Quattrocopter a unique micro-aerial vehicle. Euro-pean 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-agentquadrotor testbed control design: Integral sliding mode vs. reinforcementlearning. In Proceedings 2005 IEEE/RSJ International Conference Intel-ligent Robots and Systems, 2004. (Cited on page 24.)