111
Institutionen för systemteknik Department of Electrical Engineering Examensarbete Attitude Control of a Hexarotor Examensarbete utfört i Reglerteknik vid Tekniska högskolan vid Linköpings universitet av Tobias Magnusson LiTH-ISY-EX--14/4779--SE Linköping 2014 Department of Electrical Engineering Linköpings tekniska högskola Linköpings universitet Linköpings universitet SE-581 83 Linköping, Sweden 581 83 Linköping

Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

Institutionen för systemteknikDepartment of Electrical Engineering

Examensarbete

Attitude Control of a Hexarotor

Examensarbete utfört i Reglerteknikvid Tekniska högskolan vid Linköpings universitet

av

Tobias Magnusson

LiTH-ISY-EX--14/4779--SE

Linköping 2014

Department of Electrical Engineering Linköpings tekniska högskolaLinköpings universitet Linköpings universitetSE-581 83 Linköping, Sweden 581 83 Linköping

Page 2: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully
Page 3: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

Attitude Control of a Hexarotor

Examensarbete utfört i Reglerteknikvid Tekniska högskolan vid Linköpings universitet

av

Tobias Magnusson

LiTH-ISY-EX--14/4779--SE

Handledare: Niclas Evestedtisy, Linköpings universitet

Thomas BarathUAS Europe AB

Examinator: Daniel Axehillisy, Linköpings universitet

Linköping, 12 juni 2014

Page 4: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully
Page 5: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

Avdelning, InstitutionDivision, Department

Department of Automatic ControlDepartment of Electrical EngineeringSE-581 83 Linköping

DatumDate

2014-06-12

SpråkLanguage

Svenska/Swedish

Engelska/English

RapporttypReport category

Licentiatavhandling

Examensarbete

C-uppsats

D-uppsats

Övrig rapport

URL för elektronisk version

http://urn.kb.se/resolve?urn=urn:nbn:se:liu:diva-109073

ISBN

ISRN

LiTH-ISY-EX--14/4779--SE

Serietitel och serienummerTitle of series, numbering

ISSN

TitelTitle

Attitydstabilisering av en Hexakopter

Attitude Control of a Hexarotor

FörfattareAuthor

Tobias Magnusson

SammanfattningAbstract

This master’s thesis has been on modeling, identification and control of a hexarotor system.It has been carried out on behalf of UAS Europe in Linköping. A set of non-linear dynamicequations describing the motion of the hexarotor were derived. These equations were thenimplemented in Matlab/Simulink, which became a good simulation environment for furtherstudies.

A decentralized control system using P-PD controllers was successfully implemented in bothsimulation and on a hexarotor platform. The non-linear simulation model and the hexarotorplatform were then identified using black box identification between virtual controls andangular rates. The result from identification of the hexarotor platform was not bad at all, butleft some room for improvements.

These linear models ware then used to tune the parameters of the inner PD controllers us-ing a method called placement of dominant poles. This method worked well in simulationenvironment but unfortunately not as well on the real platform.

NyckelordKeywords Multirotor, Multicopter, Hexacopter, Hexarotor, Black-box identification, PID

Page 6: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully
Page 7: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

Abstract

This master’s thesis has been on modeling, identification and control of a hexaro-tor system. It has been carried out on behalf of UAS Europe in Linköping. Aset of non-linear dynamic equations describing the motion of the hexarotor werederived. These equations were then implemented in Matlab/Simulink, whichbecame a good simulation environment for further studies.

A decentralized control system using P-PD controllers was successfully imple-mented in both simulation and on a hexarotor platform. The non-linear simu-lation model and the hexarotor platform were then identified using black boxidentification between virtual controls and angular rates. The result from iden-tification of the hexarotor platform was not bad at all, but left some room forimprovements.

These linear models ware then used to tune the parameters of the inner PD con-trollers using a method called placement of dominant poles. This method workedwell in simulation environment but unfortunately not as well on the real plat-form.

iii

Page 8: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully
Page 9: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

Acknowledgments

At first, I would like to thank UAS Europe for giving me the opportunity of doingmy master’s thesis. My colleagues Thomas, Thom and Patrik have not only beena very nice company during my days at the office but also helped me a lot withthe project. Without them, I would not have been able to get the hexarotor flying.I also want to thank my examiner, Daniel, and my supervisor at isy, Niclas, forbeing supportive and helpful whenever needed.

My biggest thanks is to my parents. Without your unconditional support throughout my entire life I would not even be close to where I am today. You have alwaysbeen there and have given me every opportunity to become the person I am today.You have always answered my questions about big and small, lived through mynever ceasing curiosity and inspired me to never stop learning.

Then I would like to give a big and special thanks to my partner Hedvig. Whenmy thesis work was ever going slow or not going at all you were there to comfortme and cheer me up.

And lastly, to all my fellow students during my five fantastic year at LinköpingUniversity I would like to say thank you! You have made my time as a student tothe best five years years of my life. I hope I will meet you all again!

Linköping, June 2013Tobias Magnusson

v

Page 10: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully
Page 11: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

Contents

Notation xi

1 Introduction 11.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Problem formulation . . . . . . . . . . . . . . . . . . . . . . . . . . 11.3 Previous works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4 Thesis outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Hexarotor 52.1 Basic movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.1.1 Throttle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.1.2 Roll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.1.3 Pitch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.1.4 Yaw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.2 Control loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.3 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.3.1 Autopilot Easy Pilot 3.0 . . . . . . . . . . . . . . . . . . . . 82.3.2 Propulsion system . . . . . . . . . . . . . . . . . . . . . . . . 82.3.3 RC transmitter and receiver . . . . . . . . . . . . . . . . . . 92.3.4 Sensors and filter . . . . . . . . . . . . . . . . . . . . . . . . 9

3 System Modeling 113.1 Frames of reference . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.2 Kinematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.3 Dynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3.3.1 Translational dynamics . . . . . . . . . . . . . . . . . . . . . 143.3.2 Rotational dynamics . . . . . . . . . . . . . . . . . . . . . . 14

3.4 Applied forces and torques . . . . . . . . . . . . . . . . . . . . . . . 153.4.1 Gravity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.4.2 Thrust and torque from propellers . . . . . . . . . . . . . . 163.4.3 Gyroscopic effects from propellers . . . . . . . . . . . . . . 183.4.4 Air friction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

3.5 Thruster model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

vii

Page 12: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

viii Contents

3.5.1 Propeller model . . . . . . . . . . . . . . . . . . . . . . . . . 193.5.2 Electrical motor model . . . . . . . . . . . . . . . . . . . . . 19

3.6 Final model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203.6.1 System input . . . . . . . . . . . . . . . . . . . . . . . . . . . 203.6.2 Total system model . . . . . . . . . . . . . . . . . . . . . . . 20

3.7 Simulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

4 Control design 254.1 Choice of control design . . . . . . . . . . . . . . . . . . . . . . . . 254.2 Control techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

4.2.1 Decentralization . . . . . . . . . . . . . . . . . . . . . . . . . 264.2.2 Cascade structure . . . . . . . . . . . . . . . . . . . . . . . . 264.2.3 The general pid controller . . . . . . . . . . . . . . . . . . . 27

4.3 Implemented control . . . . . . . . . . . . . . . . . . . . . . . . . . 284.3.1 Roll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284.3.2 Pitch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294.3.3 Yaw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304.3.4 Throttle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304.3.5 Scaling and rotor mapping . . . . . . . . . . . . . . . . . . . 30

4.4 Flight performance . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

5 Identification 355.1 Identification of a multirotor system . . . . . . . . . . . . . . . . . 355.2 Black box identification in a closed loop . . . . . . . . . . . . . . . 36

5.2.1 Choice of input signal . . . . . . . . . . . . . . . . . . . . . 365.2.2 Applying the input signal . . . . . . . . . . . . . . . . . . . 37

5.3 Concept evaluation in simulation . . . . . . . . . . . . . . . . . . . 405.3.1 Experiment set up and data processing . . . . . . . . . . . . 405.3.2 Roll axis identification experiment . . . . . . . . . . . . . . 415.3.3 Pitch axis identification experiment . . . . . . . . . . . . . . 425.3.4 Yaw axis identification experiment . . . . . . . . . . . . . . 425.3.5 Validation data . . . . . . . . . . . . . . . . . . . . . . . . . 445.3.6 Choosing model structure . . . . . . . . . . . . . . . . . . . 455.3.7 Identification of roll dynamics model . . . . . . . . . . . . . 455.3.8 Identification of pitch dynamics model . . . . . . . . . . . . 465.3.9 Identification of yaw dynamic model . . . . . . . . . . . . . 485.3.10 Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

5.4 Data acquired from real flight . . . . . . . . . . . . . . . . . . . . . 495.4.1 Roll axis identification experiment . . . . . . . . . . . . . . 505.4.2 Pitch axis identification experiment . . . . . . . . . . . . . . 525.4.3 Yaw axis identification experiment . . . . . . . . . . . . . . 54

5.5 Models identified from flight data . . . . . . . . . . . . . . . . . . . 565.5.1 Roll dynamic model . . . . . . . . . . . . . . . . . . . . . . 565.5.2 Pitch dynamic model . . . . . . . . . . . . . . . . . . . . . . 595.5.3 Yaw dynamic model . . . . . . . . . . . . . . . . . . . . . . . 61

Page 13: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

Contents ix

6 Controller Tuning 656.1 Placement of dominant poles . . . . . . . . . . . . . . . . . . . . . 656.2 Tuning in simulation . . . . . . . . . . . . . . . . . . . . . . . . . . 67

6.2.1 Quick and reactive response . . . . . . . . . . . . . . . . . . 686.2.2 Smooth and damped response . . . . . . . . . . . . . . . . . 70

6.3 Tuning of real platform . . . . . . . . . . . . . . . . . . . . . . . . . 716.3.1 Roll rate controller . . . . . . . . . . . . . . . . . . . . . . . 726.3.2 Pitch rate controller . . . . . . . . . . . . . . . . . . . . . . . 756.3.3 Yaw rate controller . . . . . . . . . . . . . . . . . . . . . . . 766.3.4 Flight test . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

7 Conclusions and further work 797.1 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 797.2 Further work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

A Blade flapping 83

B Residual analysis 85

C Basic control theory 87

Bibliography 89

Page 14: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully
Page 15: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

xi

Page 16: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

xii Notation

Notation

Notation in modeling

Symbol Meaning

η Vector describing the attitude of the body frame rel-ative the earth frame, also called Euler angles usingTait-Bryan formalism

θ Pitch angle, i.e. rotation of B1 around y1B

ξ Vector describing the body frame’s position in theearth frame

ρ Air densityτi Reaction torque from rotor iφ Roll angle, i.e. rotation of B around xBψ Yaw angle, i.e. rotation of B2 around z2

Bω Vector representing body angular ratesΩ Angular velocity of the propeller and motoraR Rotational air friction coefficientaT Linear air friction coefficientg Gravitational accelerationl Length of air frame arm, i.e. distance between center

of gravity and propellerm Mass of the hexarotorp Body angular rate around xB-axis (forward direction

of the body)q Body angular rate around yB-axis (right direction of

the body)r Body angular rate around zB-axis (down direction of

the body)rP Propeller radius

s · , c · , t · sin( · ), cos( · ), tan( · )u Forward speed of the hexarotorv Sideway speed of the hexarotorw Downward speed of the hexarotor

x, y, z The elements of the ξ-vectorxE , yE , zE Base vectors of the earth framexB, yB, zB Base vectors of the body fixed frame

Page 17: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

Notation xiii

Notation in modeling (cont...)

Symbol Meaning

B Body fixed frame of referenceCT Propeller thrust constantCQ Propeller torque constnatE Earth frame, used as inertial frame of referenceF Sum of all external forces on the hexarotorFw Total thrust produced by propellersFA Aerodynamic force produced by propellersFR Force caused by air frictionI Current of the DC-motorJ Inertia matrix expressed in the body frame

JP ,zz The moment of inertia of the propeller and motoraround the propeller shaft

Jxx The hexarotor body’s moment of inertia around xB-axis

Jyy The hexarotor body’s moment of inertia around yB-axis

Jzz The hexarotor body’s moment of inertia around zB-axis

Kt DC-motor torque constantKv DC-motor speed constantM Sum of all external torques on the hexarotorMp Torque around xB axis produced by differential pro-

peller thrustMq Torque around yB axis produced by differential pro-

peller thrustMq Torque around zB axis produced by differential reac-

tion torqueMA Aerodynamic torque produced by propellersMG Gyroscopic torque caused by the rotation of the rotorsMR Torque caused by air frictionQi Aerodynamic torque from propeller iRA Relation between ω and time derivative of ηRL Rotation matrix from earth frame to body frameTi Thrust produced by propeller iV Vector representing linear velocity of the hexarotor in

the body frameVin Input voltage to the DC-motor

Page 18: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

xiv Notation

Notation in controller

Symbol Meaning

δi Duty cycle of a PWM-signalθC Pilot commanded pitchθ Estimate pitch angleθD Desired pitch rateµ Derivative filter coefficient in time discrete PID-

controllerφC Pilot commanded rollφ Estimate roll angleφD Desired roll rateψC Pilot commanded yaw ratep Estimated roll rateq Estimated pitch rater Estimated yaw rateui Virtual control signal to rotor iKD Derivative parameter of a PID-controllerKI Integral parameter of a PID-controllerKP Proportional parameter of a PID-controllerTs Sample timeT C Pilot commanded throttleUp Virtual roll controlUq Virtual pitch controlUr Virtual yaw rate controlUw Virtual throttle control

Abbreviations and Acronyms

Acronym Description

ahrs Attitude and heading reference systemarx Auto-regression extra inputarmax Auto-regressive moving average extra inputcpu Central processing unitdc Direct currentesc Electronic speed controllergps Global positing systemimu Inertial measurement unitpid Proportional, integral, differential (regulator)psd Power spectral densitypwm Pulse width modulationrc Radio controlleruav Unmanned aerial vehiclevtol Vertical take-off and landing

Page 19: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

1Introduction

1.1 Background

The use and development of small unmanned aerial vehicles (uavs) have in-creased significantly over the last few decades. uavs can be used in several fieldand applications. People in possession of large grounds, such as farmers andforest owners, can use uavs to remotely inspect their properties. Rescue organi-sations like the coast guard can senduavs to search for capsized boats. Being ableto replace human pilots with autonomous aerial vehicles is obviously a tremen-dous advantage.

The vertical take-off and landing (vtol) uavs are in particular interest becauseof their ability to take off and land in a limited area and hover above targets.Such air crafts make for excellent camera platforms when producing films andtelevision.

UAS Europe AB is a company in Linköping specialized in development of uavs.Today their autopilot SkyView EasyPilot has the capability of flying fixed wingaircrafts autonomously. UAS wishes to integrate support for vtol uavs in the au-topilot and in particular multirotor vtol uavs. The specific multirotor platformwhich will be used during this project is a hexarotor, i.e. a small helicopter withsix vertical rotors.

1.2 Problem formulation

The goal of this master’s thesis is to control the attitude of a hexarotor platform.The final field of application of the product will most likely be surveillance andreconnaissance missions, implying flying at low speed following way points. Also,

1

Page 20: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

2 1 Introduction

the final controller should be applicable to other multirotor platforms than theone used in this project, why the controller should be as model-independent andeasily tuned as possible, without losing too much of the flight performance.

To obtain understanding of the system and to be able to evaluate different con-trol strategies a non-linear physical model will be derived and implemented inmatlab/Simulink. To synthesis and tune the controller the platform will be iden-tified using decoupled black box models. But to be able to perform the flight ex-periments a novice control system is needed. This will be a simple pid-controllerbased upon previous works and then tested in the simulation environment.

The goals of the master’s thesis are

• Derive and implement a non-linear physical model of a multirotor

• Develop and implement simple pid controllers for the attitudes

• Identify decoupled models of the angular rate dynamics

• Synthesize and tune attitude controller from identified models

1.3 Previous works

Understanding the non-linear and unstable dynamics of a multirotor system isthe core in most previous works. The basics of the model, the rotation and trans-lation of a rigid body can be found in every paper regarding modeling and controlof multirotor platforms.

Identification of different parameters is a time consuming and in many cases ex-pensive processes. Works of [Elsamanty et al., 2013] show that even though it ispossible, it demands a lot of equipment and multiple experiments. The param-eters will still only be valid for hovering, since recreating the condition duringforward flight is very difficult. The work load may very well correspond to amaster thesis of its own, why another solution must be found.

One approach that could prove useful is the one used in [Barsk, 2012, Beltraminiet al., 2011]. There the authors try to identify linear decoupled models with datacollected from flight experiments. The controllers are then designed using thesemodels.

Control of a multirotor platform is a widely explored field in previous work. Lotsof different model dependent control strategies have been proposed, such as back-stepping [Sanca et al., 2010, Arellano-Muro et al., 2013], linear quadratic [Bouab-dallah et al., 2004, Rinaldi et al., 2013], feedback linearization [Mokhtari et al.,2006] and model predictive control [Alexis et al., 2011, Abdolhosseini et al., 2013,Barsk, 2012].

However, the final controller should be model-independent and easily tuned. pidcontrollers is a well-tried concept and may very well prove enough to stabilize the

Page 21: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

1.4 Thesis outline 3

hexarotor. Earlier work, such as [Alaimo et al., 2014, Bouabdallah et al., 2004, Ri-naldi et al., 2013], shows that pid controller can be a suitable choice of controlstrategy. An interesting approach is used by [Elbir et al., 2013] where they iden-tify several linear models from flight data and then tune the pid controllers usingthese identified models.

1.4 Thesis outline

The outline of this thesis is as follows:

• Chapter 2 explains the basic about the flying platform used. If the reader iscompletely unfamiliar with multirotors, he or she should start by readingthis chapter.

• Chapter 3 deals with the physical modeling of the hexarotor. From Newtonand Euler’s law of motion a complete set of differential equations describingthe motion of the system are derived. The chapter also briefly describes howthe model was implemented in matlab/Simulink.

