DEVELOPMENT OF PROCEDURES FOR FLIGHT...

176

Transcript of DEVELOPMENT OF PROCEDURES FOR FLIGHT...

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE

    ARDUPILOT SYSTEM

    A dissertation submitted to The University of Manchester for the degree

    of Master of Science in the Faculty of Engineering and Physical Sciences

    2011

    KHRISTOPHER KABBABE

    SCHOOL OF MECHANICAL, AEROSPACE AND CIVIL ENGINEERING

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    2

    Contents

    Table of Figures ...................................................................................................................6

    Abstract ..............................................................................................................................8

    Declaration.........................................................................................................................9

    Intellectual Property Statement.........................................................................................10

    Acknowledgments.............................................................................................................12

    Nomenclature ...................................................................................................................13

    Acronyms..........................................................................................................................14

    Chapter 1: Introduction....................................................................................................15

    1.1. Objectives...........................................................................................................16

    1.2. The report...........................................................................................................16

    Chapter 2: Literature Survey ............................................................................................18

    2.1. Scope..................................................................................................................18

    2.2. UAV....................................................................................................................18

    2.3. Autopilots...........................................................................................................20

    2.4. Simulation of Autopilots.......................................................................................20

    2.5. PID Based Autopilots ...........................................................................................22

    2.6. Fuzzy Based Autopilots........................................................................................23

    2.7. Robust H Based Autopilot...................................................................................24

    2.8. Available Autopilots.............................................................................................25

    2.9. Research and Teaching Value of the Autopilot.......................................................31

    2.10. Conclusion ..........................................................................................................37

    Chapter 3: Background Theory .........................................................................................38

    3.1. Inertial Measurement Unit (IMU) .........................................................................38

    3.2. Navigation Algorithm ..........................................................................................42

    Chapter 4: MATLAB Flight Simulation Software ................................................................45

    4.1. Flight Simulator Version 10.7 ...............................................................................45

    4.2. Flight simulator Autopilot Modes .........................................................................47

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    3

    4.3. Flight Simulator m-files........................................................................................48

    4.4. Autopilot Simulink blocks and functions................................................................49

    Chapter 5: ArduPilot: Apparatus and Setup ......................................................................53

    5.1. Components of the ArduPilot System ....................................................................53

    5.2. Experimental Setup and Aircraft Integration .........................................................57

    5.3. ArduPilot Source Code Summary..........................................................................60

    5.4. ArduIMU Source Code Summary...........................................................................63

    Chapter 6: Autopilot Testing Procedures ..........................................................................65

    6.1. Simulation ..........................................................................................................65

    6.2. Aircraft Ground Testing........................................................................................68

    6.3. PRE-Flight Testing................................................................................................72

    6.4. Flight Test Procedures..........................................................................................75

    Chapter 7: Analysis of Flight Tests ....................................................................................78

    7.1. Stabilize Mode Flight Tests...................................................................................78

    7.2. FBW A Mode.......................................................................................................82

    7.3. Failsafe (RTL).......................................................................................................83

    7.4. FBW B Mode .......................................................................................................84

    7.5. Autonomous Mode..............................................................................................84

    7.6. Differences between Simulation and Physical FLIGHT Testing.................................85

    Chapter 8: Proposed Flight Test Procedures for the 4th Year Aerospace Design Module ....87

    8.1. Preparing The ArduPIlot.......................................................................................87

    8.2. Requirements for installing the ardupilot ..............................................................92

    8.3. Before taking-off.................................................................................................92

    8.4. Testing Manual Mode..........................................................................................92

    8.5. Testing in Stabilize Mode .....................................................................................93

    8.6. TEsting in FBW Mode...........................................................................................93

    8.7. Testing in Autonomous Mode...............................................................................95

    8.8. POST PROCESSING DATA......................................................................................96

    Chapter 9: Recommendations For Future Work ................................................................97

    9.1. About the MFS ....................................................................................................97

    9.2. About the ardupilot .............................................................................................98

    9.3. About flight testing..............................................................................................99

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    4

    9.4. About Post processing data..................................................................................99

    Chapter 10: Challenges and Limitations........................................................................100

    10.1. Arduino Programming .......................................................................................100

    10.2. Flying the Aircraft..............................................................................................100

    10.3. Weather Limitations..........................................................................................101

    Chapter 11: Conclusion................................................................................................102

    11.1. The Project........................................................................................................102

    11.2. Technology assessment .....................................................................................102

    11.3. The ArduPilot System.........................................................................................102

    11.4. Simulation ........................................................................................................102

    11.5. Testing..............................................................................................................103

    11.6. Instruction Guide...............................................................................................103

    Bibliography....................................................................................................................104

    Chapter 12: Appendices...............................................................................................108

    Appendix A: Modified MATLAB Flight Simulator User Guide [36]......................................109

    Appendix B: Proposed MATLAB Autopilot User Guide ......................................................119

    Appendix C: MA TLAB Fli ght Simul ator Source Code ......................................................126

    C.1. MASTER.M ............................................................................................................126

    C.2. AIRFRAME_C ONFIGURATION.M ............................................................................128

    C.3. CLOUDSFLY_AIR FRAM E.M ..........................................................................................130

    C.4. Airframe_CALC.M ...................................................................................................132

    C.5. AutoPilotConfig.M..................................................................................................134

    C.6. ESC _Settings.M......................................................................................................135

    C.7. Waypoints_CONFIG.M .............................................................................................135

    C.8. STARTUP_Config.M .................................................................................................136

    C.9. SimMechanics_COORDINATE_SYSTEM _SETUP.M..........................................................138

    C.10. MODE_settings.M.................................................................................................140

    C.11. PID_SETTING S.M ...................................................................................................141

    C.12. PID_TUNER.M .......................................................................................................142

    C.13. AP_PID_TUNER ....................................................................................................144

    C.14. AP_Dataextract...................................................................................................145

    C.15. NAV FUNC TION .....................................................................................................148

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    5

    C.16. DCM FUNCTION .....................................................................................................149

    Appendix D: ArduPilot Modi fied Source Code ...............................................................150

    D.1. Modifications to ArduPilot_2_7 ..............................................................................150

    D.2. AP _CloudsFly_CONFIG.H.......................................................................................150

    D.3. AP _CloudsFly_PID_SETTINGS ................................................................................155

    Appendix E: ArduIMU Modified Source Code ................................................................158

    E.1. ARDUIMU.H .........................................................................................................158

    Appendix F: Wind Tunnel Te sting Re sults......................................................................160

    F.1. COMP ARATIVE RESUL TS .......................................................................................160

    F.2. Results with installed static tube.............................................................................161

    Appendix G: ArduPilot Housing CA D Drawing................................................................162

    G.1. MAIN ARDUPIL OT HOUSING ......................................................................................163

    G.2. ARDUIMU AND GPS MODUL E ...................................................................................164

    G.3. PITOT ADAP TER .......................................................................................................165

    G.4. EX TEN SION MOUNT...................................................................................................166

    G.5. CAMERA EXTENSION MOUN T .....................................................................................167

    Appendix H: Proposed Pre-Flight Check List ..................................................................168

    Appendix I : Proposed Flight Test Log.............................................................................171

    Appendix J: M apped GE KML Data For Stabili ze Test .....................................................174

    Appendix K: Content of Attached CD ............................................................................175

    WORD COUNT 22,176

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    6

    Table of Figures

    Figure 2.1 Ground Control Station examples.......................................................................19

    Figure 2.2 Test Platform Block Diagram (As proposed in [11] ) ............................................21

    Figure 2.3 Proposed Test Platform Block Diagram...............................................................22

    Figure 2.4 PID Control examples [4], [11]............................................................................23

    Figure 2.5 Architecture of the self-adaptive fuzzy PID controller [14]...................................24

    Figure 2.6 Comparison curves of step response [14]............................................................24

    Figure 2.7 Configuration and Layout of Components [17]....................................................26

    Figure 2.8 Proposed Block Diagram for the LEGO NXT Based Autopilot................................27

    Figure 1.9 Paparazzi Components Layout [7] ......................................................................28

    Figure 2.10 Paparazzi Autopilot Global Overview [18] ........................................................28

    Figure 2.11 Paparazzi Board with GPS ................................................................................28

    Figure 2.12 ArduPilot Component Assembled .....................................................................30

    Figure 2.13 ArduPilot Schematics [19] ................................................................................30

    Figure 2.14: System Architecture and Autopilot Block Diagram [20]....................................32

    Figure 2.15 Hardware System Configuration Schematic [8] .................................................34

    Figure 2.16 Block Diagram and Assembled Autopilot Hardware [8].....................................35

    Figure 3.1 MEMS 2-DOF Accelerometer ..............................................................................39

    Figure 3.2 Difference between 2 and 3 DOF Accelerometer Based IMUs [31], [32]................39

    Figure 3.3 MEMS Gyroscope...............................................................................................40

    Figure 3.4 Geometry Definition for Waypoint Following......................................................42

    Figure 3.5 Flight Path of UAV with Wind Speed - Distance vs. Line Transition ......................43

    Figure 3.6 Waypoint Smoothening Function Effect ..............................................................44

    Figure 4.1 Screenshot of Flight Simulator V10.7 Graphic Interface.......................................45

    Figure 4.2 SIMULINK Autopilot Blocks ................................................................................50

    Figure 4.3 RC Aircraft System Analogy................................................................................50

    Figure 4.4 Receiver Simulink Block......................................................................................51

    Figure 4.5 Horizontal and Vertical Position of the Aircraft Over Time ..................................52

    Figure 5.1 ArduPilot Complete Setup ..................................................................................53

    Figure 5.2 ArduPilot Board.................................................................................................54

    Figure 5.3 ArduShield V2 Flat Board ...................................................................................54

    Figure 5.4 ArduIMU V2 Flat Board......................................................................................55

    Figure 5.5 U-Blox 5 GPS......................................................................................................55

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    7

    Figure 5.6 XBee Pro S1 System ...........................................................................................56

    Figure 5.7 Initial Installation of the ArduPilot .....................................................................58

    Figure 5.8 Wiring Problem inside the Airframe ...................................................................58

    Figure 5.9 Proposed ArduPilot System Housing V1..............................................................59

    Figure 5.10 Proposed ArduPilot System Housing V2 ............................................................59

    Figure 5.11 Complete System Housing ................................................................................60

    Figure 5.12 Clouds Fly Airframe With The ArduPilot System Installed ..................................60

    Figure 5.13 Fly by Wire vs. Normal Transmitter Demand .....................................................63

    Figure 6.1 Flight Path for Autonomous Flight Simulation ....................................................67

    Figure 6.2 Impact Test at 0.5 m ..........................................................................................68

    Figure 6.3 Impact Test at 1.0 m ..........................................................................................69

    Figure 6.4 Impact Test at 1.5 m ..........................................................................................69

    Figure 6.5 Damage to the Fuselage at Drop Test No. 3 ........................................................69

    Figure 6.6 Wind Tunnel Configuration ................................................................................70

    Figure 6.7 Broughton Park FC.............................................................................................73

    Figure 6.8 Field Setup.........................................................................................................73

    Figure 6.9 ArduPilot Flight Test Waypoints.........................................................................77

    Figure 7.1 Pitch and Roll Settling Time During 1st Flight Test ..............................................79

    Figure 7.2 Pitch and Roll Settling Time During 2nd Flight Test...............................................79

    Figure 7.3 Pitch and Roll Settling Time during 3rd Flight Test ..............................................80

    Figure 7.4 Mapped Google Earth KML Data from the Stabilize Test .....................................80

    Figure 7.5 Attitude Beyond the 180 Degrees Bank Angle.....................................................81

    Figure 7.6 Time to Maximum Pitch and Bank Angle During 5th Flight Test ............................82

    Figure 7.7 Time to Maximum Bank and Pitch Angle During 6th Flight Test...........................83

    Figure 7.8 Waypoint for Autonomous Test 1 .......................................................................85

    Figure 7.9 Autonomous Simulation at 4m/s wind speed ......................................................86

    Figure 8.1 FTDI Connection To The ArduPilot ......................................................................88

    Figure 8.2 ArduPilot Configuration Tool v1.4.14..................................................................90

    Figure 8.3 Broughton Park F.C............................................................................................91

    Figure 8.4 Installing the IMU..............................................................................................92

    Figure 9.1 Proposed GUI Framework ..................................................................................98

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    8

    Abstract

    Unmanned aerial vehicles are complex systems created to substitute the human in

    missions deemed as Dirty, Dull or Dangerous [1]. With the current maturity of the

    technology and the high level of demand, academics are now interested in research

    opportunities to develop innovative and unique UAV solutions.

    At the University of Manchester, the 4th year Aerospace Engineering students have the

    task to develop a design process that will ultimately result in the production of an

    autonomous UAV, which is to be flight tested using the Arduino based autopilot.

    During the development of this project, an autopilot simulation module and several

    post-processing tools were created and are fully operational for them to be deployed

    to the students. Within this report all these tools are presented and discussed.

    A guide was written for student to setup and deploy the ArduPilot into their UAVs. This

    manual shall minimize the time it will take to students to use the ArduPilot.

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    9

    Declaration

    No portion of the work referred to in the dissertation has been submitted in support of

    an application for another degree or qualification of this or any other university or

    other institute of learning;

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    10

    Intellectual Property Statement

    I. The author of this dissertation (including any appendices and/or schedules to

    this dissertation) owns certain copyright or relatedrights in it (the Copyright)

    and s/he has given The University of Manchester certain rights to use such

    Copyright, including for administrative purposes.

    II. Copies of this dissertation, either in full or in extracts and whether in hard or

    electronic copy, may be made only in accordance with the Copyright, Designs

    and Patents Act 1988 (as amended) and regulations issued under it or, where

    appropriate, in accordance with licensing agreements which the University has

    entered into. This page must form part of any such copies made.

    III. The ownership of certain Copyright, patents, designs, trademarks and other

    intellectual property (the Intellectual Property) and any reproductions of

    copyright works in the dissertation, for example graphs and tables

    (Reproductions), which may be described in this dissertation, may not be

    owned by the author and may be owned by third parties. Such Intellectual

    Property and Reproductions cannot and must not be made available for use

    without the prior written permission of the owner(s) of the relevant

    Intellectual Property and/or Reproductions.

    IV. Further information on the conditions under which disclosure, publication and

    commercialisation of this dissertation, the Copyright and any Intellectual

    Property and/or Reproductions described in it may take place is available in

    the University IP Policy (see:

    http://documents.manchester.ac.uk/display.aspx?DocID=487), in any relevant

    Dissertation restriction declarations deposited in the University Library, The

    University Librarys regulations (see:

    http://www.manchester.ac.uk/library/aboutus/regulations) and in The

    Universitys Guidance for the Presentation of Dissertations.

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    11

    This dissertation is dedicated to my parents, grandparents, siblings, my nephew, and

    my girlfriend. I would also like to dedicate my work to General de Divisin Eutimio

    Fuguett Borregales, Aviator of the Venezuelan Air Force, who mentored me during my

    first aviation related project.

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    12

    Acknowledgments

    First, I would like to thank Gareth Roberts, whose guidance and patience made the

    process of learning about the Arduino system a great experience. Also, David

    Langkamp who arranged for the wind tunnel testing, his input on the report was also

    greatly appreciated.

    To Alberto, Ivan, Christophe, Ian, Ashley, and Chaun, thanks for creating such a great

    environment to work in.

    I would also like to thanks Dr. Crowther; whose interest, enthusiasm and guidance

    throughout the project kept me motivated and engaged.

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    13

    Nomenclature

    B Bearing

    D Derivative Gain

    d Euclidean Distance

    e error

    h Height

    I Integral Gain

    K Arbitrary Constant

    P Proportional Gain

    Q Given Vector

    R Rotation Matrix

    V Velocity Vector

    X X-Axis

    x Arbitrary Position along X axis

    Y Y-Axis

    y Arbitrary Position along X axis

    Z Z-Axis

    ADC Analogue to Digital Convertor

    Rx Accelerometer Reading

    Vref Reference Voltage

    VzeroG Zero G-Force Voltage

    Greek Letter

    Angle of Attack

    Pitch Angle

    Yaw Angle

    Roll Angle

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    14

    Acronyms

    AC Aerodynamic Centre

    CAD Computer Aid Design

    CG Centre of Gravity

    DCM Direction Cosine Matrix

    DOF Degree of Freedom

    FBW Fly by Wire

    FTDI Future Technology Devices International

    GCS Ground Control Station

    GPS Global Positioning System

    HIL Hardware-in-Loop

    IDE Integrated Development Environment

    IMU Inertial Measurement Unit

    KML Keyhole Mark-up Language

    MEMS MicroElectroMechanical Systems

    MFS MATLAB Flight Simulator

    PID Proportional, Integral, Derivative

    PWM Pulse Width Modulation

    RC Remote Control

    RPM Revolutions per Minute

    SUAV Small UAV

    UAS Unmanned Aerial System

    UAV Unmanned Aerial Vehicle

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    15

    Chapter 1:

    Introduction

    Never fly the 'A' model of anything.

    Ed Thompson.

    Unmanned aerial vehicles are complex systems created to substitute the human in

    missions deemed as Dirty, Dull or Dangerous [1]. With the current maturity of the

    technology and the high level of demand, UAVs are finding their way into civilian

    applications: law enforcement, search and rescue, etc. With this tendency due to

    increase, academics are now interested in research opportunities to develop

    innovative and unique UAV solutions.

    UAVs rely on autopilots to performautonomously. Although commercial autopilot are

    available theirhigh cost, and license protected source code, makes them useless for

    research purposes. Open source autopilots offer a cheap and highly customizable

    platform to research on, the ArduPilot is one of them [2].

    At the University of Manchester, the 4 th year Aerospace Engineering students have the

    task to develop a design process that will ultimately result in the production of an

    autonomous UAV, which is to be flight tested using the Arduino based autopilot

    ArduPilot.

    The ArduPilot system, as an open source solution, is design to fit a wide range of

    airframes [2]. Also, it requires the user to program the code to fit a particular aircraft

    and tune the PID gains to achieve the desired performance. This involves a steep

    learning curve and requires time to adjust the gains. Within the time constraints

    inherent to term projects it is necessary to streamline the process and develop a set of

    instructions aimed to minimize the challenge involved.

    This project aims to produce a set of instructions that would be used by students to

    flight test their UAVs using the ArduPilot. It also aims to create a simulation tool for

    autonomous flying using an existing flight simulator created by Dr. W. Crowther [3].

    To accomplish these goals a general objective was settled.

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    16

    1.1. OBJECTIVES

    The main objective of this project is to develop a set of tools and instructions that

    student would use to flight test their UAVs.

    To accomplish the main objective it will be necessary to:

    Investigate how autopilot works, what systems are available and how other academic

    institutions are using autopilots as learning tools.

    Gain understanding on the ArduPilot system.

    Develop an Autopilot module to be integrated into the MATLAB Flight Simulator code.

    Install the ArduPilot system in a commercially available airframe.

    Flight test the system to gain knowledge on its features and behaviour.

    Write an instruction manual based on the experience gained from field testing the

    ArduPilot.

    1.2. THE REPORT

    This report is the compilation of the accomplishments and knowledge obtained

    throughout this project.

    The literature survey aims to introduce the reader to the current state of related UAV

    technology: revising its definition, giving a current view on the systems available,

    summarising the research on autopilot being made for teaching purposes and, by

    describing their theory of operation.

    Then, the theory behind Inertial Measurement Unit (IMU), and how MicroElectro-

    Mechanical devices (MEMS) are used to tell the autopilot its current orientation, will

    be explained. It will also introduce key concepts on UAV navigation; the same

    principles are used in the ArduPilot and in the autopilot module created for MATLAB.

    The MATLAB Flight Simulator (MFS) code will then be introduced. Highlighting the

    changes made by the author to improve the user interface and to add the autopilot

    module. In this section, the blocks and scripts that constitute the autopilot will be

    explained in detail. It will be shownthat the simulated autopilot was design as a simile

    to the ArduPilot.

    The next section will containa detailed description on the ArduPilot as a system, rather

    than as a stand-alone entity. It will thenbe shown how the system was ground tested

    and integrated to the airframe for flight testing.

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    17

    Flight testing procedures used to assess the performance of the ArduPilot+CloudsFly

    integration will be introduced. It will also be shown how the functionality of the

    MATLAB autopilot system was tested.

    Next, the data obtained via telemetry will be presented and discussed. The

    performance of the ArduPilot across its main flight modes, and the sensitivity of the

    PID settings, will be the main topics of discussion.

    Additionally, using the experience and know-how obtained during this project, a

    manual with step-by-step instructions for the will be proposed. The manual includes

    guidance on how to use the ArduPilot systemand how to flight test their vehicles using

    the tools designed for that purposed.

    Limitations and challenges experienced withinthe project will thenbe listed. Solutions

    to the problems encountered will be presented, and recommendations on how to

    overcome some of the limitations encountered will also be given.

    Then, recommendation will be given on future work that should be carried out. High

    altitude testing (FABLAB), Hardware-In-Loop simulation (HIL) and furtherdevelopment

    on the MFS for pilot training and robustness are some of the topics discussed.

    Lastly, the conclusions of the project will be listed. These will be based on the

    accomplishment of the objectives raised, and the overall experience using the

    ArduPilot system.

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    18

    Chapter 2:

    Literature Survey

    Where am I?.

    Charles A. Lindbergh, upon arrival in Paris

    This literature survey aims to cover the research made so far towards achieving the

    objectives of the project.First the objectives and scope of the literature survey will be

    explained. The literature will be then reviewed in a structured fashion, by addressing

    each point in separate.

    First, based on work undertaken by the author [1], and other researchers [4], the main

    requirements for the constructiona UAV will be revised. Thensimulation and theories

    for the construction of an autopilot will be discussed with a special emphasis on PID

    controllers [4], [5].

    The off-the-shelve and open-source autopilots will be reviewed and compared, based

    on the work in [4], [6], [2] and [7].

    Lastly the work being undertakenat the Virginia Commonwealth University (VCU) and

    Georgia Institute of Technology (GT) will be reviewed; special attention will be given to

    the studies that are in progress at the University of Manchester.

    2.1. SCOPE

    Theory: Special attention will be given to simple PID controllers. Most open-source

    autopilots will be using PID control loop to construct the autopilot.

    Systems: Commercial autopilots will be mentioned to raise awareness of their

    availability and capabilities. A deeper insight will be given to open-source autopilots,

    especially to the Paparazzi and ArduPilot systems, as they can be used in student

    related projects.

    2.2. UAV

    An Unmanned Aerial Vehicles (UAV) is an aircraft is described as a powered aircraft

    capable of performing its mission without a human operator on board. Since its

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    19

    introduction in the 50s [4] UAVs have been used by the military for missions

    considered to be dull, dirty and/or dangerous [1].

    In previous work undertaken by the author, it is discussed as series of mission

    sceneries were UAV are preferred to humans. Examples of these are dangerous

    mission, for example, flying near weather disaster zones or reconnaissance missions

    over hostile territory [1]. Advantages and disadvantages of UAVs were also discussed

    in [1] as well as reasons why UAVs are systems worth studying. In his report, the

    author also attempts to categorize UAV depending on theirrole and size/performance.

    However only two types of UAVs can be said to fall within the scope of this project:

    1.1.1. Remotely Piloted Vehicles (RPV)

    RPVs are defined as those which are remotely flown by a pilot. They rely on two main

    components to function [8].

    1) The Ground Control Station (GCS)

    RPVs are flown using a distant cockpit, oftenreferred as GroundControl Station (GCS).

    Shown in Figure 2.1, the GCS is defined in [9] as a unit where an operator (pilot) can

    send and receive instructionto one or more airvehicles that have been deployed. For

    his thesis Anderson [9] designs and implements a ground control station to be used

    with Linkping Universitys existing UAV float.

    Figure 2.1 Ground Control Station examples

    His research however is limited to the GCS; no consideration is given to the

    autonomous potential of suchsystems. However his researchdoes allow visualizing of

    the data that can be obtained with the right combination of resources.

    In [10]and [8] the GCS is revisited from a status-feed point of view. The GCS is used a

    tool to supervise the flight of autonomous systems.

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    20

    2) Aircraft Systems

    [9] And [8] presents a list of some of the components that are required to guide,

    navigate and communicate with the UAV. A GPS sensor, engine RPM sensor,

    accelerometers, angular rate sensors, absolute and differential pressure sensors to

    calculate speed andbattery voltage sensor are some of the systems mention in their

    papers. A micro controller is also essential as it provides communication with the GCS

    [8].

    1.1.2. Autonomous UAVs

    UAVs are defined as those vehicles which can be used to perform a mission without

    any kind of human involvement. This capability is only possible with the use of an

    autopilot.

    2.3. AUTOPILOTS

    As previously discussed, autonomous UAV are those which are able to carry out the

    complete mission by its own means. They are able to take-off, climb, loiter and land

    (and taxi) without any human intervention [4], [8], [1], [10].

    In [11] it is recognized that autopilots were first introduced as an aid to stabilize the

    aircraft after a disturbance. They are today complex systems which are used to

    navigate the aircraft, manage its sub-systems and stability augmentation.

    This inheritedcomplexity demand for simulation of the system to be carried out before

    the device is fitted to an aircraft. In [11] it is suggested that MATLAB / Simulink and X-

    Plane can be used as a test platform for an autopilot system.

    2.4. SIMULATION OF AUTOPILOTS

    2.4.1. MATLAB / Simulink and X-Plane Approach

    In their paper Ribeiroand Oliveira [11] propose that MATLAB / Simulink can be used to

    model the autopilot module, X-Plane is used to model the aircraft dynamics and then a

    separate microcontroller to visualize the changes on the control surfaces. This

    configuration is shown in Figure 2.2.

    This configurationseems convenient as MATLAB / Simulink allows for accurate control

    design to be carried out with maximum customization. Also, X-plane can be used to

    simulate very accurate flight dynamics, as it relies on blade element theoryto calculate

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    21

    the forces acting on the entire aircraft. This simplifies the task as no flight dynamics

    simulation needs to be design on MATLAB [11].

    Figure 2.2 Test Platform Block Diagram (As proposed in [11] )

    However there is an obvious cost penalty for this configuration. X-Plane is not open-

    source software. A license is required to use the simulator; additionally a special USB

    key is needed to unlock some features that are not available to the standard

    installation of X-plane [12].

    A microcontrollercard is also required in order to link MATLAB with the physical model

    of the aircraft. A User Datagram Protocol (UDP) needs to be setup between the two

    computers being used to simulate the equipment [11].

    2.4.2. ArduPilot and X-Plane Approach

    As in [11], Bin and Justice [13], propose that the direct link between the Arduino

    Integrated development Environment (IDE) can be exploitedfor research purposes. In

    their paper, it is proposed that between the Arduino IDE and X-plane all the data

    required for a flight test can be collected.

    As in the previous approach, this solution toorelies on a licence dependent software,

    which, aside from the aggregated cost, cannot be modified therefore one is limited to

    the capabilities of X-Plane and the Arduino IDE.

    2.4.3. MATLAB / Simulink and ArduPilot Approach

    Although the approach in [11] is proved to be stable and accurate, it is deemed as an

    expensive configuration andit is proposedby the author that a similar simulation can

    be carried out without the use of X-Plane and therefore using only one computer.

    The approach proposed in [13] does not rely on MATLAB but on an open source IDE.

    This may be a good method to implement the final product (compiling and installing on

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    22

    the microcomputer). However during the design andsimulation stage, MATLAB seems

    to be the most appropriate tool to simulate the autopilot module.

    The proposed diagram is shown in Figure 2.3.

    As with any simulation, there are many ways of simulating autopilots, there are many

    levels of complexity that can be added, and many different theories that can be

    applied. As indicated in Figure 2.3 a PID based controller will be used in our model.

    However, in [4] there is a section dedicated entirely to the different types of autopilot

    based on different control theories. Some of whichwill be summarizedbelow. This will

    assist on understanding the advantages and compromises taken when using PID

    controllers.

    Figure 2.3 Proposed Test Platform Block Diagram

    2.5. PID BASED AUTOPILOTS

    PID is the most widely used controller for autopilots [2], [4], [8], [7]. Its fundamental

    equation can be expressed as

    () = () ()+ + ()] ) )] ( 2.1 )

    Where represents the output value of the controller; e(k) would be the current

    error to be corrected as read on the kth sample [5], [14]. Represented as:

    = () () ( 2.2 )

    Kp, Ki and Kd are the proportional, integral and derivative coefficients respectively. Each

    of these is represented by the general functions:

    = () ( 2.3 )

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    23

    = ()

    ( 2.4 )

    =

    () ( 2.5 )

    PID controllers are widely usedas they are simple and extremely effective. They dont

    require exhaustive computation to yield a solution. They only required for the correct

    gains (P I D coefficients) to be correctly tuned for it to work. In [11] it is suggested that

    the system gains can be accurately obtained using the root locus method.

    Figure 2.4, shows a simple traditional PID control loop on the left and a more complex

    multi-level PID controller used to correct roll attitude by an autopilot.

    Figure 2.4 PID Control examples [4], [11]

    The configuration shown on the right of Figure 2.4 is widely used and can be

    implemented as a cascade of PID controllers to improve robustness [13], [8], [14],

    [15], [11]. In most cases they will be arranged in levels were the outer levels will be

    used to compute the x and y coordinate of the aircraft (direction) to determine the

    correct heading. The middle layers are used to determine is used to stabilize the

    heading and altitude. Lastly, the inner layer is used to stabilize attitude (pitch and roll)

    [4].

    One drawback is that the system will be optimal for only one point of the flight

    envelope. As the control gains are not inherently variable, fuzzy controls are needed to

    add this feature.

    2.6. FUZZY BASED AUTOPILOTS

    Shengyi et al [14], explains how the gains of a PID controller can be setup to be self-

    adaptive with the use of Fuzzy control methods. In specific:

    = + Where : 55

    = + Where : 0.02 0.02

    = + Where : 8 8

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    24

    The structure of the control circuit, Figure 2.5, shows the double loop that would be

    required, one for the control response, and an inner one for the fuzzy control to

    decide on the gains. However there is an evident trade-off to be made. The extra

    loop would increase the computational time, although this is not a problem for

    personal computers, it is something worth considering when using microprocessors.

    Figure 2.5 Architecture of the self-adaptive fuzzy PID controller [14]

    In their paper they show how, for a longitudinal control, the settling time of

    disturbances is reduced and the overshoot controlled. Figure 2.6 shows the settling

    time after a step input.

    Figure 2.6 Comparison curves of step response [14]

    2.7. ROBUST H BASED AUTOPILOT

    Aranda and Sanchez [16], claim that by building an autopilot based on non-classical

    control theory (for example H) some of the uncertainties and need-for-experience

    required for classical theory based autopilots could be avoided; leading to a more

    robust system.

    IT is based on the assumption that the stable poles close to the transmission zeros can

    be cancelled. They identified that the cancelation is not desired when there are poles

    closed to the imaginary axis. As an example: The longitudinal poles:

    ------------ Short Period Mode

    ----------------Phugoid Mode

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    25

    The above results show that there is a pole very close to the imaginary axis, the

    Phugoid mode. This mode is by definition poorly damped [16].

    In their approach they have developed the lateral and longitudinal controls in separate

    modules. They separated each in an inner and outer loop, the inner loop to stabilize

    the aircraft and the outer to follow the navigation instructions. A detailed list of the

    results and time response of the system using robust control theory can be found in

    [16].

    While they manage to successfully build a flight control system which works for

    longitudinal disturbance, it seems to fail in lateral mode, where it failed to recover

    from engine problems [16].

    2.8. AVAILABLE AUTOPILOTS

    Reference [4] offers a very complete survey of available autopilot systems, some of the

    products described are summarized below. Although open-source autopilot were not

    discussed in [4], their research value as cost-effective, fully configurable solutions

    makes them essential in this research, for these reasons some of them are summarized

    as well.

    2.8.1. Commercial Off-the-shelf Autopilots

    Some of the commercially available autopilot solutions are discussed in Table 2.1.

    Table 2.1 Commercial off-the-shelf Autopilots (3)

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    26

    Off-the-shelf commercial autopilots are good when it is needed for a UAV to perform a

    desired task in a very specific way.However most of these systems cancost thousands

    of pounds and are closed sources. Therefore their customization is very limited to what

    the company has left for the user to configure. This renders them useless for the

    applications intended in this research.

    2.8.2. Open-source Autopilots

    2.8.2.1.LEGO NXT Based Autopilot

    Overview:

    One of the simplest open source autopilots available is based on the LEGO Mindstorm.

    The autopilot uses a proportional control loop that calculates and corrects the attitude

    of the aircraft [17].

    Requirements and Configuration:

    The NXT autopilot requires:

    - LEGO NXT Computer.

    - 2 specially design gyros.

    - A 3-axis accelerometer.

    - A specially design servo multiplex.

    - A GPS sensor with Bluetooth capabilities.

    - Knowledge in RobotC programming.

    - Complete system around 600 USD.

    Figure 2.7 shows the layout of the components around the autopilot and on the

    aircraft.

    Figure 2.7 Configuration and Layout of Components [17]

    Theory of Operation:

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    27

    To engage the autopilot the toggle switch on the transmitter is used. Then a servo will

    press a LEGO touch sensor which will then literally move the control in place. This

    assembly is shown in the picture on the far right of Figure 2.7.

    The block diagram, Figure 2.8 shows how the NXT computer is feed with the data from

    the gyros and accelerometer then, by using a proportional control it calculates the drift

    to get back on course and keep the aircraft flying straight.

    Figure 2.8 Proposed Block Diagram for the LEGO NXT Based Autopilot

    One of the problems with this configuration is uncovered in [17]. The gyros used are

    not open source as of the time of this research.They had been heavily modified as the

    standard gyros will give deflectionas rate andnot the actual degrees. This modification

    can be used in software withthe use of Kalmanfilters.However the NXT is not capable

    of performing the computations needed for the conversion, requiring hardware that

    had the function built into it [6].

    Additionally the NXT does not offer support for transmitting Pulse Width Modulation

    (PWM) signals. Therefore, a custom design servo multiplex is required to communicate

    with the servos.

    Conclusion:

    Another problem is the weight of the system. The NXT computer uses 6 AA sized

    batteries which lead to the conclusion that this configuration wouldnot be feasible for

    small UAVs (SUAVs).

    2.8.2.1.Paparazzi Autopilot

    Overview:

    By relying in complete PID loops and Kalman filters to stabilize and navigate the

    aircraft. The Paparazzi is probably one of the most capable open-source autopilot

    available.

    Requirements and Configuration:

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    28

    The Paparazzi autopilot requires the following components, which may be arranged as

    shown in Figure 2.9:

    - Autopilot Board. (A)

    - Battery. (B)

    - Datalink Modem and Antenna. (D)

    - GPS Receiver. (G)

    - IR Sensor Board. (I)

    - Motor and Controller. (M)

    - RC Receiver. (R)

    - Servos. (S)

    - Camera (for video telemetry). (P)

    - Knowledge on Linux or Mac OSX Programming.

    Theory of Operation

    The Paparazzi uses PID loops to calculate and correct error. For some application it

    simplifies the loop by setting the ID components to 0. For example, the pitch control

    loop uses only a proportional loop as pitch is usually well damped. This simplifies

    development as there is no need to tweak extra gains in the controllers [15].

    A global overview of the systemis shown in Figure 2.10. The cascade of PID controllers

    are used to stabilize and control in pitch roll andyaw angles, as well as, climb, altitude,

    course and navigation loops.

    Figure 2.10 Paparazzi Autopilot Global Overview [18]

    Figure 2.11 Paparazzi Board with GPS

    Figure 2.9 Paparazzi

    Components Layout [7]

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    29

    One of the mayor issues with this solution is that intensive programming knowledge is

    required. Additionally, the autopilot cannot be programmed using windows OS. Linux

    or Mac OSX is required. For an Aerospace Engineering student this represents a steep

    learning curve.

    Conclusion

    With the use of Kalman filters to improve accuracy the accuracy of their hardware,

    Paparazzi is one of the most capable open-source autopilots. It is also one of the most

    compact designs, Figure 2.11.

    However the programming involves requires great experience in Linux or Mac OSX

    programming, which is simply not available within the targeted users.

    2.8.2.2.Arduino Based Autopilot

    Overview:

    The ArduPilot is an autopilot system based on the open-source Arduino software and

    hardware. It comprises of a main board, an IMU shield or thermopile sensors, the GPS

    module and a pressure sensor to measure speed.

    As the Paparazzi autopilot, the ArduPilot also relies on PID controllers to function.

    Requirements and Configuration:

    The ArduPilot is a complete autopilot solution when all of the following components

    are used together. The layout of the components is shown in Figure 2.12, where the

    autopilot module is shown on the left, the IMU+ in the centre and the GPS module on

    the right.

    - ArduPilot board.

    - Shield expansion kit with airspeed sensor.

    - GPS module.

    - XY and Z sensors or ArduIMU+.

    - FTDI cable for programming.

    - Xbee module for telemetry.

    - Arduino IDE software.

    - ArduPilot ConfigTool (software) for waypoint uploading.

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    30

    Figure 2.12 ArduPilot Component Assembled

    Theory of Operation:

    The ArduPilot is the least expensive solution currently available. At around 200 GBP it

    is possible to have a complete autopilot system [2].

    As the Paparazzi autopilot the ArduPilot also uses a cascade of PID controllers to

    stabilize and navigate the aircraft.KalmanFilters are not used on the PID controllers as

    the processor currently on the board is not as capable as the one on the Paparazzi (the

    ArduPilot uses a ATMega328 embedded processor). Therefore, it is slightly less

    accurate than the Paparazzi although, with the right PID settings, the difference in

    performance will not be notable for most applications.

    The ArduPilot schematics are shown in Figure 2.13. It shows how the ArduPilot takes

    input from all the available sensors: Airspeed sensor, IMU and GPS. One of the main

    features of this autopilot is that it does not require an external MUX for servo output.

    Instead the boardtranslates the required instruction to PWM signals. This results in a

    weight and space requirement reduction (very important for SUAV applications).

    Figure 2.13 ArduPilot Schematics [19]

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    31

    The ArduIMU+ shield, shown in the centre of Figure 2.12, comprises of 3 axis

    accelerometers and gyroscopes which are used to obtain the current attitude of the

    aircraft. This information is then process by the autopilot module. Where the current

    attitude and GPS location is compared and corrected accordingly [13].

    To upload GPS waypoints a configurationtool (ConfigTool) is used. This program works

    using Google Earth to map the position of the desired waypoints. The waypoints are

    then uploaded to the board. In order to store the waypoints, modification were

    needed in the short memory access of the board (EEPROM) to allow for the waypoints

    to be uploaded and retained even after the board is turned off. However, all the

    modifications and most of the programming needed to have an operative autopilot

    come standard in a downloadable folder. The user is only required to adjust the gains

    and some minor configuration on the code [2].

    One of the drawbacks of the autopilot is the refresh rate of the GPS. The ArduPilot calls

    for position at a rate of 1Hz, which implies that the accuracy of the position will be

    inversely proportional to the speedof the UAV. It would be beneficial to install a more

    capable processor on the board to add filters to provide the autopilot with the

    capability of predicting position in between GPS readings to improve accuracy at

    medium and high speeds.

    Another drawback is the fact that the autopilot cannot receive data via telemetry while

    the aircraft is flying (without any modification).

    Conclusion:

    The ArduPilot is the most user-friendly open-source autopilot currently available. It

    relies on PID controllers to work and is very compact and light weight, ideal for SUAV

    applications. It is also the cheapest, which makes it a good candidate for student

    projects.

    2.9. RESEARCH AND TEACHING VALUE OF THE AUTOPILOT

    2.9.1. Autopilot System Design as a Capstone in Computer Design Projects at Virginia

    Commonwealth University (VCU)

    Objective

    To develop a flight control system for an autonomous UAV, using existing hardware

    based on the Armel FPSLIC device [20].

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    32

    Configuration

    An existing UAV platform was used so that students were able to concentrate on the

    autopilot system [20]. The following components were used:

    - 2 FQM-117B converted army target drones with the following modifications:

    o Addition of landing gear (for standard take-off and landing capabilities).

    o Updated radio equipment.

    o Installation of on-board GPS module.

    o New upgraded engines (specifications not available).

    - GPS System.

    - An Atmel FPSLIC device containing an 8-bit microcontroller and a 40k gate-

    equivalent field programmable gate array for students to implement hardware

    and software to the board.

    - A student design GCS based on Visual Basic.

    - Custom code for linking the GCS to the autopilot, coded using C++.

    Procedure

    The main objective of the Design project was to introduce students to real applications

    for embedded system and software design. The task was to produce a fully functional

    Flight Control System (FCS). The architecture of the system used is similar to that

    offered in the open source solutions previously described in the sense that

    microcontroller will take inputs from the GPS and then calculate the control surface

    deflection required to steer the aircraft to the selected waypoint [20]. VCUs proposed

    System and computer architecture is shown in Figure 2.14.

    Figure 2.14: System Architecture and Autopilot Block Diagram [20]

    After designing and installing theirsolutions, the student would then test their system

    on the air. The model would be flown by the lecturer in manual mode and then

    triggered to function autonomously in the air. The students were responsible of

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    33

    monitoring the GCS to verify the position of the UAV relative to the waypoints.

    Students were also responsible of modifying targeted waypoints and study the

    response of the system to the change in command from the GCS [20].

    Project Results

    In one semester students were able to successfully implement a FCU to a UAV using

    standard hardware. The interests of students inthe project lead them to continue the

    development after the semester was officially ended, adding video telemetry

    capabilities to their system. The end product was entered in the Association for UAS

    international (AUVSI) competition, were they receivedfirst place in overall competition

    and in the flight portion of it [20].

    This main requirement of the project was to develop a fully functional UAS for video

    surveillance. However, no evidence is shown on how well the systems performed

    during the flight tests, norany resulting dynamic behaviourcharacteristics. VCUs case

    study helps to demonstrate the genuine interest that Autonomous UAVs receives from

    academia.

    2.9.2. Undergraduate Teaching at Georgia Tech

    Objective

    The main purpose of Georgia Tech project is to develop a low-cost UAV test-bed as a

    teaching resource for undergraduate and graduate Aerospace Engineering students

    [8].

    Configuration

    This paper acknowledges that some of the current off-the-shelf autopilot offer limited

    access to the configuration of their system. This makes then difficult to modify,

    therefore, rendering them useless for teaching and research activities.

    They address the problem by creating their own software and hardware. To balance

    the cost they have decided to use a commercially available aircraft. The components

    used by GT include:

    - Goldsberg Decathlon ARF R/C aircraft.

    - Autopilot. Containing:

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    34

    o Sensor board. Equipped with: 3 rate gyros, 3 2-axis accelerometers, a 3-axis

    magnetometer, 2 pressure sensors, GPS receiver interface and power

    regulating circuitry.

    o Inertial sensors. Equipped with: 3 ADXS150 angular rate sensors, 3 ADXL202

    dual-axis accelerometers, a 3-axis magnetometer module (HMC2003) and a

    Motorola GPS receiver.

    - Other sensors include: RPM measurement hardware, a differential pressure

    sensors with custom made pitot tubes to measure altitude and speed; also, a

    potentiometer is used to accurately obtain the voltage outputted by the PWM

    motors. This helps to accurately obtain the deflection of the control surfaces

    during autonomous operations.

    - Telemetry modem.

    - In-house developed GCS.

    The experimental schematic is shown in Figure 2.15. This schematic map shows the

    configuration of the system as used in flight.

    Figure 2.15 Hardware System Configuration Schematic [8]

    Procedure

    After the design printing and assembly of the PCB board for the autopilot, shown in

    Figure 2.16. GT students were involved withthe calibration of the inertial sensors, the

    magnetometer and the control surface deflection. This step was vital for the correct

    installation of their custom made autopilot system.

    Static test performed on the inertial sensor were used to determine noise level on

    each sensor. The magnetometer was tested to account for disturbance from nearby

    ferrous materials.Control surfaces were tested by measuring the output voltage from

    the servo motors. The results from these tests are discussed in detailed in [8].

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    35

    Figure 2.16 Block Diagram and Assembled Autopilot Hardware [8]

    Completed the tests, attentionwas given towards identifying the dynamic behaviour

    of the aircraft. For this, a linear model for longitudinal and lateral dynamics was

    derived from data obtained from a flight test. Theoretical linear model was formulated

    for a given flight condition using the stability derivatives. In their paper it is proposed

    that these stability derivatives can be obtained by extensive wind tunnel testing or by

    using the aircraft geometric and mass characteristics. Such characteristics were

    obtained by GT by constructing a detailed CAD model to obtain mass and inertial

    properties of the aircraft and then computing the derivatives using MATLAB.

    Extended Kalman filter are used to complement the signals from the sensors and the

    GPS and to reduce noise.

    Findings

    This paper summarized the effort undertaken by the Aerospace Engineering

    Department at GT. The main configuration of the autopilot was explained in great

    detailed. It was also explain the calibration criteria and methodology for the different

    sensors.

    The next step in their project is to design the control loops to be usedby the autopilot

    to control the aircraft. From [8] it is not clear however what the involvement of the

    students (especially for the graduate students) will be. The plan for inclusion of this

    tool to the current teaching modules was now not presented.

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    36

    2.9.3. Teaching at The University of Manchester

    Objective

    The intentions of the University of Manchester are three-fold [3]:

    - To produce autonomous flight test procedures for student to implement on their

    4th year design project.

    - To substitute the flight testing exercise currently takenplace on board an aircraft

    property of Cranfield University, to decrease cost and enhance student

    experience.

    - To create an autopilot module in MATLAB / SIMULINK environment to add to the

    flight simulator writtenby University staff. This would also be used by the 4th year

    design students.

    Proposed Configuration

    Flight test procedures will be design following existing protocols for flight testing [21],

    [22], taking special considerations to the requirement applicable to UAVs [23] and

    utilizing a cost-effective, flexible and open source autopilot, such as the ArduPilot.

    The main purpose of the procedures to be designed is to evaluate the performance of

    the UAVs being design by the 4th year design students by developing their flight

    envelope maps.

    As a complement, an autopilot module will be added to the MATLAB / SIMULINK flight

    simulator, replicating the ArduPilot controllers. The module will provide the students

    with a tool to test the autonomous capabilities of their UAVs in a synthetic

    environment, reducing the risk of damaging the aircraft. It will also provide the

    capability of adjusting the gains on the PID controllers to optimize the autopilot to

    each aircraft.

    The students task will be to post process the results obtained from the flight tests.

    Assembling their flight test envelopes andassessing the performance of their models.

    The only drawback perceived so far is that none of the aircraft built flies sufficiently

    stable as to add an autopilot module. This makes impossible to perform any kind of

    flight test.

    However flight test can be performed using a commercially available UAV, following

    the approach from GT and VCU. This would prove valuable during the second year

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    37

    flight dynamic laboratory [21]. The same flight test procedures could be applied to an

    existing airframe to teach 2nd year Aerospace Students about flight testing, aircraft

    performance andaircraft dynamics; effectively substituting the need to hire external

    equipment from Cranfield University.

    2.10.CONCLUSION

    UAV or UAS are complex system which comprises of 3 main components to work: a

    Ground Control Station or GCS to control and / or monitor the current state of the

    aircraft, the aircraft to be flown and an autopilot module which stabilizes and

    navigates the aircraft through the desired path.

    It was understood that, autopilots canbe complexsystems and are often constructed

    using cascades of PID control loops. It relies on inputs from an IMU or thermopiles and

    GPS to read the aircraft attitude and location to then compare it with the flight path

    described inthe missionplan. The autopilot then corrects as needed by deflecting the

    control surfaces.The amount of the deflection and the settling time will dependon the

    gains used on the PID controllers. However these gains will be optimum at one point

    in the flight envelope.

    To obtain and validate these gains, it was shown different methods of simulating

    autopilots. It was concludedthat a MATLAB / SIMULINK simulation would be the most

    convenient and cost-effective solution as the simulator already exist.

    It was also studied how fuzzy controls can be introduced to create self-adaptive PID

    gains. However the increase in performance is linked to an increase in operational

    requirements, which might be out of reach for less-expensive autopilots.

    Different off-the-shelve commercial autopilots were visited, concluding that a close-

    source autopilot, while very useful for commercial applications, its useless for

    research applications andstudent projects. These systems were deemed too expensive

    as well.

    Open-source autopilots were investigated in further detailed. It was concluded that

    the most convenient solution is to implement the Arduinobased autopilot ArduPilot.

    Lastly different case-studies were introduced on how Universities across the word uses

    autopilot and UAV systems for academic purposes.

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    38

    Chapter 3:

    Background Theory

    It is possible to fly without motors, but not without knowledge and skill.

    Wilbur Wright.

    One of the main challenges when using autopilot is describing which way is up. The

    open source autopilots described in the literature survey relay mainly in two

    technologies: The thermopile, which uses thermal reading to seek for warmest point,

    and assumes it is the ground. The other is a more precise tool, widely used in

    commercial autopilots as well, an Inertial Measurement Unit, or IMU.

    This chapter describes the basic principles of the Inertial Measurement Unit (IMU). It

    will describe the functionality of MicroEletroMechanical system (MEMS)

    accelerometers and gyroscopes. Then, it will explain how the direction cosine matrix

    (DCM) algorithm is used for inertial navigation. Lastly, it will show the navigation

    model used within the autopilot and ArduPilot. These concepts are necessary to truly

    understand the basic theory behind todays open source autopilot technology.

    3.1. INERTIAL MEASUREMENT UNIT (IMU)

    Inertial Measurements Units (IMUs) are electronic devices, composed of

    accelerometers and gyroscopes, which are used to track a crafts position and

    orientation with respect to an arbitrary coordinate system [24] [25] [26].

    IMUs are preferred overthermopile sensors for UAV applications, as they tend to be

    more precise and are not weather or element dependent [27]. They are also more

    precise than magnetic based navigation. One disadvantage of IMUs is the drift error.

    Drift error results from the addition over time of smaller positioning errors of the

    device. However, external speed sensors and GPS sensors can be installed to correct

    drift errors [25].

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    39

    3.1.1.Accelerometers

    Accelerometers are electromechanical devices used tomeasure acceleration. They can

    be static, like the force of gravity, or dynamic, like the ones experience from a change

    in velocity. Nowadays they are fairly common in electronics, they can be found in

    smartphones, tablets, gaming consoles and other devices [28].

    A common of accelerometers are those made using microscopic piezoelectric crystals.

    As acceleration changes, the crystal gets stressed.This stress creates a voltage change

    which is then translated into acceleration. [29]

    Other types of accelerometers are those made using Microelectromechanical Systems

    (MEMS) techniques. Where a torsional bar attached to a mass on top of a pedestal

    measures the acceleration of a device in movement. Figure 3.1 shows a CAD

    representation of this arrangement. The flat design of this configuration makes it

    possible to fit these accelerometers inside a chip [30].

    Figure 3.1 MEMS 2-DOF Accelerometer

    An IMU uses, either a 3-axis MEMS accelerometeror two 2-axis MEMS accelerometers

    placed normal to each other, to measure the acceleration on all axes while the aircraft

    is in motion. Both configurations are shown in Figure 3.2.

    Figure 3.2 Difference between 2 and 3 DOF Accelerometer Based IMUs [31], [32]

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    40

    Figure 3.2 above shows the components of the forces acting inside the accelerometer.

    To compute the G force associated to each component a transformation must be made

    from the ADC reading to the g force. Equation ( 3.1 ) shows the transformation [25].

    =

    ( 3.1 )

    Where, Rx is the ADC reading from the accelerometer. Vref is the voltage supplied. The

    Divider depends on the bit module, for a 12-bit module the divider would be (2 12-1 =

    4095). VzeroG is ADC reading when no force is exerted. Lastly, everything is divided by

    the sensitivity of the device.

    Accelerometers can be used to measure acceleration while the aircraft experiences a

    change in state. For this reasona gyroscope is also neededto measure the orientation

    of the aircraft.

    3.1.2. Gyroscopes

    Gyroscopes are mechanical devices used to measure orientation. They are used for

    applications where inertial measurements are required. A basic gyroscope consists on

    a mass which is free to rotate around all 3 axes.

    An IMU uses a MEMS gyroscope to sense the orientation of an aircraft. The principle of

    operation is similar to the mechanical one. A proof mass, point 1 in Figure 3.3 is

    allowed to displace on all 3 axes. The movement generates a change in capacitance.

    The capacitance is translated into a digital signal, which is then converted into an angle

    by the processor [33]. Figure 3.3 shows a CAD model of a MEMS gyroscope.

    Figure 3.3 MEMS Gyroscope

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    41

    3.1.3.Direction Cosine Matrix (DCM)

    As described above, accelerometers andgyroscopes are used to obtain the attitude of

    the aircraft. However, this information is given with respect to the devices they are on,

    the IMU in this instance, and therefore with respect to the aircrafts [26].

    An algorithm is requiredto convert these intoEuler angles. First, the acceleration and

    translationvalues obtained from accelerometers and gyroscopes must be transformed

    by multiplying by a 3 x 3 rotational matrix. The resulting matrix will be accelerations

    and translation with respect to the ground. Lastly, these values are converted into

    Euler angles by performing a filter based on the DCM [34].

    For example:

    Given a vector Q (representing velocity, position, acceleration or translations) such

    that:

    =

    ( 3.2 )

    A 3 x 3 rotational matrix R can be used to rotate Q into another reference frame.

    Where:

    =

    ( 3.3 )

    The translation from the aircraft to earth axis is carried out by multiplying the matrix R

    and Q:

    = ( 3.4 )

    Where the relation between R and the Euler angles is the direction cosine matrix:

    = + +

    ( 3.5 )

    Where c is the cosine and s is the sine. From equations ( 3.3 ), ( 3.4 ) and ( 3.5 ). The

    Euler angles, pitch, roll and yaw are given by equation ( 3.6 ):

    ===

    ()

    (,)

    (,)( 3.6 )

    Pitch is limitedto -90 to 90 degrees. The function atan2 is used to obtain the values of

    roll and yaw for all 4 quadrants [34].

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    42

    Open source IMUs, such as the ArduIMU and the IMU shield of the ArduPilot Mega,

    relies on DCM algorithms to obtain the aircrafts orientationwith respect to the ground

    [32].

    3.2. NAVIGATION ALGORITHM

    3.2.1.Distance to waypoint

    To calculate the distance to the next waypoint, the easiest approach is to compute the

    3D Euclidean distance between those two points, equation ( 3.7 ). This approximation

    is valid as the distance between the waypoints is relatively small for SUAVs Figure 3.4

    below shows a representation of the problem.

    = ( +) +)) ) ) ( 3.7 )

    In full size UAV, the distance between waypoints maybe sufficient as to create the

    need to implement a distance functionbasedon great circle navigation. Howeversuch

    applications are not covered here.

    3.2.2.Bearing to waypoint

    The bearing is computed simply by calculating the angle that the aircraft velocity

    makes with the waypoint. The current velocity vector is computed using the DCM

    algorithm previously discussed. Figure 3.4, below, shows the required bearing angle

    [35].

    Figure 3.4 Geometry Definition for Waypoint Following

    From the problem described in Figure 3.4, geometry yields

    =

    ( 3.8 )

    However, a better practice is to use the function atan2 as it would also give the

    quadrant at which the waypoint is located from the aircraft axis [35].

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    43

    =

    ( 3.9 )

    It is important to clarify that the solution is given in radians, from to . Further

    manipulation might be necessary depending on the axis being used. An example on

    how this manipulation is carried out is given in the Navigation function within the

    autopilot block of the Simulink model, appendix C.15.

    3.2.3.Waypoint Transition

    Waypoint transition refers to the instruction, givento the autopilot, on how and when

    the aircraft is considered to have reached the current designatedwaypoint and it to be

    directed to the next.

    [35] Explains two possible scenarios on whenthe aircraft is considered to have reached

    the destination.

    For the first method, the aircraft is consideredto have reached the waypoint when the

    distance betweenthan is lesser or equal to a certain threshold. Shown in Figure 3.5,

    this is the method used within the ArduPilot code and the Simulink simulation. Care

    must be exercise when defining the threshold as flight conditions (including wind

    speed) might impede the aircraft from crossing it.

    Another method is to define that the waypoint will be reached when a line between

    the waypoints has been crossed. Figure 3.5 below shows how the line transition

    approach can result in a faster flight when high wind speeds are present.

    Figure 3.5 Flight Path of UAV with Wind Speed - Distance vs. Line Transition

    How the aircraft behaves just before, and right after, is also important. Transition can

    be carried out with an immediate effect on the heading and attitude of the aircraft.

    This is the method used in the simulation.

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    44

    Another method, also described by [35] involves a smoothening algorithm to be

    developed. This method uses a radius from the waypoint to turn the aircraft in the

    direction of the next waypoint. Both methods of transitionare represented Figure 3.6.

    Figure 3.6 Waypoint Smoothening Function Effect

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    45

    Chapter 4:

    MATLAB Flight Simulation Software

    "The pilot is still the pilot, whether he is at a remote console or on the flight deck.With the

    potential for thousands of these unmanned aircraft in use years from now, the standards for

    pilot training need to be set high to ensure that those on the ground and other users of the

    airspace are not put in jeopardy."

    Mark Rosenker, NTSB Chairman, 2007.

    This chapter describes the changes that were made to the MATLAB Flight Simulator

    code createdby Dr. Crowther. It aims to highlight the changes and the added functions

    that were made during the development of the autopilot module. A modified version

    of the Flight Simulator User Guide is included in appendix A.1. The latest version of the

    code is also included as appendix C.

    4.1. FLIGHT SIMULATOR VERSION 10.7

    The simulator was developed by Dr. Crowther [36] in the Simulink environment, to be

    used as a teaching andtraining tool for the students of the aerospace design module.

    It is mainly used to flight test the UAVs designed by students and to train the pilots ina

    risk free environment.Figure 4.1 below shows a screenshot of the graphic interface of

    the simulation while running.

    Figure 4.1 Screenshot of Flight Simulator V10.7 Graphic Interface

    Figure 4.1 shows the main features of the simulation environment: aircraft, synthetic

    word, and force representation lines on the aerodynamic surfaces. Basic user

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    46

    controlled parameters include: camera selection, simulation controls and arrow keys

    to change current view.

    The simulation works by dividing the model into small sections and then performs

    blade element theory on these areas. This allows accurate prediction of the forces and

    moments acting on the aircraft. Further information can be obtained in the Flight

    Simulator user guide [36].

    4.1.1. System Requirements:

    - A computer running MATLAB 2007b or higher (version 2010 is not recommended due

    to bugs within the visualization toolbox)

    - Real Time block (Slows down simulation to run close to real time)

    - Aerospace toolbox

    - Transmitter with USB connection or any other kind of controller device

    4.1.2. Included Airframes:

    - Default fixed winged aircraft

    - Clouds Fly model

    4.1.3. Features:

    - Flight dynamics model based on blade element theory

    - Collision detection

    - Graphics based on VRML

    - SolidWorks model compatible

    - Stability augmentation (within Autopilot)

    - Autopilot capability

    - Wind tunnel mode

    - Fully configurable models

    - Ability to visualize settling time to adjust PID gains

    4.1.4. Limitations:

    - Autopilot does not control rudder. This was made to imitate the current configuration

    used in the ArduPilot.

    - The simulation, in any mode, requires the presence of a control device.

    - The simulation does not model the physics of the electronic speed controller (ESC) of

    an electric powered aircraft.

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    47

    - Atmospheric changes are not simulated.

    - The navigation function within the autopilot does not check for cross track errors.

    4.2. FLIGHT SIMULATOR AUTOPILOT MODES

    4.2.1. Mode 1 Manual:

    Fly as a normal RC aircraft. For this mode the Simulink model bypasses the autopilot

    block to fly the aircraft as a standard radio controlled model.

    4.2.2. Mode 2 Stabilize:

    Stabilize is a stability augmentation code inwhich the aircraft goes back to level when

    the transmitter stick is released. This mode utilizes a PID control loop to return the

    aircraft back to level flight.

    This is represented on the Simulink model by stating that, for any signal within the

    threshold, the demanded attitude is level flight. Is the example below the threshold is

    set 5% transmitter signal.

    4.2.3. Mode 3 Autonomous:

    In automatic mode, all channels will be controlled by the autopilot block to follow a

    series of waypoints previously defined by the user. The algorithm used for waypoint

    following is the same as explained in section 3.2.

    4.2.4. Mode 4 Wind Tunnel:

    Wind Tunnel mode fixes the CG of the aircraft in a specific location of the world. By

    having a fixed model, the aerodynamic properties of the aircraft canbe determined at

    any fixed attitude. For this mode to work users must set the degree of freedom to

    weld and the wind speedmust be correctly set. Further instructions are provided in

    the Flight Simulator User Guide.

    4.2.5. Mode 5 Fly by wire:

    This semi-automatic mode translates the current position of the transmitterand flights

    the aircraft to the pointed direction. This mode reads the signals from the transmitter

    as an angle demand, instead of the regular rate demand. The maximum bank andpitch

    angle are designated by the user.

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    48

    When this mode is selected, assuming a maximum banking angle of 60 degrees, a full

    right movement of the aileron channel on the transmitter will be translated as a 60

    degree positive bank angle demand. When the control is release the aircraft will go

    back to level flight.

    4.3. FLIGHT SIMULATOR M-FILES

    4.3.1. Master.m

    [Appendix C.1]. Master is the simulation initialization file. Within this file the most

    common changes can be made to the simulation. Flight mode, wind speed, initial

    position, among other parameters can be change before running the simulation. This

    file also calls all necessary scripts. Therefore, there is no need to manually command

    any other script to be run.

    4.3.2. Airframe_Configuration.m

    [Appendix C.2]. This script houses all the information regarding the configuration,

    geometry and characteristics of the airframe to be simulated.

    4.3.3. Airframe_Calc.m

    [Appendix C.4]. This script runs when Airframe_Configuration terminates. It contains

    all the parameters that do not require user input.

    4.3.4. AutoPilotConfig.m

    [Appendix C.5]. This script runs Mode_Settings.m and PID_Settings.m. It provides the

    simulation with the initial demanded Euler angles, the speed control mode and the

    threshold of the autonomy the autopilot will have over the transmitter.

    4.3.5. Mode_Settings.m

    [Appendix C.10]. This m-file turns on and off the signals incoming from the controller

    and the autopilot depending on which mode is selected.

    4.3.6. PID_Settings.m

    [Appendix C.11]. This script contains the inner and outer PID gains. They are to be

    modified every time a new airframe is installed or the design is changed. The file

    PID_Tuner.m, explained below, can be used to set the gains.

  • DEVELOPMENT OF PROCEDURES FOR FLIGHT TESTING UAVS USING THE ARDUPILOT SYSTEM [2011]

    49

    4.3.7. ESC_Settings.m

    [Appendix C.6]. Depending on the autonomy mode of the speed controller, this script

    turns on and off the signals from the autopilot to take control of the speed loop.

    Although no ESC is simulated, the Simulink block and configuration script has been

    named that way for the function they perform.

    4.3.8. Waypoints_Config.m