05 Heksacopter Msc

Embed Size (px)

Citation preview

  • 7/26/2019 05 Heksacopter Msc

    1/111

    Institutionen fr systemteknikDepartment of Electrical Engineering

    Examensarbete

    Attitude Control of a Hexarotor

    Examensarbete utfrt i Reglerteknikvid Tekniska hgskolan vid Linkpings universitet

    av

    Tobias Magnusson

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

    Linkping 2014

    Department of Electrical Engineering Linkpings tekniska hgskolaLinkpings universitet Linkpings universitetSE-581 83 Linkping, Sweden 581 83 Linkping

  • 7/26/2019 05 Heksacopter Msc

    2/111

  • 7/26/2019 05 Heksacopter Msc

    3/111

    Attitude Control of a Hexarotor

    Examensarbete utfrt i Reglerteknikvid Tekniska hgskolan vid Linkpings universitet

    av

    Tobias Magnusson

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

    Handledare: Niclas Evestedtisy, Linkpings universitet

    Thomas Barath

    UAS Europe AB

    Examinator: Daniel Axehillisy, Linkpings universitet

    Linkping, 12 juni 2014

  • 7/26/2019 05 Heksacopter Msc

    4/111

  • 7/26/2019 05 Heksacopter Msc

    5/111

    Avdelning, InstitutionDivision, Department

    Department of Automatic ControlDepartment of Electrical EngineeringSE-581 83 Linkping

    DatumDate

    2014-06-12

    SprkLanguage

    Svenska/Swedish

    Engelska/English

    RapporttypReport category

    Licentiatavhandling

    Examensarbete

    C-uppsats

    D-uppsats

    vrig rapport

    URL fr 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

    FrfattareAuthor

    Tobias Magnusson

    SammanfattningAbstract

    This masters thesis has been on modeling, identification and control of a hexarotor system.It has been carried out on behalf of UAS Europe in Linkping. 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

    http://urn.kb.se/resolve?urn=urn:nbn:se:liu:diva-109073http://urn.kb.se/resolve?urn=urn:nbn:se:liu:diva-109073
  • 7/26/2019 05 Heksacopter Msc

    6/111

  • 7/26/2019 05 Heksacopter Msc

    7/111

    Abstract

    This masters thesis has been on modeling, identification and control of a hexaro-tor system. It has been carried out on behalf of UAS Europe in Linkping. A

    set 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

  • 7/26/2019 05 Heksacopter Msc

    8/111

  • 7/26/2019 05 Heksacopter Msc

    9/111

    Acknowledgments

    At first, I would like to thank UAS Europe for giving me the opportunity of doingmy masters thesis. My colleagues Thomas, Thom and Patrik have not only been

    a 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 LinkpingUniversity 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!

    Linkping, June 2013Tobias Magnusson

    v

  • 7/26/2019 05 Heksacopter Msc

    10/111

  • 7/26/2019 05 Heksacopter Msc

    11/111

    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

  • 7/26/2019 05 Heksacopter Msc

    12/111

    viii Contents

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

    3.6 Final model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203.6.1 System input. . . . . . . . . . . . . . . . . . . . . . . . . . . 20

    3.6.2 Total system model . . . . . . . . . . . . . . . . . . . . . . . 203.7 Simulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

    4 Control design 25

    4.1 Choice of control design . . . . . . . . . . . . . . . . . . . . . . . . 254.2 Control techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

    4.2.1 Decentralization. . . . . . . . . . . . . . . . . . . . . . . . . 264.2.2 Cascade structure . . . . . . . . . . . . . . . . . . . . . . . . 264.2.3 The general pidcontroller . . . . . . . . . . . . . . . . . . . 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 . . . . . . . . . . . . . . . . . 35

    5.2 Black box identification in a closed loop . . . . . . . . . . . . . . . 365.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 . . . . . . . . . . . . . . . . . . . . . . . . . 44

    5.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

  • 7/26/2019 05 Heksacopter Msc

    13/111

    Contents ix

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

    6.2.1 Quick and reactive response . . . . . . . . . . . . . . . . . . 68

    6.2.2 Smooth and damped response . . . . . . . . . . . . . . . . . 706.3 Tuning of real platform . . . . . . . . . . . . . . . . . . . . . . . . . 71

    6.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

  • 7/26/2019 05 Heksacopter Msc

    14/111

  • 7/26/2019 05 Heksacopter Msc

    15/111

    xi

  • 7/26/2019 05 Heksacopter Msc

    16/111

    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 ofB1 aroundy1B Vector describing the body frames position in the

    earth frame Air densityi Reaction torque from rotori Roll angle, i.e. rotation ofBaroundxB Yaw angle, i.e. rotation ofB

    2

    aroundz2B

    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 aroundzB-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-vector{xE , yE , zE} Base vectors of the earth frame{xB, yB, zB} Base vectors of the body fixed frame

  • 7/26/2019 05 Heksacopter Msc

    17/111

    Notation xiii

    Notation in modeling (cont...)

    Symbol Meaning

    B Body fixed frame of reference

    CT Propeller thrust constantCQ Propeller torque constnatE Earth frame, used as inertial frame of referenceF Sum of all external forces on the hexarotor

    Fw Total thrust produced by propellersFA Aerodynamic force produced by propellersFR Force caused by air frictionI Current of the DC-motor

    J Inertia matrix expressed in the body frameJP,zz The moment of inertia of the propeller and motor

    around the propeller shaftJxx The hexarotor bodys moment of inertia around xB-

    axisJyy The hexarotor bodys moment of inertia around yB-

    axisJzz The hexarotor bodys moment of inertia around zB-

    axisKt DC-motor torque constantKv DC-motor speed constant

    M Sum of all external torques on the hexarotorMp Torque around xB axis produced by differential pro-peller thrust

    Mq Torque around yB axis produced by differential pro-peller thrust

    Mq Torque around zB axis produced by differential reac-tion torque

    MA Aerodynamic torque produced by propellersMG Gyroscopic torque caused by the rotation of the rotorsMR Torque caused by air friction

    Qi Aerodynamic torque from propelleriRA Relation betweenand time derivative ofRL Rotation matrix from earth frame to body frameTi Thrust produced by propelleriV Vector representing linear velocity of the hexarotor in

    the body frameVin Input voltage to the DC-motor

  • 7/26/2019 05 Heksacopter Msc

    18/111

    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-

    controllerC Pilot commanded roll Estimate roll angle

    D Desired roll rateC Pilot commanded yaw ratep Estimated roll rateq Estimated pitch rater Estimated yaw rate

    ui Virtual control signal to rotoriKD Derivative parameter of a PID-controllerKI Integral parameter of a PID-controllerKP Proportional parameter of a PID-controllerTs Sample time

    TC Pilot commanded throttleUp Virtual roll control

    Uq Virtual pitch controlUr Virtual yaw rate controlUw Virtual throttle control

    Abbreviations and Acronyms

    Acronym Description

    ahrs Attitude and heading reference systemarx Auto-regression extra input

    armax Auto-regressive moving average extra inputcpu Central processing unitdc Direct current

    esc Electronic speed controllergps Global positing systemimu Inertial measurement unitpid Proportional, integral, differential (regulator)psd Power spectral density

    pwm Pulse width modulationrc Radio controller

    uav Unmanned aerial vehiclevtol Vertical take-offand landing

  • 7/26/2019 05 Heksacopter Msc

    19/111

    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 send uavs to search for capsized boats. Being ableto replace human pilots with autonomous aerial vehicles is obviously a tremen-dous advantage.

    The vertical take-offand landing (vtol) uavs are in particular interest becauseof their ability to take offand 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 Linkping 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 masters 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

  • 7/26/2019 05 Heksacopter Msc

    20/111

    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 masters thesis are

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

    Develop and implement simple pidcontrollers 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. Lotsofdifferent 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

  • 7/26/2019 05 Heksacopter Msc

    21/111

    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 pidcontroller 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 using

    these identified models.

    1.4 Thesis outline

    The outline of this thesis is as follows:

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

    Chapter3deals with the physical modeling of the hexarotor. From Newtonand Eulers 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.

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

    Chapter5contains the experiment design, data collection and system iden-tification performed and then presents the identified models.

    Chapter6deals with the synthesis and tuning of the control system and theevaluation of the flight performance after the tuning.

    Chapter7sums up this thesis with conclusions and some discussions of theresults.

  • 7/26/2019 05 Heksacopter Msc

    22/111

  • 7/26/2019 05 Heksacopter Msc

    23/111

    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 source

    of 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

  • 7/26/2019 05 Heksacopter Msc

    24/111

    6 2 Hexarotor

    2.1.1 Throttle

    The main control of the hexarotor is the throttle. It is used to control the hexaro-tors movement in the body fixed vertical direction. Since the propellers are fixed

    pitched, 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.

  • 7/26/2019 05 Heksacopter Msc

    25/111

    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.

  • 7/26/2019 05 Heksacopter Msc

    26/111

    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 controls

    the 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 cpuis responsiblefor communication and controlling the air vehicle. The secondary cpucollectsdata from sensors and filters that data. The board also contains a modem forcommunication with a ground station.

    2.3.2 Propulsion systemEach 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

  • 7/26/2019 05 Heksacopter Msc

    27/111

    2.3 Hardware 9

    AHRS

    Main CPU

    IMU Magnetmetometer

    GPSBarometer

    ESCMotor

    ESCMotor

    ESCMotor

    ESCMotor

    ESCMotor

    ESCMotor

    SBUS-Receiver

    Modem

    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 pwmsignal. It is instead controlled byan esc, the one used in this project is a Turnigy Plush 25A. The escreceives apwmsignal from the flight board and controls the motors by rapidly turning onand offthe 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 cpua filter used to estimate heading and attitude of the hexarotor isrunning. A compilation of the states, sensors and data processing can be seen in

  • 7/26/2019 05 Heksacopter Msc

    28/111

    10 2 Hexarotor

    Table2.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 the

    control 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. Thegpscan 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 filter

    Latitude 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

  • 7/26/2019 05 Heksacopter Msc

    29/111

    3System Modeling

    3.1 Frames of reference

    LetE

    ={

    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) withxEpointing to the north,yEpointing to the eastandzEpointing downwards [Cook, 2007].

    Also, introduceB={xB, yB, zB}as a body fixed frame with origin at the hexaro-tors center of gravity. xBis equivalent with the forward direction of the hexarotor,yBwith right and zBwith 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

  • 7/26/2019 05 Heksacopter Msc

    30/111

    12 3 System Modeling

    3.2 Kinematics

    The body fixed frames 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 theroll angle , re-sulting in a new frame of reference calledB1. Then, rotate the new frameB1 about the new axis y 1Bby thepitch angle ,

    resulting in a new frame of reference calledB2. Lastly, rotate the new frameB2 about the new axisz2B(which coincide with

    zE) by the yawangle , resulting in a new frame aligned with the earthfixed frame.

    In order to transform any linear quantity from earth frame to body frame rotation

    matrices are used. In order to simplify the notation sin( ) and cos( ) are abbrevi-ateds andc respectively. The relation betweenBandB1 after therollingcanbe described by

    xByBzB

    =1 0 00 c s0 s c

    x1By1Bz1B

    (3.1)

    where the rotation matrix is denoted R(x, ). In similar manner, after thepitchingB1 is related toB2 via

    x1By1Bz1B

    =

    c 0 s0 1 0

    s 0 c

    x2By2Bz2B

    (3.2)

    with the rotation matrixR(y, ). After the finalyawingB2 andEare related by

    x2By2Bz2B

    =

    c s 0s c 0

    0 0 1

    xEyEzE

    (3.3)

  • 7/26/2019 05 Heksacopter Msc

    31/111

    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, ) andR(z, ). That yields

    xByBzB

    =

    cc cs sssc cs sss+c c s ccsc+ss css s c cc

    xEyEzE

    (3.4)and the total rotational matrix is denotedRL. This matrix is sometimes referredto as thedirection cosine matrix. One convenient feature ofRLis that its inverseis equal to the transpose, that isR1L =R

    TL , sinceRLS O(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 positionis

    =RTL VVV (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, wherepis rotation around thexB-axis,qis rotation around theyBaxis andris rotation around thezB-axis.

    The first rotation applied to the earth fixed frame, the yawing, is subject to threesuccessive angular transformation: rotation aroundzE ,y1BandxB. The second ro-

    tation, thepitchingis subject to two successive angular transformation: rotationaround y1BandxB. Lastly, therollingis only subject to one attitude transforma-tion: rotation aroundxB. That gives the relation

    pqr

    =R(x, )R(y, )R(z, )

    00

    +R(x, )R(y, )

    00

    +R(x, )

    00

    =

    1 0 s0 c sc0 s cc

    (3.6)

    where the final transformation matrix is denoted RA. Then the time derivate ofthe hexarotors attitudeis

    =R1A (3.7)

    and witht short for tan( ) the inverse can be written

    R1A =1 s t c t0 c s0 sc

    cc

    (3.8)

  • 7/26/2019 05 Heksacopter Msc

    32/111

    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, Newtons 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 aaaEis the accel-eration of the body fixed frame expressed in the inertial frame, m is the mass ofthe body which is constant and FFFEis 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 from

    equation (3.5) a change of basis can be obtained and the expression becomesRLFFF

    B=mRLaaaB=mRL

    dVVVdt

    E

    (3.10)

    where the time derivate is still with respect to the inertial frame and VVVis 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 dVVV

    dtB

    +

    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=m VVV+ mVVV (3.12)

    3.3.2 Rotational dynamics

    Again starting in the inertial frame, Eulers second axiom is

    MMME=LLLE (3.13)where the time derivative is with respect to the inertial frame, LLLEis the angularmomentum of the body expressed in the earth frame and MMMEis the sum of all

  • 7/26/2019 05 Heksacopter Msc

    33/111

    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=RALLLB=RA dJdt E (3.14)whereLLL= Jand Jis the inertia matrix expressed in the body frame. Differen-tiatingJwith respect to the earth frame is rather difficult since it will be time-dependent. Instead, using the transport theorem again, the expression becomes

    MMMB=

    dJdt

    B

    + J (3.15)

    Since the choice of body fixed frame ensured that the inertia matrix is time in-

    variant, the final equation isMMMB=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 FFFand torquesMMM. This will be done

    in 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 and

    direction of rotor rotation

    T6

    T1

    T2

    T3

    T4

    T5

    mg

    (b) Thrusts and gravity applied

    to the rigid body

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

  • 7/26/2019 05 Heksacopter Msc

    34/111

    16 3 System Modeling

    3.4.1 Gravity

    First offis 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 hexacopters

    center of gravity according to Eulers first axiom and is directed along thezE -axis.In the body fixed frame the contribution of the gravitional force FFFBGis

    FFFBG=RL

    00

    mg

    =mg

    ssccc

    (3.17)wheregis 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. Figure3.2showswhere 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 propelleri is denoted Ti ,then the lift forceFwis

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

    Since the sources of thrust, i.e. the propellers, are not located in the center of

    gravity, they will create torques around the different axes of rotation. With somebasic geometry seen in Figure3.3,its easy to find the produced torque. AroundthexB-axis the torqueMpfrom propeller thrust is

    Mp=l

    2T1 lT2

    l

    2T3+

    l

    2T4+lT5+

    l

    2T6 (3.19)

    wherel is the length of each arm. Around the yB-axis the torqueMqis

    Mq=

    3l2

    T1

    3l2

    T3

    3l2

    T4+

    3l2

    T6 (3.20)

    The torque around the zB-axis is a result of Newtons 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 propelleriis calledithe total torque aroundthezB-axis denotedMris

    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

  • 7/26/2019 05 Heksacopter Msc

    35/111

    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 propelleri is denoted

    i, then the generated thrustT

    iis

    Ti =kT2i (3.22)

    wherekT is a propeller specific constant explained more thoroughly later. In thesame way, the aerodynamic torqueQiof propelleribecomes

    Qi=kQ2i (3.23)

    wherekQis a propeller specific constant.

    Now, the total torqueMMMA from the aerodynamic effects of the propeller can bewritten

    MMMA=

    l2

    kT21 l22

    l

    2kT

    23+

    l

    2kT

    24+l

    25+

    l

    2kT

    26

    3l2

    kT21

    3l2

    kT23

    3l2

    kT24+

    3l2

    kT26

    kQ21+kQ22 kQ23+kQ24 kQ25+kQ26

    (3.24)

    and the total forceFFFAbecomes

    FFFA= 00kT(21+ 22+ 23+ 24+ 25+ 26)

    (3.25)

  • 7/26/2019 05 Heksacopter Msc

    36/111

    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 the

    rotation 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 iand the precession vector as. The gyroscopictorqueMMMGi from propelleri is

    MMMGi =JP

    00

    (1)ii

    (3.26)whereJPis 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 =

    00

    JP,zz(1)ii

    =

    qJP,zz(1)iipJP,zz(1)ii

    0

    (3.27)Summing up all propellers, the total gyroscopic torqueMMMGis

    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)

    whereATandARare diagonal matrices with diagonal elementsaTandaRrespec-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.

  • 7/26/2019 05 Heksacopter Msc

    37/111

    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 the

    bending 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 thrustT is

    T=CTr4P

    2 (3.31)

    whereis the air density,rPis the propeller radius andCT is the thrust coefficientof the propeller. Similarly, the aerodynamic torqueQcan be expressed as

    Q= CQr5P

    2 (3.32)

    whereCQ is the propeller torque constant. ModelingCT andCQ 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 escreceives 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 andoffthe 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 pwmto voltage mapping and a classicmodel of a dc-motor is considered sufficient for the purpose of this thesis. The

    pwmto voltage mapping is described in Chapter3.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)

    whereIis the current, Vinis the voltage input, Kv andKt are speed and torqueconstants, is the motor speed,is the reaction torque andQis the aerodynamictorque.

  • 7/26/2019 05 Heksacopter Msc

    38/111

    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

    =RTL VVV (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 controlled

    by 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+

    22+

    23+

    24+

    25+

    26) (3.35a)

    Mp=l

    2kT

    21 lkT22

    l

    2kT

    23+

    l

    2kT

    24+l kT

    25+

    l

    2kT

    26 (3.35b)

    Mq=

    3l2

    kT21

    3l2

    kT23

    3l2

    kT24+

    3l2

    kT26 (3.35c)

    Mr=kQ21+kQ22 kQ23+kQ24 kQ25+kQ26 (3.35d)WG= (1+ 2 3+ 4 5+ 6) (3.35e)

    whereFwcorresponds to the third component of aerodynamic force FAfrom thepropellers defined by equation (3.25)and Mp ,MqandMrto 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= ccu+ (ssc cs)v+ (csc+ss)w (3.36a)

  • 7/26/2019 05 Heksacopter Msc

    39/111

    3.7 Simulator 21

    y= csu+ (sss+cc)v+ (css sc)w (3.36b)z=s u+scv+ccw (3.36c)u=r v

    qw+sg

    aT

    m

    u (3.36d)

    v=pw ru+scgaTm

    v (3.36e)

    w= qu pv+ccg 1m

    FwaT

    mw (3.36f)

    = p+stq+ctr (3.36g)

    = cq s r (3.36h)=

    s

    cq+

    c

    cr (3.36i)

    p= Jyy

    Jzz

    Jxxqr+

    1Jxx

    Mp+J

    P,zzJxxqWG

    aRJxx

    p (3.36j)

    q= JzzJxx

    Jyyrp+

    1Jyy

    MqJP,zzJyy

    pWG aRJyy

    q (3.36k)

    r= JxxJyy

    Jzzpq+

    1Jzz

    Mr 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 acceleration

    and 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 Figure3.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.991093 2.661052 + 4.93102 27.33 (3.37)

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

  • 7/26/2019 05 Heksacopter Msc

    40/111

    22 3 System Modeling

    Rigid body

    J , m

    V

    V

    F

    M

    +

    g

    Gravity

    Air friction

    V

    AT

    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 torqueQias inputs and produces an angular velocityiand a

    reaction torquei . 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 andCQ, 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 torqueMGi .

    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.

  • 7/26/2019 05 Heksacopter Msc

    41/111

    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 thrust

    and 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 Table3.1all 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.8103 kgm2 [Sanca et al., 2010]

    Iyy Moment of inertia around y-axis

    3.8103 kgm2 [Sanca et al., 2010]

    Izz Moment of inertia around z-axis

    7.1103 kgm2 [Sanca et al., 2010]

    CT Propeller thrust constant 0.01458 [Sanca et al., 2010]CQ Propeller torque constant 1.037103 [Sanca et al., 2010]r Propeller radius 0.14 m MeasurementKv Motor constant 4.19103 Vs/rad [Sanca et al., 2010]Kt Motor constant 4.19103 Nm/A [Sanca et al., 2010]R Motor resistance 1 [Sanca et al., 2010]IP,zz Motor and propeller inertia

    around propeller shaft4.3105 kgm2 [Sanca et al., 2010]

    aT Translational air frictionconstant

    4.8102 Ns/m [Sanca et al., 2010]

    aT Rotational air friction con-stant

    6.4 104 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

  • 7/26/2019 05 Heksacopter Msc

    42/111

  • 7/26/2019 05 Heksacopter Msc

    43/111

    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 control

    system 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.

    pidcontrollers 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 pidcontrollers.

    25

  • 7/26/2019 05 Heksacopter Msc

    44/111

    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 are

    big. 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

    Pilotcommands

    Hexarotor

    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

  • 7/26/2019 05 Heksacopter Msc

    45/111

    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. The

    pilot 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

    Pilotcommands

    Hexarotor

    Angular rate control

    Angle Angular rate

    Desired

    angular rate

    V

    irtualcontrol

    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 PI D 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) = KPe(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+KI

    s +KD

    s

    s+ 1=KP+

    KIs

    +KD1

    KD

    + 1s

    (4.2)

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

  • 7/26/2019 05 Heksacopter Msc

    46/111

    28 4 Control design

    derivative can be approximated as s = 1Ts (1z1), where Ts is the sample time,which yields the discrete time transfer function

    F[z] = KP+ KI Ts1 z1 +KD 1KD + Ts1z1(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

    z1

    e[k] = (1 z1)

    KD (1 z1) +Tse[k] =

    KD z1

    KD +Tsd[k] +

    1 z1KD +Ts

    e[k]

    = KD KD +Ts

    d[k 1] + 1KD +Ts

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

    whered[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] = KPe[k] +KD d[k], d[k] = KD

    KD +Tsd[k 1] + 1

    KD +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. Figure4.3shows 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] = KPe[k] +KD d[k], d[k] = KD

    KD +Tsd[k 1] + 1

    KD +Ts(e[k] e[k 1])

    (4.7)

  • 7/26/2019 05 Heksacopter Msc

    47/111

    4.3 Implemented control 29

    Mapping

    P PD+-

    +-

    P PD+-+-

    PD+-

    ++

    Mapping

    Scaling

    Hexarotor

    C

    D

    p

    Up

    C

    D

    q

    Uq

    C

    r

    Ur

    TC 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.

    wheree[k] = D[k] p[k], pis the measured roll rate and Up is the virtual rollcontrol. Here, the assumption thatp , since the roll angle and the pitchanglealways 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] = KPe[k] +KD d[k], d[k] = KD

    KD +Tsd[k 1] + 1

    KD +Ts(e[k] e[k 1])

    (4.9)

    wheree[k] = D

    [k] q[k], qis the measured pitch rate andUqis the virtual pitchcontrol. Here, the assumption thatq was made.Both the input to the outer loop, the commanded pitch angle, and the input to

  • 7/26/2019 05 Heksacopter Msc

    48/111

    30 4 Control design

    the inner loop, the desired pitch rate, as well as the output Uqfrom 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] = KPe[k] +KD d[k], d[k] = KD

    KD +Tsd[k 1] + 1

    KD +Ts(e[k] e[k 1])

    (4.10)

    wheree[k] = C

    [k] r[k], C

    is yaw rate command from the pilot, ris the mea-sured yaw rate andUris the virtual yaw control. Here, the assumption thatr 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(RCRmi n)/ Rmax 1) Ul im (4.11)

    whereUwis the virtual throttle control limited betweenUl im,RC is the throttlecommand from the pilot limited between Rmi nandRmax . The exponential map-ping makes the pilots throttle adjustment smoother at low throttle speed. Tomake sure the mapping is from [Rmi n, Rmax ] to [Ul im, Ul im] c2 is only tunableparameter. c1is calculated by

    c1= Rmax +Umax

    ec2(RmaxRmi n)/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

  • 7/26/2019 05 Heksacopter Msc

    49/111

    4.3 Implemented control 31

    Mp

    Mq

    = 2

    2

    2

    2

    32 0

    32

    32 0

    32

    21

    22

    2

    324

    25

    26

    (4.13)

    where = lkT. The mapping was calculated by inverting the relation above, us-ing a psedo inverse. Since kTis 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/61/3 01/6 3/61/6 3/61/3 01/6

    3/6

    Up

    Uq

    (4.14)

    whereuiare the rotor signals which later will be mapped to a PWM duty cycle

    and Up and Uq are the virtual roll and pitch control respectively. To simplifyeven further, the mixing relation was normalized, which gave

    u1u2u3u4u5

    u6

    =

    1/2 3/21 0

    1/2 3/21/2 3/2

    1 0

    1/2 3/2

    Up

    Uq

    (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 11 0 1

    1/2

    3/2

    11/2 3/2 1

    1 0 11/2

    3/2 1

    Up

    Uq

    Ur

    +

    111111

    Uw (4.16)

  • 7/26/2019 05 Heksacopter Msc

    50/111

    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 signalsuiwere finally mapped linearly from the interval [100, 100] tothe duty cycles of the pwmsignals,iwhich were in the interval of [1000, 2000].

    4.4 Flight performance

    The P-PD controllers were tuned empirically according to Table4.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 offbetween 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 Figure4.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 Figure4.4and4.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 Figure4.4where the the pitch rate first reaches about 40 degrees/s, but

  • 7/26/2019 05 Heksacopter Msc

    51/111

    4.4 Flight performance 33

    Pitch

    rate

    [degrees/s]

    Time [s]

    148 150 152 154 156 15840

    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 Figure4.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 Figure4.6showsthat 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 asblade flappingand is discused further in appendixA.

  • 7/26/2019 05 Heksacopter Msc

    52/111

    34 4 Control design

    Pitch

    angle

    [degrees]

    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.

    Virtualp

    itchcontrol

    Time [s]

    148 150 152 154 156 15810

    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.

  • 7/26/2019 05 Heksacopter Msc

    53/111

    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

  • 7/26/2019 05 Heksacopter Msc

    54/111

    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 may

    incur 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. Though

    in 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 should

    be 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

  • 7/26/2019 05 Heksacopter Msc

    55/111

    5.2 Black box identification in a closed loop 37

    with a full period of the lowest frequency and then exponentially increases thefrequency. In figure5.1the 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 psdshows

    that 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) Thepsdof 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 Figure5.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.

  • 7/26/2019 05 Heksacopter Msc

    56/111

    38 5 Identification

    HexarotorController+-Input

    Error

    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 inFigure5.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 from

    the controllers.

    HexarotorController+-0 Error

    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 receiving

    a zero reference input.

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

    out.

    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) =

    P2xy (f)

    Pxx(f)Pyy (f)

    (5.1)where Pxx is the psd of the frequency sweep input, Pyy the psdof the virtualcontrol andP

    xyis the cross psdbetween the two. C

    xyis close to 1 when the two

    signals are strongly correlated. In Figure5.5it 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.

  • 7/26/2019 05 Heksacopter Msc

    57/111

    5.2 Black box identification in a closed loop 39

    Power[dB]

    Frequency [Hz]0 2 4 6 8 10

    40

    20

    0

    20

    (a) Thepsdof the virtual control when the input is the desired angle

    P

    ower[dB]

    Frequency [Hz]0 2 4 6 8 10

    40

    20

    0

    20

    (b) Thepsdof the virtual control when the input is mixed with the controller output

    Figure 5.4:A comparison of thepsdof 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.

    Magnitude

    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

    Magnitude

    Frequency [Hz]0 2 4 6 8 10

    0

    0.5

    1

    (b) Coherence between frequency sweep input and virtual control when input mixed

    with 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.

  • 7/26/2019 05 Heksacopter Msc

    58/111

    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 was

    therefore 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 Table5.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 any

    interesting 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

  • 7/26/2019 05 Heksacopter Msc

    59/111

    5.3 Con