• Chapter 4 describes the initial novice controller and its key concepts andhow it was implemented in both simulation environment and on the autopi-lot.

• Chapter 5 contains the experiment design, data collection and system iden-tification performed and then presents the identified models.

• Chapter 6 deals with the synthesis and tuning of the control system and theevaluation of the flight performance after the tuning.

• Chapter 7 sums up this thesis with conclusions and some discussions of theresults.

Page 22: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully
Page 23: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

2Hexarotor

The multirotor platform used in this thesis is a hexarotor. It consists of six armsall connected symmetrically to the central hub. At the end of each arm a pro-peller driven by an electric motor is attached. All the propellers have fixed pitchblades, meaning that propellers can not be tilted (The movement of the classichelicopter is controlled by pitching the main propeller). The electronics usedfor communication and control are placed on the central hub together with thebattery.

2.1 Basic movement

The only way of controlling the hexarotor is through its propellers. Each pro-peller produces an upward thrust by pressing air downwards. Since the sourceof the thrust is located outside the center of gravity, differential thrust can beused to rotate the vehicle. The rotation of the rotors (motors and propellers) alsoproduce a reaction torque opposite of the direction of the rotation. Since half ofthe propellers are spinning in one direction, the net torque when all rotors haveequal speed is zero.

The are four basic movements: throttle, roll, pitch and yaw. These control signals,in this thesis denoted virtual control signals, are mapped to different ways ofchanging the propeller speed. The speed of every individual rotor is the sum ofthe four control signals’ contribution to that particular rotor.

Linear movement, i.e. fly the hexarotor along the ground, is controlled throughthe roll and pitch angle. That is, to move forward (in some sense) the hexarotoris tilted downwards. This will produce an acceleration in the forward direction.

5

Page 24: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

6 2 Hexarotor

2.1.1 Throttle

The main control of the hexarotor is the throttle. It is used to control the hexaro-tor’s movement in the body fixed vertical direction. Since the propellers are fixedpitched, the direction of the throttle is fixed. The biggest part of the throttle isused to counter act gravity. When increasing (decreasing) the throttle, the hexaro-tor will travel upwards (downwards). If the hexarotor is tilted, part of the thrustwill move the hexarotor in the tilted direction.

Figure 2.1: Throttle is produced by increasing (decreasing) the speed of allrotors equally much.

2.1.2 Roll

The roll command is used to rotate the hexarotor around its forward-axis. Rollingis performed by increasing (decreasing) the thrust produced by the propellers onthe right side of the hexarotor while decreasing (increasing) the thrust producedby the propellers on left side of the hexarotor. The total thrust will thus remainunchanged and the command leads only to a rotation.

Figure 2.2: Roll movement is produced by increasing (decreasing) the speedof rotors on right side while decreasing (increasing) the left side rotors’ speedequally much.

Page 25: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

2.1 Basic movement 7

2.1.3 Pitch

The pitch command is used to rotate the hexarotor around its right-axis. Pitchingis performed by increasing (decreasing) the thrust produced by the propellerson the front of the hexarotor while decreasing (increasing) the thrust producedby the propellers on the rear of the hexarotor. The total thrust will thus remainunchanged and the command leads only to a rotation.

Figure 2.3: Pitch movement is produced by increasing (decreasing) the rearrotors’ speed while decreasing (increasing) the front rotors’ speed.

2.1.4 Yaw

The yaw command is used to rotate the hexarotor around its vertical axis. Yaw-ing is performed by increasing (decreasing) the thrust produced by the propellersrotating clockwise while decreasing (increasing) the thrust produced by the pro-pellers rotating counter-clockwise. The total thrust will thus remain unchangedand the command leads only to a rotation.

Figure 2.4: Yaw movement is produced by increasing (decreasing) the speedof the rotors rotating clockwise while decreasing (increasing) the rotors ro-tating counter clockwise.

Page 26: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

8 2 Hexarotor

2.2 Control loop

The control system on the hexarotor is divided into an inner and an outer loop.The inner loop controls the attitude and height while the outer loop controlsthe position. The position is controlled by sending reference values to the innercontroller. The outer loop could either be a pilot with a radio controller flyingin stabilized mode or a control system running on board. The task of the outerloop could either be to maintain a hover position or following way points from anavigation system.

Inner controller HexarotorOuter controller

Attitude, altitude

Position

Navigation

system

Figure 2.5: A brief overview of the different blocks in the control chain

2.3 Hardware

The core of the hardware is the autopilot Easy Pilot developed by UAS EuropeAB. It contains two central processing units (cpus) responsible for control, com-munication and sensor data processing. A bunch of sensors are used such as aninertial measurement unit (imu), a barometer and a gps-receiver. The systemcan receive flight commands through a radio controller (rc) or through a groundstation control. The autopilot is also capable of sending back flight data to theground station. A map of the different hardware components is seen in Figure2.6.

2.3.1 Autopilot Easy Pilot 3.0

The flight board used is the Autopilot Easy Pilot 3.0 developed by UAS EuropeAB. Its core are the two central processing units. The main cpu is responsiblefor communication and controlling the air vehicle. The secondary cpu collectsdata from sensors and filters that data. The board also contains a modem forcommunication with a ground station.

2.3.2 Propulsion system

Each propulsion system consists of an electronic speed controller (esc), a brush-less electronic motor and a propeller. The propellers used are 11 inch slow flight

Page 27: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

2.3 Hardware 9

AHRS

Main CPU

IMU Magnetmetometer

GPSBarometer

ESCMotor

ESCMotor

ESCMotor

ESCMotor

ESCMotor

ESCMotor

SBU

S-Receiver

Mod

em

Figure 2.6: An overview of the different hardware components used on theplatform.

propellers. They are driven by NTM Prop Drives Series 28-30A 800kv brushlessmotors. They are capable of rotating up to 18400 rpm without any load. A brush-less motor cannot be driven directly by a pwm signal. It is instead controlled byan esc, the one used in this project is a Turnigy Plush 25A. The esc receives apwm signal from the flight board and controls the motors by rapidly turning onand off the current to the different poles in the motor.

2.3.3 RC transmitter and receiver

The transmitter is the radio controller Futaba T7C. It is used to control the hexaro-tor by sending reference values for roll, pitch, yaw and throttle. The operator canthen control the hexarotor through its control system, in a mode called stabilizedflight. The receiver for the radio controller is a Futaba R6203SB. It transfers thereceived commands through a serial bus to the autopilot.

2.3.4 Sensors and filter

To keep track of the attitude, heading and position of the hexarotor an arrayof sensors together with a software filter is needed. On the autopilot board allthe needed sensors are integrated except for the external gps-receiver. On thesecondary cpu a filter used to estimate heading and attitude of the hexarotor isrunning. A compilation of the states, sensors and data processing can be seen in

Page 28: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

10 2 Hexarotor

Table 2.1.

The sensors used to estimate the angular velocity of the body are gyroscopes,one for each body axis. The gyro signals are low pass filtered before sent to thecontrol loop. To estimate the attitude of the hexarotor the gyroscopes are usedtogether with accelerometers. The estimation is made by a complementary filter.The attitude is estimated by integrating the angular velocities from the gyroscope.Since all gyros have a small drift the accelerometers are used to compensate forthat drift. The estimation of heading of the body is made in a similar manner, butinstead of accelerometer data a magnetometer is used.

The estimation of position, that is longitude and latitude, is made by the gps. Thegps can also estimate altitude and direction of velocity. Since a hexarotor can flyin any direction (not just forward, compared to a fixed wing aircraft) the flightdirection does not have be equal to the body heading.

Finally, the two barometers measure static pressure and dynamic pressure respec-tively. From these measurement the altitude and change of altitude can be foundas well as air speed.

State Sensors used Processing

Body angular velocities Gyroscope Low pass filteringAttitude (roll and pitch) Gyroscope, accelerometer Complementary filterBody heading (yaw) Gyroscope, magnetometer Complementary filterLatitude and longitude gps -Flight direction gps -Flight speed gps -Altitude Barometer Low pass filteringAltitude change Barometer -

Table 2.1: How the different states are obtained and estimated

Page 29: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

3System Modeling

3.1 Frames of reference

Let E = xE , yE , zE be an inertial frame with origin on the surface of the earth. Asconvenient when describing aircraft motion, the earth fixed frame is a north-east-down-system (NED-system) with xE pointing to the north, yE pointing to the eastand zE pointing downwards [Cook, 2007].

Also, introduce B = xB, yB, zB as a body fixed frame with origin at the hexaro-tor’s center of gravity. xB is equivalent with the forward direction of the hexarotor,yB with right and zB with down. This choice of body fixed frame has the advan-tage that the inertia tensor is time-invariant and that the body symmetry willsimplify the equations.

yExE

zE

yB

xB

zB

ξ

φ

θ

ψ

Figure 3.1: The two frames of reference and their relation

11

Page 30: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

12 3 System Modeling

3.2 Kinematics

The body fixed frame’s position in the earth fixed frame can be described by thevector ξξξ = [ x y z ]T and its orientation, attitude and heading, by the vectorηηη = [ φ θ ψ ]T . The angles used to represent the orientation are definedusing Tait-Bryan formalism. This type of formalism differs from proper Eulerangles by using three different axes when forming the rotation [Bishop, 2007].Within aerospace literature this representation is often referred to as Euler angles,which may cause some confusion.

The adopted order of rotation is commonly used when describing aircraft motion[Cook, 2007, Merzouki et al., 2012]. To bring the body fixed frame into coinci-dence with the earth fixed frame the following rotations are considered:

• First, rotate the body-fixed frame about the xB-axis by the roll angle φ, re-sulting in a new frame of reference called B1.

• Then, rotate the new frame B1 about the new axis y1B by the pitch angle θ,

resulting in a new frame of reference called B2.

• Lastly, rotate the new frame B2 about the new axis z2B (which coincide with

zE) by the yaw angle ψ, resulting in a new frame aligned with the earthfixed frame.

In order to transform any linear quantity from earth frame to body frame rotationmatrices are used. In order to simplify the notation sin( · ) and cos( · ) are abbrevi-ated s · and c · respectively. The relation between B and B1 after the rolling canbe described by

xByBzB

=

1 0 00 cφ sφ0 −sφ cφ

x1By1Bz1B

(3.1)

where the rotation matrix is denoted R(x, φ). In similar manner, after the pitchingB1 is related to B2 via

x1By1Bz1B

=

cθ 0 sθ0 1 0−sθ 0 cθ

x2By2Bz2B

(3.2)

with the rotation matrix R(y, θ). After the final yawing B2 and E are related by

x2By2Bz2B

=

cψ sψ 0−sψ cψ 0

0 0 1

xEyEzE

(3.3)

Page 31: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

3.2 Kinematics 13

using the rotation matrix R(z, ψ). The total rotational matrix, to transform anyquantity from earth frame to body frame, is obtained by multiplying R(x, φ),R(y, θ) and R(z, ψ). That yields

xByBzB

=

cθcψ cθsψ −sθsφsθcψ − cφsψ sφsθsψ + cφcψ sφcθcφsθcψ + sφsψ cφsθsψ − sφcψ cφcθ

xEyEzE

(3.4)

and the total rotational matrix is denoted RL. This matrix is sometimes referredto as the direction cosine matrix. One convenient feature of RL is that its inverseis equal to the transpose, that is R−1

L = RTL , since RL ∈ SO(3) [Siciliano and Khatib,2008]. This is useful when transforming quantities in the body fixed frame to theearth fixed frame.

Denote the linear velocity of the hexarotor expressed in the body fixed frameVVV = [ u v w ]T . Then the second time derivative of the position ξξξ is

ξξξ = RTLVVV (3.5)

In order to relate the change of attitude with the body angular velocities the dif-ferent steps of the rotation have to be considered [Sidi, 1997]. First, denote thebody angular velocitiesωωω = [ p q r ]T , where p is rotation around the xB-axis,q is rotation around the yB axis and r is rotation around the zB-axis.

The first rotation applied to the earth fixed frame, the yawing, is subject to threesuccessive angular transformation: rotation around zE , y1

B and xB. The second ro-tation, the pitching is subject to two successive angular transformation: rotationaround y1

B and xB. Lastly, the rolling is only subject to one attitude transforma-tion: rotation around xB. That gives the relation

pqr

= R(x, φ)R(y, θ)R(z, ψ)

00ψ

+ R(x, φ)R(y, θ)

0θ0

+ R(x, φ)

φ00

=

1 0 −sθ0 cφ sφcθ0 −sφ cφcθ

φθψ

(3.6)

where the final transformation matrix is denoted RA. Then the time derivate ofthe hexarotor’s attitude ηηη is

ηηη = R−1A ω (3.7)

and with t · short for tan( · ) the inverse can be written

R−1A =

1 sφtθ cφtθ0 cφ −sφ0 sφ

cθcφcθ

(3.8)

Page 32: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

14 3 System Modeling

3.3 Dynamics

To begin with, the general equations of linear and angular motion of a rigid bodymust be derived. To do this, Newton-Euler formalism is used. In order to distin-guish between quantities expressed in different frames of reference, the followingnotation is used:

• A quantity expressed in the inertial earth frame is denoted XE

• A quantity expressed in the body fixed frame is denoted XB

• A quantity already defined in a frame of reference, e.g. ωωω, will not have thenotation above.

3.3.1 Translational dynamics

In the earth fixed inertial frame, Newton’s second law can be applied [Taylor,2005], giving

FFFE = mξξξ = maaaE (3.9)

where the time derivate is with respect to the inertial frame and aaaE is the accel-eration of the body fixed frame expressed in the inertial frame, m is the mass ofthe body which is constant and FFFE is the sum of all external forces applied tothe body expressed in the inertial frame. However, it would be convenient to ex-press the dynamics in the body fixed frame. By using the rotational matrix fromequation (3.5) a change of basis can be obtained and the expression becomes

RLFFFB = mRLaaa

B = mRL

(dVVVdt

)E

(3.10)

where the time derivate is still with respect to the inertial frame and VVV is the ve-locity of the body fixed frame expressed in the body fixed frame. Computing thatderivative is rather cumbersome, but using a well-known relation, sometimescalled the transport theorem, yields

FFFB = m

((dVVVdt

)B

+ωωω × VVV)

(3.11)

Let the time derivative with respect to the body fixed frame be denoted by a dot,then the final equation of the translational dynamics expressed in the body fixedframe is

FFFB = mVVV +ωωω ×mVVV (3.12)

3.3.2 Rotational dynamics

Again starting in the inertial frame, Euler’s second axiom is

MMME = LLLE (3.13)

where the time derivative is with respect to the inertial frame, LLLE is the angularmomentum of the body expressed in the earth frame and MMME is the sum of all

Page 33: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

3.4 Applied forces and torques 15

external torques applied to the body expressed in the earth frame. The quantitiescan be expressed in the body fixed frame by applying the rotational matrix forangular velocities from equation (3.7), giving

RAMMMB = RALLL

B = RA

(dJωωωdt

)E

(3.14)

where LLL = Jωωω and J is the inertia matrix expressed in the body frame. Differen-tiating J with respect to the earth frame is rather difficult since it will be time-dependent. Instead, using the transport theorem again, the expression becomes

MMMB =(

dJωωωdt

)B

+ωωω × Jωωω (3.15)

Since the choice of body fixed frame ensured that the inertia matrix is time in-variant, the final equation is

MMMB = Jωωω +ωωω × Jωωω (3.16)

3.4 Applied forces and torques

The relations in equation (3.12) and (3.16) are general equations of motion for arigid body. Now, it is time to apply them to the hexarotor system by finding thedifferent components of the external forces FFF and torques MMM. This will be donein similar manner as [Bresciani, 2008, Pounds et al., 2010].

The forces and torques acting on the hexacopter are gravity, air friction aerody-namic forces and torques produced by the propellers and the gyroscopic effectsfrom the rotation of the propellers. The torque caused by the angular accelera-tion of the propeller has been neglected. All quantities are expressed in the bodyfixed frame unless anything else is stated.

Tk , Ωk Tj , Qj

ΩjQk(a) Thrust, reaction torque anddirection of rotor rotation

T6T1

T2

T3

T4

T5

mg

(b) Thrusts and gravity appliedto the rigid body

Figure 3.2: Forces and torques produced by rotors. k = 2,4,6 and j = 1,3,5

Page 34: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

16 3 System Modeling

3.4.1 Gravity

First off is the gravity which is the only force or torque which is naturally ex-pressed in the earth frame. The gravitational force is acting on the hexacopter’scenter of gravity according to Euler’s first axiom and is directed along the zE-axis.In the body fixed frame the contribution of the gravitional force FFFBG is

FFFBG = RL

00mg

= mg

sθsφcθcφcθ

(3.17)

where g is the acceleration due to gravity.

3.4.2 Thrust and torque from propellers

The second contribution is the thrust produced by the aerodynamics of the pro-pellers and reaction torque from the rotation of the rotors. Figure 3.2 showswhere the forces are applied on the air frame.

The sum of the thrust from the different propellers is total lift force and is alwaysdirected along the negative zB-axis. If the thrust from propeller i is denoted Ti ,then the lift force Fw is

Fw = T1 + T2 + T3 + T4 + T5 + T6 (3.18)

Since the sources of thrust, i.e. the propellers, are not located in the center ofgravity, they will create torques around the different axes of rotation. With somebasic geometry seen in Figure 3.3, it’s easy to find the produced torque. Aroundthe xB-axis the torque Mp from propeller thrust is

Mp = − l2T1 − lT2 − l2T3 +

l2T4 + lT5 +

l2T6 (3.19)

where l is the length of each arm. Around the yB-axis the torque Mq is

Mq =

√3l2T1 −

√3l2T3 −

√3l2T4 +

√3l2T6 (3.20)

The torque around the zB-axis is a result of Newton’s third law. When the DC-motor accelerates and keeps the propeller rotating, it exerts a torque on the pro-peller shaft. The motor will be subject to an equally sized torque in oppositedirection from the propeller shaft. Since the motor is mounted to the airframe,the torque will propagate to the airframe. This torque is often called reactiontorque. If the reaction torque from propeller i is called τi the total torque aroundthe zB-axis denoted Mr is

Mr = −τ1 + τ2 − τ3 + τ4 − τ5 + τ6 (3.21)

The reaction torque is produced by two different sources. When the motors andpropellers accelerate, they will exert a torque on the air frame. Also, pressingthe propeller through the air creates friction. This friction is called aerodynamic

Page 35: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

3.4 Applied forces and torques 17

30

xB

yB

60

l

Figure 3.3: The geometry of the hexarotor seen from above

torque. The contribution from accelerating the propeller is neglected since itsduration will be very quick, and thus the reaction torque will be equal to theaerodynamic torque.

The thrust and aerodynamic torque produced by a propeller can be related tothe rotational speed of the propeller blades. A simplified relation of the thrustgeneration model used in [Bouabdallah, 2007] is used for now. If the rotationalspeed of propeller i is denoted Ωi , then the generated thrust Ti is

Ti = kTΩ2i (3.22)

where kT is a propeller specific constant explained more thoroughly later. In thesame way, the aerodynamic torque Qi of propeller i becomes

Qi = kQΩ2i (3.23)

where kQ is a propeller specific constant.

Now, the total torque MMMA from the aerodynamic effects of the propeller can bewritten

MMMA =

− l2kTΩ

21 − lΩ2

2 −l2kTΩ

23 +

l2kTΩ

24 + lΩ2

5 +l2kTΩ

26

√3l2kTΩ

21 −√

3l2kTΩ

23 −√

3l2kTΩ

24 +

√3l2kTΩ

26

−kQΩ21 + kQΩ

22 − kQΩ2

3 + kQΩ24 − kQΩ2

5 + kQΩ26

(3.24)

and the total force FFFA becomes

FFFA =

00

−kT (Ω21 + Ω2

2 + Ω23 + Ω2

4 + Ω25 + Ω2

6)

(3.25)

Page 36: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

18 3 System Modeling

3.4.3 Gyroscopic effects from propellers

A propeller is a mass which rotates both around the propeller shaft, but since itis connected to the airframe, it will follow the rotations of the airframe. If therotation around the shaft is the spin and the rotation of the airframe is the pre-cession, the gyroscopic torque produced by the propeller can be found. The spinquantity is already defined as Ωi and the precession vector as ω. The gyroscopictorqueMMMGi from propeller i is

MMMGi = ω × JP 0

0(−1)iΩi

(3.26)

where JP is the inertia matrix of the propeller around the propeller axis and thefactor (−1)i comes from the fact that the propellers rotate in opposite directions.Using the fact that the inertia matrix is a diagonal matrix the expression can besimplified to

MMMGi = ω × 0

0JP ,zz(−1)iΩi

=

qJP ,zz(−1)iΩi

−pJP ,zz(−1)iΩi0

(3.27)

Summing up all propellers, the total gyroscopic torqueMMMG is

MMMG =

qJP ,zz(−Ω1 + Ω2 −Ω3 + Ω4 −Ω5 + Ω6)−pJP ,zz(−Ω1 + Ω2 −Ω3 + Ω4 −Ω5 + Ω6)

0

(3.28)

3.4.4 Air friction

The air frames movement through the air will cause friction. Because of the shapeof the air frame, the air friction is assumed to be low and a simple model issufficient. The model of the air friction is given by

FFFR = −AT ·VVV (3.29)

MMMR = −AR ·ωωω (3.30)

where AT and AR are diagonal matrices with diagonal elements aT and aR respec-tively.

3.5 Thruster model

The thruster model can be separated into two subsystems: the propeller and theelectric motor. The propeller converts rotational speed into thrust and the elec-trical motor converts voltage into rotational speed. This part of the modeling isquite often neglected, but can have a big impact of the performance. The most im-portant part is the time delay of the propulsion system which is the time betweenthe pwm-signal is calculated and the propeller reaching the desired speed.

Page 37: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

3.5 Thruster model 19

3.5.1 Propeller model

A proper, accurate propeller model includes but is not limited to studying ofmomentum theory, blade element theory, relative airflow, blade flapping and thebending and twisting of the propeller blades as in works of [Khan and Nahon,2013]. It is a quite complicated subject, and much of the result comes out asempirical data. A basic propeller model, as found in [Pounds et al., 2010], statesthat the generated thrust T is

T = CT ρr4P πΩ

2 (3.31)

where ρ is the air density, rP is the propeller radius and CT is the thrust coefficientof the propeller. Similarly, the aerodynamic torque Q can be expressed as

Q = CQρr5P πΩ

2 (3.32)

where CQ is the propeller torque constant. Modeling CT and CQ is the compli-cated part of the propeller model and is mostly done empirically. The constantswill depend on the geometry of the propeller as well as the direction the pro-peller is traveling in. An extended model of a propeller taking theses factors intoaccount can be found in [Khan and Nahon, 2013].

3.5.2 Electrical motor model

The electrical motors used on the platform are rather complex to model in detail.The esc receives a pwm-signal which it decodes to a desired rotor speed. Themotor contains permanent magnets. To make the magnets rotate, a magneticfield is moved around the housing of the motor. The magnets are trying to followthat magnetic field, and a rotation is created. The speed of this rotation dependson how fast the magnetic field is moved around which is made by turning on andoff the poles in the housing.

The interesting part of the dynamics of the rotor is the time constant and the pwmto rotor speed relation. Because of that, a pwm to voltage mapping and a classicmodel of a dc-motor is considered sufficient for the purpose of this thesis. Thepwm to voltage mapping is described in Chapter 3.7. A second order dc-motormodel is found in [Ljung and Glad, 1999]. By assuming that the inductance andthe friction caused by the moving parts of the motor are zero the model becomesa first order model which is considered enough. The model is defined by

I =Vin − KvΩ

R(3.33a)

Ω =KtIP

+ I − τIP

(3.33b)

τ = Q (3.33c)

where I is the current, Vin is the voltage input, Kv and Kt are speed and torqueconstants, Ω is the motor speed, τ is the reaction torque andQ is the aerodynamictorque.

Page 38: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

20 3 System Modeling

3.6 Final model

Combining the first derivative of the position equation (3.5), the first derivative ofthe orientation equation (3.7), the translational dynamics equation (3.12), the ro-tational dynamics equation (3.16), and the external forces equations (3.17), (3.24),(3.25) and (3.28) the final model becomes

ξξξ = RTLVVV (3.34a)

mVVV = −ωωω ×mVVV + BFFFG + BFFFA + BFFFR (3.34b)

ηηη = RTAωωω (3.34c)

Jωωω = −ωωω × Jωωω + BMMMA + BMMMG + BMMMR (3.34d)

3.6.1 System input

The input to the system can be chosen as several physical quantities. To fulfill therequirement of platform independence, or at least make the model as modular aspossible, one can choose the system input as total aerodynamic force and torqueproduced by the propellers and the gyroscopic torque as a disturbance.

To extend the model, the rotational speed of the propellers can be chosen as inputto the system. Then the model can include a complex relation between rotationalspeed of the propellers and generated trust and reaction torque. Going evenfurther, one can include the electrical motors in the model. These are controlledby the pwm-input to the esc, and then the duty cycle of the pwm-signals couldbe the input signal.

In this model, the rotational speed of the propellers will be chosen as input. Tosimplify notation, these will be mapped to the virtual input signals by

Fw = kT (Ω21 + Ω2

2 + Ω23 + Ω2

4 + Ω25 + Ω2

6) (3.35a)

Mp = − l2kTΩ

21 − lkTΩ2

2 −l2kTΩ

23 +

l2kTΩ

24 + lkTΩ

25 +

l2kTΩ

26 (3.35b)

Mq =

√3l2kTΩ

21 −√

3l2kTΩ

23 −√

3l2kTΩ

24 +

√3l2kTΩ

26 (3.35c)

Mr = −kQΩ21 + kQΩ

22 − kQΩ2

3 + kQΩ24 − kQΩ2

5 + kQΩ26 (3.35d)

WG = (−Ω1 + Ω2 −Ω3 + Ω4 −Ω5 + Ω6) (3.35e)

where Fw corresponds to the third component of aerodynamic force FA from thepropellers defined by equation (3.25) and Mp, Mq and Mr to the components inthe aerodynamic torques MA defined by equation (3.24) and where WG is theinput to the disturbance caused by gyroscopic torques.

3.6.2 Total system model

For convenience, the system model is written in component form where the in-puts have been included

x = cθcψu + (sφsθcψ − cφsψ)v + (cφsθcψ + sφsψ)w (3.36a)

Page 39: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

3.7 Simulator 21

y = cθsψu + (sφsθsψ + cφcψ)v + (cφsθsψ − sφcψ)w (3.36b)

z = −sθu + sφcθv + cφcθw (3.36c)

u = rv − qw + sθg − aTmu (3.36d)

v = pw − ru + sφcθg − aTmv (3.36e)

w = qu − pv + cφcθg − 1mFw − aTm w (3.36f)

φ = p + sφtθq + cφtθr (3.36g)

θ = cφq − sφr (3.36h)

ψ =sφ

cθq +

cθr (3.36i)

p =Jyy − JzzJxx

qr +1Jxx

Mp +JP ,zzJxx

qWG − aRJxxp (3.36j)

q =Jzz − JxxJyy

rp +1Jyy

Mq −JP ,zzJyy

pWG − aRJyyq (3.36k)

r =Jxx − JyyJzz

pq +1JzzMr − aRJzz

r (3.36l)

3.7 Simulator

The model derived earlier was implemented in matlab/Simulink. The aim wasto make it modular, easily upgradeable and modifiable in terms of number ofpropellers and configuration. This led to a Simulink model divided into severalsubsystems. The subsystem containing the thruster could easily be altered to aquadcopter or octacopter by just changing a variable in the configuration file.

The dynamic model is implemented in several subsystems according to Figure3.4. The core is an arbitrary rigid body which is subject to external forces andtorque. The rigid body contains information about its mass and moment of iner-tia. The output from the rigid body is velocity, acceleration, angular accelerationand angular speed according to equations (3.34b) and (3.34d).

The external forces are gravity, air friction and aerodynamic thrust and torqueas in equations (3.34b) and (3.34d). Gravity and air friction are implementedstraight forward. To transform gravity into body coordinates, the function blockneeds the angles of the hexarotor.

The aerodynamic thrust and torque are implemented in a more complex blockwhich is seen in Figure 3.5. The input signal to the thruster is the duty cycleof the PWM-signal. This is mapped to a voltage according to [Khan and Nahon,2013], that is

Vin = P (δ) = 4.99 · 10−9δ3 − 2.66 · 10−5δ2 + 4.93 · 10−2δ − 27.33δ (3.37)

The DC-motor is an implementation of equation (3.33) which takes a voltage Vin

Page 40: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

22 3 System Modeling

Rigid body

J, m

V

V

ω

ω

F

M

+

Gravity

Air friction

VAT

Air friction

ωAR

Thrusters

+MA

FA

MG

FG

FR

MR

δi

Figure 3.4: A block diagram showing how the dynamic equations are imple-mented in Simulink. A rigid body translate the external forces generated bygravity, air friction and the thrusters into translational and rotational move-ment.

and aerodynamic torque Qi as inputs and produces an angular velocity Ωi and areaction torque τi . The propeller block is an implementation of equations (3.31)and (3.32). From the angular speed of the motor it produces thrust and reactiontorque. It contains information about the propeller: thrust and torque constantsCT and CQ, air density ρ and propeller radius r. The gyroscopic block realizesequation (3.27), converting angular speed of the rotor and body angular rate ofthe hexarotor to gyroscopic torque MGi .

Only one thruster block is implemented. Instead of making six equal blocks, thethruster block has vectors as inputs and outputs. Every element in the vectorrepresents a thruster. This makes it possible to simulate not just hexarotors, but

DC-motor

Kt , Kv ,JP ,zz , RΩ

τiVin

PWM-to-voltage

δ P (δ)ω

Gyroscopic

JP ,zzMGi

Qi

Propeller

CT , CQ, ρ, r Ti

Geometry

MG

FA

MA

l

Figure 3.5: A block diagram of a thruster implemented in Simulink.

Page 41: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

3.7 Simulator 23

a multirotor with an arbitrary number of rotors.

In order to make the system as arbitrary as possible with respect to number ofrotors, the geometry block had to be implemented. This block maps the thrustand torques produced by the arbitrary number of propellers to net forces andtorque exerting on the hexarotor. It contains information about length of thearms, propeller rotation direction and the geometry seen in Figure 3.3, i.e. theposition of the thruster with respect to the body-fixed frame.

The numerical parameters used in the simulation are a mixture of previous, sim-ilar projects and measurements of the the real platform. In Table 3.1 all parame-ters used in the simulator can be found.

Name Description Numerical value Source

m Mass of platform 2.1 kg Measurementl Length of arm 0.32 m MeasurementIxx Moment of inertia around x-

axis3.8 · 10−3 kgm2 [Sanca et al., 2010]

Iyy Moment of inertia around y-axis

3.8 · 10−3 kgm2 [Sanca et al., 2010]

Izz Moment of inertia around z-axis

7.1 · 10−3 kgm2 [Sanca et al., 2010]

CT Propeller thrust constant 0.01458 [Sanca et al., 2010]CQ Propeller torque constant 1.037 · 10−3 [Sanca et al., 2010]r Propeller radius 0.14 m MeasurementKv Motor constant 4.19 · 10−3 Vs/rad [Sanca et al., 2010]Kt Motor constant 4.19 · 10−3 Nm/A [Sanca et al., 2010]R Motor resistance 1 Ω [Sanca et al., 2010]IP ,zz Motor and propeller inertia

around propeller shaft4.3 · 10−5 kgm2 [Sanca et al., 2010]

aT Translational air frictionconstant

4.8 · 10−2 Ns/m [Sanca et al., 2010]

aT Rotational air friction con-stant

6.4 · 10−4 Ns/m [Sanca et al., 2010]

ρ Air density 1.20 kg/m3 [Nordling, 2006]g Acceleration of gravity 9.81 m/s2 [Nordling, 2006]

Table 3.1: The numerical values of the parameters used in simulation

Page 42: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully
Page 43: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

4Control design

The hexarotor is a very unstable system and not possible to control without aproper control system. In order to perform identification experiments a controlsystem was implemented both in simulation and on the real platform. The initialcontrol system used a decentralized approach with cascade P-PD controllers foreach axis with empirically chosen parameters. The input commands to the con-trol loops were sent by a test pilot with a radio controller when flying the realplatform.

4.1 Choice of control design

In previous works several different control design are proposed to control multi-rotor systems. Model depended controller such as ackstepping [Sanca et al., 2010,Arellano-Muro et al., 2013], linear quadratic [Bouabdallah et al., 2004, Rinaldiet al., 2013], feedback linearization [Mokhtari et al., 2006] and model predictivecontrol [Alexis et al., 2011, Abdolhosseini et al., 2013, Barsk, 2012] are popularin literature regarding control of multirotor systems. However, most of the resultfrom those works are from simulations.

pid controllers are a well tried concept, even among multirotors. [Alaimo et al.,2014, Bouabdallah et al., 2004, Rinaldi et al., 2013] have all successfully imple-mented such controllers. Since the final users of the autopilot should be able tounderstand and tune the controllers without a degree in master of science, UASEurope prefers pid controllers.

25

Page 44: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

26 4 Control design

4.2 Control techniques

The initial control system used three different concepts: decentralization, cascad-ing and pid. The result was three different P-PD controllers, all easily tuned andimplemented that together were capable of controlling the hexarotor.

4.2.1 Decentralization

A common approach when controlling the attitude of a multirotor system is toneglect the effects from the cross couplings and design one SISO-controller forevery control signal, that is roll, pitch and yaw. The cross couplings will howeverexist. The gyroscopic effects from the rotors are estimated to be small since theinertia of a rotor is very small. But the gyroscopic effects from the rotating air-frame may be in the same size as the control signal when the angular rates arebig. Although, previous works have shown that treating the cross couplings as adisturbance is sufficient for controlling a multirotor. This strategy can be foundin works of [Bouabdallah, 2007, Bresciani, 2008] among others and has been suc-cessfully implemented in the commercial autopilot ArduCopter. [ArduPilot.com,2012].

In Figure 4.1 a simple block diagram shows the concept of a decentralized controlon a hexarotor. One control loop for every axis, roll, pitch and yaw, was usedtogether with a throttle mapping.

Throttle mapping

Pil

otco

mm

and

s

Hex

arot

or

Roll Control

Roll, roll rate

Pitch Control

Pitch, pitch rate

Yaw Control

Yaw, yaw rate

Figure 4.1: The three different loops controlling the hexarotor together witha throttle mapping.

4.2.2 Cascade structure

A cascade structure is often used when the dynamics of a system is of varyingspeed. The inner loop controls the fast dynamics of the angular rate while theouter controller works with the slower angle dynamics. This is a control design

Page 45: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

4.2 Control techniques 27

which in literature is referred to as a PD2 controller and which has been success-fully implemented in the ArduCopter project.

A block diagram of a cascade control structure can be found in Figure 4.2. Thepilot command is transformed into a desired angular rate by comparing it to thecurrent angle of the hexarotor. The desired angular rate is the reference signal tothe inner, faster controller. This controller produces the virtual control signal.

Angle control

Pil

otco

mm

and

s

Hexarotor

Angular rate control

Angle Angular rate

Desired

angular rate

Vir

tual

cont

rol

Figure 4.2: The cascade structure of the control loops handling attitude.

The critical part is the inner controller which controls the angular rate. This iswhere the stability of the hexarotor is ensured. Once able to control the angularrates, controlling the angles is just a matter of setting the angular rate. The outercontroller will then be more of a design choice, the hexarotor can easily be mademore or less aggressive.

4.2.3 The general PID controller

Both the angle and angular rate controller is initially implemented using pidtechniques. pid controllers are very popular, easily implemented and can betuned by common users. The ideal pid controller can be found in [Glad andLjung, 2006] and is defined by

u(t) = KP e(t) + KI

t∫t0

e(τ)dτ + KDde(t)

dt(4.1)

where e(t) is the error between reference signal and measured value. A perfectderivation is never possible in practice and the transfer function of the controllerbecomes

F(s) = KP +KIs

+ KDs

µs + 1= KP +

KIs

+ KD1

KDµ + 1s

(4.2)

where µ is a design parameter. The implemented controller is a discrete timecontroller so the pid controller has to be discretized. Using Euler backward, the

Page 46: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

28 4 Control design

derivative can be approximated as s = 1Ts

(1 − z−1), where Ts is the sample time,which yields the discrete time transfer function

F[z] = KP + KITs

1 − z−1 + KD1

KDµ + Ts1−z−1

(4.3)

To implement the derivative part as a discrete time system, the transfer functionfor the derivative is written as a recurrence relation

d[k] =1

KDµ + Ts1−z−1

e[k] =(1 − z−1)

KDµ(1 − z−1) + Tse[k] =

KDµz−1

KDµ + Tsd[k] +

1 − z−1

KDµ + Tse[k]

=KDµ

KDµ + Tsd[k − 1] +

1KDµ + Ts

(e[k] − e[k − 1]) (4.4)

where d[k] is the derivative part of the output, which also is described in [Enqvistet al., 2010]. A discrete time PD controller would then be

u[k] = KP e[k] + KDd[k], d[k] =KDµ

KDµ + Tsd[k − 1] +

1KDµ + Ts

(e[k] − e[k − 1])

(4.5)

4.3 Implemented control

The controllers were implemented on the autopilot and tuned empirically. Thecontrol loop ran at approximately 60 Hz. Figure 4.3 shows a block diagram de-scribing the different control loops, mapping and scaling.

4.3.1 Roll

The roll controller used a cascade structure including an outer P controller andan inner PD controller. The outer controller is described by

φD [k] = Pφ(φC[k] − φ[k]) (4.6)

where the output φD is the desired roll rate, φC is the roll command from thepilot and φ is the estimated roll angle. The inner controller is described by

Up[k] = KP e[k] + KDd[k], d[k] =KDµ

KDµ + Tsd[k − 1] +

1KDµ + Ts

(e[k] − e[k − 1])

(4.7)

Page 47: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

4.3 Implemented control 29

Map

pin

g

P PD+-+-

P PD+-+-

PD+-

++

Mapping

Scaling

Hexarotor

φC

φ

φD

p

Up

θC

θ

θD

q

Uq

ψC

r

Ur

T C Uwδ

1,2,...,6

u1,

2,...,6

Figure 4.3: A block diagram of the control loops running together withthrottle mapping, virtual control to control signal mapping and hardwarescaling.

where e[k] = φD [k] − p[k], p is the measured roll rate and Up is the virtual rollcontrol. Here, the assumption that p ≈ φ, since the roll angle φ and the pitchangle θ always will be small, was made.

Both the input to the outer loop, the commanded roll angle, and the input to theinner loop, the desired roll rate, as well as the output Up from the cascade loopwas limited. The limit was lower than the physical limit of the propulsion systemand was made to avoid far too aggressive commands.

4.3.2 Pitch

The pitch controller is implemented in the exact same manner as the roll control.The outer controller is described by

θD [k] = Pθ(θC[k] − θ[k]) (4.8)

where the output θD is the desired pitch rate, θC is the pitch command from thepilot and θ is the estimated pitch angle. The inner controller is described by

Uq[k] = KP e[k] + KDd[k], d[k] =KDµ

KDµ + Tsd[k − 1] +

1KDµ + Ts

(e[k] − e[k − 1])

(4.9)

where e[k] = θD [k] − q[k], q is the measured pitch rate and Uq is the virtual pitchcontrol. Here, the assumption that q ≈ θ was made.

Both the input to the outer loop, the commanded pitch angle, and the input to

Page 48: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

30 4 Control design

the inner loop, the desired pitch rate, as well as the output Uq from the cascadeloop was limited. The limit was lower than the physical limit of the propulsionsystem and was made to avoid far too aggressive commands.

4.3.3 Yaw

The yaw loop is implemented with only the inner PD controller and the pilot isthus able to control the yaw rate directly. The yaw control is described by

Ur [k] = KP e[k] + KDd[k], d[k] =KDµ

KDµ + Tsd[k − 1] +

1KDµ + Ts

(e[k] − e[k − 1])

(4.10)

where e[k] = ψC[k] − r[k], ψC is yaw rate command from the pilot, r is the mea-sured yaw rate and Ur is the virtual yaw control. Here, the assumption that r ≈ ψhas been made.

The input to the controller, the commanded roll rate, and the output Ur fromthe controller, was limited. The limit was lower than the physical limit of thepropulsion system and was made to avoid far too aggressive commands.

4.3.4 Throttle

The throttle was mapped from pilot command to virtual throttle control with therelation

Uw = c1(ec2(RC−Rmin)/Rmax − 1) − Ulim (4.11)

where Uw is the virtual throttle control limited between ±Ulim, RC is the throttlecommand from the pilot limited between Rmin and Rmax. The exponential map-ping makes the pilot’s throttle adjustment smoother at low throttle speed. Tomake sure the mapping is from [Rmin, Rmax] to [−Ulim, Ulim] c2 is only tunableparameter. c1 is calculated by

c1 =Rmax + Umax

ec2∗(Rmax−Rmin)/Rmax − 1(4.12)

With this implementation the pilot was able to control the roll and pitch angle,the yaw rate and throttle which is a common set up for hobby multirotor systems.

4.3.5 Scaling and rotor mapping

The four virtual control signals had to be mapped and scaled to actual pwmsignals to the rotors. This was done in two steps. First, with the help of equa-tions (3.35b) and (3.35c) the applied roll and pitch moment could be written

Page 49: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

4.3 Implemented control 31

Mp

Mq

=

−α2 −α −α2 α

2 α α2

√3α2 0 −

√3α2 −

√3α2 0

√3α2

Ω21

Ω22

Ω23

Ω24

Ω25

Ω26

(4.13)

where α = lkT . The mapping was calculated by inverting the relation above, us-ing a psedo inverse. Since kT is an unknown, model dependent parameter ofthe propeller dynamics, α was simply set to 1. Thus, the motor mix was calcu-lated using only the geometry of the arms of the hexarotor. This gave the mixingrelation

u1u2u3u4u5u6

=

−1/6√

3/6−1/3 0−1/6 −√3/61/6 −√3/61/3 01/6

√3/6

UpUq

(4.14)

where ui are the rotor signals which later will be mapped to a PWM duty cycleand Up and Uq are the virtual roll and pitch control respectively. To simplifyeven further, the mixing relation was normalized, which gave

u1u2u3u4u5u6

=

−1/2√

3/2−1 0−1/2 −√3/21/2 −√3/21 0

1/2√

3/2

UpUq

(4.15)

The virtual yaw control was mapped by adding a column to the matrix abovewhich contains the sign of the propeller direction. This was then added to thevirtual throttle control and so the final rotor mapping was

u1u2u3u4u5u6

=

−1/2√

3/2 −1−1 0 1−1/2 −√3/2 −11/2 −√3/2 11 0 −1

1/2√

3/2 1

Up

Uq

Ur

+

111111

Uw (4.16)

Page 50: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

32 4 Control design

This mapping had no other physical meaning than the geometry of the arms. Inpractice, the virtual yaw control will have much less impact than the roll andpitch virtual controls. This will however be solved by setting the control parame-ters accordingly, moving the tuning to one place in the control chain.

The rotor signals ui were finally mapped linearly from the interval [−100, 100] tothe duty cycles of the pwm signals, δi which were in the interval of [1000, 2000].

4.4 Flight performance

The P-PD controllers were tuned empirically according to Table 4.1.

Controller KP KD Input limit

Roll angle 4 - 25 degreesPitch angle 4 - 25 degreesRoll rate 10 20 100 degrees/sPitch rate 10 20 100 degrees/sYaw rate 60 120 100 degrees/s

Table 4.1: The empirically found parameters to the two P controllers andthree PD controllers used

The hexarotor performed rather well in some aspects. The pilot was not ableto flip the hexarotor thanks to the limit of the commanded angle and angularrate. The trade off between attitude stabilization and yaw rate control felt com-fortable according the test pilot. However, two problems were discovered duringthe flight test.

The first problem is perhaps a bit more simple. By looking at the first few secondsof a response to a pitch rate command in Figure 4.4, it is quite obvious that thepitch rate response was rather oscillatory. This is due to both the nature of thehexarotor and a minor flaw in the control design.

The flaw in the control design is that the controller differentiate the control error.This will cause aggressive responses to pilot commands. Also, the derivative filterseems to filter out much of the response from the D-part of the controller. Thiscould have been solved by tuning the parameter µ more properly. The nature ofthe hexarotor is both a time delay in the propulsion system and the fact that thesystem is sort of an integrator.

The second problem can clearly be seen in both Figure 4.4 and 4.5. The hexarotornever reaches the commanded pitch angle. At first glance, one might think thisdue to the absence of an integral part in the controller. This is however not theentire truth. Surely, the pitch angle never reaches the desired angle. But after thefirst peak, the hexarotor slowly rotates back toward zero angle. This can also beseen in Figure 4.4 where the the pitch rate first reaches about 40 degrees/s, but

Page 51: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

4.4 Flight performance 33

Pitch

rate

[deg

rees/s]

Time [s]148 150 152 154 156 158

−40

−20

0

20

40

60

Figure 4.4: The response of a pitch rate command. The dashed line is thedesired pitch rate set by the outer controller and the solid line is the pitchrate. The pitch rate response is quite oscillatory which is caused by the na-ture of the hexarotor, the time delay in the propulsion system and the factthe controller differentiate the control error instead of just the measurement.

then stays below 10 degrees/s even though the desired pitch rate is around 40degrees/s.

An integral part would improve the steady state error, but probably cause evenmore oscillations. To propose a solution to the problem, a better understandingof what is causing the error is needed. The problem looks to be within the pitchrate loop. The outer loop is obviously trying to increasing the pitch rate, butthe hexarotor only response the first time. The difference between the two timeinstances (around 151 seconds and from 152 seconds in Figure 4.4) is that thehexarotor is standing still at first, but then starts to accelerate because of thepitch command. Unfortunately, no measurements of the velocity were acquired.

A look at the virtual pitch control during the pitch command in Figure 4.6 showsthat the hexarotor does not respond equally to the command depending on whenthe command is given. At 151 the virtual pitch command only has to reach 5to rotate the hexarotor. Then, when the hexarotor has gained speed, not even avirtual pitch command of 10 is able to rotate the hexarotor.

This problem is also investigated in [Hoffmann et al., 2007]. Here the authorsshows that when the velocity increases a restoring moment is created whichbrings the hexarotor back to zero angle. This restoring moment is caused by aphenomenon known as blade flapping and is discused further in appendix A.

Page 52: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

34 4 Control design

Pitch

angle[deg

rees]

Time [s]148 150 152 154 156 1580

5

10

15

20

Figure 4.5: The response of a pitch command. The dashed line is com-manded pitch angle set by the pilot and the solid line is the pitch angle.The controller is not strong enough to drive the system up to the desired an-gle. After a while, the hexarotor is even starting to rotate back toward zeroangle.

Virtual

pitch

control

Time [s]148 150 152 154 156 158

−10

−5

0

5

10

15

Figure 4.6: The virtual pitch control during the pitch command. The firstpeak gave an immediate pitch response, but when the hexarotor had gainspeed, not even a pitch command twice the size could rotate the hexarotor.

Page 53: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

5Identification

Identifying a multirotor platform could roughly be carried out in two differentways. The most tested approach in previous work is identification of the physicalparameters. However, in this thesis a black box identification between virtualcontrol input and angular rates was preferred. The flight experiments as well assystem identification from obtained data was first tested and evaluated in simu-lation before conducted on the real platform.

5.1 Identification of a multirotor system

Roughly there are two different approaches to identify a multirotor system, fac-ing different kinds of problems. The most common approach in previous workis to identify the physical parameters such as moment of inertia and the rela-tion between propeller thrust and angular speed of the propeller. However, suchan approach is quite time consuming and expensive in the sense that a lot ofequipment is needed. Since the autopilot will be used to control various kinds ofmultirotor platforms, these experiments has to be repeated whenever changingpayload, using another propulsion system or modifying the system in other ways.

The other approach is to do a black box identification between virtual controlinput and angular rate. This has been tried in another project by [Barsk, 2012].Although it is model dependent, once performed on one system it can easily berepeated on other systems. The main drawback is that to perform the neededflight experiments to acquire identification data, the multirotor has to have aworking controller because of the unstable nature of the multirotor system. Thatmeans that the input signal will not be the one actually controlling the multirotor,but a reference signal to the control system or an overlay on the controller output.

35

Page 54: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

36 5 Identification

The biggest issue of this approach is that the identified system will be underinfluence of feedback. Both the angle and the angular rate will be estimated andthen used by the controller. But trying to fly a multirotor not using feedback isan extremely difficult task, even for the most experienced pilot.

5.2 Black box identification in a closed loop

The identification will be performed using a black box structure, i.e. no previousknowledge of the system will be used. The biggest issue is that the data collectionmust be done using feedback, or otherwise the system would be uncontrollable.The approach used is called direct approach in [Ljung and Glad, 1999]. Thenthe system is excited using a reference signal to the controller but only the actualinput and the output is measured. Identification performed on a closed loop mayincur additional difficulties compared to performed on an open loop.

5.2.1 Choice of input signal

The choice of input signal is very important when identifying a system. Firstoff, the frequency range of the input signal has to be considered. The systemdynamics will only be accurate in the frequency range where the input signalhas high power spectral density. Thus, the dynamics of interest in the modelhas do be in the input signal. Finding the frequency range of interest can befound by performing a step experiment and then finding the rise time. Thoughin the case of a multirotor system, a step experiment is very tricky to performsince the system is unstable. The final choice of frequency range will be basedupon previous works. From this it is concluded that the input signal shouldcontain frequencies from 0.1 Hz up to 5 Hz in order to excite the most importantdynamics.

The next step is to choose the actual input signal. The input signal must satisfyseveral demands. The hexarotor must be maintained near hovering state at alltime to minimize the effects from non-linearities. Also, when tilting the hexarotorit will start drifting. To keep it close to the starting point the input signal shouldbe symmetrical around zero. Furthermore, the input of choice should be easilyproduced by a pilot through a radio controller.

In their work [Beltramini et al., 2011] are trying three different input signals toidentify a multirotor system using a gray box. According to their simulations, anoptimal multisine input yields the most accurate parameter identification, whilean optimal piece wise constant input and a frequency sweep provides acceptableresults. In [Tischler, 2006] the author provides lots of useful ideas which are ap-plicable in the practical case. There, the recommended input signal is a frequencysweep (chirp) with an exponential frequency increase.

The input signal used in the identification experiments in this thesis was theexponential frequency sweep. It fulfills all the above requirements and was con-sidered the easiest one to generate by the test pilot. The frequency sweep starts

Page 55: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

5.2 Black box identification in a closed loop 37

with a full period of the lowest frequency and then exponentially increases thefrequency. In figure 5.1 the first 100 seconds of a frequency sweep is seen as wellas the power spectral density (psd) estimate. This particular frequency sweepwas designed to contain frequencies between 0.1 Hz and 5 Hz. The psd showsthat the signal contains the desired frequencies up to 5 Hz.

Time [s]0 20 40 60 80 100

−2

0

2

(a) The time history of a frequency sweep showing the first 100 seconds

Power

[dB]

Frequency [Hz]0 2 4 6 8 10

−40

−20

0

(b) The psd of the frequency sweep input

Figure 5.1: A computer generated frequency sweep with exponentially in-creasing frequency. The frequency range is 0.1 Hz to 5 Hz and the ampli-tude is normalized. Gaussian noise with standard deviation of 10% of theamplitude has been added. This signal contains information in the desiredfrequency range and should be a good choice of input signal.

5.2.2 Applying the input signal

In addition to the choice of input signal there are other factors to consider. Thecross coupling of the system is regarded low. During the identification phase thesystem is therefor treated as a decoupled system. The input signal will be appliedfor one of the axes at time, while the controllers for the other axes will try to keepthe hexarotor still. Since the identification will be carried out on a closed loopsystem, there are two different ways of applying the input to the hexarotor.

The first way is to apply the input as a desired angle to the controllers which canbe seen in Figure 5.2. The disadvantage of this strategy is obviously that the con-trollers will modify the input signal before applying them to the hexarotor. Thebenefit is that the risk of crashing is lower and the maximum angle is constrainedby the nature of the controller.

Page 56: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

38 5 Identification

HexarotorController+-InputError

Measurement

VirtualControl

Figure 5.2: A schematic drawing of how the input is applied in the first way,as a reference to the controllers.

The second way is to overlay the input on the controller output which is seen inFigure 5.3. The controllers works in the same manner as in the first case with thedifference that they receive a zero reference. The controllers will counter act theinput signal and try to bring the hexarotor back to hover state. By adjusting downthe gain in the controllers this should provide stability as well as less impact fromthe controllers.

HexarotorController+-0Error

Measurement

VirtualControl++

Input

Figure 5.3: A schematic drawing of how the input is applied in the secondway, as an overlay on the controller output while the controller is receivinga zero reference input.

To find out which approach that is most promising in practice, some simulationexperiments were performed. In Figure 5.4 the psd of the actual inputs, i.e. thethe virtual control signals, to the system are compared using the two differentapproaches. The desired frequency content seen in Figure 5.1b were equally pre-served when applied as a reference to the controllers, as seen in Figure 5.4a, aswhen mixed with the controller output, as seen in Figure 5.4b. Clearly both ap-proaches had the downside that the lower frequencies of the input were filteredout.

A second way of comparing the different cases is by looking at the squared co-herence estimate between frequency sweep input and the virtual control. This isdone by plotting

Cxy(f ) =

∣∣∣∣∣∣∣ P 2xy(f )

Pxx(f )Pyy(f )

∣∣∣∣∣∣∣ (5.1)

where Pxx is the psd of the frequency sweep input, Pyy the psd of the virtualcontrol and Pxy is the cross psd between the two. Cxy is close to 1 when the twosignals are strongly correlated. In Figure 5.5 it is seen that not much differedbetween the two ways of applying the input signal. Also in this comparison it isseen that the lower frequencies of the inputs were disturbed by the controller.

Page 57: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

5.2 Black box identification in a closed loop 39

Power

[dB]

Frequency [Hz]0 2 4 6 8 10

−40−20

020

(a) The psd of the virtual control when the input is the desired angle

Power

[dB]

Frequency [Hz]0 2 4 6 8 10

−40−20

020

(b) The psd of the virtual control when the input is mixed with the controller output

Figure 5.4: A comparison of the psd of the two different ways of applying theinput signal in simulation. The effects on the energy content seems very sim-ilar, the lower frequencies were filtered out by the controller but the higherfrequencies were well preserved.

Mag

nitude

Frequency [Hz]0 2 4 6 8 10

0

0.5

1

(a) Coherence between frequency sweep input and virtual control when input ap-plied as a reference to the controllers

Mag

nitude

Frequency [Hz]0 2 4 6 8 10

0

0.5

1

(b) Coherence between frequency sweep input and virtual control when input mixedwith controller output

Figure 5.5: A comparison of the squared coherence function between fre-quency sweep input and virtual control in simulation. The function is closeto 1 at the frequencies where the input and output are strongly correlated.In both cases, the frequencies below 1 Hz are not strongly correlated.

Page 58: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

40 5 Identification

Both ways were almost identical in producing data for identification. The chosenapproach of applying the input signal was as a desired angle since this shouldgive the pilot better control of the hexarotor during the frequency sweeps.

5.3 Concept evaluation in simulation

To evaluate the concept of collecting flight data and identify a black box model,everything was first tested in simulation. Here it could be investigated that thechosen experiment design produced the data required to make good models ofthe hexarotor system. It would also give some knowledge of what the modelsshould look like when identifying the real platform.

5.3.1 Experiment set up and data processing

For the roll and pitch identification experiment in simulation a frequency sweepinput was used, with a frequency range from 0.1 Hz to 5 Hz, a maximum ampli-tude of 15 degrees and a time duration of 300 seconds. Gaussian noise with avariance of 10% of the amplitude was added.

The yaw axis dynamics differs from the roll and pitch dynamic. The reactiontorque used for yaw rotation is much weaker than the corresponding for roll andpitch. Also, the moment of inertia is higher around the yaw axis. Thus, the yawdynamics should be in a lower frequency range. The maximum frequency wastherefore chosen to 2 Hz.

The signal was used as an angle reference for the controller during the roll andpitch axis experiment and as an angular rate reference during the pitch axis ex-periment. The acquired data was the virtual input and the measured angular rate.The experiment was conducted for every axis, that is once for roll, pitch and yaw.An overview of the setup of the experiment design can be read in Table 5.1.

Axis Input type Frequency range Amplitude Input applied

Roll Chirp 0.1 Hz - 5 Hz 15 degrees Roll referencePitch Chirp 0.1 Hz - 5 Hz 15 degrees Pitch referenceYaw Chirp 0.1 Hz - 2 Hz 15 degrees/s Yaw rate reference

Table 5.1: A survey of the identification experiments performed in simula-tion

The sampling rate was set to 50 Hz which was the estimated sampling rate of thereal platform. A rule of thumb states that the sampling rate should be ten timesthe bandwidth of the system. Since the system most likely would not contain anyinteresting dynamics above 5 Hz this sample rate was considered enough.

The acquired data was filtered to remove content in the frequency range of nointerest during the identification. The signal had been filtered by a tenth order

Page 59: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

5.3 Concept evaluation in simulation 41

butterworth filter with cut off frequency 5 Hz for roll and pitch dynamics iden-tification and 2 Hz for yaw dynamics identification. The filter was applied byusing the matlab command filtfilt instead of filter to avoid phase lag.

5.3.2 Roll axis identification experiment

In Figure 5.6 a time history of the angles of the hexarotor during the roll axisidentification experiments can be seen. The roll angle was kept within approxi-mately 15 degrees. At higher frequencies it is clear that the hexarotor could notkeep up with the desired angle. The pitch was however kept small while the yawangle did not vary too much. This indicates that the system could be treated asa decoupled system since the impact from pitch and yaw movement should besmall.

Roll[deg

rees]

Time [s]0 50 100 150 200 250 300

−20

0

20

(a) The roll angle during the roll axis identification experiment

Pitch

[deg

rees]

Time [s]0 100 200 300

−20

0

20

(b) The pitch angle during the rollaxis identification experiment

Yaw

[deg

rees]

Time [s]0 100 200 300

−50

0

50

(c) The yaw angle during the rollaxis identification experiment

Figure 5.6: A time history plot of the angles of the hexarotor during the rollaxis identification experiment in simulation. The roll angle was kept withinthe desired limit. When the frequency of the chirp increased the hexarotorsystem could not keep up. The pitch angle was kept close to zero by thepitch controller and yaw angle did not vary too much thanks to the yaw ratecontroller.

The frequency content of the acquired data, the virtual input and the roll rate, isseen in Figure 5.7. The psd estimate has been smoothed to improve readability.As previously seen the input suffered from loss of content in the lower frequen-cies due to the impact of the controller. Also, the low pass filtered data, whichlater will be used for identification, is shown in the plot.

Page 60: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

42 5 Identification

Frequency [Hz]0 5 10 15

−60−40−20

020

(a) Frequency content of the virtualroll control

Frequency [Hz]0 5 10 15

−50

0

(b) Frequency content of the mea-sured roll rate

Figure 5.7: The frequency content of the acquired data from the roll axisidentification experiment. The solid lines are the unfiltered signals and thedotted lines have been low pass filtered with cut off frequency 5 Hz. Thelower frequencies are filtered out in the input signal, as expected.

5.3.3 Pitch axis identification experiment

The result from the pitch axis identification experiment was almost identical tothe roll axis result. This was unsurprisingly since the same input was used andthe only different between roll and pitch movement is that a different propellermappings are used. The pitch angle was varied within the desired angle limit.The roll angle was kept close to zero while the yaw angle did not vary too fast.The frequency content seen in the psd estimate was unsurprisingly very similarto the psd estimated from the roll axis identification experiment. Because of thealmost identical result, no further plots are presented.

5.3.4 Yaw axis identification experiment

The yaw axis identification experiment was conducted a bit differently, as pre-viously explained. In Figure 5.8 a time history of the angles of the hexarotorduring the yaw axis identification experiments can be seen. The roll and pitchangles were kept small which ensured low cross coupling effects. The yaw angledid not have to be kept around a specific work point to ensure near hover stateand did not have to be limited. The yaw rotation movement was as seen in Figure5.8 not as reactive as the roll and pitch movement.

The frequency content of the acquired data, the virtual yaw rate input and theyaw rate, is seen in Figure 5.9. The frequency content was evenly distributedamong the frequencies of interest. At the lower frequencies there were even morefrequency content than before. This was probably because only one controllerwas active. The data should be suitable for identification of the yaw dynamics.

Page 61: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

5.3 Concept evaluation in simulation 43

Yaw

[deg

rees]

Time [s]0 50 100 150

0

20

40

(a) The yaw angle during the yaw axis identification experiment

Roll[deg

rees]

Time [s]0 50 100 150

−20

0

20

(b) The roll angle during the yawaxis identification experiment

Pitch

[deg

rees]

Time [s]0 50 100 150

−20

0

20

(c) The yaw pitch during the yawaxis identification experiment

Figure 5.8: A time history plot of the angles of the hexarotor during yaw axisidentification experiment in simulation. The roll and pitch angle were keptsmall. The yaw angle did not have to be contained within a certain interval.At the higher frequencies of the chirp, the hexarotor was barely moving. Thiscould certainly be a limitation when conducting this experiment on the realplatform.

Power

[dB]

Frequency [Hz]0 5 10 15

−60−40−20

020

(a) Frequency content of the virtualyaw control

Power

[dB]

Frequency [Hz]0 5 10 15

−50

0

(b) Frequency content of the mea-sured yaw rate

Figure 5.9: The frequency content of the acquired data from the yaw axisidentification experiment. The solid lines are the unfiltered signals and thedotted lines have been low pass filtered with cut off frequency 5 Hz. The fre-quency content of the virtual yaw control is evenly distributed, even at thelower frequencies. This can be because only one controller is active, com-pared to two in the previous experiments.

Page 62: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

44 5 Identification

5.3.5 Validation data

As always when doing system identification a different data set for validation isneeded for cross validation. To obtain a usable data set from simulation, anotherinput signal than the frequency sweep is applied. The chosen input is a two sideddoublet as recommended in [Tischler, 2006]. It was applied to the system just asin previous experiments.

In Figure 5.10 a time history of a two sided doublet input as well as the angle ofthe hexarotor when this input was applied is seen. The other angles were limitedby the controller as seen in previous experiments. The hexarotor is maintainedaround hover state and the angle is limited. The frequency content of the virtualinput and the measured angular rate can be seen in Figure 5.11. The frequencycontent in this signal seems to be slightly lower than the chirp.

Time [s]0 5 10 15

−2

0

2

(a) The two sided doublet input

Ang

le[deg

rees]

Time [s]0 5 10 15

−20

0

20

(b) The angle of the hexarotor duringthe input

Figure 5.10: The two sided doublet input applied as a reference to the con-trollers and the angle of the hexarotor during the generation of validationdata. The other angles were kept small by the controllers.

Power

[dB]

Frequency [Hz]0 5 10 15

−60−40−20

020

(a) Frequency content of the virtualcontrol

Power

[dB]

Frequency [Hz]0 5 10 15

−50

0

(b) Frequency content of measuredangular rate.

Figure 5.11: The frequency content of the acquired data from one of thevalidation experiments. The solid lines are the unfiltered signals and thedotted lines have been low pass filtered with cut off frequency 5 Hz.

Page 63: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

5.3 Concept evaluation in simulation 45

5.3.6 Choosing model structure

Choosing the best model structure is mostly a trial and error process. During thisphase of the system identification all model structures available and consideredreasonable, that is arx, armax, Box-Jenkins and process models, were testedand evaluated. It became quite clear that most often the more complex modelstructures armax and Box-Jenkins did not perform better than arx or processmodels. Therefore they are not discussed through this part of the report.

5.3.7 Identification of roll dynamics model

The best ARX model found was a second order with two zeros which gave a fitof 94% using the validation data set and a parameter uncertainty in the order of10−6. A higher model order did not improve the fit. When prediciting the outputfive steps ahead, it gave a fit of 94%.

The process model fitted to the validation data also gave a fit of 94% using thevalidation data set while having a parameter uncertainty in the order of 10−2.The process model did not improve if a zero or a time delay was introduced. Theoutput from the models compared to the measured output can be seen in Figure5.12.

Rollrate[deg

rees/s]

Time [s]0 5 10 15 20 25 30 35 40

−100

−50

0

50

Figure 5.12: A comparison between the simulated output from the roll dy-namics models and the measured output. The measured output is the blueline, the output from the ARX model is the green line and the output fromthe process model is the red line. Both models can predict the output verywell.

A common way of validating a model is by looking at its residuals which is ex-plained in appendix B. In the residual plot of the models in 5.13 it is clear thatboth models passed the cross correlation test, but failed the whiteness test. Sincethe measurement noise was feedback through the controller, it was quite obviousthat the models would fail this test. Increasing the model order of the ARX modeldid not improve the results either.

The discrete time ARX model had its two real poles close to z = 1, making it closeto unstable. Its real valued zero was located near z = −1 and its effects are hardto analyze since the real system is continuous time, as stated in [Glad and Ljung,

Page 64: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

46 5 Identification

Cross corr for input u1 and output y1 resids

Samples

Autocorrelation of residuals for output y1

−20 −15 −10 −5 0 5 10 15 20

−20 −15 −10 −5 0 5 10 15 20

−0.20

0.2

−10

1

Figure 5.13: A plot of the roll dynamics model residulas. The green lineis the ARX model and red line is the process model. Both models pass thecross correlation test but fails the whiteness test. The bad results on theautocorrelation may be due to that the system is under influence of feedback.

1997]. The continuous time process model had one real valued fast pole and onereal valued pole close to the imaginary axis and no zeros.

The final choice of model was the ARX model. Both models produced similarresults and were very alike. The ARX model contained zeros and will be a bet-ter robustness test for the tuning synthesis later on since tuning a system withzeros obviously is harder than tuning one without. The transfer function of theidentified ARX model is

φ[k] =0.001688z−1 + 0.001627z−2

1 − 1.917z−1 + 0.9175z−2 Up[k] +1

1 − 1.917z−1 + 0.9175z−2 e[k] (5.2)

where e[k] is white, Gaussian noise with variance 2.3612 · 10−6. The model ismade continuous by the matlab command d2c using zero order hold, whichgives the transfer function

G(s) =0.0003662s + 8.649s2 + 4.303s + 0.6024

(5.3)

5.3.8 Identification of pitch dynamics model

Since the pitch dynamics is almost identical to the roll dynamics, at least theoret-ically, the same kind of models as for the roll dynamics, were tested. Unsurpris-ingly both models gave an equally good fit as the roll dynamics models. The ARXmodel fitted the validation data with 95%, just as the process model. The param-eter uncertainty were in the same order as for the roll dynamics model, that is,10−6 for the ARX model and 10−2 for the process model.

Page 65: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

5.3 Concept evaluation in simulation 47

The simulated output from the models can be found i Figure 5.14. The analyse ofthe model residual plots, seen in Figure 5.15 yielded the same conclusions as forthe roll dynamics just as its placement of poles and zeros. When simulated witha five step predication horizon the ARX model had a fit of 94% and the processmodel of 95%.

Pitch

rate

[deg

rees/s]

Time [s]0 5 10 15 20 25 30 35 40

−100

−50

0

50

Figure 5.14: A comparison between the simulated output from the pitchdynamic models and the measured output. The measured output is the blueline, the output from the ARX model is the green line and the output fromthe process model is the red line. Both models can predict the output verywell.

Cross corr for input u1 and output y1 resids

Samples

Autocorrelation of residuals for output y1

−20 −15 −10 −5 0 5 10 15 20

−20 −15 −10 −5 0 5 10 15 20

−0.20

0.2

−10

1

Figure 5.15: A plot of the pitch dynamic model residulas. The green lineis the ARX model and red line is the process model. Both models pass thecross correlation test but fails the whiteness test. The bad results on theautocorrelation may be due to that the system is under influence of feedback.

The final choice of model is once again the ARX model. The transfer function of

Page 66: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

48 5 Identification

the identified ARX model is

φ[k] =0.001687z−1 + 0.00163z−2

1 − 1.917z−1 + 0.9175z−2 Up[k] +1

1 − 1.917z−1 + 0.9175z−2 e[k] (5.4)

where e[k] is white, Gaussian noise with variance 2.3612 · 10−6. The model ismade continuous by the matlab command d2c using zero order hold, whichgives the transfer function

G(s) =0.0003662s + 8.649s2 + 4.303s + 0.6024

(5.5)

5.3.9 Identification of yaw dynamic model

The yaw dynamics identification experiment was conducted a bit differently, asdescribed earlier. Still though, the identification was just as accurate as the rolland pitch dynamics models respectively. The arx model had a fit of 95% whilehaving a parameter uncertainty in the order of 10−6. The process model also hada fit of 95% and a parameter uncertainty in the order of 10−2. When simulatedwith a five step prediction horision the arx model had a fit of 98% and the pro-cess model a fit of 94%.

The simulated output from the models compared with the measured output canbe seen in Figure 5.16. Since only one feedback was used, there was some expec-tation of improving the model residuals. In Figure 5.17 it can be seen that theylook very similar to previous residual plots.

Pitch

rate

[deg

rees/s]

Time [s]0 5 10 15 20 25 30 35 40

−20

0

20

Figure 5.16: A comparison between the simulated output from the yaw dy-namic models and the measured output. The measured output is the blueline, the output from the arx model is the green line and the output fromthe process model is the red line. Both models can predict the output verywell.

The arx model has similar placement of its poles compared to previous models.Its zero is located on the real axis between the poles and the origin. As mentionedbefore, a zero in the z-domain is hard to analyse when the model is a sampledversion of a continuous time system.

The final choice of model is once again the arx model. The transfer function of

Page 67: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

5.4 Data acquired from real flight 49

Cross corr for input u1 and output y1 resids

Samples

Autocorrelation of residuals for output y1

−20 −15 −10 −5 0 5 10 15 20

−20 −15 −10 −5 0 5 10 15 20

−0.50

0.5

−10

1

Figure 5.17: A plot of the yaw dynamic model residulas. The green lineis the arx model and red line is the process model. Both models pass thecross correlation test but fails the whiteness test. The bad results on theautocorrelation may be due to that the system is under influence of feedback.

the identified arxmodel is

φ[k] =0.0001333z−1 − 0.2573 · 10−5z−2

1 − 1.94z−1 + 0.9402z−2 Up[k] +1

1 − 1.94z−1 + 0.9402z−2 e[k]

(5.6)where e[k] is white, Gaussian noise with variance 2.3612 · 10−6. The model ismade continuous by the matlab command d2c using zero order hold, whichgives the transfer function

G(s) =0.004117s + 0.273s2 + 3.081s + 0.6985

(5.7)

5.3.10 Evaluation

From the results above, it seems obvious that the system can be identified well.The critical part is producing good estimation and validation data. The qualityof the data will depend on how well the pilot manages to produce the frequencysweeps used in simulation. Most likely a higher model will be needed since theresponse of the real hexarotor will be more non-linear than the simulation modelused. Although, there are hopes of being able to identify the real system as ablack box model.

5.4 Data acquired from real flight

The identification experiments with the real platform was performed indoor tominimize disturbances from wind. The test pilot executed several frequency

Page 68: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

50 5 Identification

sweeps for roll, pitch and yaw respectively. The amplitude was limited by thecontroller to 25 degrees. The data was sampled at the highest rate the systemcould manage which was at approximately 60 Hz.

Several attempts were made and the best data sets were picked out. The twosided doublets used in simulation did not provide good validation data. Perhapsthis was because they were not long or many enough. Nevertheless, they didnot contain the frequency content required. Instead a frequency sweep had to beused as validation data, alas the amount of estimation data was reduced. The datawas detrended and then low pass filtered at 5 Hz using the non-casual variant ofthe matlab command idfilt.

5.4.1 Roll axis identification experiment

In Figure 5.18 the attitude of the hexarotor during a roll experiment is seen. Thesweeps have varying frequency, but as seen it was hard producing a perfect fre-quency sweep. The pitch angle is maintained within an acceptable limit and theyaw angle does not change too fast. The biggest variations in pitch angle canbe because the pilot accidently moved the pitch stick while producing roll move-ments.

Roll[deg

rees]

Time [s]285 290 295 300 305 310 315 320 325 330

−200

20

(a) The roll angle during a roll axis identification experiment

Pitch

[deg

rees]

Time [s]290 300 310 320 330

−10

0

10

(b) The pitch angle during a roll axisidentification experiment

Yaw

[deg

rees]

Time [s]290 300 310 320 330

−20

0

20

(c) The yaw angle during a roll axisidentification experiment

Figure 5.18: A time history plot of the angles of the hexarotor during a rollaxis identification experiment. This data was used as model estimation data.The roll angle was kept within the desired limit. The pitch angle was notkept very small at all time, but was within an acceptable limit. The yawangle did not change to fast. This data should be suitable for identifying theroll dynamics.

Page 69: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

5.4 Data acquired from real flight 51

The frequency content is plotted in Figure 5.19. Compared to the simulations theinput did not contain much energy above 2.5 Hz. Probably this was because thecontroller filtered out the high frequency content or that the propulsion systemwas slower than in the simulation model. On the other hand, the content amongthe lower frequencies seemed even better than in simulation.

Power

[dB]

Frequency [Hz]0 5 10 15

−40−20

020

(a) Frequency content of the virtualroll control

Power

[dB]

Frequency [Hz]0 5 10 15

−80−60−40−20

0

(b) Frequency content of the mea-sured roll rate

Figure 5.19: The frequency content of the acquired data from the roll axisidentification experiment. This data was used as estimation data. The solidlines are the unfiltered signals and the dotted lines have been low pass fil-tered with cut off frequency 5 Hz. Not much energy content is seen above2.5 Hz which is because the controller filtered out that content. As a conse-quence, the model will only cover frequencies up to that frequency.

A set of validation data was also obtained which can be seen in Figure 5.20. Thevalidation data looked a lot like the estimation data set, and may give an overconfidence in model performance. Its frequency content is visible in Figure 5.21.Here it can be seen that the lower frequency content was quite low.

Roll[deg

rees]

Time [s]130 135 140 145 150

−200

20

Figure 5.20: A time history plot of the roll angle during a frequency sweep.This data was used as validation data for the roll model.

Page 70: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

52 5 Identification

Power

[dB]

Frequency [Hz]0 5 10 15

−40−20

020

(a) Frequency content of the virtualroll control

Power

[dB]

Frequency [Hz]0 5 10 15

−80−60−40−20

0

(b) Frequency content of the mea-sured roll rate

Figure 5.21: The frequency content of the acquired data from the roll axisidentification experiment. This data was used as validation data. The solidlines are the unfiltered signals and the dotted lines have been low pass fil-tered with cut off frequency 5 Hz. Not much content is seen above 2.5 Hz

5.4.2 Pitch axis identification experiment

Figure 5.23 shows the attitude of the hexarotor during the pitch axis experiment.Several frequency sweeps were performed. The roll angle was not kept small atall time, but within an acceptable limit. By the looks of the angle plots, the pilotseems to have made corrections of the pitch between the sweeps. The strangelook of the yaw axis may be due to corrections from the pilot and gyro drift.

The look of the frequency content in Figure 5.22 is similar to the roll experiment.The higher frequencies are filtered out by the controller and thus the model willonly be valid up to about 2.5 Hz.

Power

[dB]

Frequency [Hz]0 5 10 15

−40−20

020

(a) Frequency content of the virtualcontrol

Power

[dB]

Frequency [Hz]0 5 10 15

−80−60−40−20

0

(b) Frequency content of the mea-sured roll rate

Figure 5.22: The frequency content of the acquired data from the pitch axisidentification experiment. This data was used as model estimation data. Thesolid lines are the unfiltered signals and the dotted line has been low passfiltered with cut off frequency 5 Hz.

Page 71: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

5.4 Data acquired from real flight 53

Pitch

[deg

rees]

Time [s]340 350 360 370 380 390 400

−200

20

(a) The pitch angle during a pitch axis identification experiment

Roll[deg

rees]

Time [s]340 360 380 400

−20

0

20

(b) The roll angle during a pitch axisidentification experiment

Yaw

[deg

rees]

Time [s]340 360 380 400

−50

0

50

(c) The yaw angle during a pitch axisidentification experiment

Figure 5.23: A time history plot of the angles of the hexarotor during a pitchaxis identification experiment. This data was used as model estimation data.The pitch angle was kept within the desired limit. The roll angle was notkept small at all time, but was probably corrected by the pilot between thesweeps. The yaw angle did not change to fast, but seemed to have a drift inthe filter.

A validation data set was obtained in the same manner as for roll and can be seenin Figure 5.24. This sweep was performed rather well by the pilot. Once again,the frequency content, found in Figure 5.25, is high among the lower frequenciesbut decreases after 2.5 Hz.

Pitch

[deg

rees]

Time [s]105 110 115 120 125 130

−200

20

Figure 5.24: A time history plot of the pitch angle during a pitch frequencysweep. This data was used as validation data for the pitch model.

Page 72: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

54 5 Identification

Power

[dB]

Frequency [Hz]0 5 10 15

−40−20

020

(a) Frequency content of the virtualpitch control

Power

[dB]

Frequency [Hz]0 5 10 15

−80−60−40−20

0

(b) Frequency content of the mea-sured pitch rate

Figure 5.25: The frequency content of the acquired data from the pitch axisidentification experiment. This data was used as model validation data. Thesolid lines are the unfiltered signals and the dotted lines have been low passfiltered with cut off frequency 5 Hz.

5.4.3 Yaw axis identification experiment

In the plot of the psd in Figure 5.26 it is seen that the frequency content is similarto what was seen in the simulations.

Power

[dB]

Frequency [Hz]0 5 10 15

−40−20

02040

(a) Frequency content of the virtualyaw control

Power

[dB]

Frequency [Hz]0 5 10 15

−80−60−40−20

0

(b) Frequency content of the mea-sured yaw rate

Figure 5.26: The frequency content of the acquired data from a yaw axisidentification experiment. This data was used as model validation data.Thesolid lines are the unfiltered signals and the dotted line has been low passfiltered with cut off frequency 5 Hz.

Performing frequency sweeps for the yaw axis was a bit more difficult comparedto roll and pitch since the hexarotor is not as reactive in this direction. The atti-tude of the hexarotor during the sweep is seen in Figure 5.27. The roll and pitchangle were kept small and the yaw angle is varied with increased frequency. It ishowever clear that the cross coupling from yaw command to roll and pitch rateis quite strong. The change of rotor speed when rotating in yaw is much biggerthan for pitch and roll which may be the cause.

A small offset in the pitch and roll angle is seen, but if this was due to a bias

Page 73: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

5.4 Data acquired from real flight 55

in the attitude filter or was the actual case during the experiment is not known.The bias is only around 3 degrees, and did perhaps not affect the hexarotor verymuch.

Yaw

[deg

rees]

Time [s]510 515 520 525 530

−100

0

100

(a) The yaw angle during a yaw axis identification experiment

Roll[deg

rees]

Time [s]510 520 530

−10

0

10

(b) The roll angle during a yaw axisidentification experiment

Pitch

[deg

rees]

Time [s]510 520 530

−10

0

10

(c) The pitch angle during a yaw axisidentification experiment

Figure 5.27: A time history plot of the angles of the hexarotor during a yawaxis identification experiment. This data was used as model estimation data.The yaw angle is varied with increasing frequency. The roll and pitch anglesare clearly affected by the yaw movement but the controllers are keepingthem small.

The validation data set is similar to the estimation data set. The attitude of thehexarotor can be seen in Figure 5.28 and the frequency content in 5.29.

Yaw

[deg

rees]

Time [s]220 225 230 235 240

−100

0

100

Figure 5.28: A time history plot of the yaw angle of the hexarotor during ayaw frequency sweep. This data was used as yaw model validation data. Theyaw angled is varied while the pitch and roll angle are kept small.

Page 74: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

56 5 Identification

Power

[dB]

Frequency [Hz]0 5 10 15

−40−20

02040

(a) Frequency content of the virtualyaw control

Power

[dB]

Frequency [Hz]0 5 10 15

−80−60−40−20

0

(b) Frequency content of the mea-sured yaw rate

Figure 5.29: The frequency content of the acquired data from a yaw axisidentification experiment. This data was used as model validation data. Thesolid lines are the unfiltered signals and the dotted lines have been low passfiltered with cut off frequency 5 Hz.

5.5 Models identified from flight data

5.5.1 Roll dynamic model

Four different models at the lowest model order possible were found. These werea third order arxmodel, a third order armaxmodel a process model with a timedelay and a process model with a time delay and a zero. The four chosen modelsall fitted the validation data better than 43% as seen in Table 5.2.

Model Validation data fit

arx 47%armax 47%Process model with delay 43%Process model with delay and zero 63%

Table 5.2: How well the models fitted the validation data

The model which had the best fit was the process model with a zero. However,when looking at its zeros and poles there were obvious problems. One of its poleswas extremely far to the left. This could also be seen by looking at the parametervalues of the model. The largest one was in the order of 108 and the smallest onein the order of 10−11. That would most likely cause numerical problems later andthe model was discarded.

Looking at the plot in Figure 5.30 of simulated output, all models managed torecreate the validation data quite well at the higher frequencies. At the lowerfrequencies the fit was far worse, which was predicted by looking at the frequencycontent of the estimation data.

The models were also tested for five step ahead prediction. The fit from the result

Page 75: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

5.5 Models identified from flight data 57

Rollrate[deg

rees/s]

Time [s]0 5 10 15 20

−200

−100

0

100

200

Figure 5.30: A comparison between the simulated output from the roll dy-namic models and the measured output. The measured output is the blackline, the arx model is the blue line, the armax model is the magenta lineand the process model is the green line. The model fits well during the highfrequency parts of the validation signal, but worse otherwise.

is found in Table 5.3. The arx and armax models performed really well andmanaged to predict the output at same level as in simulation, around 94%.

Model Validation data fit

arx 93%armax 94%Process model with delay 43%

Table 5.3: How well the models fitted the validation data when predictingthe output five steps ahead

The residual plots looked similar to the ones from the simulation. All modelsfailed the whiteness test which is due to the feedback in the system. Accordingto [Ljung and Glad, 2004] feedback in the system also leads to correlation fornegative samples. In Figure 5.31 the residuals of the models have been plotted.The arx, armax models along with the process model without zero passes thetest and seemed to have capture enough of the system dynamics.

The discrete time arx and armax having a similar model order, they also hadsimilar placement of the poles and zeros. The zero was located very near theorigin. Their poles were located near the unit circle, two complex on the insideand one real on the outside. This made the models both unstable and oscillatorywhich reflects the behaviour of the real system well. The continuous time pro-cess model had its two complex poles quite near the imaginary axis, making that

Page 76: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

58 5 Identification

Cross corr for input u1 and output y1 resids

Samples

Autocorrelation of residuals for output y1

−20 −15 −10 −5 0 5 10 15 20

−20 −15 −10 −5 0 5 10 15 20

−1

0

1

−1

0

1

Figure 5.31: A plot of the roll dynamic models residuals. The arx model isthe blue line, the armax model is the magenta line and the process modelis the green line. The arx and armaxmodels pass the cross correlation testwhen considering that the correlation for negative samples are affected bythe feedback. All models fail the whiteness test which is due to the feedback.

system prone to oscillate.

As predicted, none of the models managed to capture the dynamics of the lowerfrequencies, which is due to lack of good estimation data in that frequency range.The process model with a zero is not chosen because of the big variations in thesize of the parameters. The arx and armaxmodels performed equally well andtherefore the armax is discarded. The final choice of model is the arx model,defined by

φ[k] =0.0002181−1

1 − 2.891z−1 + 2.82z−2 − 0.9299z−3Up[k]+1

1 − 2.891z−1 + 2.82z−2 − 0.9299z−3 e[k]

(5.8)where e[k] is white, Gaussian noise with variance 4.1132 · 10−6. The model wasmade continuous by the matlab command d2c using zero order hold, whichgave the transfer function

G(s) =0.004469s2 + 0.812s + 49.02s3 + 4.362s2 + 147.1s − 147.2

(5.9)

Page 77: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

5.5 Models identified from flight data 59

5.5.2 Pitch dynamic model

The pitch dynamic model should be very alike the roll dynamic model. The samemodel structures were tested together with an additional forth order arx andarmax models since a higher model order improved the fit. Again, the processmodel with a zero had big variations in the size of the parameter values and wastherefore discarded. The model fit to the validation data can be found in Table5.4. The armaxmodels did not fit better than the arxmodels and were rejected.

Model Validation data fit

Third order arx 45%Third order armax 44%Forth order arx 53%Forth order armax 52%Process model with delay 43%

Table 5.4: How well the models fitted the validation data

The simulated output together with the measured validation output can be seenin Figure 5.32. It can be seen that the models still had problems when the inputfrequency is low, but performed well at the higher frequencies.

Pitch

rate

[deg

rees/s]

Time [s]0 5 10 15 20 25

−200

−100

0

100

200

Figure 5.32: A comparison between the simulated output from the pitch dy-namic models and the measured output. The measured output is the blackline, the third order arx model is the blue line, the process model is thegreen line and the forth order arxmodel is the red line. The models fit wellduring the high frequency parts of the validation signal, but worse other-wise.

The arx and armaxmodels was able to predict the output five steps ahead verywell which is seen in Table 5.5. Even though the models would not be used to

Page 78: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

60 5 Identification

predict the output, this is still a good measure of model quality. The processmodel was, as seen in the Table 5.5, not very good at predicting the output.

Model Validation data fit

Third order arx 93%Third order armax 93%Forth order arx 96%Forth order armax 97%Process model with delay 45%

Table 5.5: How well the models fitted the validation data when predictingthe output five steps ahead

In the plot of the model residuals in Figure 5.33 it is seen that none of the modelspassed either the whiteness test nor the cross correlation test. When the modelorder was increased there were no signs of improvement either.

Cross corr for input u1 and output y1 resids

Samples

Autocorrelation of residuals for output y1

−20 −15 −10 −5 0 5 10 15 20

−20 −15 −10 −5 0 5 10 15 20

−1

0

1

−1

0

1

Figure 5.33: A plot of the pitch dynamic models residuals. The third orderarxmodel is the blue line, the process model is the green line and the forthorder arx model is the red line. All models fails both the whiteness andcross correlation test.

The process model along with the third order arxmodel had poles and zeros likeas the roll dynamic model. The forth order arx model had four complex poles,all inside but close to the unit circle. All models reflect the oscillatory nature ofthe hexarotor.

Page 79: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

5.5 Models identified from flight data 61

The improvement of the forth order arxmodel compared to the third order wasnot sufficient to motivate a more complex model. Also, the roll dynamic couldbe modelled by a third order arx model and since the pitch dynamic should bealmost identical, the third order arx model was chosen here as well. The modelis defined by

φ[k] =0.0002608−1

1 − 2.87z−1 + 2.777z−2 − 0.9076z−3Up[k]+1

1 − 2.87z−1 + 2.777z−2 − 0.9076z−3 e[k]

(5.10)where e[k] is white, Gaussian noise with variance 5.3713 · 10−6. The model wasmade continuous by the matlab command d2c using zero order hold, whichgave the transfer function

G(s) =0.0053742 + 0.9805s + 59.31s3 + 5.819s2 + 144s − 127

(5.11)

5.5.3 Yaw dynamic model

Four different models were tested. The armax models were rejected since theyhad shown any improvements compared to the more simple arx model. Themodels tested were a second order arx, a third order arx, a process model witha delay and a process model with delay and zero. The fit of the models usingthe validation data can be seen in Table 5.6. The process model with a zero didnot have the numerical issues this time, but had a worse fit to the validation datacompared to the process model without a zero. Therefore it could be discardedearly.

Model Validation data fit

Second order arx 64%Third order arx 75%Process model with delay 70%Process model with delay and zero 68%

Table 5.6: How well the models fitted the validation data

As seen in the plot of the simulated output in Figure 5.34 the validation datadid not contain much low frequency content. This leads to an over confidence inthe identified model. If the validation would have contained more low frequnecysweeps, the fitting would probably be worse than now. But on the other hand, theyaw dynamics should be easier to identify with linear models than the roll andpitch dynamics because of the nature of yaw rotation.

The models were also tested in predicting the output five steps ahead. As before,the arx models managed to predict the output almost exactly while the processmodel had som issues. The results can be found in Table 5.7.

The residuals of the models were investigated. The second order arx modelpasses the cross correlation test while the others fail. Just as before, none of the

Page 80: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

62 5 Identification

Yaw

rate

[deg

rees/s]

Time [s]0 5 10 15 20 25

−100

−50

0

50

100

Figure 5.34: A comparison between the simulated output from the yaw dy-namic models and the measured output. The measured output is the blackline, the second order arxmodel is the blue line, the third order arxmodelis the red line, the process model without zero is the green line and the pro-cess model with zero is cyan line. The model fits well during the high fre-quency parts of the validation signal, but worse otherwise.

Model Validation data fit

Second order arx 92%Third order arx 96%Process model with delay 70%

Table 5.7: How well the models fitted the validation data when predictingthe output five steps ahead

models pass the whiteness test.

The two poles of the continuous time process model are both real. One of them isquite far to the left in the s-plane. This tells nothing of the oscillations one mightexpect. The two arxmodels have similar pole placement as previous models. Allpoles are inside the unit circle, but complex and near the unit circle.

Page 81: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

5.5 Models identified from flight data 63

Cross corr for input u1 and output y1 resids

Samples

Autocorrelation of residuals for output y1

−20 −15 −10 −5 0 5 10 15 20

−20 −15 −10 −5 0 5 10 15 20

−1

0

1

−0.50

0.5

1

Figure 5.35: A plot of the yaw dynamic models residuals. The second orderarx model is the blue line, the third order arx model is the red line andthe process model is the green line. The second order arx model passes thecross correlation test.

Page 82: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully
Page 83: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

6Controller Tuning

When linear models of the system had been identified, an analytical tuning methodwas tried. The method formed the closed loop through placing dominant poles bysetting the right pid parameters. This meant that an integral part in the inner PDcontroller had to be introduced in the control design. In theory and simulationthe method worked well, but when tested on the real platform it failed.

6.1 Placement of dominant poles

The technique used to tune the P-PD controller is placement of dominant poles,introduced in [Persson and Åström, 1993] and well described in [Zhiping, 2007].The desired performance of the closed loop is express by a pair of conjugate poles,

λ1,2 = −α ± β. (6.1)

The characteristics of a step response from a system containing two complex con-jugate poles is presented in C. To ensure that the system is dominated by thosepoles all other poles of the closed loop must lie to left of the line s = −mα wherem usually is between 3 and 5. In addition to that there can be no zeros nearby.The problem is then reduced to finding the pid parameters which guarantee thatλ1,2 are the dominant poles. This problem is solved by expressing KI and KD interms of KP and then using a root-locus of the closed loop to find an appropriatevalue of KP . In Figure 6.1 the placement of the dominant poles and the desiredarea of the other poles can be seen in the s-plane.

The identified system can in general terms be expressed by

G(s) =N (s)D(s)

e−Td s (6.2)

65

Page 84: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

66 6 Controller Tuning

ρ1

ρ2

−mαRe

Im

Figure 6.1: The desired placement of the poles in closed loop. λ1 and λ2are the dominant poles. All other poles should lie in the area left to the lines = −mα.

whereN (s) is the numerator polynomial, D(s) is the denominator polynomial andTd the time delay of the system. The transfer function of a perfect pid controlleris

F(s) = KP +KIs

+ KD s

The closed loop system will have the transfer function

Gc(s) =F(s)G(s)

1 + F(s)G(s)(6.3)

from reference signal to output. The solutions to the characteristic equation ofthe closed loop, i.e. the denominator put to zero, are the placements of the polesof the closed loop. To begin with, this is used to find an expression for KD bysubstituting λ1 = −α + β into 1 + F(s)G(s) = 0, which yields

1 + F(λ1)G(λ1) = 0 ⇐⇒ F(λ1) =−1G(λ1)

⇐⇒

⇐⇒ KP +KI

−α + β+ KD (−α + β) = KP + KI

−α + βα2 + β2 + KD (−α + β) =

−1G(λ1)

(6.4)

Since this is a complex equation, the real and imaginary parts can be solved sep-arately. By solving for KI and KD in terms of KP it is obtained that

KI =α2 + β2

2αKP − (α2 + β2)Γ1, Γ1 =

12α<

[ −1G(λ1)

]+

12β=

[ −1G(λ1)

](6.5a)

KD =1

2αKP + Γ2, Γ2 = − 1

2α<

[ −1G(λ1)

]+

12β=

[ −1G(λ1)

](6.5b)

It can easily be shown that the poles of the closed loop are the solutions to thecharacteristic equation 1 + F(s)G(s) = 0. With the expressions for KI and KD , the

Page 85: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

6.2 Tuning in simulation 67

characteristic equation becomes

0 = 1 +(Kp +

(α2 + β2

2αKP − (α2 + β2)Γ1

)1s

+(KP

2α+ Γ2

)s

)N (s)e−Td s

D(s)=

= 1 − (α2 + β2)Γ1

s

N (s)e−Td s

D(s)+ sΓ2

N (s)D(s)

+ KP

(2αs + α2 + β2 + s2

2αs

)N (s)e−Td s

D(s)=

=sD(s) − (α2 + β2)Γ1N (s) + s2Γ2N (s)e−Td s

sD(s)︸ ︷︷ ︸(∗)

+KP

(2αs + α2 + β2 + s2

2αs

)N (s)e−Td s

D(s)

(6.6)

Dividing all terms with (∗) gives

0 = 1 +KP

(2αs + α2 + β2 + s2

2αs

)N (s)e−Td s

D(s)

sD(s) − (α2 + β2)Γ1N (s)e−Td s + s2Γ2N (s)e−Td s

sD(s)

=

1 + KP(2αs + α2 + β2 + s2)N (s)e−Td s

2αsD(s) − 2α(α2 + β2)Γ1N (s)e−Td s + 2αs2Γ2N (s)e−Td s⇐⇒

⇐⇒ 1 + KP G(s) = 0 (6.7)

which can be analysed using a root-locus.

6.2 Tuning in simulation

Before using root-locus to determine KP , the desired step response had to be de-signed. This was a trade off between rise time, overshoot and reasonable parame-ter values. To demonstrate the method, two different pole placements were cho-sen. One prioritising a quick, reactive response and one a smooth, well dampedresponse.

The system used in the synthesis is the identified roll model, defined by equa-tion (5.2). The pitch model is almost the same as the roll model. The yaw modellooks like the roll model too and thus it is sufficient to evaluate only tuning ofthe roll model.

When the parameters had been calculated they were used in the simulation. Therewere several things which could be tested. The tuning synthesis was made witha continuous time pid-controller using a perfect derivative, while the controllersin the simulation environment were discrete time with a filtered approximationof a derivative. Will the parameters still be valid? And how would the controllersreact to measurement noise?

Page 86: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

68 6 Controller Tuning

6.2.1 Quick and reactive response

Choosing λ1,2 = −2 ± 4 gives in theory a system with rise time 0.345 secondsand an overshoot at 20.8%. Plugging λ and the identified roll model from equa-tion (5.3) into equation (6.7) and then using thematlab function rlocus to plotthe pole placement for different KP , yielded the plot found in Figure 6.2. There itis seen that a KP > 5.02 is needed to push the other poles left of the line s = −αmwith m = 3.

Imag

inary

Real

KP = 3.64

−8 −6 −4 −2 0 2 4

−5

0

5

Figure 6.2: The root locus plot of poles of the closed loop using a quick andreactive controller. The two poles which we want to dominate the closedloop are not affected by the choice of KP . To push the third left of the lines = −6 KP has to be 5.05 or greater.

Using that KP in equations (6.5a) and (6.5b) gives the pid controller

F(s) = 5.02 +13.89s

+ 0.66s. (6.8)

and the closed loop transfer function

Gc(s) =0.0002443s3 + 5.771s2 + 43.67s + 1.2

s3 + 10.07s2 + 44.027s + 121.2(6.9)

A pole zero plot of Gc(s) shows that the zeros are not very near the dominantpoles, but actually between the dominant poles and the line s = αm. Hopefullythe dominant pole would still be dominant enough to form the desired step re-sponse.

A Bode plot of the roll rate system showed that the phase margin of the systemwas 55 degrees and the amplitude margin was infinite. That was considered goodenough since the main focus was to form the step response of the closed loop.

The parameters were then tried in simulation. At first, no measurement noise

Page 87: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

6.2 Tuning in simulation 69

was used to show the theoretical performance of the closed loop. A 20 degreesstep in roll rate reference was tried. The tracking performance of the controllercan be seen in Figure 6.3. The overshoot was slightly larger than desired, 21.5%while the rise time was only 0.08 seconds.

Rollrate[deg

rees/s]

Time [s]9.5 10 10.5 11 11.50

5

10

15

20

Figure 6.3: The step response from the quick and reactive roll rate controllerin simulation with measurement noise turned off. The rise time is very small,about 0.08 seconds, while the overshoot is 21.5%.

When measurement noise was added the performance was still good. In Figure6.4 it is seen that the overshoot increased, but the rise time was still small.

Rollrate[deg

rees/s]

Time [s]9.5 10 10.5 11 11.5

0

5

10

15

20

25

Figure 6.4: The step response from the quick and reactive roll rate controllerin simulation using measurement noise.

Page 88: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

70 6 Controller Tuning

6.2.2 Smooth and damped response

The poles were now chosen to λ1,2 = −2± 2 which should give a rise time of 0.76seconds and an overshoot at 4.3%. The root locus, found in Figure 6.5, were onceagain used to find KP . This time, KP were determined to 3.64.

Imag

inary

Real

KP = 3.64

−8 −6 −4 −2 0 2 4−4

−2

0

2

4

Figure 6.5: The root locus plot of the poles in the closed loop using a smoothand damped controller. The two poles chosen earlier are not affected by thechoice of KP . To push the third pole left of the line s = −6, KP has to be 3.64or greater.

This choice of KP gave the controller

F(s) = 3.64 +5.57s

+ 0.66s. (6.10)

and the closed loop transfer function

Gc(s) =0.0002443s3 + 5.718s2 + 31.48s + 48.16

s3 + 10.02s2 + 32.08s + 48.16(6.11)

A bode plot of the roll rate system showed the phase margin were 74 degreeswhile the amplitude margin When this controller was used in simulation, withoutmeasurement noise, it produced a step response which can be seen in Figure 6.6.It had an overshoot of 9% and a rise time of 0.08 seconds. The overshoot waslower but the rise time was still very fast.

Using measurement noise, the controller produced a step response as seen inFigure 6.7. It had the same rise time but a bigger overshoot. The measurementnoise was quite obviously having a rather big impact on the performance. Stillthough, the behavior of the hexarotor with the tuned controller looked accept-able. The parameters designed for the continuous time controller worked alsowith the discrete time controller. This tuning method was ready to be tested onthe real platform.

Page 89: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

6.3 Tuning of real platform 71

Rollrate[deg

rees/s]

Time [s]9.5 10 10.5 11 11.5

0

5

10

15

20

Figure 6.6: The step response from the smooth and damped roll rate con-troller in simulation with measurement noise turned off. The rise time isvery small, about 0.08 seconds, while the overshoot is 9%.

Rollrate[deg

rees/s]

Time [s]9.5 10 10.5 11 11.5

0

5

10

15

20

25

Figure 6.7: The step response from the smooth and damped roll rate con-troller in simulation using measurement noise.

6.3 Tuning of real platform

The tuning of the pid-controllers were made using the same method as tested insimulation. The transfer functions used were the models previously identified.The poles were placed to form a good step response and bode plot of the closedloop, which was an iterative process. The dominant poles were disturbed bynearby zeros which affected the performance. The method used did not handlethose zeros at all. When the step response and bode plot looked alright, the

Page 90: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

72 6 Controller Tuning

performance was tested on the real platform.

6.3.1 Roll rate controller

The model used was the identified arx-model, defined by equation (5.9). Thebode plot of the model can be found in Figure 6.8. As seen, the system had a poorphase curve originating from the unstable pole.

Frequency (rad/s)

Pha

se(deg

)Mag

nitude(dB)

10−2 10−1 100 101 102 103 104−270

−180

−90−150−100−50

0

Figure 6.8: A bode plot of the roll model. The phase curve was near -180degrees at low frequencies, which made the system unstable initially.

Forming the closed loop of roll rate controller proved to be quite hard. The modelused to tune the parameters was more complex and challenging than the one usedin the concept evaluation in simulation. The choice of dominant pole was madeby looking at the shape of the step response and the nyquist curve. In other wordsit was an iterative process.

The choice of dominant poles were

λ1,2 = −0.7 ± 0.2 (6.12)

which, in theory, should give slow step response with rise time 4.35 seconds andno overshoot. These Figures might sound bad, but the poles were chosen to formthe step response of the actual closed loop. This will soon become clear. To im-prove results, the value of m was modified. A bigger m means that the dominantpoles will be more dominant with the cost of bigger pid parameters. m = 12proved to be good trade off.

The model and the dominant poles were inserted into equation (6.7) which wasthen analysed using root-locus. The plot of the root-locus is found in Figure 6.9.

Page 91: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

6.3 Tuning of real platform 73

To push the other poles behind the line s = −12 · 0.7 a KP value of 33.47 or greaterwas needed.

Imag

inary

Real

KP = 33.47

−10 −5 0 5 10−40

−30

−20

−10

0

10

20

30

40

Figure 6.9: The root-locus plot of the poles of the closed loop using the con-troller defined by the dominant poles λ1,2 = −0.7±0.2. The KP value neededto push all other poles left to the line s = −12 · 0.7 was 33.47.

With this choice of KP the pid-controller became

F(s) = 33.47s +11.53s

+ 18.73s (6.13)

which gave the transfer function of the closed loop

Gc(s) =0.07725s4 + 14.17s3 + 872.5s2 + 1522s + 521.6

s4 + 18.2s3 + 1008s2 + 1387s + 521.6(6.14)

The location of the poles and zeros of Gc can be found in Figure 6.10. In theplot where the dominant poles have been zoomed, it is clear that two zeros arenear the dominant poles. This was a downside of the tuning method, since thedesigned step response would be affected by the zeros but nothing in the methodstated how to handle those zeros.

To find the stability margins of the system the nyquist curve of the system isplotted in Figure 6.11. There it can be seen the phase margin is 37 degrees while

Page 92: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

74 6 Controller Tuning

Imag

inaryax

is

Real axis−100 0 100

−100

0

100

(a) All poles and zeros

Imag

inaryax

is

Real axis−2 −1 0

−0.5

0

0.5

(b) Zoomed in at dominant poles

Figure 6.10: A pole-zero plot of the closed roll loop. The dominant poles areaffected by the nearby zeros.

the gain margin is -20.9 dB. A negative gain margin means that if the loop gainis lowered too much, the system will become unstable.

Imag

inaryAxis

Real Axis−15 −10 −5 0 5 10−15

−10

−5

0

5

Figure 6.11: The nyquist curve of the roll rate system. The phase margin is37 degrees while the gain margin is -20.9 dB. If the loop gain is lowered toomuch, the closed loop will lose its stability.

At last, the step response of the closed loop have been plotted in Figure 6.12. Therise time was only 0.04 seconds. This is not very realistic and the model hadobviously not captured the time delay that should be present in the propulsionsystem. The overshoot was 26% at its biggest. The zeros had a relativly big impacton the step respons and made it far more oscillative.

Page 93: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

6.3 Tuning of real platform 75

Time [s]

0 1 2 3 4 50

0.5

1

1.5

Figure 6.12: The step response of the closed loop. The rise time was only0.04 seconds, which obviously was extremely unrealistic. The overshoot was26%.

6.3.2 Pitch rate controller

Then the pitch dynamic loop was to be tuned. The identified system, defined byequation (5.11) was used. Its bode plot was almost identical with the bode plotthe roll dynamic and thus it will not be presented here. The dominant poles werechosen to

λ1,2 = −0.7 ± 0.2 (6.15)

which were exactly the same as for the roll controller. Using root-locus again, aKP value of 24.99 was needed to push the other poles left to the line s = −0.7 · 12.This was slightly lower than for the roll control. This gave the pid-controller

F(s) = 24.99 +8.63s

+ 13.88s (6.16)

and the closed loop equation

Gc(s) =0.0694s4 + 12.79s3 + 788.9s2 + 1387s + 476.4

s4 + 18.2s3 + 922.9s2 + 1267s + 476.4(6.17)

The closed loop had its poles and zeros placed almost identical as the closedroll loop. Once again, this was as expected. The nyquist curve of the pitch ratesystem showed that the phase margin and gain margin were almost the same asthe corresponding ones for the roll rate loop.

The step response had similar look to the step response of the closed roll loop.The overshoot was 23 % and the rise time was only 0.04 seconds. Once again, therise time is obviously not realistic and the identification phase was not able tomodel that properly.

Page 94: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

76 6 Controller Tuning

6.3.3 Yaw rate controller

The yaw rate controller was quite a challenge to tune. In Figure 6.13 the bodeplot of the yaw dynamics model is shown. The system was not unstable and thusits bode plot looked rather good.

Frequency (rad/s)

Pha

se(deg

)Mag

nitude(dB)

10−2 10−1 100 101 102 103 104−270−180−90

0−150−100−50

0

Figure 6.13: The bode plot of the yaw dynamics model. Thanks to the lowgain of the system, the gain margin was high at all time.

The poles were chosen to λ1,2 = −1.3 ± 0.8 and m was set to 2. Using root-locusas before, KP was found to be 77.07. This gave the PID-controller

F(s) = 77.07 +75.30s

+ 21.02s (6.18)

and the closed loop

Gc(s) =0.04259s4 + 7.866s3 + 490.4s2 + 1357s + 1305

s4 + 13.1s3 + 755.6s2 + 1474s + 1305(6.19)

The integral term of the controller was very big and would probably cause prob-lems with integral windup. To control the yaw rate properly an integral termwas really not needed. Although, to form the closed loop it was needed. Whenthe parameters later were tested on the real platform, the integral part had to belowered and even removed since the control system otherwise would prioritizethe yaw loop too much over pitch and roll.

A look at the zeros and poles of the closed loop in the s-plane in Figure 6.14showed that once again there were zeros near the dominant poles. Plotting thenyquist curve showed that the phase margin was 37 degrees and that the gainmargin was infinite.

A final look at the step response of the closed loop in Figure 6.15 the rise timeagain was far to quick to be realistic. The overshoot was very small, about 4%.

Page 95: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

6.3 Tuning of real platform 77

Overall, the step response is very oscillative beacuse of the zeros near the domi-nant poles.

Imag

inaryax

is

Real axis−100 0 100

−100

0

100

(a) All poles and zeros

Imag

inaryax

is

Real axis−2 −1 0

−2

0

2

(b) Zoomed in at dominant poles

Figure 6.14: A plot of the poles and zeros of the closed yaw loop. In thezoomed plot it is obvious that the zeros were too close to the dominant poles.

Time [s]

0 1 2 3 4 50

0.5

1

1.5

Figure 6.15: The step response of the closed yaw loop. The rise time wasonly 0.06 seconds, while the settling time was 3.1 seconds. The overshootwas only 4 %.

6.3.4 Flight test

The parameters found in the design process were then used in the control loop onthe real platform. Since the initial control system on the hexarotor did not havean integral part, one was added to the existing PD-controller. However, with thenew parameters the hexarotor had become impossible to fly. It reacted extremelyoscillatory and aggressive. When the integral part was removed it was still notable to fly properly.

Page 96: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully
Page 97: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

7Conclusions and further work

7.1 Conclusions

The model implemented could fairly well simulate the behavior of a hexarotorsystem during hoover flight. A control system using decentralized P-PD con-trollers was a good choice since it managed to stabilize the hexarotor’s attitude.It was easily implemented and tuned and should work on all kinds of multirotorsystems.

The black-box identification of the attitude dynamics showed promising results.The frequency sweep used was a wisely chosen input signal. The hexarotor man-aged to stay airborne and it stayed near hover flight during the entire sweep. Withmore and better data, the identified models could have been really good.

The method for tuning the parameters, placement of dominant pole, was suc-cessful in simulation but did not work on the real platform. The most reasonableexplanation is the fact the identified models were not good enough. In simulationhowever, the step response of the system could be shaped in a desirable way.

7.2 Further work

A better physical model of the propulsion systems should be developed to makethe simulation model more realistic. One easy thing could be to include timedelay in the motors, which should give a better understanding of the robustnesslimitations.

The identification experiments should be repeated, with focus on the lower fre-quencies. By using a lower amplitude on the sweeps, the risk of leaving the hover

79

Page 98: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

80 7 Conclusions and further work

flight should be minimized.

The control design could be improved by using gain scheduling to compensate forthe restoring moment discussed earlier. Also the derivative part of the controllercould be improved by better tuning the filter parameter and using a set pointweight of zero, which means that only the measurement will be differentiated.

Page 99: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

Appendix

Page 100: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully
Page 101: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

ABlade flapping

The propeller model used in thesis assumes rigid propellers, but in reality theyare far from rigid which is why this effect was unaccounted for in the controllerdesign.

T

Tlon

Air speed

Center of gravity

hr

α

Figure A.1: Longitudinal motion will cause the propeller blades to flap.This in turn tilts the thrust vector which produced a restoring moment.

In short, blade flapping is caused when the propeller translates through the air.The difference between propeller speed and air speed, that is the effective velocity,will be greater at the side of the advancing blade. A bigger effective velocitymeans more lift force on that side of the propeller. This will cause the blades toflap up and down once per revolution which tilts the thrust vector away from theflight direction. In figure A.1 a sketch of the effect can be seen. The tilting of the

83

Page 102: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

84 A Blade flapping

thrust vector causes a longitudinal force, which is equal to

Tlon = sin(α)T (A.1)

where the tilt angle α depends on the amount of blade flapping. The blade flap-ping can be said to be depended on the longitudinal speed of the hexarotor (i.e.the air speed), the rotor speed and the stiffness of the blades. The attachmentpoint of the propeller is above center of gravity causes the longitudinal force tocreate a restoring moment, calculated by

Mr = Tlonhr (A.2)

where hr is the distance vertical distance between the propeller and the center ofgravity of the hexarotor.

Page 103: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

BResidual analysis

The analysis of a model’s residuals, that is its prediction errors, is a good way ofevaluating if the chosen model structure is able to capture all dynamic excited bythe input signal according to [Ljung and Glad, 2004].

If y(t) is the measured output from the system and y(t|θN ) is the predicted outputfrom the identified model described by the parameter vector θN (N is number ofsamples in the estimation data), then the prediction error is naturally defined by

ε(t) = ε(t, θN ) = y(t) − y(t|θN ) (B.1)

Ideally, the prediction error should be independent of the input signal u(t). Ifvital part of system dynamics is missing in the model, the model will not be ableto predict the output correctly and the prediction errors will not be independentof the input signal. By creating the covariance function between the input andthe prediction errors, that is,

Rεu(τ) =1N

N∑t=1

ε(t + τ)u(t), |τ | ≤ M (B.2)

If the prediction error really is independent of the input, then Rεu(τ) is normallydistributed for big N with mean zero and variance according to

Pr =1N

∞∑k=−∞

Rε(k)Ru(k) (B.3)

where Rε(k) and Ru(k) are the covariance functions of ε and u respectively.

To find out if Rεu(τ) can be considered small enough one usually compares it to±3√Pr . If Rεu(τ) is outside these lines for some τ , it may be an indication that

85

Page 104: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

86 B Residual analysis

ε(t + τ0) and u(t) are dependent for this particular τ0. If an arx-model is usedthen one should consider including u(t − τ0) in the model. If this τ0 < 0 it is notan indication of an incomplete model structure, but rather a sign of that the datahas been collected during feedback.

One more way of investigate if the disturbance model is sufficient is by lookingat the autocorrelation of the residuals. Ideally, the residuals should be mutuallyindependent. This is tested by looking at

Rεε =1N

N∑t=1

ε(t)ε(t + τ) (B.4)

This test is sometimes referred to as a whiteness test since the residuals shouldbehave as white noise.

Page 105: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

CBasic control theory

A second order system can be represented by

G(s) =ω2

0

s2 + 2ζω0s + ω20

(C.1)

with ζ < 1 when the poles are complex conjugates. ζ is said to the relative damp-ing of the system, while ω0 is a time scaling. The poles of this system are

s = ω0

(−ζ ±

√1 − ζ2

)(C.2)

With the representation used earlier in thesis, that is the poles are

ρ1,2 = −α ± β (C.3)

it is easily seen that α = ω0ζ and β = ω0

√1 − ζ2. The inverse relation is given by

ω0 =√α2 + β2, ζ =

α√α2 + β2

=1√

1 +(βα

)2(C.4)

From this it cat be concluded that the distance from origo to the poles is the timescaling, while the relation between α and β is the relative damping. The relationbetween α and β can also be interpreted as an angle, φ. This is because

cos(arctan(x)) =1√

1 + x2(C.5)

and by setting arctan(β/α) = arctan(φ) it is obtained that

ζ = cos(φ) (C.6)

87

Page 106: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

88 C Basic control theory

The angle and the distance can be drawn in the complex plane, as done in figureC.1.

Re

Im

β

α

φ

ω0

Figure C.1: The poles and their relation to φ and ω0

The step response from this system is

y(t) = 1 − e−ζω0t√1 − ζ2

sin(ω0

√1 − ζ2t + φ), cosφ = ζ (C.7)

From this equation it can directly be seen that the frequency of the oscillationfrequency of the step response is in fact β and that the exponential damping is α.From equations (C.4) and (C.7) it can be concluded that the characteristics of thestep response is affected according to C.1.

Parameter Interpretation Effect by increase of parameter

|α| Exponential damping Faster settling time, lower overshoot|β| Oscillation frequency Faster rise time, bigger overshootarctan(β/α) Relative damping Faster rise time, bigger overshoot√α2 + β2 Time scaling Faster rise time, overshoot constant

Table C.1: How changing the poles affects the characteristics of the stepresponse

From this it can be said that a large β compared to α gives more oscillations andthe magnitude of both α and β corresponds to the speed of the system.

Page 107: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

Bibliography

M. Abdolhosseini, Y.M. Zhang, and C.A. Rabbath. An efficient model predic-tive control scheme for an unmanned quadrotor helicopter. Journal of In-telligent & Robotic Systems, 70(1-4):27–38, 2013. ISSN 0921-0296. doi:10.1007/s10846-012-9724-3. Cited on pages 2 and 25.

A. Alaimo, V. Artale, C. Milazzo, and A. Ricciardello. Pid controller applied tohexacopter flight. Journal of Intelligent & Robotic Systems, 73(1-4):261–270,2014. ISSN 0921-0296. doi: 10.1007/s10846-013-9947-y. Cited on pages 3and 25.

K. Alexis, G. Nikolakopoulos, and A. Tzes. Switching model predictive attitudecontrol for a quadrotor helicopter subject to atmospheric disturbances. ControlEngineering Practice, 19(10):1195 – 1207, 2011. ISSN 0967-0661. doi: http://dx.doi.org/10.1016/j.conengprac.2011.06.010. Cited on pages 2 and 25.

ArduPilot.com. Arducopter wiki: Attitude pid, 2012. URL https://code.google.com/p/arducopter/wiki/AC2_attitude_PID. Accessed: 2014-04-11. Cited on page 26.

C.A. Arellano-Muro, L.F. Luque-Vega, B. Castillo-Toledo, and A.G. Loukianov.Backstepping control with sliding mode estimation for a hexacopter. In Electri-cal Engineering, Computing Science and Automatic Control (CCE), 2013 10thInternational Conference on, pages 31–36, Sept 2013. doi: 10.1109/ICEEE.2013.6676026. Cited on pages 2 and 25.

K-J. Barsk. Model predictive control of a tricopter. Master’s thesis, LinköpingUniversity, Automatic Control, The Institute of Technology, 2012. Cited onpages 2, 25, and 35.

F. Beltramini, M. Bergamasco, and M. Lovera. Experiment design for mimo modelidentification, with application to rotorcraft dynamics. In World Congress, vol-ume 18, pages 14392–14397, 2011. Cited on pages 2 and 36.

R.H. Bishop. Mechatronic Systems, Sensors, and Actuators: Fundamentals andModeling. The Mechatronics Handbook, Second Edition. Taylor & Francis,

89

Page 108: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

90 Bibliography

2007. ISBN 9781420009002. URL http://books.google.se/books?id=3UGQsi6VamwC. Cited on page 12.

S. Bouabdallah. Design and Control of Quadrotors with Application to Au-tonomous Flying. PhD thesis, École polytechnique fédérale de Lausanne,2007. URL http://infoscience.epfl.ch/record/95939/files/EPFL_TH3727.pdf. Cited on pages 17 and 26.

S. Bouabdallah, A. Noth, and R. Siegwart. Pid vs lq control techniques applied toan indoor micro quadrotor. In Intelligent Robots and Systems, 2004. (IROS2004). Proceedings. 2004 IEEE/RSJ International Conference on, volume 3,pages 2451–2456, Sept 2004. doi: 10.1109/IROS.2004.1389776. Cited onpages 2, 3, and 25.

T. Bresciani. Modeling, identification and control of a quadrotor helicopter. Mas-ter’s thesis, Lund University, oct 2008. Cited on pages 15 and 26.

M.V. Cook. Flight Dynamics Principles. Butterworth-Heinemann, 2nd edition,2007. ISBN 0080550363. Cited on pages 11 and 12.

O. Elbir, A.U. Batmaz, and C. Kasnakoglu. Improving quadrotor 3-axes stabiliza-tion results using empirical results and system identification. In Control Con-ference (ASCC), 2013 9th Asian, pages 1–5, June 2013. doi: 10.1109/ASCC.2013.6606281. Cited on page 3.

M. Elsamanty, A. Khalifa, M. Fanni, A. Ramadan, and A. Abo-Ismail. Method-ology for identifying quadrotor parameters, attitude estimation and control.In Advanced Intelligent Mechatronics (AIM), 2013 IEEE/ASME InternationalConference on, pages 1343–1348, July 2013. doi: 10.1109/AIM.2013.6584281.Cited on page 2.

M. Enqvist, T. Glad, S. Gunnarsson, and J. Löfberg. Industriell reglerteknik,kurskompendium, 2010. Cited on page 28.

T. Glad and L. Ljung. Reglerteori, Flervariabla och Olinjära metoder. Studentlit-teratur AB, 2:5 edition, 1997. ISBN 978-91-44-03003-6. Cited on page 45.

T. Glad and L. Ljung. Reglerteknik, Grundläggande teori. Studentlitteratur AB,4:7 edition, 2006. ISBN 978-91-44-02275-8. Cited on page 27.

Gabriel M. Hoffmann, Haomiao Huang, Steven L. Wasl, and Er Claire J. Tomlin.Quadrotor helicopter flight dynamics and control: Theory and experiment. InIn Proc. of the AIAA Guidance, Navigation, and Control Conference, 2007.Cited on page 33.

W. Khan and M. Nahon. Toward an accurate physics-based uav thruster model.Mechatronics, IEEE/ASME Transactions on, 18(4):1269–1279, Aug 2013. ISSN1083-4435. doi: 10.1109/TMECH.2013.2264105. Cited on pages 19 and 21.

L. Ljung and T. Glad. System Identification: Theory for the user. Prentice Hall, 2edition, 1999. ISBN 0136566952. Cited on pages 19 and 36.

Page 109: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

Bibliography 91

L. Ljung and T. Glad. Modellbygge och Simulering. Studentlitteratur AB, 2:5edition, 2004. ISBN 978-91-44-02443-1. Cited on pages 57 and 85.

R. Merzouki, A.K. Samantaray, P.M. Pathak, and B.O. Bouamama. Intelli-gent Mechatronic Systems: Modeling, Control and Diagnosis. SpringerLink: Bücher. Springer, 2nd edition, 2012. ISBN 9781447146285. URL http://books.google.se/books?id=k81ECeMxyk8C. Cited on page 12.

A. Mokhtari, N. K. M’Sirdi, K Meghriche, and A Belaidi. Feedback lineariza-tion and linear observer for a quadrotor unmanned aerial vehicle. AdvancedRobotics, 20(1):71 – 91, 2006. ISSN 01691864. Cited on pages 2 and 25.

C. Nordling. Physics Handbook. Studentlitteratur AB, 8:4 edition, 2006. ISBN978-91-44-04453-8. Cited on page 23.

P. Persson and K.J. Åström. Dominant pole design - a unified viewof PID controller tuning. Control Engineering Practice, 1(6):1082,1993. ISSN 0967-0661. doi: http://dx.doi.org/10.1016/0967-0661(93)90080-B. URL http://www.sciencedirect.com/science/article/pii/096706619390080B. Cited on page 65.

P. Pounds, R. Mahony, and P. Corke. Modelling and control of a large quadro-tor robot. Control Engineering Practice, 18(7):691 – 699, 2010. ISSN 0967-0661. doi: http://dx.doi.org/10.1016/j.conengprac.2010.02.008. Special Issueon Aerial Robotics. Cited on pages 15 and 19.

F. Rinaldi, A. Gargioli, and F. Quagliotti. Pid and lq regulation of a multirotorattitude: Mathematical modelling, simulations and experimental results. Jour-nal of Intelligent & Robotic Systems, 73(1-4):33–50, 2013. ISSN 0921-0296.doi: 10.1007/s10846-013-9911-x. Cited on pages 2, 3, and 25.

A.S. Sanca, P.J. Alsina, and J. de Jesus F Cerqueira. Dynamic modeling withnonlinear inputs and backstepping control for a hexarotor micro-aerial vehi-cle. In Robotics Symposium and Intelligent Robotic Meeting (LARS), 2010Latin American, pages 36–42, Oct 2010. doi: 10.1109/LARS.2010.14. Cited onpages 2, 23, and 25.

B. Siciliano and O. Khatib. Springer Handbook of Robotics. Gale virtual referencelibrary. Springer, 2008. ISBN 9783540239574. URL http://books.google.se/books?id=Xpgi5gSuBxsC. Cited on page 13.

M.J. Sidi. Spacecraft Dynamics and Control: A Practical EngineeringApproach. Cambridge Aerospace Series. Cambridge University Press,1997. ISBN 9780521787802. URL http://books.google.se/books?id=xQpZJMtDehQC. Cited on page 13.

J.R. Taylor. Classical Mechanics. University Science Books, 2005.ISBN 9781891389221. URL http://books.google.se/books?id=P1kCtNr-pJsC. Cited on page 14.

Page 110: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

92 Bibliography

M.B. Tischler. Aircraft and Rotorcraft System Identification. Engineering Meth-ods with Flight-Test Examples. AIAA education series. Reston, VA : AmericanInstitute of Aeronautics and Astronautics, 2006. ISBN 1563478374. Cited onpages 36 and 44.

Z. Zhiping. Stabilizability and dominant pole placement by pid controllers. Mas-ter’s thesis, National University of Singapore, 2007. Cited on page 65.

Page 111: Institutionen för systemteknik - Simple searchliu.diva-portal.org/smash/get/diva2:736152/FULLTEXT01.pdf · A decentralized control system using P-PD controllers was successfully

Upphovsrätt

Detta dokument hålls tillgängligt på Internet — eller dess framtida ersättare —under 25 år från publiceringsdatum under förutsättning att inga extraordinäraomständigheter uppstår.

Tillgång till dokumentet innebär tillstånd för var och en att läsa, ladda ner,skriva ut enstaka kopior för enskilt bruk och att använda det oförändrat för icke-kommersiell forskning och för undervisning. Överföring av upphovsrätten viden senare tidpunkt kan inte upphäva detta tillstånd. All annan användning avdokumentet kräver upphovsmannens medgivande. För att garantera äktheten,säkerheten och tillgängligheten finns det lösningar av teknisk och administrativart.

Upphovsmannens ideella rätt innefattar rätt att bli nämnd som upphovsmani den omfattning som god sed kräver vid användning av dokumentet på ovanbeskrivna sätt samt skydd mot att dokumentet ändras eller presenteras i sådanform eller i sådant sammanhang som är kränkande för upphovsmannens litteräraeller konstnärliga anseende eller egenart.

För ytterligare information om Linköping University Electronic Press se förla-gets hemsida http://www.ep.liu.se/

Copyright

The publishers will keep this document online on the Internet — or its possi-ble replacement — for a period of 25 years from the date of publication barringexceptional circumstances.

The online availability of the document implies a permanent permission foranyone to read, to download, to print out single copies for his/her own use andto use it unchanged for any non-commercial research and educational purpose.Subsequent transfers of copyright cannot revoke this permission. All other usesof the document are conditional on the consent of the copyright owner. Thepublisher has taken technical and administrative measures to assure authenticity,security and accessibility.

According to intellectual property law the author has the right to be men-tioned when his/her work is accessed as described above and to be protectedagainst infringement.

For additional information about the Linköping University Electronic Pressand its procedures for publication and for assurance of document integrity, pleaserefer to its www home page: http://www.ep.liu.se/

© Tobias Magnusson