Missing:
Faculty of Postgraduate Studies and Scientific Research German University in Cairo
Robust Model Reference Adaptive Control of a Quadrotor Unmanned Aerial Vehicle
A thesis submitted in partial fulfillment of the requirements for the degree of Master of Science in Mechatronics Engineering
By
Ramy Abdelmonem Mohamed Rashad Hashem Supervised by
Prof. Dr. Ayman Ali El-Badawy
March, 2015
Faculty of Postgraduate Studies and Scientific Research German University in Cairo
Robust Model Reference Adaptive Control of a Quadrotor Unmanned Aerial Vehicle
A thesis submitted in partial fulfillment of the requirements for the degree of Master of Science in Mechatronics Engineering
By
Ramy Abdelmonem Mohamed Rashad Hashem Supervised by
Prof. Dr. Ayman Ali El-Badawy
March, 2015
Approval Sheet This thesis has been approved in partial fulfillment for the degree of: Master of Science in Mechatronics Engineering by the Faculty of Postgraduate Studies and Scientific Research at the German University in Cairo (G.U.C) on (DD/MM/2015)
Declaration This is to certify that: (i) the thesis comprises only my original work toward the Master Degree (ii) due acknowledgment has been made in the text to all other material used
Ramy Abdelmonem Mohamed Rashad Hashem
Acknowledgment In the name of Allah, the most graceful the most merciful, and peace be upon who was sent as mercy to all mankind. First of all I would like to thank my thesis supervisor, Prof. Dr. Ayman El-Badawy, for his insight and support throughout the duration of this thesis. I would like to also express my gratitude to my teammates in the Mechatronics department of the German University of Cairo who contributed to this work a lot starting with my “19 Dash” teammates Ahmed Abou-donia, Youssef Ahmed Abou Dorra, Omar Khaled Abu Elmagd, Ramez Refaat Fouad Doss, Amr Nader Afifi and Ramy Amir Shawkey. In addition to my “22 Dash” teammates Samir Ayman Abdel-Aal, Omar Magdy and last but not least Samuel Maged. I would like to also thank all my academic colleagues in the Mechatronic University in Cairo for attending my pre-defense seminar and for their useful comments on my work. Last but definitely not least, I would like to express my deepest thanks to my parents, wife, brother and sister for their great support and encouragement and for bearing with me all these years. Finally I would like to thank Allah for the help and support in my life and especially in this thesis.
VI
Abstract This thesis work focuses on the challenges involved in the design, development and control of a quadrotor unmanned aerial vehicle. The main objective of the control system designed is the stabilization of the quadrotor in its hovering configuration in the presence of parametric uncertainties that may occur during flight. One particular uncertainty was addressed in this thesis which is the partial failure of the quadrotor’s actuators. The system’s nonlinear and linearized dynamical model is presented and utilized to develop a simulation environment for testing the control algorithms. The effect of the partial failure of an actuator on the dynamical model of the quadrotor is derived and discussed. Two control approaches were utilized to stabilize the quadrotor in the presence of uncertainties; First a linear controller was derived based on PID techniques and the second approach was a model reference adaptive controller with robust modifications to overcome the instability phenomena that may occur. The stabilization performance of both controllers was compared in simulation. Results have shown that the adaptive controller yields superior performance in rejecting the disturbances added to the nominal model due to a partial failure in the actuators. To validate the designed control systems, a quadrotor platform was assembled and developed. The quadrotor was equipped with several on-board sensors to provide estimates of the quadrotor states without the assist of any external aid. To overcome the drawbacks of the ultrasonic rangefinder, which was used for altitude measurements, a spikes removing algorithm was developed based on the discrete wavelet transform. Finally, the linear controller was validated for stabilizing the attitude of the quadrotor and the results have shown that the attitude was successfully stabilized.
VII
Contents 1 Introduction 1.1 Motivation . . . . . . 1.2 Literature Review . . 1.3 Research Objectives . 1.4 Outline . . . . . . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
1 1 2 4 5
2 System modeling 2.1 Basic concepts . . . . . . . . . . 2.2 Newton-Euler Model . . . . . . 2.2.1 Kinematics . . . . . . . 2.2.2 Dynamics . . . . . . . . 2.2.3 Motor dynamical model 2.3 Simulation Environment . . . . 2.4 System Uncertainties . . . . . . 2.5 Linearized system model . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
6 6 7 8 9 13 14 15 16
3 Linear Control System Design 3.1 Attitude Control System Design 3.1.1 Single feedback loop . . 3.1.2 Rate feedback controllers 3.1.3 Digital implementation . 3.2 Position Control System Design 3.3 Simulation Results . . . . . . . 3.4 Partial actuator failure . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
19 19 20 21 24 27 29 29
. . . .
32 32 33 34 38
. . . .
40 41 41 46 46
4 Robust Adaptive Control System Design 4.1 Problem formulation . . . . . . . . . . . . 4.2 Control system design . . . . . . . . . . . 4.3 Simulation Results . . . . . . . . . . . . . 4.4 Robust modifications . . . . . . . . . . . . 5 Position Estimation 5.1 Vertical Position Estimation . . . . 5.1.1 Discrete Wavelet Transform 5.1.2 Experimental validation . . 5.2 Horizontal Position Estimation . .
VIII
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
6 Experimental Validation 6.1 Overall system structure . . . 6.2 Quadrotor components . . . . 6.2.1 Airframe . . . . . . . . 6.2.2 Rotors . . . . . . . . . 6.2.3 Power source . . . . . 6.2.4 Flight avionics . . . . 6.2.5 Software Architecture . 6.2.6 Test Bed . . . . . . . . 6.3 Parameter Identification . . . 6.3.1 Mass properties . . . . 6.3.2 Rotor properties . . . 6.4 Experimental Results . . . . . 6.4.1 Roll and Pitch Tuning 6.4.2 Yaw Tuning . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
50 50 50 51 52 53 54 55 56 57 58 59 62 62 66
7 Summary and Future Work 71 7.1 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 7.2 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 A Attitude Estimation A.1 Inertial Sensors . . . . . . . . . . A.1.1 Gyroscope . . . . . . . . . A.1.2 Accelerometer . . . . . . . A.1.3 Magnetometer . . . . . . . A.2 Attitude Estimation Algorithms . A.2.1 Roll and Pitch Estimation A.2.2 Yaw Estimation . . . . . . A.3 Scalar Kalman Filter . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
73 73 73 74 74 77 78 79 80
B Graphical User Interfaces 81 B.1 MATLAB GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 B.2 Ground-station GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 C Software Flowcharts 88 C.1 Quadrotor Operating System . . . . . . . . . . . . . . . . . . . . . . 88 C.2 Quadrotor Control System . . . . . . . . . . . . . . . . . . . . . . . . 88
IX
List of Figures 2.1 2.2 2.3 2.4 2.5 2.6
Quadrotor structure . . . . . . . . . . . Quadrotor motion . . . . . . . . . . . . . Inertial and body-fixed reference frames . Rotor aerodynamic forces and moments . Simulation block diagram . . . . . . . . 3D Visualization of Quadrotor . . . . . .
. . . . . .
. 6 . 7 . 8 . 11 . 14 . 15
3.1 3.2 3.3
Roll axis block diagram with single feedback loop . . . . . . . . . . Roll axis block diagram with rate feedback loop . . . . . . . . . . . Frequency response of PD (solid blue) versus P-SAS (dashed red) controllers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Pitch angle stabilization with P-SAS controller. Constant disturbance is added at t = 10 s . . . . . . . . . . . . . . . . . . . . . . . . . . . Frequency response of PID (solid blue) versus PI-SAS (dashed red) controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Pitch angle stabilization with P-SAS controller. Constant disturbance is added at t = 10 s . . . . . . . . . . . . . . . . . . . . . . . . . . . Frequency response of continuous and discrete-equivalent controllers for fs = 100 Hz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Altitude axis block diagram with PID controller with the derivative action on the feedback signal . . . . . . . . . . . . . . . . . . . . . . Linear control system architecture . . . . . . . . . . . . . . . . . . . Simulation results: Snapshots of the quadrotor stabilization using the linear control system . . . . . . . . . . . . . . . . . . . . . . . . . . Simulation results: Position and attitude errors of the quadrotor using the linear control system during stabilization . . . . . . . . . . . . . Simulation results: Snapshots of the quadrotor using the linear control system with 25 % LoE in one rotor . . . . . . . . . . . . . . . . Simulation results: Position and attitude errors of the quadrotor using the linear control system with 25 % LoE in one rotor . . . . . . . .
. 20 . 22
3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 4.1 4.2 4.3 4.4
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
Model reference adaptive control architecture . . . . . . . . . . . . Simulation results: Snapshots of the quadrotor using MRAC with 25 % LoE in one rotor . . . . . . . . . . . . . . . . . . . . . . . . . . . Simulation results: Position and attitude errors of the quadrotor using MRAC with 25 % LoE in one rotor . . . . . . . . . . . . . . . . . . Norm of the tracking error for simulation run without unmodeled dynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X
. 23 . 24 . 25 . 25 . 27 . 28 . 28 . 30 . 30 . 31 . 31 . 33 . 36 . 36 . 37
4.5 4.6 4.7 4.8
Parameter drift in the estimate of the feedback gain matrix K(t). Three parameters are displayed from the matrix for illustration . . Norm of the tracking error for simulation run with sensors noise . . Dead zone modification . . . . . . . . . . . . . . . . . . . . . . . . . Elimination of the parameter drift phenomenon in the estimate of the feedback gain matrix K(t). . . . . . . . . . . . . . . . . . . . . . . .
. 37 . 38 . 38 . 39
5.1 5.2 5.3
Overall position estimation structure . . . . . . . . . . . . . . . . . . Simulation results: Spikes in the ultrasonic measurements . . . . . . . Simulation results: Quadrotor’s altitude (upper) and control signal (lower) in the presence of spikes in the ultrasonic measurements . . . 5.4 Discrete wavelet transform architecture. The superscript ∗ denotes signals before removing spikes . . . . . . . . . . . . . . . . . . . . . . 5.5 Simulation block diagram with spikes rejection algorithm. The superscript m denotes the measured signal used in the control systems. The signals z, z ∗ and z m denote the quadrotor’s altitude, ultrasonic faulty measurement and the corrected signal respectively. . . . . . . . 5.6 Simulation results: Spikes removed from the ultrasonic measurements. Figure shows the raw signal (dashed blue) and the signal after removing the spikes (solid red) . . . . . . . . . . . . . . . . . . . . . . . . . 5.7 Simulation results: Quadrotor’s altitude (upper) and control signal (lower) after applying the DWT-based algorithm . . . . . . . . . . . . 5.8 Experimental Results: Applying DWT on ultrasonic measurement (upper) with approximate coefficients (middle) and detail coefficients (lower) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.9 Experimental Results: Spikes rejection results of distance measurements 5.10 Experimental Results: Estimated velocity in x (left) and y (right) axes 5.11 Experimental Results: Integrated position of quadrotor using velocity estimates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.12 Experimental Results: Spikes rejection results of the optical flow sensor measurements of velocity component in x direction . . . . . . . . 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 6.10 6.11 6.12 6.13 6.14
Overall system structure . . . . . . . . Quadrotor frame . . . . . . . . . . . . Rotor system . . . . . . . . . . . . . . Power sources . . . . . . . . . . . . . . Processing units . . . . . . . . . . . . . Inertial sensors . . . . . . . . . . . . . Software architecture . . . . . . . . . . Testbed 3D model . . . . . . . . . . . . Quadrotor 3D model . . . . . . . . . . Mass distribution pie chart . . . . . . . Static thrust test experimental setup . Thrust coefficient curve fitting results . Motors measured RPM vs. commanded RPM mapping curve fitting results . .
XI
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PWM . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . signal . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
41 42 42 43
44
45 45
47 47 48 49 49 51 51 52 53 54 55 56 57 58 59 60 60 61 61
6.15 Experimental results: Roll (left) and pitch (right) axes using P-SAS controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.16 Root locus and Bode plot of modeled closed loop system using implemented P-SAS controller gains . . . . . . . . . . . . . . . . . . . . . 6.17 Root locus and Bode plot of modeled closed loop system using implemented PI-SAS controller gains . . . . . . . . . . . . . . . . . . . . 6.18 Experimental results: Roll (left) and pitch (right) axes using PI-SAS controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.19 Experimental results: Comparison of pitch control in response to a constant disturbance applied using P-SAS (left) and PI-SAS (right) controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.20 Experimental results: Roll (left) and pitch (right) axes in flight unconstrained by the testbed using PI-SAS controller . . . . . . . . . 6.21 Experimental results: Roll (left), pitch (middle) and yaw (right) axes in flight. Deteriorated performance is observed due to constant disturbance of yaw axis . . . . . . . . . . . . . . . . . . . . . . . . . . 6.22 Experimental results: Roll (left), pitch (middle) and yaw (right) axes in flight. Improved performance after retuning of roll and pitch controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. 63 . 64 . 64 . 65
. 66 . 67
. 69
. 70
A.1 A.2 A.3 A.4
Locus of raw magnetometer measurements . . . . . . Locus of measurements before and after calibration in Overall attitude estimation structure . . . . . . . . . Estimated yaw angle . . . . . . . . . . . . . . . . . .
. . . each . . . . . .
. . . . plane . . . . . . . .
. . . .
. . . .
76 77 78 79
B.1 B.2 B.3 B.4 B.5 B.6 B.7 B.8 B.9
MATLAB GUI : Animation Panel . . . . MATLAB GUI : Attitude Plots Panel . . MATLAB GUI : Position Plots Panel . . MATLAB GUI : Motor Plots Panel . . . MATLAB GUI : Controller Gains Panel Ground-station GUI : Manual Setup . . Ground-station GUI : Motors Control . . Ground-station GUI : Configuration . . . Ground-station GUI : Hover Control . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
82 82 83 83 84 85 85 86 87
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
C.1 Quadrotor Operating System (QOS) program flowchart . . . . . . . . 89 C.2 Quadrotor Control System (QCS) program flowchart . . . . . . . . . 90
XII
List of Tables 1.1
Publicly available OSPs . . . . . . . . . . . . . . . . . . . . . . . . .
3.1
Values of linear controller parameters used in simulation study . . . . 29
4.1
Maximum deviations in the errors of the quadrotor’s configuration using the linear and model reference adaptive controller. Position errors are in cm while the attitude errors are in degrees . . . . . . . . 35
6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8
Motors specifications . . . . . . . . . . . . . . . . . . Power supply specifications . . . . . . . . . . . . . . . Masses of the quadrotor’s components . . . . . . . . Quadrotor’s mass properties identified . . . . . . . . P-SAS controller gains for the roll and pitch axes . . PI-SAS controller gains for the roll and pitch axes . . P-SAS controller gains for the yaw axis . . . . . . . . Linear control system gains of attitude after retuning
XIII
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
3
52 53 58 59 62 64 68 68
List of Acronyms CMOS Complementary Metal-Oxide Semiconductor CoM Center of Mass DMP Digital Motion Processor DoF Degrees of Freedom DWT Discrete Wavelet Transform EoM Equations of Motion ESC Electronic Speed Controller FIR Finite Impulse Response GNSS Global Navigation Satellite System GPIO General Purpose Input/Output GPS Global Positioning System GUI Graphical User Interface I2C Inter-Integrated Circuit IMU Inertial Measurement Unit INS Inertial Navigation System LHP Left Half Plane LiPo Lithium Polymer LoE Loss of Effectiveness LQ Linear Quadratic LTI Linear Time Invariant MEMS Micro-electromechanical systems MIMO Multiple Input Multiple Output
XIV
MRAC Model Reference Adaptive Control OSP Open Source Project PC Personal Computer PD Proportional-Derivative PI Proportional-Integral PID Proportional-Integral-Derivative PWM Pulse Width Modulation QCS Quadrotor Control System QOS Quadrotor Operating System RPI Raspberry Pi SAS Stability Augmenting System SFTP Secure File Transfer Protocol SLAM Simultaneous Localization and Mapping SPI Serial Peripheral Interface SSH Secure Shell Protocol UAV Unmanned Aerial Vehicle UDP User Datagram Protocol WLAN Wireless Local Area Network
XV
Chapter 1 Introduction 1.1
Motivation
In recent years there has been an increasing interest in aerial robotics which have led to many breakthroughs in this area of research. Several industries have been investing in aerial robotics to replace human power in achieving dangerous or repetitive missions both in civilian and military applications. The advances in sensor and battery technologies have led to the development of many aerial robotic platforms allover the world. Fixed-wing Unmanned Aerial Vehicles (UAVs) are capable of performing long range missions efficiently, however they lack the capability of hovering and maneuverability which is required for many UAV tasks. Conventional helicopter UAVs possess many advantages over fixed-wing ones due to their ability to vertically take-off and land in confined spaces in addition to their ability of hovering over targets and maneuverability. However, conventional helicopters require complex mechanical structures in addition to complex control algorithms. One particular multirotor aircraft has gained a lot of interest by researchers which is the quadrotor aerial robotic vehicle making it a standard platform for research in robotics worldwide. Quadrotors have enabled researchers to test control, mapping, swarm robotics and navigation algorithms at a low cost. Their ability to carry sufficient payload, ability to vertically take off and land in addition to their high maneuverability in tight spaces have made them a suitable candidates for implementing cost-effective solutions for a varsity of indoor and outdoor applications. According to [1], the main categories of civilian applications include remote sensing, disaster response, surveillance, transportation and image acquisition. Remote sensing applications include mine detection, pipelines spotting, powerlines monitoring, mapping, meteorology, geology and agriculture. Disaster response include chemical and radiation sensing, wildfire management and flood monitoring. Surveillance missions involve border patrols, coastal patrols, traffic monitoring and law enforcement. Transportation tasks include small and large cargo transportation in addition to delivering payloads in crop dusting and firefighting. Finally image acquisition is used in cinematography and entertainment applications. In addition to civilian applications, quadrotors can be utilized in military applications such as delivering payloads (e.g., medical aids to troops, missiles and bombs), surveillance of human targets and remote sensing of 1
CHAPTER 1. INTRODUCTION
2
human and infrastructure targets. The quadrotor possesses many advantages compared to other UAVs due to their simple mechanical structure which allows researchers to develop platforms from off the shelf components. Moreover, the quadrotor is capable of vertically take off and land in addition to translating at low speeds. In addition, quadrotors are capable of performing complex aggressive maneuvers. However, the high maneuverability and agility of quadrotors comes at a cost that the system is inherently unstable. Therefore they need feedback control algorithms to be able to fly.
1.2
Literature Review
A large part of publications related to quadrotor helicopters have focused on developing control algorithms. The objective of the developed control schemes is either to stabilize the quadrotor’s Center of Mass (CoM) at a desired point in its configuration space or for the CoM to track a certain trajectory. In this section a review of the different control approaches followed in the literature will be presented starting with linear control techniques such as Proportional-Integral-Derivative (PID) and Linear Quadratic (LQ) techniques then nonlinear control approaches utilizing Lyapunov theory, backstepping control, feedback linearization and geometric control approaches. Finally, researchers who have utilized different robust control and adaptive control techniques to accommodate the uncertainties present in the quadrotor’s dynamic model will be presented. One technique of developing a control system is to linearize the quadrotor’s nonlinear dynamical model around the hover state then stabilize the system using linear control methods. Classical PID control has been exploited in [2–8]. It has the advantage that it is model independent and is simple to implement. LQ control techniques were used in [2, 6, 7, 9] with the advantage of producing an optimal input signal. However, a comparison between PID control and LQ adaptive optimal control by [6] has shown that the latter technique yielded average performance due to modeling imperfections. The quadrotor’s dynamical model has a cascade structure as will be described later in section (2.2). This cascade structure has been exploited in inner-loop / outerloop control approaches in [10–12]. Most publicly available Open Source Projects (OSPs), listed in table (1.1), have designed various cascade PID control structures to augment the stability of the system. As a result, the damping of the system increases and the quadrotor becomes controllable by the user. Research projects that included OSPs as their main flight controller includes [13] and [14] which used the Pixhawk, in addition to [15] and [16] which used the Arducopter. Moreover, the Mikrokopter was used in [17] and [18]. A detailed comparison between the available OSPs with descriptions of their sensors, flight avionics, attitude estimation techniques and control algorithms used can be found in [19]. Due to the nonlinear nature of the quadrotor’s dynamical model, linear control schemes are expected to perform relatively poorly [20]. However, these techniques have been implemented in several research projects and proved capable of regulating the quadrotor system. Controllers designed using such methods can be used to
CHAPTER 1. INTRODUCTION
3
track slow motions. However, to execute aggressive maneuvers and achieve better performance, nonlinear control methods should be used. A comparison between a linear PID controller and a nonlinear one with a PD2 feedback structure in addition to compensation of Coriolis and gyroscopic torques has been made by Tayebi and McGilvray in [21] and [22]. The results have shown that the latter technique provides exponential attitude stabilization while the linear controller only provides asymptotic stability. Several researchers designed nonlinear control laws using Lyapunov theory like [7, 23–25]. Moreover, Castillo et al. proposed a nonlinear nested saturation control scheme based on Lyapunov stability criterion in [26] and [27] . Such control scheme allows more aggressive maneuvers and maintains good disturbance rejection [2]. The same authors in [28] compared the performance of their proposed control technique with LQ control and their experimental results have shown that the proposed nonlinear controller yields better performance. The same control technique was used by Lara et al. [5] who compared their nonlinear controller to a Proportional-Derivative (PD) one and the results have shown that the performance of both controllers was closed when the operational point is close to the origin but the nonlinear controller was more robust when the quadrotor is subject to aggressive perturbations. Backstepping control techniques can be used to guarantee the convergence of the quadrotor’s internal states but requires high computational power [3]. The quadrotor’s cascade structure has been exploited by using the backstepping control approach in [29–33]. Bouabdallah [7] proposed a modified backstepping approach which included an integral action and the controller has enabled the quadrotor to perform autonomous hovering in addition to autonomous take-off and landing. Feedback linearization has been used by many researchers to apply linear control methods over a large area of the state space. PD control was applied on the feedback linearized dynamics in [34–37]. Feedback linearization was combined with robust linear control techniques in [38], while Satici et al. [39] combined it with robust optimal control. All references mentioned so far used either Euler-angles or quaternions parametrization to represent the quadrotor’s attitude. To overcome problems of using Euler angles and quaternions, Stepaniak [40] implemented a method where the Euler-angles were extracted from the rotation matrix R while propagating it through time which Project Name Arducopter Openpilot Paparazzi Pixhawk Mikrokopter KKmulticopter Multiwii Aeroquad
Website URL http://code.google.com/p/arducopter http://www.openpilot.org http://paparazzi.enac.fr http://pixhawk.ethz.ch http://www.mikrokopter.de http://www.kkmulticopter.com http://www.multiwii.com http://www.aeroquad.com
Table 1.1: Publicly available OSP
CHAPTER 1. INTRODUCTION
4
was also used in [2]. Another method of representing the quadrotor’s attitude is by using the rotation matrix R itself. This representation allows the design of geometric tracking controllers that are almost globally attractive. This method has been implemented by [39, 41–45]. None of the control approaches mentioned so far accounts for the significant uncertainties present in the system. Typical linear control techniques, such as PID or LQ control posses some robustness properties to such uncertainties. However, these techniques might fail to stabilize the system in the case of severe uncertainties. Robust control techniques can be used to handle the uncertainties in the system as done by [2, 44, 46]. The robust feedback linearization approach was used in [38], while a robust optimal control approach was exploited in [39] where the designed controller yielded an exponential decrease of the tracking error to zero. Uncertainties in the system can also be handled using adaptive techniques. Feedback linearization based approaches have been used by [37], [10], [47] augmented by adaptive laws. Adaptive backstepping was also supplemented by adaptive laws in [48], [49], [50]. To overcome the drawbacks of backstepping approaches, [51] implemented a command filtered backstepping technique with a linear tracking differentiator to eliminate the time-scale separation assumption usually adopted. A Lyapunov-based adaptive control system was used by [52] and [?] to provide robustness against parametric uncertainties and external disturbances. Lee [43] augmented his previously proposed control system expressed on the special orthogonal group SO(3) with and adaptive law to estimate the quadrotor’s inertia matrix. In addition, [53] implemented a Multiple Input Multiple Output (MIMO) control system based on state feedback output tracking design where adaptation accommodates against parameter uncertainties and varying operating points. Moreover, Model Reference Adaptive Control (MRAC) approaches have been used by [54], [55] and [56] to provide robustness against partial actuator failures.
1.3
Research Objectives
The primary research objective for this thesis is to develop a control algorithm capable of stabilizing the quadrotor in the hovering configuration. Two approaches have been followed to develop control systems capable of stabilizing the quadrotor in its configuration space. First, a PID-based linear control system is developed independently for each decoupled subsystem of the quadrotor dynamics. Second, a model reference adaptive based controller is developed to provide the quadrotor to stabilize in the presence of severe parametric uncertainties. The adaptive controller was modified to increase its robustness that will overcome the stability phenomena known as parameter drift. A high fidelity simulation environment is developed using the quadrotor’s dynamical model to test the designed control systems numerically before applying them to a physical platform. The two control systems are implemented and compared through a series of simulation studies to test the advantages and disadvantages of each approach. A quadrotor platform is developed as part of this work from off the shelf com-
CHAPTER 1. INTRODUCTION
5
ponents and the control algorithms are implemented digitally using an on-board microcomputer. Experimental validation of the linear control system on the developed platform has been included in this thesis work. A requirement for the control system is a feedback signal of the quadrotor’s states. All states were estimated in this work using embedded sensors without any external aid. The altitude measurements provided by an ultrasonic rangefinder suffered from spikes and were corrected using an efficient method based on the discrete wavelet transform. The effect of these spikes in the measurement signal was also studied in a simulation.
1.4
Outline
This thesis is organized as follows: Chapter 2, System modeling, includes the basic concepts of the quadrotor structure and movement. The nonlinear dynamical model of the quadrotor is derived, then linearized about the hovering configuration and the effect of partial actuator failure on the system dynamics is discussed. Moreover, the simulation environment developed is presented. Chapter 3, Linear control system design, includes the detailed design of the position and attitude control systems in addition to simulation studies. A particular scenario is simulated which includes a partial failure in one actuator and the quadrotor’s response is simulated. Chapter 4, Robust adaptive control system design, presents the developed adaptive controller which will allow the quadrotor to face parametric uncertainties that arise. Then robust modifications are applied to the adaptive control system to overcome its limitations. Chapter 5, Position estimation, discusses the different on-board sensors used in this work in addition to the estimation algorithms and techniques followed to provide estimates of the quadrotor’s vertical and horizontal position and velocity. Chapter 6, Experimental validation, includes the system hardware and software architecture in addition to the details of the different hardware components utilized are presented. Moreover, the different experiments performed to validate the linear control system are explained. Chapter 7, Summary and future work, presents a summary of the main results of this thesis in addition to the future extensions and applications.
Chapter 2 System modeling 2.1
Basic concepts
The quadrotor system consists of four motors in a cross configuration, as shown in figure (2.1). Each motor has attached to it a fixed pitch propeller blade and all the propellers’ axes of rotation are parallel. The quadrotor’s motion depends directly on the angular speeds of the four propellers. Varying the propeller speeds changes the thrust force produced by the four rotors, therefore the motion of the quadrotor changes. The rotation of each propeller is opposed by air drag. As a result, a reactive moment acts on the rotor which is known as the induced moment. In the quadrotor helicopter, the front-rear pair and the right-left pair of propellers rotate in opposite directions to produce a counter rotating torque. Therefore such configuration eliminates the need for a tail rotor, which is used by the conventional helicopter to counteract the induced moment acting on it from the main rotor. However, to maintain an upward thrust force, the propeller blades are divided in two pairs: two puller and two pusher blades.
Figure 2.1: Quadrotor structure The first motion type of the quadrotor is collective thrust in its current orientation. The quadrotor hovers when all the propellers rotate at the same hovering speed ΩH which causes the total thrust produced from the four rotors to be equivalent to the gravitational force when the propellers’ axes are pointing upwards (cf. figure 2.2a). The quadrotor’s altitude changes by increasing or decreasing the thrust 6
CHAPTER 2. SYSTEM MODELING
7
produced from all rotors by the same amount. As a result, the total thrust changes but the total torque acting on the quadrotor remains zero. Horizontal motions of the quadrotor are achieved by rotating about the lateral and longitudinal axes. To control these motions, a differential thrust must be applied within a pair of rotors while maintaining the same total thrust. To produce such rolling moment in the lateral axis, the differential thrust is applied within the rightleft rotor pair by increasing the speed of one one rotor decreasing the speed of the other (cf. figure 2.2b). In the same manner, producing a differential thrust within the front-rear pair causes a pitching moment in the longitudinal axis as shown in figure (2.2c). Finally to change the heading of the quadrotor, there must be an imbalance in the overall torque acting on it. To achieve such yawing motion, a differential torque is applied to the two pairs of rotors by increasing (or decreasing) the front-rear rotor speeds with the same amount decreased(or increased) in the right-left pair as shown in figure (2.2d). These four operations described represent the only methods available to control the quadrotor’s motion.
front
left
front
right
left
rear
right
rear
(a) Hovering motion
(b) Rolling moment
front
front
left
right
rear
left
right
rear
(c) Pitching moment
(d) Yawing moment
Figure 2.2: Quadrotor motion
2.2
Newton-Euler Model
In this section, the quadrotor will be modeled as a rigid body in space with 6 Degrees of Freedom (DoF) using the Newton-Euler formalism. The quadrotor model will consist of a rigid cross-frame with four rotors equally displaced from the CoM. All the flight avionics, batteries and other components are assumed to be mounted below or above the CoM.
CHAPTER 2. SYSTEM MODELING
2.2.1
8
Kinematics
Let I : {OI , XI , YI , ZI } denote a right handed inertial frame of reference, while B : {Ob , Xb , Yb , Zb } denotes the right handed body-fixed frame where its origin is selected to be the CoM and it is aligned with the quadrotor’s structure as shown in figure (2.3). The unit vectors along the inertial frame {I} and body-fixed frame {B} are denoted by {i~1 , i~2 , i~3 } and {b~1 , b~2 , b~3 } respectively.
front
left
right
rear
Figure 2.3: Inertial and body-fixed reference frames Before deriving the quadrotor’s Equations of Motion (EoM) the following assumptions have been made: 1. The quadrotor’s structure is rigid. 2. The quadrotor’s structure is symmetric about Zb 3. The propeller blades are rigid ie, blade-flapping effects are neglected. The quadrotor’s position in the inertial frame is defined by the vector I p = [x, y, z]> ∈ R3 , where x, y, z are the Cartesian coordinates of the CoM along i1 , i2 , i3 respectively. The quadrotor’s attitude is defined by the orientation of the body-fixed frame with respect to the inertial frame which is denoted by the rotation matrix R ∈ SO(3), where SO(3) is the special orthogonal group of 3 by 3 orthogonal matrices defined as SO(3) = {R ∈ R3×3 |RT R = I, det(R) = 1}. The quadrotor’s configuration is described using the position vector I p and its attitude with respect to frame {I}. Therefore, the configuration space of the quadrotor is Q = SE(3), where SE(3) is the special Euclidean group defined as SE(3) = R3 n SO(3),
(2.1)
CHAPTER 2. SYSTEM MODELING
9
which is the semi-direct product of the three dimensional Euclidean space R3 and the special orthogonal group SO(3). Let the attitude vector be I Θ = [φ, θ, ψ]> ∈ R3 where its components are the Euler angles that parametrize the orientation of frame {B} with respect to frame {I} locally. To get the rotation matrix R, we first rotate about ZI by the yaw angle ψ, then rotate about the Yb axis by the pitch angle θ and finally rotate about the Xb axis by the roll angle φ. The rotation matrix R is given by cθ cψ −cφ sψ + sφ sθ cψ sφ sψ + cφ sθ cψ R = cθ sψ cφ cψ + sφ sθ sψ −sφ cψ + cφ sθ sψ , (2.2) −sθ s φ cθ cφ cθ where c(·) and s(·) are short hand terms for cos (·) and sin (·) respectively. Let the linear velocity vector expressed in {B} be B ν = [u, v, w]> ∈ R3 , where u, v, w are the vector components along Xb , Yb and Zb respectively. While the angular velocity vector expressed in {B} will be denoted by B ω = [p, q, r]> ∈ R3 , where p, q, r are the roll rate, pitch rate and yaw rate respectively. The linear velocity vector B ν expressed in {B} is related to the one in the inertial frame (I ν) by I ν = I p˙ = R B ν, (2.3) where R is the rotation matrix defined by equation (2.2). The relation between the angular velocity vector b ω expressed in {B} is related to the one in the inertial frame (I ω) by the Euler kinematic equations defined as I
˙ =T ω = IΘ
B
ω,
where T is the transformation matrix given by 1 sφ tθ cφ tθ cφ −sφ T = 0 0 sφ /cθ cφ /cθ
(2.4)
(2.5)
A detailed derivation of the transformation matrices defined by equations (2.2) and (2.5) can be found in [3].
2.2.2
Dynamics
The quadrotor kinematics were described using equations (2.3) and (2.4). NewtonEuler formalism will now be used to derive the EoM of the quadrotor. The quadrotor’s linear EoM will be derived in the inertial frame {I}, while the angular EoM will be derived in frame {B}. The latter choice is argued from the following [3]: 1. The inertia matrix becomes time-invariant 2. Body symmetry simplifies the EoM
CHAPTER 2. SYSTEM MODELING
10
3. Roll, pitch and yaw rates (B ω) are usually measured in frame {B} using the on-board Inertial Measurement Unit (IMU). While the linear EoM are chosen to be expressed in {I} since the quadrotor’s altitude is usually measured using range finding sensors while the translational position is usually measured using a motion capture system or a Global Positioning System (GPS). The dynamic equations for the quadrotor system are described using m I ν˙ = I F I
B
ω˙ = −B ω × (I
B
ω) + B τ
,
(2.6)
where m is the mass, I ∈ R3×3 is the inertia matrix referred to the CoM and expressed in {B}, I F represents the vector of external forces applied on the quadrotor expressed in {I} and B τ represents the vector of external torques applied on the quadrotor expressed in {B}. The external forces and torques applied to the quadrotor’s airframe are from three main sources: gravity, aerodynamic effects of the rotors and gyroscopic effects. Contribution due to Gravity Gravity exerts a vertical force on the quadrotor’s CoM along i~3 . The gravitational force vector is given by 0 I Fgravity = 0 . (2.7) −mg Contribution due to Aerodynamic Effects The aerodynamics of rotors was studied thoroughly during the mid 1900s and detailed models of rotor aerodynamics have been developed. However, for a typical robotic quadrotor system, the complex detailed aerodynamic modeling is best to be ignored and a basic level of aerodynamic modeling is sufficient [41]. The aerodynamic forces and moments can be derived using a combination of momentum and blade element theory. The steady state thrust fi generated by a hovering rotor in free air is modeled as fi = CT ρAri ri 2 Ωi 2 ,
(2.8)
where CT is the thrust coefficient which depends on geometry and profile, ρ is the density of air, and for each rotor i, Ari and ri are the rotor’s disk area and radius respectively, while Ωi is the rotor’s angular velocity. A simple lumped parameter model is used in practice as follows: fi = b Ωi 2 ,
(2.9)
where b is a constant thrust factor which can be determined experimentally from static thrust tests.
CHAPTER 2. SYSTEM MODELING
11
Figure 2.4: Rotor aerodynamic forces and moments The steady state reaction torque due to rotor drag acting on a hovering rotor in free air is modeled as τi = d Ωi 2 , (2.10) where d is a constant drag factor which can be also determined experimentally from static thrust tests. The four rotors are labeled from 1 to 4 in clockwise direction, where rotor 1 is on the positive x axis as shown in figure (2.4). The total thrust at hovering (Fthrust ) applied in {B} is the sum of thrust supplied by the four rotors B
Fthrust =
4 X
fi = b
i=1
4 X
Ωi 2 ,
(2.11)
i=1
whereas the total thrust force applied in the inertial frame of reference {I} is given by I Fthrust = R B Fthrust . (2.12) The net roll, pitch and yaw moments acting on the quadrotor about the axes Xb , Yb and Zb respectively are given by B
τφ = l(f4 − f2 ) = bl(Ω4 2 − Ω2 2 )
B
τθ = l(f3 − f1 ) = bl(Ω3 2 − Ω1 2 )
B
(2.13)
τψ = −τ1 + τ2 − τ3 + τ4 = d(−Ω1 2 + Ω2 2 − Ω3 2 + Ω4 2 ),
where B τφ , B τθ , B τψ are the roll, pitch and yaw moments respectively while l is the distance from the quadrotor’s central axis Zb to the rotors as shown in figure (2.4). The mapping between the net thrust and moments and the rotor speeds can be
CHAPTER 2. SYSTEM MODELING
12
written in matrix form B
Fthrust b b b B τφ 0 −bl 0 B = τθ −bl 0 bl B τψ −d d −d | {z Γ
2 Ω1 b Ω2 2 bl 0 Ω3 2 d Ω4 2 }
(2.14)
Using the inverse of the matrix Γ , we can calculate the required rotor speeds given the desired thrust and moments. Therefore in the design of a control system for the quadrotor, the control inputs vector is typically chosen as b U1 Fthrust b ~ = U2 = bτφ . U (2.15) U3 τθ b U4 τψ After calculating the desired control inputs vector, the desired rotor speeds then are calculated using the inverse of equation (2.14) given by 2 −1 −1 1 U 0 2bl 4d Ω 1 1 4b 2 1 −1 1 U2 Ω2 4b 2bl 0 4d . = (2.16) 2 1 1 −1 Ω3 4b 0 2bl 4d U3 2 1 1 1 U4 0 4d Ω4 4b 2bl | {z } Γ −1
Contribution due to Gyroscopic Effects In normal hovering conditions, the spin axes of the four rotors are parallel to the Zb axis. However, if the quadrotor rolls or pitches the angular momentum vectors of the rotors change direction which result in a gyroscopic torque that attempts to align the spin axes with the precession axes of the rotors. For a single rotor, the gyroscopic torque represented in the body-frame τgyr i is equal to the rate of change of the rotor’s angular momentum in addition to the Coriolis effect between the body frame and the rotor’s frame of reference given by d (Ip · Ωi ) + B ω × (Ip · Ωi ) (2.17) dt where Ip is the rotor’s moment of inertia and Ωi is the rotor’s speed. Neglecting the angular acceleration of the rotors, the contribution from a single rotor can be written as Ip z q Ωi τgyr i = −Ip z p Ωi , (2.18) 0 τgyr i =
where Ip z is the component of the moment of inertia in the z axis of the rotor’s frame. Finally the total gyroscopic torque from all the four rotors can be written as
CHAPTER 2. SYSTEM MODELING
13
τgyr
Ip z q ΩT = −Ip z p ΩT , 0
(2.19)
where ΩT is the algebraic sum of the four rotors given by ΩT = −Ω1 + Ω2 − Ω3 + Ω4 .
(2.20)
Other aerodynamic effects associated with a quadrotor system cause only minor perturbations and can be neglected for a typical robotic system [41]. Neglected aerodynamic effects include blade flapping, ground effect and induced drag. Summary of Equations of Motion The quadrotor’s dynamic equations of motion are summarized in the following equation x¨ (sφ sψ + cφ sθ cψ ) Um1 (2.21) y¨ = (−sφ cψ + cφ sθ sψ ) Um1 z¨ (cφ cθ ) Um1 − g 1 [(I − Iz )qr − Ip z q ΩT + U2 ] p˙ Ix y 1 (2.22) q˙ = Iy [(Iz − Ix )pr + Ip z p ΩT + U3 ] . 1 r˙ [(Ix − Iy )pq + U4 ] Iz
2.2.3
Motor dynamical model
According to equation (2.14), the quadrotor’s dynamical model is driven through the four rotor speeds. Therefore high bandwidth control of each motor’s speed is significant for the overall control of the quadrotor. Most quadrotor systems are constructed using brushless DC motors driven by Electronic Speed Controllers (ESCs). The main function of each ESC is electronic commutation in addition to controlling the motor’s speed. As a result of a system identification experiment done by [11], it is suggested that the closed loop motor control system can be modeled by a first order differential equation Ω˙ i act = Km (Ωi des − Ωi act ),
(2.23)
where Ωi des is the commanded rotor speed, Ωi act is the actual rotor speed and Km is the motor gain. In this work, the motor dynamics are incorporated in this manner.
CHAPTER 2. SYSTEM MODELING
14
Figure 2.5: Simulation block diagram
2.3
Simulation Environment
In this section, the dynamical model developed in the previous sections will be used to develop a simulation environment. This tool helps in verifying the correctness of the developed model and allows the incorporation of aerodynamic effects on the quadrotor. Moreover, the simulation environment will be used to test and compare different control algorithms developed. The simulation environment is developed c , which is an environment for multi-domain simulation using Matlab/Simulink and model-based design for dynamical systems. The simulation model consists of several interconnected blocks as shown in figure (2.5). Starting from the left to the right, the first subsystem is the Desired Task which contains the desired configuration of the quadrotor passed on to the control systems which will be designed later. These control systems are implemented in the block Position and Attitude Control Systems. The calculated control signals are transmitted to the Motors Signals Calculation then to the Motors Empirical Model to calculate each motor’s speed and incorporate the dynamics of the motors which are then transformed to the resultant forces and moments acting on the quadrotor as described in (2.14) in the subsystem Input Matrix Mapping. The EoM of the quadrotor are divided and implemented in two different blocks. The first one is the Rotational Dynamics (Body) block which includes the angular EoM defined by equation (2.22) while the translational EoM defined by equation (2.21) are implemented in the Translational Dynamics (Inertial) block. To include the error sources generated from the sensors used in the quadrotor system, the subsystem Inertial Navigation System simulates these sources, such as random noise and spikes, before the quadrotor states are fed-back to the control systems. To analyze the simulated results after each simulation run, the signals are imported in a Graphical User Interface (GUI) created using MATLAB. The GUI allows the analysis of the quadrotor’s position and orientation in addition to the calculated
CHAPTER 2. SYSTEM MODELING
15
Figure 2.6: 3D Visualization of Quadrotor control signals and the individual motor speeds. The GUI includes also a 3D visualization of the quadrotor to help in verifying its performance. The quadrotor is represented by four circles each at one end of the airframe represented by two line segments. The front circle is colored red instead of yellow to mark the orientation of the quadrotor. Figure (2.6) shows a snapshot of the quadrotor after a simulation run. The detailed description and features of the GUI are presented in Appendix (B).
2.4
System Uncertainties
The nonlinear model (2.21-2.22) describes most of the dominant dynamics during trivial flight regimes and neglect aerodynamic effects including blade flapping, ground effect and induced drag. These neglected aerodynamics are treated as uncertainties in the system model in addition to severe uncertainties that may arise due to actuator failure or structural damage of the propeller blades. The effect of partial actuator failures on the system dynamics will be examined in this section. To model this effect we assume only the first rotor is damaged without loss of generality. The effective rotor speeds are then related to the rotor speeds calculated from the control input by 2 Ω λ 0 0 0 Ω1 2 1 2 Ω2 0 1 0 0 Ω2 2 = , (2.24) 2 Ω3 0 0 1 0 Ω3 2 2 Ω4 0 0 0 1 Ω4 2 ef f
calc
where 0 ≤ λ ≤ 1 is a constant representing the effectiveness of the first rotor where λ = 1 indicates the rotor is undamaged. The previous equation can be written in
CHAPTER 2. SYSTEM MODELING
16
matrix form as Ω2ef f = Λ Ω2calc ,
(2.25)
where Λ is the rotors effectiveness matrix. The rotor speeds calculated from the control input are obtained using equation (2.16) which can be written in matrix form as Ω2calc = Γ −1 U calc , (2.26) while the effective aerodynamic forces and moments that affect the quadrotor’s dynamics in equation (2.21-2.22) are given by U ef f = Γ Ω2ef f .
(2.27)
Using the previous three equations, the relation between the effective forces acting on the quadrotor’s rigid body and the calculated ones is given by −1+λ b−bλ 3+λ 0 − 2l U U 4d 1 1 4 U2 U2 0 1 0 0 . = (2.28) (l−lλ) bl(−1+λ) 1+λ U3 4 0 U 2 4d 3 d(−1+λ) d−dλ 3+λ 0 U4 U4 4b 2bl 4 calc
ef f
The off-diagonal elements in this matrix represent a coupling effect between the collective thrust, pitch and yaw axes. In general if any single rotor of was damaged there will be this coupling effect between the collective thrust, yaw and one of the roll or pitch axes depending on which rotor was damaged.
2.5
Linearized system model
In this section, the quadrotor’s linearized EoM will be derived. The quadrotor’s hovering configuration is used as the operating point about which the EoM are linearized. Such configuration is defined by p˜ = [˜ x, y˜, z˜]> = [xo , yo , zo ]> I ν˜ = [x˜˙ , y˜˙ , z˜˙ ]> = [0, 0, 0]> , I ˜ ˜ θ, ˜ ψ] ˜ > = [0, 0, ψo ]> Θ = [φ, I
B
(2.29)
ω ˜ = [˜ p, q˜, r˜]> = [0, 0, 0]>
where the accent ∼ denotes the nominal value of the state. In addition, the small angles assumption for the roll and pitch angles yields; cφ ≈ 1, cθ ≈ 1, sφ ≈ φ and sθ ≈ θ. In order to achieve such configuration, the total thrust produced by the rotors should be equal to the quadrotor’s weight, while the net roll, pitch and yaw moments ˜ is written as should be equal to zero. The nominal control inputs vector U ˜ = [U˜1 , U˜2 , U˜3 , U˜4 ] = [mg, 0, 0, 0], U
(2.30)
CHAPTER 2. SYSTEM MODELING
17
while the rotor speeds vector Ω = [Ω1 , Ω2 , Ω3 , Ω4 ] in this case should be equal to r mg ˜ , i = 1, ..., 4. (2.31) Ωi = Ωh = 4b The input mapping equations (2.14) will be linearized first using Taylor series expansion. The first input U1 can be written as ∂U1 ˜ ˜ U1 (Ω) = U˜1 + (Ω)(Ω − Ω) ∂Ω = mg + 2bΩh (Ω1 − Ωh ) + 2bΩh (Ω2 − Ωh ). + 2bΩh (Ω3 − Ωh ) + 2bΩh (Ω4 − Ωh )
(2.32)
By carrying out a similar derivation for the other three control inputs, equations 2.15 can be written as ∆U1 ∆U2 ∆U3 ∆U4
= 2bΩh (∆Ω1 + ∆Ω2 + ∆Ω3 + ∆Ω4 ) = 2blΩh (∆Ω4 − ∆Ω2 ) , = 2blΩh (∆Ω3 − ∆Ω1 ) = 2dΩh (−∆Ω1 + ∆Ω2 − ∆Ω3 + ∆Ω4 ),
(2.33)
where ∆Ui represents the deviation in the control inputs from the nominal values in (2.30) and ∆Ωi represent the deviation from the nominal hovering speed defined by equation (2.31). For specific control inputs calculated from the quadrotor’s controllers, the desired deviations in the rotor speeds can be calculated using the inverse of the equations (2.33) given by ∆U1 8bΩh ∆U1 = 8bΩh ∆U1 = 8bΩh ∆U1 = 8bΩh
∆Ωdes 1 = ∆Ωdes 2 ∆Ωdes 3 ∆Ωdes 4
∆U3 4blΩh ∆U2 − 4blΩh ∆U3 + 4blΩh ∆U2 + 4blΩh −
∆U4 8dΩh ∆U4 + 8dΩh . ∆U4 − 8dΩh ∆U4 + 8dΩh −
(2.34)
The previous equations can be written in matrix form and modified by choosing new control inputs as follows ∆Ωdes 1 0 −1 −1 ∆Ω T 1 des ∆Ω2 1 −1 0 1 ∆Ωφ = , (2.35) des ∆Ω3 1 0 1 −1 ∆Ωθ ∆Ωdes 1 1 0 1 ∆Ω ψ 4 where ∆ΩT , ∆Ωφ , ∆Ωθ and ∆Ωψ are the new control inputs defined by ∆U1 8bΩh ∆U3 ∆Ωθ = 4blΩh
∆ΩT =
∆U2 4blΩh . ∆U4 ∆Ωψ = 8dΩh ∆Ωφ =
(2.36)
CHAPTER 2. SYSTEM MODELING
18
The significance of this modification is that the new control inputs are related to the desired deviations in motor speeds by addition and subtraction only which simplifies the computations done by the quadrotor’s processor. Moreover, the relation doesn’t depend on the quadrotor parameters as in equation (2.35) which implies that these values are not required to be stored in the quadrotor’s processor. Using Taylor series expansion to linearize the quadrotor’s EoM similar to the first control input in equation (2.32) we end up with the following: The translational EoM (2.21) after linearization about the hovering configuration will be written as x¨ = g(sψo φ + cψo θ) y¨ = g(sψo θ − cψo φ), 8bΩh ∆ΩT z¨ = m
(2.37)
where sψo and cψo are short hand notations for sin (ψo ) and cos (ψo ) respectively. Finally the rotational EoM (2.4) and (2.22) are linearized and written as φ˙ = p θ˙ = q ψ˙ = r
4blΩh ∆Ωφ Ix 4blΩh q˙ = ∆Ωθ . Iy 8dΩh r˙ = ∆Ωψ Iz p˙ =
(2.38)
This linearized model captures the dominant dynamics of the quadrotor near the hovering configuration. The model shows decoupled dynamics in the collective, roll, pitch and yaw axes while motion in the x and y direction is achieved by vectoring the collective thrust vector. Moreover the model also shows the time scale separation present in the quadrotor system as the dynamics in the x and y directions are quadruple integrators while the dynamics of the remaining four axes are double integrators only [56]. The four decoupled systems represented in the Laplace domain can be written as KT Z(s) = 2 ∆ΩT (s) s θ(s) Kθ = 2 ∆Ωθ (s) s
Kφ φ(s) = 2 ∆Ωφ (s) s , ψ(s) Kψ = 2 ∆Ωψ (s) s
(2.39)
where KT , Kφ , Kθ , Kψ are constants including the system parameters in (2.37-2.38). Incorporating all the system parameters in its transfer function was due to the choice of the modified control inputs given by equation (2.36). This modification decreases the sensitivity of the control performance to the system parameters due to the action of feedback which increases the robustness of the designed control system to errors in the parameter identification process described in section (6.3). The set of equations presented in this section will be used in the coming chapters to develop control algorithms that stabilize the quadrotor in its hovering configuration in the presence of disturbances.
Chapter 3 Linear Control System Design Developing a control scheme capable of stabilizing the quadrotor in its configuration space Q = SE(3), defined by equation (2.1), is a challenging task. The challenge arises due to several reasons. First, the system is underactuated; there are four inputs, defined by equation (2.15), used to control the system that lives in a six dimensional configuration space. Second, the system possesses unstable, nonlinear and coupled open loop dynamics. The nonlinearities and coupling in the system is easily observable in the EoM (2.21) and (2.22). As for the system’s stability, a Linear Time Invariant (LTI) state space model for a hovering quadrotor was identified in [57] and proven to be unstable. Such identified model has shown that the system poles are located in the right half plane of the real-imaginary axis while the damping ratio is negative. Therefore, the quadrotor system needs to be stabilized using feedback control. Other challenges include the rotor dynamics which include the motor dynamics in addition to the interactions with the drag forces applied on the propeller blades. Such dynamics can be difficult to model, although it can be approximated by a first order linear model [11]. In quadrotor systems, a hierarchical control approach is usually common. The low level control includes the rotor speed control loop, usually delegated to the electronic speed controllers on board. The next level includes the attitude control and finally the high level loop controls the position of the quadrotor. The control objective of the high level controller is either to stabilize the quadrotor’s CoM at a desired point in its configuration space or for the CoM to track a certain trajectory. Many researchers exploited linear control techniques such as PID and LQ as shown in section (1.2). To apply linear control techniques on the quadrotor, the nonlinear dynamical model needs to be linearized about an operating point which is chosen to be the hovering configuration.
3.1
Attitude Control System Design
As previously mentioned, the open loop rotational dynamics of the quadrotor are unstable. Therefore they need to be stabilized by a feedback control algorithm. Since the rotational dynamics of all the three axes posses the same structure, they can all be stabilized by the same control structure. Several linear controllers will be 19
CHAPTER 3. LINEAR CONTROL SYSTEM DESIGN
20
d φdes
+ −
eφ
∆Ωφ
C(s)
u
Kφ s
p
1 s
φ
Figure 3.1: Roll axis block diagram with single feedback loop proposed and analyzed in this section. To assess the performance of these controllers some quantifying measures will be discussed, namely the sensitivity function and its counterpart the complementary sensitivity function which will be denoted by S(s) and T (s) respectively. These functions will be used to analyze the effect of load disturbances, noise, parametric variations and control effort of the closed loop system utilizing a specific controller [58].
3.1.1
Single feedback loop
Consider the Laplace transform of the linearized rotational dynamics of the roll axis given in equation (2.39), a 1 DoF controller can be designed and implemented in a cascade configuration as shown in figure (3.1). The dynamics of the plant consists of two poles at the origin which needs to be stabilized by adding zeros in the open Left Half Plane (LHP). Therefore a PD controller would be suitable. The controller transfer function C(s) is given by C(s) = Kd s + Kp .
(3.1)
The closed loop system’s performance can be analyzed by the open loop L(s), sensitivity S(s) and complementary sensitivity T (s) transfer functions given by (Kd s + Kp ) Kφ s2 s2 S(s) = 2 . s + K d Kφ s + Kp Kφ (Kd s + Kp ) Kφ T (s) = 2 s + K d Kφ s + Kp Kφ L(s) =
(3.2)
Moreover, the response of the closed loop system to a disturbance input d(s) can be evaluated by φ(s) Kφ D(s) = = 2 . (3.3) d(s) s + Kd Kφ s + Kp Kφ Finally, the steady state error ess in the case of step disturbances is given by ess = −
1 . Kp
(3.4)
In the case where only an attitude control system is designed for stabilizing the quadrotor’s attitude about the hovering point, the quadrotor will experience an accelerating drift in its position due to this constant steady state error. This can be
CHAPTER 3. LINEAR CONTROL SYSTEM DESIGN
21
easily observed from equation (2.37). However, if an additional control system is designed to stabilize the quadrotor’s position, then the proposed PD attitude controller would be suitable. To eliminate the steady state error, an integrator should be available in the controller’s transfer function C(s), such as the PID controller given by Kd s2 + K p s + Ki . (3.5) C(s) = s The open loop, sensitivity and complementary sensitivity transfer functions given by Kφ (Kd s2 + Kp s + Ki ) s3 s3 S(s) = 3 . s + Kd Kφ s2 + Kp Kφ s + Ki Kφ Kφ (Kd s2 + Kp s + Ki ) T (s) = 3 s + Kd Kφ s2 + Kp Kφ s + Ki Kφ L(s) =
(3.6)
Finally, the response of the closed loop system to a disturbance input d(s) can be evaluated by Kφ s D(s) = 3 . (3.7) 2 s + Kd Kφ s + Kp K φ s + Ki Kφ Compared to the PD controller, the PID controller has the advantage of eliminating the steady state error, while the PD controller has less parameters to tune. Moreover, both controllers allow the placing of the closed loop poles of the characteristic equation arbitrarily.
3.1.2
Rate feedback controllers
Usually UAVs include on-board gyroscopes as part of the IMU which provide a measure of the quadrotor’s angular rate that can be used in the feedback loop to provide rate regulation. Control systems utilizing the rate measurement for rate regulation are popular in aircraft control [19] and are known as Stability Augmenting System (SAS). By applying a stability augmenting system on the quadrotor, the system’s damping increases and another controller should be designed to stabilize the quadrotor’s attitude. The general structure of this inner loop-outer loop architecture is shown in figure (3.2). Both the attitude controller C(s) in the outer loop and the rate controller H(s) in the inner loop can be designed to be simply proportional gains. This controller will denoted by the P-SAS controller and its transfer functions are given by C(s) = Kpφ
H(s) = Kpp .
(3.8)
Similar to the single feedback controllers, the closed loop response can be analyzed
CHAPTER 3. LINEAR CONTROL SYSTEM DESIGN
22
d φdes
+ −
eφ
pdes
C(s)
u −
Kφ s
p
1 s
φ
H(s)
Figure 3.2: Roll axis block diagram with rate feedback loop by Kpφ Kφ s (s + Kpp Kφ ) s (s + Kpp Kφ ) S(s) = 2 . s + Kpp Kφ s + Kpφ Kφ Kpφ Kφ T (s) = 2 s + Kpp Kφ s + Kpφ Kφ L(s) =
(3.9)
In addition, the closed loop behavior to input disturbances is governed by D(s) =
s2
Kφ + sKpp Kφ + Kpφ Kφ
(3.10)
which implies that there will be a finite steady state error given by ess = −
1 . Kpφ
(3.11)
Moreover, the inner closed loop transfer function relating the desired angular rate pdes , calculated by the outer controller, and the actual angular rate p is given by p pdes
=
Kφ . s + Kφ Kpp
(3.12)
Compared to the PD controller previously introduced, both controllers have the same number of parameters to be tuned, they allow the arbitrary placement of closed loop poles and the steady state error is finite in both cases. However, the PD controller has the disadvantage of being non-causal and the closed loop response will exhibit large overshoots in the case of a step reference which will cause un undesirable spike in the control signal. Such behavior can be justified in figures (3.3a-3.3b) which show the frequency response of the closed loop systems for both the PD controller and the P-SAS controller. In figure (3.3a), which shows the complementary sensitivity function, it can be observed that |T (jω)| at high frequencies for the PD controller is higher than the P-SAS controller. This implies that the same closed loop response will be achieved using rate feedback but with less control effort, in addition to better noise attenuation. However, by analyzing the sensitivity functions of both controllers shown in
CHAPTER 3. LINEAR CONTROL SYSTEM DESIGN
2
4
10 Magnitude (−)
Magnitude (−)
10
2
10
0
10
−2
10
−2
10
−4
10
10 −2
10
−1
10
0
10
1
10
2
−1
10
0
10
1
10
2
10
Phase (deg)
200
−50
−100
−150
−200 −2 10
−2
10
10
0 Phase (deg)
0
10
−6
−4
10
23
−1
10
0
10
1
10
Frequency (rad/s) (a) Complementary Sensitivity Function
2
10
150
100
50
0 −2 10
−1
10
0
10
1
10
2
10
Frequency (rad/s) (b) Sensitivity Function
Figure 3.3: Frequency response of PD (solid blue) versus P-SAS (dashed red) controllers. figure (3.3b), it can be observed at low frequencies that |S(jω)| is lower for the PD controller which implies less sensitivity to small plant uncertainties. Therefore using rate feedback we can achieve the same desired closed loop performance without the drawbacks discussed. The tuning of this control law can be divided into two stages; first the inner loop is tuned such that its closed loop pole is placed at a location that specifies the system’s time constant as implied by (3.12). Then the outer loop’s gain Kpφ is tuned such that the closed loop’s system second pole is placed at a location smaller by at least ten times the inner loop’s closed loop pole. The effect of the pole placement can be verified by the system’s time-domain response. By inspecting the literature for works with experimental validation, it was discovered that a settling time of at least two seconds yields a satisfactory performance. In simulations, the controllers presented are tuned by the help of the MATLAB Control System Toolbox which contains helpful analysis tools using root locus and frequency response techniques. Figure (3.4) shows the response of the pitch angle controlled by the rate feedback controller. The pitch angle started with an initial value of 10 degrees and was successfully stabilized by the controller. However, a step disturbance was introduced in the simulation run at t = 10 s and as a result a steady state error appeared as expected. To reduce the steady state error, Kpφ can be increased as implied by equation(3.11). However, this will cause higher overshoots in the closed loop response. To eliminate the steady state error, the attitude proportional controller C(s) can
CHAPTER 3. LINEAR CONTROL SYSTEM DESIGN
24
10
9
Pitch Angle [degrees]
8
7
6
5
4
3
2
1
0
0
2
4
6
8
10
12
14
16
18
20
Time [sec]
Figure 3.4: Pitch angle stabilization with P-SAS controller. Constant disturbance is added at t = 10 s be replaced by a Proportional-Integral (PI) controller, thus denoted by the PI-SAS controller. The transfer functions of this controller are then given by Kpφ s + Kiφ H(s) = Kpp , (3.13) s while the open loop, sensitivity and complementary sensitivity transfer functions in addition to the closed loop transfer function to a disturbance input are given by C(s) =
(Kiφ + Kpφ s) Kφ s2 (s + Kpp Kφ ) s2 (s + Kpp Kφ ) S(s) = 3 s + Kpp Kφ s2 + Kpφ Kφ s + Kiφ Kφ . (Kiφ + Kpφ s) Kφ T (s) = 3 s + Kpp Kφ s2 + Kpφ Kφ s + Kiφ Kφ Kφ s D(s) = 3 2 s + Kpp Kφ s + Kpφ Kφ s + Kiφ Kφ L(s) =
(3.14)
Compared to the PID controller previously introduced in subsection (3.1.1), we can achieve using this controller the same closed loop behavior with less control effort and better noise attenuation as implied by the frequency response functions shown in figures(3.5a-3.5b) The simulation result of implementing the PI-SAS controller on the pitch axis is shown in figure (3.6) which indicate that the steady state error has been eliminated after the introduction of the step disturbance.
3.1.3
Digital implementation
Implementing the attitude controllers, developed in the previous subsection, on the quadrotor is done using a digital computer on-board. The control laws for the PSAS attitude controller of the roll-axis given by equation (3.8) will be presented in this subsection which will possess the same structure as for the pitch and yaw axes. The control inputs (∆Ωφ , ∆Ωθ , ∆Ωψ ) used to calculate the desired rotor speeds(cf.
CHAPTER 3. LINEAR CONTROL SYSTEM DESIGN
4
5
10 Magnitude (−)
Magnitude(−)
10
2
10
0
10
−2
10
−4
10
0
10
−5
10
−10
−2
−1
10
0
10
1
10
10
2
10
10
−2
50
300
0
250
−50 −100 −150 −200 −2 10
−1
0
10
1
10
10
0
10
1
10
2
10
10
200 150 100 50 0 −2 10
2
10
−1
10
Phase (deg)
Phase (deg)
25
−1
0
10
1
10
Frequency (rad/s)
2
10
10
Frequency (rad/s)
(a) Complementary Sensitivity Function
(b) Sensitivity Function
Figure 3.5: Frequency response of PID (solid blue) versus PI-SAS (dashed red) controllers
10
Pitch Angle [degrees]
8
6
4
2
0
−2
0
2
4
6
8
10
12
14
16
18
20
Time [sec]
Figure 3.6: Pitch angle stabilization with P-SAS controller. Constant disturbance is added at t = 10 s
CHAPTER 3. LINEAR CONTROL SYSTEM DESIGN
26
equation 2.35) are calculated using the inner loop control law given by ∆Ωφ = Kpp (pdes − p) ∆Ωθ = Kpq (q des − q) ,
(3.15)
∆Ωψ = Kpr (rdes − r) while the desired body angular rates (pdes , q des , rdes ) are calculated by the outer loop controller utilizing the desired Euler angles (φdes , θdes , ψ des ) through the following control laws pdes = Kpφ (φdes − φ) q des = Kpθ (θdes − θ) . r
des
= Kpψ (ψ
des
(3.16)
− ψ)
In the case of the PI-SAS attitude controller, a discrete equivalent for the controller’s transfer function (3.13) needs to be designed. This method of design is known as emulation [59]. Several discrete transfer functions in the Z-domain will be computed and compared to the continuous time transfer function to choose the one which approximates its characteristics over the frequency range of interest. The approaches used were numerical integration, zero-pole mapping and hold equivalence. The discrete equivalents using Tustin’s method, first-order hold and zero-pole mapping all possessed the same structure given by C(z) =
(2Kpφ + Ts Kiφ )z + (Ts Kiφ − 2Kpφ ) , 2(z − 1)
(3.17)
where Ts is the sampling period. As for the zero-order hold discrete equivalent, which is similar to the one using forward integration rule, the transfer function has the structure given by C(z) =
Kpφ z + (Ts Kiφ − Kpφ ) . (z − 1)
(3.18)
Finally the discrete equivalent transfer function using the backward integration rule is given by (Kpφ + Ts Kiφ )z − Kpφ . (3.19) C(z) = (z − 1) The frequency response functions of the three proposed discrete equivalents and the continuous controller are shown in figure (3.7) for a sampling frequency (fs ) of 100 Hz(which is implemented on the real system as described later). As observed from the frequency responses, all the discrete equivalents approximate the response of the designed PI controller with insignificant differences. Therefore, the author chose Tustin’s method for the digital implementation of the PI attitude controller. The discrete control laws for calculating the desired body angular rates (pdes , q des , rdes ) are given by des pdes k = pk−1 + aφ1 eφ,k + aφ0 eφ,k−1 des qkdes = qk−1 + aθ1 eθ,k + aθ0 eθ,k−1 des rkdes = rk−1 + aψ1 eψ,k + aψ0 eψ,k−1
(3.20)
CHAPTER 3. LINEAR CONTROL SYSTEM DESIGN
27
Figure 3.7: Frequency response of continuous and discrete-equivalent controllers for fs = 100 Hz where for each axis x ∈ {φ, θ, ψ}, ex,k is the current attitude error while ax1 and ax0 are the coefficients of the discrete transfer function C(z) calculated by ax 1 =
3.2
Ts Kix + 2Kpx 2
ax 0 =
Ts Kix − 2Kpx . 2
(3.21)
Position Control System Design
The control structure chosen for the horizontal position of the quadrotor is two PISAS controllers similar to the attitude controllers since velocity measurements are available in the developed platform as will be discussed later. The controllers output the desired roll and pitch angles φdes and θdes based on the error in the position. This approach assumes a timescale separation between the dynamics of the horizontal position and the dynamics of the roll and pitch angles which is observed in equation (2.37). The altitude controller will be chosen to be a PID controller with the derivative action on the feedback action only (cf. figure 3.8) to avoid spikes in the control signal [58]. The controller transfer functions C(s) and H(s) are given by Nz Kdz s Kpz s + Kiz H(s) = , (3.22) s s + Nz while the controller’s difference equations derived using Tustin’s method are given by C(s) =
∆ΩT z˙des,k z˙k ez,k
= z˙des,k − z˙k = z˙des,k−1 + a0 ez,k + a1 ez,k−1 , = −b2 z˙k−1 + a2 zk − a2 zk−1 = zdes,k − zk
(3.23)
CHAPTER 3. LINEAR CONTROL SYSTEM DESIGN z des
+ −
ez
C(s)
z˙des
∆ΩT −
z˙
KT s2
28 z
H(s)
Figure 3.8: Altitude axis block diagram with PID controller with the derivative action on the feedback signal
Figure 3.9: Linear control system architecture where a0 , a1 , a2 and b2 are the coefficients of the discrete transfer functions C(z) and H(z) given by 2Kpz + Kiz Ts 2 2Kdz Nz a2 = 2 + Nz Ts
a0 =
−2Kpz + Kiz Ts 2 . −2 + Nz Ts b2 = 2 + Nz Ts a1 =
(3.24)
Finally, the linear control system of the quadrotor, summarized in figure (3.9), consists of two P-SAS controllers for the roll and pitch axes, three PI-SAS controllers for the x, y and yaw axes in addition to one PID controller for the quadrotor’s altitude. The reason why the roll and pitch axes were controlled using P-SAS controllers instead of PI-SAS ones, is that an integrator will be available in the x and y controllers that will command the desired roll and pitch angles that will stabilize the quadrotor’s horizontal position. Thus there is no need to include another integrator in the inner loop. The four control signals are then mapped to the desired deviations in the motor speeds from the hovering speed as described in (2.35).
CHAPTER 3. LINEAR CONTROL SYSTEM DESIGN
3.3
29
Simulation Results
The linear control system developed in the previous sections is simulated with the nonlinear quadrotor model to check the closed loop performance of the system. The quadrotor starts from an initial configuration defined by I > [I p> 0 , Θ0 ] = [0.25, 0.2, 0.8, 0, 0, 50],
(3.25)
where the position coordinates are in meters and the angles are in degrees. The controller successfully stabilizes the system to the desired configuration defined by I > [I p> d , Θd ] = [0, 0, 0.4, 0, 0, 0],
(3.26)
as shown in figures (3.10-3.11) which show snapshots of the simulation run in addition to the position and attitude errors. A remark should be stated regarding the error in the yaw angle. As observed in the lower plot of figure (3.11), the error in the yaw angle is 50 degrees and to avoid a large yaw rate the parameters of its corresponding controller are tuned such that the system has a large settling time. Thus the operation in the linear range is conserved and not violated. Finally, The list of parameters used in the simulation run are summarized in table (3.1). Gain Value Kpp 50 250 Kpφ 50 Kpq Kpθ 250 80 Kpr Kpψ 60 Kiψ 15
Gain Kpx , Kpy Kix , Kiy Kdx , Kdy Kpz Kiz Kdz Nz
Value 1.5 0.5 3 71 25 81 10
Table 3.1: Values of linear controller parameters used in simulation study
3.4
Partial actuator failure
As mentioned before, the linear control system can successfully stabilize the system and provide some robustness against parametric uncertainties. However, this control system will yield poor performance against severe uncertainties that may rise due to partial actuator failure as shown in this section. A simulation run has been carried out with an actuator Loss of Effectiveness (LoE) introduced during the run. The results for an actuator LoE of 25% in the first rotor as shown in figures (3.123.13) which show snapshots of the simulation run in addition to the position and attitude errors. The figures show that after the first rotor was damaged at t = 8 sec, the control system was able to stabilize the quadrotor due to the integral action. However, the error of the quadrotor’s configuration is large and impractical. These results motivate the development of control systems that handle the parametric uncertainties in the system more effectively.
CHAPTER 3. LINEAR CONTROL SYSTEM DESIGN
30
(a) t = 0 sec
(b) t = 1 sec
(c) t = 2 sec
(d) t = 4 sec
(e) t = 8 sec
(f) t = 12 sec
Position Errors [m]
Figure 3.10: Simulation results: Snapshots of the quadrotor stabilization using the linear control system
0.1 0
e
−0.1
x
−0.2
ey
−0.3
ez
−0.4
0
2
4
6
8
10
12
14
16
18
20
Attitude Errors [deg]
Time [sec] 20 10 0
eφ
−10
eθ
−20 −30
eψ
−40 −50
0
2
4
6
8
10
12
14
16
18
20
Time [sec]
Figure 3.11: Simulation results: Position and attitude errors of the quadrotor using the linear control system during stabilization
CHAPTER 3. LINEAR CONTROL SYSTEM DESIGN
31
(a) t = 0 sec
(b) t = 9 sec
(c) t = 11 sec
(d) t = 13 sec
(e) t = 15 sec
(f) t = 20 sec
Position Errors [m]
Figure 3.12: Simulation results: Snapshots of the quadrotor using the linear control system with 25 % LoE in one rotor
0.5
0
ex
−0.5
e
y
−1
e
z
−1.5
0
2
4
6
8
10
12
14
16
18
20
Attitude Errors [deg]
Time [sec] 10 0 −10
eφ
−20
eθ eψ
−30 −40
0
2
4
6
8
10
12
14
16
18
20
Time [sec]
Figure 3.13: Simulation results: Position and attitude errors of the quadrotor using the linear control system with 25 % LoE in one rotor
Chapter 4 Robust Adaptive Control System Design As seen in the previous chapter, a control system that takes into consideration uncertainties in the system’s model is required to handle severe uncertainties that may arise such as partial actuator failure. In this chapter, an adaptive controller based on a reference model matching approach was chosen. This approach is known in the literature as Model Reference Adaptive Control (MRAC). In MRAC, the desired system’s behavior is described by a reference model which is typically chosen to be an LTI system driven by the reference input (r) as shown in figure (4.1). The control laws are designed such that the closed loop system from the reference input r to the system’s states xp is equal to the reference model’s states xm . In the case of unknown system parameters, the controller gains θc∗ are directly estimated using adaptive laws such that the tracking error e = xm − xp converges to zero.
4.1
Problem formulation
The main function of the adaptive controller is to accommodate for any uncertainties present in the linearized system’s dynamics (2.37-2.38). These linearized EoM can be written in state space form along with the uncertainties as x˙ p = Ap xp + Bp up ,
(4.1)
where Ap ∈ Rnp ×np is constant, fully populated and unknown which may contain unmodeled cross-coupling terms while Bp ∈ Rnp ×mp is constant and unknown and contains cross-coupling terms that may arise due to the LoE of one of the motors as shown in section (2.4). The state vector xp contains xp = [x, x, ˙ y, y, ˙ z, z, ˙ φ, p, θ, q, ψ, r]>
(4.2)
and for simplicity we assume all the states are available for measurement. As for the input vector up it contains up = [∆ΩT , ∆Ωφ , ∆Ωθ , ∆Ωψ ]> .
32
(4.3)
CHAPTER 4. ROBUST ADAPTIVE CONTROL SYSTEM DESIGN
33
Figure 4.1: Model reference adaptive control architecture [60] The system output is defined to be yp ∈ Rqp which contains x, y, z and ψ variables. The reference model is described by x˙ m = Am xm + Bm rp
(4.4)
where Am ∈ Rnp ×np is a stable matrix and Bm ∈ Rnp ×mp . The reference model and reference signal r are designed such that xm represents the desired trajectory that xp has to track.
4.2
Control system design
In the case of known parameters and no uncertainties, the control law up can be designed using classical design techniques to be up = −K ∗ xp + L∗ r,
(4.5)
where K ∗ ∈ Rmp ×np is the feedback gains matrix and L∗ ∈ Rmp ×qp is the feedforward gains matrix. The gain matrices can be chosen to satisfy the algebraic matching equations Am = Ap − Bp K ∗ Bm = Bp L∗ , (4.6) which will cause the closed loop system to be similar to the reference model and thus x(t) → xm (t) exponentially fast for any bounded signal r(t). In this work we assume a solution of the matching condition (4.6) exists, i.e., there is sufficient structural flexibility to meet the control objective. Moreover, instead of designing the reference model, the gains designed for the linear control system (cf. chapter 3) will be used to create the reference model through the matching equation (4.6). As for the case where the system’s parameters are unknown and uncertainties are present, we use the control law up = −K(t) xp + L(t) rp ,
(4.7)
CHAPTER 4. ROBUST ADAPTIVE CONTROL SYSTEM DESIGN
34
where K(t), L(t) are the estimates of K ∗ , L∗ respectively which will be generated using an online parameter estimator. First we define the tracking error e to be e = xp − xm
(4.8)
which will be used by the gradient-based adaptive laws to estimate the required parameters such that e(t) → 0 as t → 0. The adaptive laws proposed [60] are given by > P e x> K˙ = Γ1 Bm p , > L˙ = −Γ2 Bm P e rp>
(4.9)
where Γ1 , Γ2 ∈ Rmp ×mp are diagonal, positive definite matrices of adaptive gains, P = P > ∈ Rnp ×np is the unique solution to the Lyapunov equation A> m P + P Am = −Q,
(4.10)
where Q = Q> ∈ Rnp ×np is an arbitrary positive definite matrix chosen in this work to be the identity matrix for simplicity. To account for constant exogenous disturbances that may be applied to the system dynamics, the control input will be modified to include an estimate of the disturbance ud (t). The modified control law and the corresponding adaptive law for the disturbance’s estimate are given by up = −K(t) xp + L(t) rp + ud (t) > u˙ d = −Γ3 Bm P e
.
(4.11)
The stability of the presented adaptive controller is based on nonlinear theory which has been studied by many researchers throughout the previous decades [55]. The proof of stability is based on a Lyapunov function candidate given by ∗−1 ˜ ∗−1 ˜ −1 ∗−1 ˜ > Γ−1 ˜ > Γ−1 V = e> P e + tr(K K +L L + u˜> u˜d ), 1 L 2 L d Γ3 L
(4.12)
where the symbol ∼ indicates the parameter estimation error, which is in general unknown but only used in the stability analysis not in the controller design. As shown in [55], the derivative of the Lyapunov function candidate is given by V˙ = −eT Qe ≤ 0,
(4.13)
which by Barbalat’s lemma, it proves for the linear dynamics (2.37-2.38) that the closed loop system is asymptotically stable and limt→∞ e(t) = 0. As for the nonlinear system, during hovering the stability result is reduced from global asymptotic convergence to boundedness of the tracking error e(t).
4.3
Simulation Results
The MRAC system designed in the previous sections has been simulated with the quadrotor’s nonlinear dynamical model in the presence of uncertainties due to partial
CHAPTER 4. ROBUST ADAPTIVE CONTROL SYSTEM DESIGN
35
actuator failure. A simulation run has been carried out with an actuator LoE of 25% introduced during the run similar to the simulation run carried in (3.4). The results presented in figures (4.2-4.3) show that the adaptive controller successfully stabilized the quadrotor after the damage of the first rotor. The results show a maximum deviation in the quadrotor’s position of only 1.5, 0.05 and 3 cm in the x, y and z axes respectively. While the maximum deviations in the quadrotor’s attitude are about 0.05 and 6 degrees in the pitch and yaw angles whereas the roll axis was almost unaffected since the loss of effectiveness of motor one doesn’t affect it. A comparison between the simulation results of the adaptive controller, presented in this section, and the linear controller (cf. section 3.4) is presented in table (4.1) which shows that the adaptive controller generates a superior performance in stabilizing the quadrotor. ey Controller ex Linear 130 70 MRAC 1.5 0.1
ez eφ eθ 40 2 20 2 0.01 0.5
eψ 30 6
Table 4.1: Maximum deviations in the errors of the quadrotor’s configuration using the linear and model reference adaptive controller. Position errors are in cm while the attitude errors are in degrees
Parameters Drift Although the performance of the adaptive controller is satisfactory, it is well known that adaptive control schemes might suffer from instability phenomena in the presence of noise, unmodeled dynamics and other types of uncertainties that are frequently encountered. One of the instability phenomena of adaptive laws is what is known as parameter drift, which is mainly due to the integral action of the adaptive laws. To analyze such instability phenomenon, the norm of the tracking error vector e(t), which was used in the adaptive laws, will be studied. The norm of the tracking error for the simulation run using the adaptive controller is shown in figure (4.4). Initially the error was zero and no adaptation was taking place until the 8th second when the actuator failure occurred. Then the controller gain parameters were estimated in the direction that decreases the error e(t). However, in practice the adaptive laws are driven by the tracking error in addition to errors due to unmodeled dynamics. When the tracking error e(t) is large compared to modeling errors, the controller gains estimates are driven in the direction that reduces the tracking error. However, when the tracking error becomes smaller than the modeling error then the controller gain estimates may be driven in a direction mostly dictated by the modeling errors. To show such behavior, a simulation run will be repeated with random white Gaussian noise added to the states measurements to simulate the sensors noise. Figure (4.5) shows three randomly chosen parameters of the feedback gain matrix K(t) during the simulation run while figure (4.6) shows the norm of the tracking error. As observed from these two figures, the parameters estimates are continuously changing even before the occurrence of the actuator failure, which can be justified by
CHAPTER 4. ROBUST ADAPTIVE CONTROL SYSTEM DESIGN
36
(a) t = 0 sec
(b) t = 8 sec
(c) t = 9 sec
(d) t = 10 sec
(e) t = 11 sec
(f) t = 12 sec
Position Errors [m]
Figure 4.2: Simulation results: Snapshots of the quadrotor using MRAC with 25 % LoE in one rotor 0.03
e
x
0.02
e 0.01
y
0
ez
−0.01
−0.02
0
2
4
6
8
10
12
14
16
18
20
Attitude Errors [deg]
Time [sec] 2 1 0
eφ
−1 −2
eθ
−3 −4
eψ
−5 −6
0
2
4
6
8
10
12
14
16
18
20
Time [sec]
Figure 4.3: Simulation results: Position and attitude errors of the quadrotor using MRAC with 25 % LoE in one rotor
CHAPTER 4. ROBUST ADAPTIVE CONTROL SYSTEM DESIGN
37
0.25
Error Norm [−]
0.2
0.15
0.1
0.05
0
0
2
4
6
8
10
12
14
16
18
20
Time [sec]
Figure 4.4: Norm of the tracking error for simulation run without unmodeled dynamics
130
K(1,1) K(3,6) K(4,8)
120
Adaptive gains [−]
110
100
90
80
70
60
50
0
2
4
6
8
10
12
14
16
18
20
Time [sec]
Figure 4.5: Parameter drift in the estimate of the feedback gain matrix K(t). Three parameters are displayed from the matrix for illustration
CHAPTER 4. ROBUST ADAPTIVE CONTROL SYSTEM DESIGN
38
0.4
0.35
Error Norm [−]
0.3
0.25
0.2
0.15
0.1
0.05
0
0
2
4
6
8
10
12
14
16
18
20
Time [sec]
Figure 4.6: Norm of the tracking error for simulation run with sensors noise
Figure 4.7: Dead zone modification the norm of the tracking error that never converges to zero due to the sensors noise. Therefore, due to the pure integral term in the adaptive laws, the controller gain parameters will suffer from drifting and will never stop adapting. In the simulation run performed, the results show no instability in the quadrotor’s performance due to its short duration. However, in practice using this control system for a duration of minutes will yield an unstable response for the quadrotor.
4.4
Robust modifications
As shown in the previous section, the adaptive controller suffered from parameters drift and in general adaptive control approaches need to be modified to increase their robustness against unmodeled dynamics. Robust adaptive control deals with the modification of adaptive controllers to make them robust against these uncertainties [60]. In this section we consider the development of robust adaptive laws for the estimation of the controller parameters. A simple way to eliminate such phenomenon is to adapt only when the tracking error is large relative to the modeling error by introducing a dead-zone as shown in figure (4.7). The adaptive laws are modified to
CHAPTER 4. ROBUST ADAPTIVE CONTROL SYSTEM DESIGN
39
100
K(2,4) K(3,6) K(4,8)
95
Adaptive gains [−]
90
85
80
75
70
65
60
55
0
2
4
6
8
10
12
14
16
18
20
Time [sec]
Figure 4.8: Elimination of the parameter drift phenomenon in the estimate of the feedback gain matrix K(t). include a function f (e) = e + g instead g0 g = −g0 −e
of the tracking error e, while g is given by if e < −g0 if e > g0 if − g0 ≤ e ≤ g0
(4.14)
where g0 is a design parameter vector that specifies the size of the dead-zone which indicates a known upper bound of the modeling error. The dead-zone modification forces the parameter estimates to move in the direction of the deepest descent only when the modeling error is smaller than the tracking error. This design parameter is chosen in practice to be just greater than the standard deviation of each component of the tracking error e(t) by trial and error. Finally the result of applying the deadzone modification to the MRAC system designed is shown in figure (4.8). The figure shows that the dead-zone modification applied to the adaptive laws has successfully prevented the drift in the parameters and the parameters change only at about t = 8 sec when the actuator failure occurs.
Chapter 5 Position Estimation Quadrotors can be used in a variety of applications if equipped with appropriate sensors and control algorithms. One of the main advantages of quadrotors is their fast dynamics that allow them to perform aggressive maneuvers. However, to autonomously control the quadrotor, its fast dynamics requires accurate and frequently updated knowledge about its attitude, velocity and position. Such knowledge can be provided by an Inertial Navigation System (INS). However, commercially available high quality ones are rather expensive, which motivates the development of navigation systems for quadrotors using low cost sensors. A necessary condition for implementing the developed controllers is to provide feedback signals of the quadrotor’s states used by the control systems. This chapter presents how different low cost embedded sensors are used to provide estimates of the quadrotor’s vertical and horizontal position and velocity, which is summarized in figure (5.1). In this work, only embedded sensors were used by the quadrotor without the use of any external aid. The estimation of the quadrotor’s rotational states is delegated to appendix (A). To measure the quadrotor’s position, Global Navigation Satellite System (GNSS) receivers, such as GPS, can be used outdoors, while vision based motion capture systems can be used in indoor applications. The drawbacks of using low GPS receivers is that they provide an accuracy of several meters, in addition to the attenuation and scattering of microwave signals in indoor environments which make them an unsuitable choice, whereas motion capture systems can be used only indoors, in addition to being rather expensive. Estimating the position and velocity of the quadrotor using embedded sensors only is called ego-motion estimation [61]. One approach would be to use three rangefinders, such as ultrasonic or infrared based range finders, which provide relative distance to the quadrotor’s environment. A more involved approach would be to use monocular vision sensors to develop vision-aided inertial navigation algorithms such as Simultaneous Localization and Mapping (SLAM). However, such approach requires high computational power for feature extraction and matching algorithms. On the other hand, simpler methods and sensors are available for optic flow extraction, which work at a lower resolution.
40
CHAPTER 5. POSITION ESTIMATION
41
Figure 5.1: Overall position estimation structure
5.1
Vertical Position Estimation
In this work, the quadrotor is equipped with an ultrasonic rangefinder that provides the quadrotor with its relative distance to the ground. It is well known in practice that ultrasonic rangefinders suffer from spikes in distance measurements due to specular reflectance and acoustic noise. The presence of these spikes is problematic since the distance measurements are used as the feedback to the altitude controller developed to hold the altitude of the quadrotor in 3D space and also used to scale the optical flow measurements to metric velocities as will discussed later. To study the effect of these spikes on the control performance, a simulation study was performed using the developed environment (cf. section 2.3). In the simulation, two spikes were intentionally added to the measurements at t = 5 s and t = 12 s. Due to the differentiation action in the altitude controller, the faulty measurements have caused spikes in the control signal. Therefore, the altitude control signal has reached its saturation value which have yielded an unsatisfactory performance in the quadrotor’s altitude. The quadrotor suffered from large overshoots in its altitude whenever spikes occurred in the ultrasonic measurements. The results of this simulation run can be seen in figures (5.2-5.3).
5.1.1
Discrete Wavelet Transform
Due to its short time span, the analysis of the altitude measurement spikes requires resolution in time and frequency instead of frequency alone. Therefore, the wavelet transform is a suitable choice for analyzing the signal. The wavelet transform has an advantage over the Fourier transform in its ability to produce temporal resolution i.e., it captures both location in time information and frequency information. Therefore it has been a suitable candidate for applications in numerical fields [62]. Sheybani et al. [63] have utilized the wavelet transform to filter diagnostic data signals with spikes and noise to remove the spikes in the signals while preserving the noise. The wavelet transform has been also used in [64] to filter spikes in power
CHAPTER 5. POSITION ESTIMATION
42
4.5
Ultrasonic measurements [m]
4
3.5
3
2.5
2
1.5
1
0.5
0
0
2
4
6
8
10
12
14
16
18
20
Time [sec]
Figure 5.2: Simulation results: Spikes in the ultrasonic measurements 1.1
Altitude [m]
1 0.9 0.8 0.7 0.6 0.5 0.4
0
2
4
6
8
10
12
14
16
18
20
18
20
Control Signal [rad/s]
Time [sec] 300 200 100 0 −100 −200 −300
0
2
4
6
8
10
12
14
16
Time [sec]
Figure 5.3: Simulation results: Quadrotor’s altitude (upper) and control signal (lower) in the presence of spikes in the ultrasonic measurements
CHAPTER 5. POSITION ESTIMATION
43
Figure 5.4: Discrete wavelet transform architecture. The superscript ∗ denotes signals before removing spikes converter systems. Moreover, the wavelet transform has been used in image processing applications as in [65] who generated the Low-pass image using an approach based on Discrete Wavelet Transform (DWT) . Wavelet theory has been applied successfully to a number of biomedical problems. Uebeyli et al. [66] applied the wavelet transform to extract features from the spike-wave discharges record of rats, while wavelet transform has been used in [67] to analyze physiological data such as heart rhythm, chest volume, and blood oxygen saturation. To detect and remove these spikes a DWT approach was followed. The DWT decomposes the ultrasonic measurement signal into two sets of coefficients known as detail coefficients and approximate coefficients. The signal can be reconstructed from these same coefficients using the inverse DWT after detecting and removing the spikes as illustrated in figure (5.4). The signal decomposition is performed by passing the signal through a low pass filter Hd (z) and a high pass filter Gd (z) [64]. The two filters are a pair of quadrature mirror filters related with the power complement property given by |Hd (expjw )|2 + |Gd (expjw )|2 = 1.
(5.1)
The Haar Wavelet is chosen as the mother wavelet since it can be implemented using the first order Finite Impulse Response (FIR) filters given by 1 1 Hd (z) = √ + √ z −1 2 2 . 1 1 Gd (z) = − √ + √ z −1 2 2
(5.2)
The approximate and the detail coefficients are produced from the low pass and high pass filters respectively, after a dyadic downsampling which keeps even indexed elements only. A threshold procedure is applied to the approximate and detail coefficients and then the despiked signal is reconstructed using the inverse DWT.
CHAPTER 5. POSITION ESTIMATION
44
Figure 5.5: Simulation block diagram with spikes rejection algorithm. The superscript m denotes the measured signal used in the control systems. The signals z, z ∗ and z m denote the quadrotor’s altitude, ultrasonic faulty measurement and the corrected signal respectively. The Haar low pass and high pass FIR filters used in the reconstruction phase are given by 1 Hr (z) = √ + 2 1 Gr (z) = √ − 2
1 √ z −1 2 . 1 −1 √ z 2
(5.3)
In this work, spikes are removed from the original signal by setting the detail coefficients to zero over the period when the threshold is exceeded. The approximate coefficients are also modified in regions where the difference between two consecutive coefficients exceeds a certain threshold. The approximate coefficients are then set to the previous value in the case of spikes detection. This modification of the approximate coefficients was not performed in [64] as a three level decomposition of the input signal was performed. However, in the approach followed in this work, only a single level decomposition was needed which reduced the time delay between the input signal and the filtered measurement. To avoid implementation issues that may arise, the modification of the approximate coefficients is only performed consecutively for a specified time window. To validate the developed algorithm, the DWT-based algorithm was implemented in the simulation environment. The simulation environment was modified to include the algorithm implemented digitally with a sampling frequency of 100 Hz as shown in figure (5.5). A simulation run was performed to show the result after applying the spikes removal algorithm which are shown in figures (5.6-5.7). The results indicate that after applying the DWT-based algorithm, the ultrasonic measurements were corrected and the performance was unaffected by the spikes in the measurements.
CHAPTER 5. POSITION ESTIMATION
45
4.5
Raw Despiked
Ultrasonic measurements [m]
4
3.5
3
2.5
2
1.5
1
0.5
0
0
2
4
6
8
10
12
14
16
18
20
Time [sec]
Figure 5.6: Simulation results: Spikes removed from the ultrasonic measurements. Figure shows the raw signal (dashed blue) and the signal after removing the spikes (solid red)
Altitude [m]
0.65 0.6 0.55 0.5 0.45 0.4
0
2
4
6
8
10
12
14
16
18
20
12
14
16
18
20
Control Signal [rad/s]
Time [sec] 200 150 100 50 0 −50
0
2
4
6
8
10
Time [sec]
Figure 5.7: Simulation results: Quadrotor’s altitude (upper) and control signal (lower) after applying the DWT-based algorithm
CHAPTER 5. POSITION ESTIMATION
5.1.2
46
Experimental validation
After testing the algorithm in the simulation environment, it was implemented on the quadrotor platform. The experiment was performed by gathering ultrasonic measurements from a real sensor mounted on-board the quadrotor platform discussed in chapter (6). The quadrotor control system was responsible for stabilizing the quadrotor’s attitude only and the quadrotor was free to move vertically with manual assistance that prevents it from falling to the ground. Figure (5.8) shows a typical ultrasonic measurement data set with significant spikes. The approximate and detail coefficients single level DWT of this signal are shown as well. The experiment was performed for 18 seconds with a total of 360 samples which implies that the sampling frequency is 20 Hz which is the typical frequency for ultrasonic rangefinders. Due to the dyadic down-sampling, the number of the approximate and detail coefficients for this signal is 180 for each. The threshold is then applied to these coefficients and finally the despiked signal is reconstructed from the modified coefficients by the inverse DWT as shown in figure (5.9). Finally the despiked signal is passed through a scalar Kalman filter before it is used in the altitude control system to extrapolate the altitude estimates until the next ultrasonic measurement is sampled. One major advantage of the developed algorithm is that it doesn’t require any iterations within the sampling period therefore it was computationally inexpensive. This advantage is due to the choice of the Haar wavelet which can be implemented using first order FIR filters.
5.2
Horizontal Position Estimation
The quadrotor platform developed in this work incorporates an optical flow sensor based on a machine vision Complementary Metal-Oxide Semiconductor (CMOS) image sensor which provides velocity estimates of the quadrotor. Optical flow sensors based on CMOS image sensors have an advantage over their counterparts which use computer mouse hardware sensors which require strong lighting conditions to provide accurate measurements. CMOS based optical flow sensors calculate the velocity (or flow) of pixel coordinates in the image plane through two successive frames acquired from the image sensor. By assuming a constant distance to the scene during the last two successive frames, the x and y components of the motion field vf can be written as −Tx f − qf + ry z , −Ty f = + pf − rx z
vf x = vf y
(5.4)
where Tx and Ty are the translational components of the motion, p, q, r are the angular velocity components, z is the distance to the scene and f is the focal length. Then the translational velocity in metric scale vm,trans can be calculated from the motion field by z ~vm,trans = ~vf . (5.5) f
Ultrasonic Measurements [m]
CHAPTER 5. POSITION ESTIMATION
47
4 3 2 1 0
0
2
4
6
8
10
12
14
16
18
100
120
140
160
180
100
120
140
160
180
Approximate Coefficients [−]
Time [sec] 4
3
2
1
0
20
40
60
80
Detail Coefficients [−]
Sample [−] 2 1 0 −1 −2 −3
0
20
40
60
80
Sample [−]
Figure 5.8: Experimental Results: Applying DWT on ultrasonic measurement (upper) with approximate coefficients (middle) and detail coefficients (lower)
4
Raw Despiked
3.5
Distance [m]
3
2.5
2
1.5
1
0.5
0
2
4
6
8
10
12
14
16
18
Time [sec]
Figure 5.9: Experimental Results: Spikes rejection results of distance measurements
CHAPTER 5. POSITION ESTIMATION
0.06
48
0.06
Raw Filtered
0.04
0.04
0.02
0.02
Vy (m/s)
Vx (m/s)
Raw Filtered
0
0
−0.02
−0.02
−0.04
−0.04
−0.06
0
5
10
15
20
25
Time (sec)
30
35
40
45
−0.06
0
5
10
15
20
25
30
35
40
45
Time (sec)
Figure 5.10: Experimental Results: Estimated velocity in x (left) and y (right) axes For an overview of the relation between the motion field and the translational velocity and the complete derivation of the presented equations, the reader can refer to [68]. The velocity measurements provided by the optical flow sensor are not used directly since they are corrupted by white Gaussian noise and a constant bias, instead they are filtered by a scalar Kalman filter which causes the smoothing of the velocity estimates as shown in figure (5.10). The process model used states simply that the posterior estimate is equal to the current estimate. The filtered velocities are then integrated to estimate the quadrotor’s position. Figure (5.11) shows the integrated position estimated while the quadrotor was stationary. The results indicate that during the experimental run which lasted almost two minutes, the maximum drift was about 3 cm in the x direction and 1.5 cm in the y direction. The optical flow sensor only provides velocity measurements in the x-y plane utilizing the distance between the image sensor and the scene as indicated by equation (5.5). Therefore, it is necessary to estimate this distance which is accomplished in this work by an ultrasonic range finder. Due to the spikes present in the ultrasonic measurements, the velocity measurements will in return be faulty. Therefore, the corrected signal of the ultrasonic measurement is used to scale the velocity measurements and the result is shown in figure (5.12). However, it was observed that in simulation the effect of these faulty signals on the stabilization performance in the longitudinal position was insignificant. The first justification for this observation is that only the ratio between the corrected altitude signal and faulty one was used which is usually not large since the typical maximum range for ultrasonic sensors is about 4 meters . Another justification can be observed from figure (3.9) which implies that the velocity measurements x˙ and y˙ do not directly affect the quadrotor’s control inputs but rather pass through the roll and pitch controllers which act as a low pass filter that reduces the effect of the spikes in the velocity measurements.
CHAPTER 5. POSITION ESTIMATION
49
0.015
X Y
0.01
Distance (m)
0.005
0
−0.005
−0.01
−0.015
−0.02
−0.025
−0.03
0
10
20
30
40
50
60
70
80
90
100
Time (sec)
Figure 5.11: Experimental Results: Integrated position of quadrotor using velocity estimates
4
Before After
Velocity [m/s]
3
2
1
0
−1
−2
0
2
4
6
8
10
12
14
16
18
Time [sec]
Figure 5.12: Experimental Results: Spikes rejection results of the optical flow sensor measurements of velocity component in x direction
Chapter 6 Experimental Validation A major objective of this work was the development, assembly and testing of a quadrotor platform instead of purchasing a commercial one. The quadrotor’s airframe, motors and propellers were chosen from the available off-the-shelf ones in the market. However, the software and system integration was fully developed in the Control and Dynamics Lab in the German University in Cairo. The author was part of the team who started developing this platform before applying for the Master of Science degree. However, the development and upgrading of the quadrotor system was continued during this thesis work. In this chapter, an overview about all the components included in this UAV will be presented.
6.1
Overall system structure
A typical quadrotor UAV consists of four rotors mounted in cross configuration on a light weight airframe. Moreover, it consists of flight avionics, sensor systems and communication systems to communicate with the control ground station or to other robotic platforms. The quadrotor system developed in this work consists of four brushless DC motors driven by ESCs on board as illustrated in figure (6.1). The quadrotor is equipped with various sensors including an IMU which consists of an accelerometer and gyroscope triad. Moreover, the quadrotor contains a three-axis magnetometer and an optical flow sensor which includes also an ultrasonic range finder. The quadrotor is equipped with an Arduino Due micro-controller responsible for processing incoming data from the sensors and commanding desired rotor speed to the ESCs. Moreover, a Raspberry Pi (RPI) computer is installed on the quadrotor platform which is responsible for the implementation of the control algorithms, communicating with the Arduino Due on board in addition to communicating with the ground station control software developed.
6.2
Quadrotor components
In this section, an overview of the individual hardware and software components included in the UAV system will be provided. The hardware components include the airframe, rotors system, power source and the on-board flight avionics.
50
CHAPTER 6. EXPERIMENTAL VALIDATION
51
Figure 6.1: Overall system structure
6.2.1
Airframe
The X650F frame from HobbyKing was used as the main frame. The frame is the main structure of the quadrotor, it consists of 4 identical aluminum beams connected to a central hub, each beam holds one of the motors. The main material of the frame is glass-fiber, which provides high rigidity with low weight. All other components are mounted on the frame which consists of several layers. Landing skids are attached to the central hub to keep a distance of 15 cm from the ground. The assembled frame is shown in figure (6.2).
Figure 6.2: Quadrotor frame [69]
CHAPTER 6. EXPERIMENTAL VALIDATION
(a) MK3638 Brushless DC motors [71]
52
(b) APC electric propellers [72]
Figure 6.3: Rotor system
6.2.2
Rotors
Each one of the four rotors consists of an assembly including a brushless DC motor and propeller blades. Brushless DC motors are typically used in quadrotor UAVs due to their higher torque per weight and higher torque per watt compared to their brushed counterparts. Moreover, brushless DC motors use electronic commutation rather than mechanical commutation which provides a longer lifetime. The one used in developing this platform is the MK3638 14 pole brushless DC motor provided by MikroKopter shown in figure (6.3a). Each motor draws a maximum of 20 A which requires a power source that can supply at least 80 A. A brief list of the motor’s specifications is presented in table 6.1. Each motor has an electric propeller manufactured by APC [70] attached to it, designed specifically for electric powered model airplaness. The propellers have a diameter of 13 inches and pitch of 6.5 inches (cf. figure 6.3b). Since two of motors spin clockwise and the other two spin anti-clockwise, the propellers are divided into two puller and two pusher blades such that thrust of the four motors is always directed upward. Feature Lithium cell count Load current No-load speed Mechanical power Dimensions Shaft diameter
Description 3-6 max. 20 A 770 rpm / V 350 W h=35 mm, d=38 mm 4 mm
Table 6.1: Motors specifications
CHAPTER 6. EXPERIMENTAL VALIDATION
(a) 4500 mAh Battery [73]
(b) 2600 mAh Battery [74]
53
(c) Power supply [75]
Figure 6.4: Power sources
6.2.3
Power source
Lithium Polymer (LiPo) batteries provide high capacity in small sized light weight packs, which makes them suitable for supplying electricity for aerial robots. Two separate batteries were used in the developed platform; one for the motors and another for the flight avionics. An 11.1 V 4500 mAh battery will be used to supply power to the four motors and an 11.1 V 2600 mAh battery will be used for all the electronic components (cf. figure 6.4). The 4500 mAh battery has the capability to discharge up to 35 times its capacity which can supply about 157 A, therefore it is suitable for providing power to the four motors. To conduct experiments inside the laboratory using batteries it would be impractical as the flight time provided by the batteries is only a few minutes. Another disadvantage is that batteries do not provide constant power to the motors as they discharge which will affect the performance of the developed control algorithms. Therefore a 1.5 kW power supply is used to provide 12 V DC output and allow current supply up to 125 A (cf. figure 6.4c). The use of this power supply has proven to be very useful in the tuning of the control algorithms. A brief list of the power supply’s specifications is presented in table 6.2. Feature Output Power Rating Input Voltage Output Voltage-Current Dimensions
Description 1.5 kW 90-264 VAC/127-370 VDC 12 VDC, 125 A 278 x 127 x 83.5 mm
Table 6.2: Power supply specifications
CHAPTER 6. EXPERIMENTAL VALIDATION
(a) Raspberry Pi [76]
54
(b) Arduino Due [77]
Figure 6.5: Processing units
6.2.4
Flight avionics
Raspberry Pi The main processing unit of our developed platform is a Model B RPI with a 700 MHz processor (cf. figure 6.5a). The RPI is a Linux based small computer developed by the Raspberry Pi foundation. The foundation aimed of making an easy platform for basic learning Computer Science [76]. The RPI provides USB ports, Ethernet, video output and General Purpose Input/Output (GPIO) pins, which makes it suitable for our project. The RPI includes the Quadrotor Control System (QCS) which is a C++ software developed on the quadrotor platform to handle communication with the ground station computer, implement the attitude and position control systems, gather data from the IMU and finally communicate with the Arduino Due to retrieve the magnetometer and optical flow sensor data in addition to commanding the motor speeds. Arduino Due Arduino Due (Figure 6.5b) is an open source micro-controller board with a central processing unit clock of 84 MHz, that provides an electronic platform capable of interfacing with a wide range of electronic devices and handling different input/output operations. The Arduino micro-controller is used in the developed platform as the low level processing unit which implements the Quadrotor Operating System (QOS) which is an Arduino-based software developed on the quadrotor platform to send the control signals to the ESCs that correspond to the desired motors speed calculated by the RPI, in addition to interfacing the magnetometer and optical flow sensors to gather the sensor data which is passed on to the RPI. Inertial Sensors IMUs are typically used in aircrafts to provide attitude information. The MPU6050 IMU (Figure 6.6a ) from Invensense was used, which combines a 3-axis gyroscope and a 3-axis accelerometer on the same silicon die together with an on board Digital
CHAPTER 6. EXPERIMENTAL VALIDATION
(a) MPU6050 [78]
(b) HMC5883L [79]
55
(c) PX4FLOW [80]
Figure 6.6: Inertial sensors Motion Processor (DMP) capable of processing complex 6-axis sensor fusion algorithms. Through an Inter-Integrated Circuit (I2C) interface with the RPI, angular rates measurements and acceleration measurements in the quadrotor body-fixed frame are gathered. Moreover, the roll and pitch angle are provided by the sensor fusion algorithm on the DMP at an update rate of 100 Hz. Moreover, the quadrotor platform is equipped with a 3-axis magnetometer that provides heading information. The HMC5883L is the magnetometer sensor used which provides the measured magnetic fields in the body-fixed frame through an I2C interface at an user configurable update rate of up to 75 Hz (cf. figure 6.6b). Optical Flow Sensor Velocity estimates of the quadrotor are provided in the developed platform using PX4FLOW (cf. figure 6.6c) which is sensor system based on an ARM Cortex M4 processor that uses a CMOS machine vision sensor to perform optical flow processing. To estimate metric velocity values, as described in equations (5.4 - 5.5), the PX4FLOW includes an on-board ultrasonic range sensor, used to measure the distance towards the scene, in addition to an on-board gyroscope used to compensate the measured optical flow values. The detailed system setup can be found in [68].
6.2.5
Software Architecture
The developed quadrotor platform system consists of 3 main programs as summarized in figure (6.7). The first one is the Ground-station which is a Java application executed on the Personal Computer (PC), the Quadrotor Control System (QCS) executed on the RPI and the Quadrotor Operating System (QOS) executed on the Arduino Due micro-controller. Data is exchanged between the QCS and the QOS using a Serial Peripheral Interface (SPI) which operates in a full duplex mode thus allows a higher throughput compared to I2C. The RPI and Arduino Due are configured as the master and slave respectively. An Ad-hoc Wireless Local Area Network (WLAN) is developed between the PC and the RPI. The PC acts as the server and creates the network and the RPI is
CHAPTER 6. EXPERIMENTAL VALIDATION
56
Figure 6.7: Software architecture configured to automatically connect to it with the Service Set Identifier (SSID) and network key preconfigured on it. Communication between the PC and the RPI is performed using several network protocols; the Secure Shell Protocol (SSH) is used for secure data communication, remote command-line log in and remote command execution of the RPI. The RPI includes an SSH server application waiting for a remote host to ask for connection. The SSH client program executed on the PC is “MobaXterm” which is a free source application for remote computing. This program also includes a free X server which allows users to access a remote graphical user interface and interact with it using any input device. Another remote computing application installed on the PC is WinSCP which is a Secure File Transfer Protocol (SFTP) client that provides file access, transfer and management functionality to the PC users. For the inter-communication between the Ground Station and the QCS, the most widely used programming interfaces used are sockets. The User Datagram Protocol (UDP) is used by both applications to send messages (datagrams) to each other through the established WLAN. For data analysis and plotting, the logged data of the quadrotor system are exported as MATLAB formatted data by the Ground Station using an open source Java library which provides the necessary framework to read, write or manipulate MATLAB binary files. The exported files are then analyzed through a GUI developed using MATLAB which helps in comparing the results of the experimental or simulation runs. Detailed description of this GUI can be found in Appendix (B).
6.2.6
Test Bed
One of the most significant tasks during this work was the tuning of the control algorithms developed. The success of the control system designed depends mainly on the performance of the roll and pitch control laws as they have a higher effect on the stability of the overall system compared to the other DoF. To tune the roll and
CHAPTER 6. EXPERIMENTAL VALIDATION
(a) Testbed
57
(b) Quadrotor mounted on testbed
Figure 6.8: Testbed 3D model pitch controllers, a testbed has been designed and manufactured to constrain all the quadrotor’s DoF except the roll or pitch axes. The Solidworks model of the testbed and a snapshot of how the quadrotor is mounted on it are shown in figure (6.8).
6.3
Parameter Identification
In section (2.3), a MATLAB based simulation environment has been introduced and used for testing and validating the control algorithms developed in this work. A crucial step of developing a simulation model that approximates the actual quadrotor system is to estimate the quadrotor’s parameters which include the quadrotor’s mass properties and the rotor’s aerodynamic properties. The parameters required to build the simulation environment are the: • quadrotor’s total mass (m) • arm length (l) • mass moment of inertia matrix (I) • propellers’ mass moment of inertia (Ip z ) • propellers’ thrust coefficient (b) • propellers’ drag coefficient (d) • motor’s first order model gain (Km )
CHAPTER 6. EXPERIMENTAL VALIDATION
58
Figure 6.9: Quadrotor 3D model
6.3.1
Mass properties
The mass moment of inertia (I) is found by weighing the individual components of the quadrotor including the airframe, batteries, motors, propellers and flight avionics then building a physically accurate 3D model in Solidworks as shown in figure (6.9). Figure (6.10) shows the mass distribution of the different components of the quadrotor system, while the individual masses of the quadrotor’s components in addition to the quadrotor’s mass properties calculated using Solidworks are summarized in tables (6.3 - 6.4) respectively. Component Airframe Motors ESC Propellers Arduino Uno Raspberry Pi Other Circuit Boards Motors Battery Electronics Battery Total Mass
Mass [g] 823 500 103.2 128 30 45 20 400 209 2258.2
Table 6.3: Masses of the quadrotor’s components
CHAPTER 6. EXPERIMENTAL VALIDATION
59
Figure 6.10: Mass distribution pie chart Name
Parameter Value
Mass Arm Length Moment of Inertia about x axis Moment of Inertia about y axis Moment of Inertia about z axis Propeller’s moment of Inertia about z axis
m l Ix Iy Iz Ip z
2258.2 27.5 41.398 42.257 75.905 0.0413
Unit g cm g.m2 g.m2 g.m2 g.m2
Table 6.4: Quadrotor’s mass properties identified
6.3.2
Rotor properties
As explained in section (2.2.2), each motor produces a vertical thrust and drag moment proportional to the square of the angular speed where the proportionality constants are b and d respectively. The thrust coefficient b is estimated by a static thrust test as shown in figure (6.11). The test is conducted by measuring the thrust produced by a single rotor using a weighing scale while varying the rotor’s speed. One of the challenges that appeared was that the quadrotor’s ESCs don’t provide feedback about the measured rotor’s speed which is required to conduct the static thrust test. To solve such problem, an optical tachometer was used to measure the angular speed of the propeller blades. The static thrust experiment results are presented in figure (6.12) which shows the measured rotor speed and thrust force in addition to a least square fit computed by the Curve Fitting Toolbox in MATLAB. The thrust coefficient was found to be about 2.551 x 10−5 N s2 . The drag coefficient
CHAPTER 6. EXPERIMENTAL VALIDATION
60
Figure 6.11: Static thrust test experimental setup Thrust Coefficient Experiment 12
10
Thrust [N]
8
6
4
Emperical Curve Fitting
2
0
0
0.5
1
1.5
2
2.5
3
3.5
Rotor Speed Squared [rad2/s2]
4
4.5 5
x 10
Figure 6.12: Thrust coefficient curve fitting results was found to be estimated to be 6.377 x 10−7 N s2 which is a factor of 40 from the thrust coefficient and the first order model’s gain was found to be about 25 rad/s by matching the performance of the real system to the simulation results. As mentioned in section (6.2.2), the quadrotor is equipped with ESCs that control the speed of the brushless DC motors through high frequency Pulse Width Modulation (PWM). The mapping between the given PWM command and the actual motors speed was identified experimentally as shown in figures (6.13-6.14). The measured speeds of the four motors versus the PWM signal are shown in figure (6.13), which indicates that a single function can be used to approximate the mapping of the four motors. The measured data were fitted by a linear quadratic polynomial (cf. figure 6.14) given by fpwm = 9.686 x 10−5 Ω2 + 0.09004 Ω − 6.416, (6.1) where fpwm and Ω are the PWM command and rotor speed respectively. This equation will be utilized by the QCS to calculate the PWM commands to be sent to the QOS given the desired rotor speeds calculated by the flight control system.
CHAPTER 6. EXPERIMENTAL VALIDATION
61
Motors speed−RPM mapping Experiment 700
Measured Speed [rad/s]
600
500
400
300
Motor 1 Motor 2 Motor 3 Motor 4
200
100
0
10
20
30
40
50
60
70
80
90
PWM Signal [%]
Figure 6.13: Motors measured RPM vs. commanded PWM signal
Motor speed−RPM mapping Experiment 100
90
80
PWM Signal [%]
70
60
50
40
30
20
Emperical Curve Fitting
10
0 100
200
300
400
500
Motor Speed [rad/s]
Figure 6.14: RPM mapping curve fitting results
600
700
CHAPTER 6. EXPERIMENTAL VALIDATION
6.4
62
Experimental Results
In this section, the results of the experimental validation of the control laws developed previously will be discussed. The experiments were conducted in the following order: the roll and pitch controllers where first tuned and tested extensively on the test bed introduced in (6.2.6). Then the quadrotor was tested in flight with the roll and pitch controllers only to test the system’s performance. The yaw controller was then tuned in flight and coupling effects on the roll and pitch controllers were tested.
6.4.1
Roll and Pitch Tuning
The stability of the overall system depends significantly on the performance of the roll and pitch controllers. The tuning of these controllers was performed independently on the test bed developed. The tuning of the inner loop gains was performed first by increasing the value continuously until the system’s damping becomes significant. The outer loop gain was then increased until the quadrotor becomes stable and can recover from impulse disturbances. The results of the roll and pitch P-SAS controllers are shown in figures (6.15a - 6.15b) which show the angles and control signals respectively. As observed in the angles plot, a large steady state error exists in the pitch axis compared to the roll axis which is also reflected in the control signals plot as the pitch control signal has an offset of about -30 rad/s which is due to a constant disturbance applied on this axis. The controller gains used in this experiment are presented in table (6.5). Gain Value
Kpp 82
Kpφ 190
Kpq 82
Kpθ 190
Table 6.5: P-SAS controller gains for the roll and pitch axes Before implementing the PI-SAS controller and tuning it, the results of the conducted experiments for the P-SAS controller were used to improve the simulation environment so that it can be used to tune higher order controllers. The improvements included adding the constant disturbances applied on the system due to unmodeled dynamics and neglected aerodynamic effects. To analyze the satisfactory closed loop performance reached by manual tuning of the control laws, the pole locations of the system will be inspected using the MATLAB Control System Toolbox. Figure (6.16) shows the root locus and bode plots of the pitch axis dynamics with the P-SAS controller implemented with the same gains used on the real system. The plot shows that by choosing the inner loop gain Kpq to be 82, the inner closed loop pole was placed at s = −25 which corresponds so a time constant of 1 s. By tuning the outer loop gain Kpθ to be 190, the location of the two closed loop poles have reached s = −2.5 and s = −22.5. The next step was to implement and tune the PI-SAS controller on the simulation environment and test the controller gains on the real system. The gains identified and implemented are presented in table (6.6). The root locus and bode plots of the closed loop system is shown in figure (6.17), which indicates that the closed loop poles are placed at s = −1.25 ± 0.25 and − 21. The experimental results of the
CHAPTER 6. EXPERIMENTAL VALIDATION
1
12
10
Theta Angle [degrees]
Roll Angle [degrees]
0.5
0
−0.5
−1
−1.5
−2
−2.5
63
8
6
4
2
0
−2
0
2
4
6
8
10
12
14
16
18
−4
20
0
2
4
6
Time [sec]
8
10
12
14
16
18
20
14
16
18
20
Time [sec]
20
20
15
10
Pitch Control Signal [rad/s]
Roll Control Signal [rad/s]
(a) Angles
10
5
0
−5
−10
0
−10
−20
−30
0
2
4
6
8
10
12
14
16
18
20
−40
0
Time [sec]
2
4
6
8
10
12
Time [sec]
(b) Control signals
Figure 6.15: Experimental results: Roll (left) and pitch (right) axes using P-SAS controller
CHAPTER 6. EXPERIMENTAL VALIDATION
64 Open Loop Bode Plot
Root Locus Plot 20
6 0.974
0.945
0.9
0.82
0.66
0.4
Magnitude (dB)
0 0.99
4
0.997
−40
−60
−80 30 0
25
20
15
10
G.M.: Inf Freq: Inf Stable loop
5 −100 −90
Phase (deg)
Imag Axis
2
−20
−2 0.997
−4
0.99
0.974
0.945
0.9
0.82
0.66
−135
P.M.: 84.8 deg Freq: 2.31 rad/sec
0.4 −180
−6 −30
−25
−20
−15
−10
−5
0
0
1
10
2
10
Real Axis
3
10
10
Frequency (rad/sec)
Figure 6.16: Root locus and Bode plot of modeled closed loop system using implemented P-SAS controller gains Root Locus Plot
Open Loop Bode Plot
1
100 0.999
0.998
0.996
0.99
0.976
0.9 80
Magnitude (dB)
0.8 1 0.6
1
0.2
25 0
20
15
10
40 20 0 −20 −40 −60 G.M.: −Inf dB Freq: 0 rad/sec Stable loop
−80
5
−100 −90 P.M.: 68.3 deg Freq: 2.95 rad/sec
−0.2
−0.4
Phase (deg)
Imag Axis
0.4
60
1
−0.6 1 −0.8
0.999 −1 −25
0.998
0.996
0.99
0.976
−120
−150
0.9 −180
−20
−15
−10
−5
0
Real Axis
−2
10
−1
10
0
10
1
10 Frequency (rad/sec)
2
10
3
10
4
10
Figure 6.17: Root locus and Bode plot of modeled closed loop system using implemented PI-SAS controller gains PI-SAS controller implemented on the test bed are shown in figures (6.18a - 6.18b). The results show that the controller stabilized the pitch axis from an initial value of almost −20 degrees. Gain Value
Kpp 80
Kpφ 230
Kiφ 180
Kpq 80
Kpθ 230
Kiθ 180
Table 6.6: PI-SAS controller gains for the roll and pitch axes To compare between the P-SAS and PI-SAS controllers, an experiment was conducted on the pitch axis with a constant disturbance added to the system after the quadrotor stabilizes. The experiment results (cf. figures 6.19a - 6.19b) show that the PI-SAS controller was able to eliminate the steady state error in the case of a constant disturbance as expected. Finally the roll and pitch controllers were implemented simultaneously on the quadrotor without attaching it to the test bed and
2.5
20
2
15
1.5
10
Theta Angle [degrees]
Roll Angle [degrees]
CHAPTER 6. EXPERIMENTAL VALIDATION
1
0.5
0
−0.5
−1
−1.5
65
5
0
−5
−10
−15
0
5
10
15
20
25
−20
30
0
5
10
Time [sec]
15
20
25
30
20
25
30
Time [sec]
20
80
15
60
Pitch Control Signal [rad/s]
Roll Control Signal [rad/s]
(a) Angles
10
5
0
−5
−10
−15
−20
40
20
0
−20
−40
−60
0
5
10
15
20
25
30
−80
0
Time [sec]
5
10
15
Time [sec]
(b) Control signals
Figure 6.18: Experimental results: Roll (left) and pitch (right) axes using PI-SAS controller
CHAPTER 6. EXPERIMENTAL VALIDATION
8
66
4
Theta Angle [degrees] (PI−SAS)
Theta Angle [degrees] (P−SAS)
6
4
2
0
−2
−4
−6
2
0
−2
−4
−6
−8
−10
0
5
10
15
20
25
30
35
−8
40
0
5
10
15
Time [sec]
20
25
30
35
40
Time [sec]
(a) Angles
60
Pitch Control Signal [rad/s] (PI−SAS)
Pitch Control Signal [rad/s] (P−SAS)
40
30
20
10
0
−10
−20
−30
−40
0
5
10
15
20
25
30
35
40
50
40
30
20
10
0
−10
−20
0
Time [sec]
5
10
15
20
25
30
35
40
Time [sec]
(b) Control signals
Figure 6.19: Experimental results: Comparison of pitch control in response to a constant disturbance applied using P-SAS (left) and PI-SAS (right) controllers the quadrotor was stabilized as shown in the experiment results in figures (6.20a - 6.20b). However, the quadrotor experienced an unlimited drift in the yaw angle which prevents it from hovering stably. Such drift implies that there is a constant disturbance about the yaw axis which needs to be stabilized by feedback control.
6.4.2
Yaw Tuning
Following the same procedure of tuning the roll and pitch controllers, the yaw inner loop controller was first tuned then the outer loop gain was chosen while the quadrotor was in flight. For simplicity, the P-SAS controller was only implemented for the yaw axis as the existence of a steady state error would not affect the system’s other DoF as in the case of the roll and pitch controllers. The results of the quadrotor’s
CHAPTER 6. EXPERIMENTAL VALIDATION
5
67
5
4 4
Pitch Angle [degrees]
Roll Angle [degrees]
3
2
1
0
−1
−2
3
2
1
0
−1
−3 −2 −4
−5
0
5
10
15
20
25
30
35
−3
40
0
5
10
15
Time [sec]
20
25
30
35
40
Time [sec]
20
15
10
10
Pitch Control Signal [rad/s]
Roll Control Signal [rad/s]
(a) Angles
0
−10
−20
−30
−40
−50
−60
5
0
−5
−10
−15
−20
0
5
10
15
20
25
30
35
40
−25
0
Time [sec]
5
10
15
20
25
30
35
40
Time [sec]
(b) Control signals
Figure 6.20: Experimental results: Roll (left) and pitch (right) axes in flight unconstrained by the testbed using PI-SAS controller
CHAPTER 6. EXPERIMENTAL VALIDATION
68
attitude stabilization are shown in figures (6.21a-6.21b) while the controller gains used are summarized in table (6.7). Gain Value
Kpr 90
Kpψ 100
Table 6.7: P-SAS controller gains for the yaw axis It can be observed that the yaw angle has been stabilized with a large steady state error of about 25 degrees which is acceptable in this case as mentioned. As for the roll angle its performance was not affected by the yaw controller, however a significant deterioration in the performance of the pitch angle appeared as shown in figure (6.21a). The reason behind this deterioration can be deducted from the yaw control signal shown in figure (6.21b). It is clearly observed that the yaw axis is subjected to a constant disturbance of about +60 rad/s. The yaw controller produced a signal that stabilizes the yaw angle and overcomes this constant disturbance. The effect of the yaw control signal (∆Ωψ ) on the four rotor speeds can be observed from equation (2.35); The equation implies that motors one and three will experience an average of 60 rad/s increase in their speeds while motors two and four will experience a decrease in their speeds by the same amount due to the yaw controller’s contribution. By inspecting the decoupled dynamics of the roll and pitch axes in the hovering configuration given by equation (2.38), it can be observed that the two axes are directly proportional to the hovering speed Ωh which was calculated theoretically to be about 465 rad/s. However, due to the yaw controller’s constant disturbance, the average speed of motors one and three will increase while the average speed of motors two and four will decrease. Therefore, the system dynamics in the roll and pitch axes have changed which requires retuning of the roll and pitch axes in the new conditions. Finally after retuning the roll and pitch axes in the presence of the yaw controller, the quadrotor’s performance was improved significantly as shown in figures (6.22a 6.22b) and the final gains used are summarized in table (6.8). Gain Value
Kpp 95
Kpφ 260
Kiφ 180
Kpq 50
Kpθ 140
Kiθ 95
Kpr 90
Kpψ 100
Table 6.8: Linear control system gains of attitude after retuning
CHAPTER 6. EXPERIMENTAL VALIDATION
69
(a) Angles
(b) Control signals
Figure 6.21: Experimental results: Roll (left), pitch (middle) and yaw (right) axes in flight. Deteriorated performance is observed due to constant disturbance of yaw axis
CHAPTER 6. EXPERIMENTAL VALIDATION
70
(a) Angles
(b) Control signals
Figure 6.22: Experimental results: Roll (left), pitch (middle) and yaw (right) axes in flight. Improved performance after retuning of roll and pitch controllers
Chapter 7 Summary and Future Work 7.1
Summary
Aerial robotics is a fast-growing field that currently grasps the attention of many researchers worldwide. Researchers currently utilize the quadrotor aerial vehicle due to its mechanical simplicity and high maneuverability. By the assistance of control algorithms and sensors technology, these aerial robots will be utilized to create costeffective solutions for a wide range of engineering applications in the future. In this thesis we have addressed some of the challenges involved in the design, development and control of a quadrotor platform. We began by introducing the system’s dynamical model and utilizing it to develop a simulation environment to test the control algorithms numerically. Two approaches were followed to design a control system; First a control system based on linear control theory, especially PID techniques, was designed for each decoupled subsystem of the quadrotor’s linearized dynamics. The linear control system was successful in stabilizing the quadrotor and provided some robustness against parametric uncertainties. However, the linear control system yields poor performance in the case of sever uncertainties that occur due to actuator failure as shown in the simulation studies. An adaptive controller based on the model matching approach was designed for such scenario and the simulation studies have shown that the adaptive controller yields superior performance compared to the linear one. To experimentally validate the developed control algorithms, a quadrotor platform was developed and assembled. The quadrotor was equipped with various onboard sensors and no external sensory systems were utilized. The challenges of utilizing these low-cost sensors to estimate the quadrotor’s states, used in the control system, were discussed and the techniques used in practice to overcome their drawbacks were mentioned. A algorithm for removing spikes in ultrasonic altitude measurements based on the discrete wavelet transform was implemented both in simulation and digitally on the on-board computer. Moreover, states estimation algorithms were utilized to fuse some sensors together to overcome the limitations available individually in these sensors. The final work of this thesis included several experimental studies to validate the control algorithms developed and to study the effect of controller parameter variations. However, due to time limitations, only the linear controllers designed for 71
CHAPTER 7. SUMMARY AND FUTURE WORK
72
the attitude subsystems were implemented and validated on the developed platform.
7.2
Future Work
The first task in the future work would be to validate the linear position controllers in addition to the digital implementation of the adaptive control system and the tuning of its design parameters. The adaptive controller was based on a model reference control approach with adaptive laws designed using Lyapunov-based arguments. Future work could include the comparison of this adaptive controller with other ones developed utilizing adaptive pole placement schemes in addition to developing adaptive laws using least squares methods. Moreover, other robust modification techniques can be tested and compared including fixed-sigma, switching-sigma and parameter projection techniques. All the simulation studies performed in this thesis were based on the assumption that the quadrotor is being stabilized in still air. However, in outdoor applications this assumption is violated due to wind gusts disturbances applied on the quadrotor. A major extension of this thesis work is to study the effect of wind gusts on the quadrotor and test the performance of the different controllers in stabilizing the quadrotor in the presence of these disturbances.
Appendix A Attitude Estimation A.1
Inertial Sensors
Real quadrotor platforms use Micro-electromechanical systems (MEMS) inertial sensors, such as gyroscopes, accelerometers and magnetometers. Combined together they form an Inertial Measurement Unit (IMU). These sensors can be used alone in preliminary experiments where the quadrotor, attached to a test rig, can rotate freely as in [6]. They can also be used to develop Stability Augmenting System (SAS) as in [40]. Moreover, they can be supplemented by other sensors which provide information related to the quadrotor’s position. In this section, the different inertial sensors used in the developed quadrotor system to estimate its attitude will be discussed.
A.1.1
Gyroscope
Gyroscopes measure the instantaneous rotational rate of the body they are mounted on with respect to the inertial frame. The gyroscope measurements m ω ∈ R3 can be modeled independently of the moving platform’s equations of motion to which they are attached as follows: m
ω = g K a ω + g b + g η,
(A.1)
where a ω ∈ R3 is the actual angular velocity of the body, g K ∈ R3x3 is the scale factor matrix and g b , g v ∈ R3 are the bias vector and assumed uncorrelated white Gaussian measurement noise with zero mean respectively. The previous sensor model is a simplified one which does not take into consideration cross-coupling, cross-axis sensitivity and misalignment [81]. The bias and scale factor of the gyroscope sensor depend on environmental conditions, especially the ambient temperature. The scale factor drifts of gyroscopes are known to cause negligible effects compared to the bias drifts. Moreover, the variations in temperature are considered the most significant element to affect the bias drift of gyroscopes. Henceforth, we assume that bias errors of gyroscopes during this work to be constant while the scale factor matrix in (A.1) is assumed to be equal to the identity matrix. In practice, the bias errors can be compensated and calibrated effectively
73
APPENDIX A. ATTITUDE ESTIMATION
74
based on a method known as “zero attitude updates” [81]. The method’s procedure is to simply average the output of the gyroscope for a few seconds while the quadrotor is stationary, then the bias is assumed constant for the duration of the flight. Henceforth, a zero attitude update will be implemented at the beginning of each experimental run in this work.
A.1.2
Accelerometer
Accelerometers in a strap down IMU configuration measure a combination of the inertial and gravitational acceleration. The output of the sensor m a in response to the acceleration of the body it is mounted on is expressed as m
a = a KR> (a a − g i~3 ) + a b + a η,
(A.2)
where a a ∈ R3 is the actual acceleration of the body, a K ∈ R3x3 is the scale factor matrix and a b , g v ∈ R3 denote the bias vector and additive measurement noise respectively. The presented model for the accelerometer also ignores cross-coupling, cross-axis sensitivity and misalignment effects. In contrast to gyroscopes, the temperature coefficients of accelerometers are relatively lower while the scale factor drifts of accelerometers also have negligible effect on the measurement accuracy like gyroscopes. In this work, we assume the scale factor matrix in (A.2) to be equal too the identity matrix while we assume the bias error to be constant. The bias errors can be calibrated and compensated by a technique called “zero velocity updates” which requires keeping the accelerometer from moving. The method calculates the average of the sensor while the sensor is perfectly leveled such that the horizontal components of the accelerometer measure don’t measure the gravity vector g thus the only constant measurement will be the bias error. As for the measurement’s component in the z axis, the accelerometer should ideally measure +1g, thus the bias error can be compensated effectively. Therefore, a zero velocity update method is implemented in this work once offline and then the estimated bias errors are assumed constant throughout all experiments.
A.1.3
Magnetometer
Magnetometers are used in UAVs to provide a heading estimation by measuring the earth’s magnetic field (geomagnetic field). Unlike accelerometer and gyroscope MEMS sensors, which use mechanical sensing elements unaffected by magnetic fields, magnetometers are sensitive to the magnetic fields in the vicinity of the sensor. These magnetic deviations cause additional errors to instrumentation errors which are due to fabrication limitations common for a wide variety of sensors such as scale factors, sensor offsets, and non-orthogonality of the sensor axes [82]. Magnetic deviations are due to surrounding ferromagnetic materials on the quadrotor which can be divided into two categories; hard iron and soft iron effects. Hard iron errors are due to stationary magnetic fields generated by ferromagnetic materials in the vicinity of the magnetometer. Soft iron errors are created by the induction
APPENDIX A. ATTITUDE ESTIMATION
75
of a temporary magnetic field into normally un-magnetized ferromagnetic components near the magnetometer. Soft iron effects are more complex to model than hard iron since the induced soft iron magnetic fields depend on the orientation of the quadrotor relative to the earth’s geomagnetic field. Combining both magnetic deviations and instrumentation errors, it is possible to derive a complete error model for the magnetometers measurement m B as follows m
B = AR>a B + m b + m η,
(A.3)
where A ∈ R3x3 is a symmetric matrix combining scale factors, misalignment and soft iron disturbances, m b is the bias vector which combines the sensor offsets and the hard iron effects, while a B represents the geomagnetic field expressed as B cos δ a B = 0 , (A.4) B sin δ where B is the geomagnetic field strength which varies over the earth’s surface from a minimum of 0.22 gauss over South America to a maximum of 0.67 gauss south of Australia, while δ is the angle of inclination of the geomagnetic field measured downwards. Detailed geomagnetic field maps are available from the World Data Center for Geomagnetism [83]. Calibration Procedure Magnetometer calibration is an old problem in ship navigation and many calibration techniques have been presented in the literature. The classic compass swinging calibration technique [84] is a heading calibration algorithm that computes scalar parameters using a least squares algorithm. The major shortcoming of this approach is the necessity of an external heading information. In recent literature, advanced magnetometer calibration algorithms have been proposed to tackle error sources directly in the sensor space, with no external attitude references and using optimality criteria. For an overview of the different calibration techniques in the literature, the reader can refer to [82] and [85]. In the complete absence of hard and soft iron interference (including any sensor offset), a magnetometer will accurately measure the three components of the geomagnetic field in the sensor’s frame of reference. Irrespective of the magnetometer orientation, the vector magnitude of the measured field will equal the magnitude of the geomagnetic field. Under arbitrary rotation, the locus of the magnetometer measurements will lie on the surface of a sphere centered at zero field with radius equal to the geomagnetic field magnitude (B). The addition of a hard iron field adds a fixed vector offset to all measurements and displaces the locus of measurement by an amount equal to the hard iron offset. The measurement sphere is now centered at the hard iron offset but still has a radius equal to the geomagnetic field strength. Soft iron effects distort the measurement sphere along preferred axes and with differing gains along each axis. The measurement locus then becomes an ellipsoid centered at the hard iron offset.
APPENDIX A. ATTITUDE ESTIMATION
(a) Uncalibrated measurements
76
(b) Calibrated measurements
Figure A.1: Locus of raw magnetometer measurements To mathematically model the locus of magnetometer measurements, the following equation kRT a Bk = (RT a B)T (RT a B) = B 2 . (A.5) constraints the measurements of a perfect magnetometer in a disturbance free environment to have a magnitude equal to the geomagnetic field strength. Rewriting (A.3) and substituting it in (A.5) gives (m B − m b)T (A−1 )T (A−1 )(m B − m b) = B 2 .
(A.6)
By introducing the intermediate parameter Q = (A−1 )T (A−1 ),
(A.7)
(m B − m b)T Q(m B − m b) = B 2 ,
(A.8)
equation (A.6) becomes
which yields a general equation of an ellipsoid. Therefore, in general the locus of the magnetometer raw measurements form the surface of the ellipsoid defined by (A.8). The ellipsoid is centered at the hardiron offset m b, has the shape determined by the matrix Q and has the overall size defined by the geomagnetic field strength B. Figure (A.1a) shows equation (A.8) visually using real magnetometer data measured by the magnetometer while fixed on the quadrotor platform. The shaded ellipsoid shows the optimum fit of the raw measurements to an ellipsoid. The calibration algorithm used in this work is an ellipsoid fitting problem with magnetic field measurements collected along different orientations using algebraic fitting utilizing least squares techniques. The outputs of the calibration algorithm are the A matrix and bias vector m b which are used to calculate the calibrated magnetic fields c B as c
B = A−1 (m B − m b).
(A.9)
APPENDIX A. ATTITUDE ESTIMATION
77
Figure A.2: Locus of measurements before and after calibration in each plane The calibration procedure is performed offline on a data set gathered by rotating the quadrotor through arbitrary orientations. The ellipsoid fitting is done using a free source MATLAB function which can be found in [84]. Figure (A.1b) shows the calibrated magnetometer measurements after estimating the matrix A and the bias vector m b which were calculated to be 0.9694 −0.0038 −0.0049 −0.0585 m A = −0.0038 0.9541 −0.0869 , b = 0.1488 . (A.10) −0.0049 −0.0869 1.0891 −0.0587 Moreover, a comparison of the measurement locus in the three planes before and after calibration are shown in figure (A.2).
A.2
Attitude Estimation Algorithms
This section will discuss how the different inertial sensors described previously can be utilized to estimate the quadrotor’s attitude. The overall structure for attitude estimation followed in this thesis work is summarized in figure (A.3). Traditional INS can integrate the angular velocity measured by the on-board gyroscope to get the quadrotor’s attitude. In the same manner, the acceleration measured by the accelerometer can be integrated once to obtain the velocity and twice to obtain the position. However, a low cost IMU typically generates signals which contain high noise levels in addition to time varying biases. As a consequence, the estimated states will suffer from an unlimited drift [86]. A common technique to estimate the UAV’s attitude is to apply vector measurement of known inertial directions. These vector measurements can be obtained from an accelerometer which measures the gravity vector in the absence of other accelerations or from a magnetometer which measures the Earth’s magnetic field. The roll φ and pitch θ angles can be estimated using accelerometer as m
ay φˆaccel = arctan( m ) az , m ax ˆ θaccel = arctan( m ) az
(A.11)
APPENDIX A. ATTITUDE ESTIMATION
78
Figure A.3: Overall attitude estimation structure where m ax , m ay , m az are the accelerometer measurements in the x, y and z axis respectively. Magnetometer measurements can be used to estimate the yaw angle after compensating for the hard iron and soft iron effects as described in (A.1.3). However the measured magnetic fields in the body frame {B} should be compensated for the tilting of the sensor, then the yaw angle can be estimated as t
By ψˆmagn = arctan( t ), Bx
(A.12)
where t Bx and t By are the tilt compensated components in the x and y axis respectively calculated by Bx = cθ c Bx + sφ sθ c By + cφ sθ c Bz , t By = cφ c By − sφ c Bz
t
(A.13)
where c Bx , c By and c Bz are the calibrated magnetometer measurements calculated by (A.9).
A.2.1
Roll and Pitch Estimation
In the presence of other accelerations, angle estimates based on accelerometers alone are unreliable. Attitude estimation algorithms overcome this issue by combining the gyroscope measurements, which provide high frequency information about the angular rates, with the accelerometer measurements, which provide low frequency information about the UAV’s orientation with respect to gravity. In practice, several sensor fusing algorithms have been applied to combine these sensor measurements, from a simple complementary filter to a full extended Kalman filter. Readers can refer to [87] for an overview of the different sensor fusion algorithms. Such algorithms are based on the EoM of the sensing unit in 3D space,
APPENDIX A. ATTITUDE ESTIMATION
79
2.5
Raw Filtered Integrated
2
Yaw Angle (deg)
1.5
1
0.5
0
−0.5
−1
−1.5
−2
0
5
10
15
20
25
30
35
Time (sec)
Figure A.4: Estimated yaw angle regardless of the platform on which the sensors are mounted. However, [88] have demonstrated that the blade flapping phenomenon in quadrotors can be used to derive a set of dynamic equations that can aid attitude estimation using inertial sensors. In this work, the roll and pitch angles are obtained from a closed source sensor fusion algorithm implemented on the embedded processor in the IMU described in section (6.2.4), thus eliminating the need to implement a fusion algorithm.
A.2.2
Yaw Estimation
After compensating for hard iron and soft iron effects, the yaw angle estimated using the magnetometer measurements is highly accurate. However, to guard against temporary magnetic disturbances which can be experienced by the quadrotor, a sensor fusion algorithm is designed to combine the gyroscope measurement and the yaw angle calculated by the magnetometer. Since the main focus of this work is hovering control of the quadrotor, a linear Kalman filter is chosen to estimate the yaw angle. The gyroscope measurement (r) is used as the input to the process model while the measured state ψˆmagn is provided by the magnetometer measurements as in (A.12). The discrete process model of the designed filter is given by ψˆk = ψˆk−1 + rk ∆t,
(A.14)
where ψˆk is the estimated yaw angle and the suffix k indicates the value at the current sampling interval. The complete discrete Kalman filter algorithm can be found in [89] and for completion, it is included in the following section. Figure (A.4) shows a comparison between the different estimates of the yaw angle provided by the designed Kalman filter, the magnetometer estimate and the angle estimate obtained by integrating the gyroscope measurement.
APPENDIX A. ATTITUDE ESTIMATION
A.3
80
Scalar Kalman Filter
The Kalman filter in its various forms is clearly established as a fundamental tool for analyzing and solving a broad class of estimation problems [89]. In this thesis, three Kalman filters were utilized; The first one generates the yaw angle by fusing the rate measurements from the gyroscope and the angle measurements from the magnetometer. The second Kalman filter was used to smooth the velocity measurements from the optical flow sensor and finally another Kalman filter was used to extrapolate the ultrasonic measurements which were generated at a low rate of 20 Hz to reach a rate of 100 Hz. All three filters were designed separately from the others thus three scalar filters were designed. The equations of the first scalar Kalman filter are given as follows: ψ¯k = ψk + Ts rkm P¯k = Pk + Q P¯k , K= ¯ Pk + R ψk+1 = ψ¯k + K(ψkm − ψ¯k ) Pk+1 = (1 − K)P¯k
(A.15)
where the subscripts k and k + 1 denote the corresponding value of the previous and current iterations respectively. The symbols ψ and r denote the yaw angle and yaw angular rate respectively, P denotes the variance of the state ψ, K denotes the Kalman filter gain while Q and R denote the process and measurement noise variances respectively. The macron accent (bar over the letter) denote the estimate before processing the measurement at time k. The yaw measurements from the magnetometer and the yaw rate measurements from the gyroscope are denoted in the equations by ψ m and rm respectively. The tuning parameters of this filter are the constant scalars Q and R which are chosen to yield satisfactory fusion of the two sensors. The other two Kalman filters for the optical flow sensor and ultrasonic rangefinder measurements have the same structure of the presented equations. The only difference will be in the symbols and the first equation will be replace in the case of the ultrasonic sensor by z¯k = zk , (A.16) where z denote the estimate of the ultrasonic measurement. While in the case of the optical flow sensor the first equation is given by v¯k = vk ,
(A.17)
where v denote the estimate of the horizontal velocity components which are assumed to be uncorrelated.
Appendix B Graphical User Interfaces In this chapter, the two GUIs developed during this thesis work will be presented in details. The first GUI developed is the MATLAB GUI which was used to analyze the results of experimental and simulation runs, while the second one is a Java-based GUI developed as the Ground-station from which the quadrotor system is supervised and controlled.
B.1
MATLAB GUI
The developed GUI, shown in figure (B.1), consists of several panels which are viewed by selecting the corresponding toggle buttons. The first panel is the Animation panel which displays a 3D animated figure of the quadrotor which simulates the position and orientation data of the quadrotor during the last experimental or simulation run. The GUI also includes a configuration panel which allows the user to display attitude related data in either radians or degrees in addition to choosing the unit of the motor speeds in either radians per second, revolutions per minute or as a PWM percentage (cf. figure B.1). The second panel is Attitude Plots which is used to display the roll, pitch and yaw angles in addition to the control signals in each of the three axes as shown in figure (B.2). Moreover, figure (B.3) shows the data of the quadrotor’s 3D position, displayed in the Position Plots panel in addition to the calculated control signals affecting each axis. The individual motor speeds and the difference between motors one and three in addition to the difference between motors two and four are displayed in the Motor Plots panel (cf. figure B.4) while all the controller gains used are also displayed in the Controller gains panel shown in figure (B.5).
B.2
Ground-station GUI
In this section, the GUI of the developed Ground-station application will be described in details. The GUI, shown in figure (B.6), consists of three main tabs; Manual Setup, Hover Control and Config. The first step in using the GUI is to establish and initialize the socket-based connection between the Ground-station
81
APPENDIX B. GRAPHICAL USER INTERFACES
Figure B.1: MATLAB GUI : Animation Panel
Figure B.2: MATLAB GUI : Attitude Plots Panel
82
APPENDIX B. GRAPHICAL USER INTERFACES
Figure B.3: MATLAB GUI : Position Plots Panel
Figure B.4: MATLAB GUI : Motor Plots Panel
83
APPENDIX B. GRAPHICAL USER INTERFACES
84
Figure B.5: MATLAB GUI : Controller Gains Panel and the QCS by pressing the Connect button. The GUI includes also a Notification System which is used by the application to display warnings, notifications and errors to the user. The first tab is the Manual Setup (cf. figure B.6) which allows the user to operate and test each motor individually through four sliders. Moreover, for the ease of use, the GUI allows the user to control the four motors simultaneously using the same slider by pressing the Thrust Control button as shown in figure (B.7). In addition, the user can display the raw sensors data including the three Euler angles,angular rates and 3D position in addition to the 2D velocity and the flow quality variables which are provided by the optical flow sensor. The GUI starts displaying the values of these parameters once the user presses the Manual Setup button. The application also logs the mentioned parameters in addition to other ones and the user can save the logged data as a MATLAB binary file by pressing the Export Data button. The second tab in the developed GUI is the Config tab, shown in figure (B.8), which provides the user with different configuration capabilities. The user can utilize this tab to input several values including the accelerometer and magnetometer calibration parameters which are pre-calculated using the approaches described in chapter (A). As for the calibration of the gyroscope, it is done online using the ”zero attitude updates” method described previously. Moreover, the user can configure using this tab the parameters of the different Kalman filters implemented in addition to setting the offset of the quadrotor’s configuration if needed.
APPENDIX B. GRAPHICAL USER INTERFACES
Figure B.6: Ground-station GUI : Manual Setup
Figure B.7: Ground-station GUI : Motors Control
85
APPENDIX B. GRAPHICAL USER INTERFACES
86
Figure B.8: Ground-station GUI : Configuration
Finally, the last tab is the Hover Control tab which consists of several panels that allow the user to validate and test control algorithms as shown in figure (B.9). The first step in starting an experimental run, is the configuration of the different control laws developed. The user chooses the type of controller for the roll and pitch, yaw, altitude and position controllers, then the user inputs the controller gains in the corresponding text fields. As a feedback for the user, the type of each controller chosen is displayed in the Controller Types panel. When the Update Parameters button is pressed, the controller parameters are uploaded to the QCS. The user can now start the experiment by increasing the four motors speed using Hovering Speed slider and once the quadrotor is in the hovering configuration, the control algorithms start when the user presses the Start Control button. The user can command the desired values to the control laws using the Manual Control panel in addition to the PC’s keyboard. During the experimental run, the user can change the controller gains online which simplifies the tuning process of the controllers developed. Finally, by re-pressing the Start Control button, the experiment is terminated and the four motors are turned off. The user can save the logged data of the sensors in addition to the control signals in the QCS by pressing the Export Data button. The saved data can be analyzed and plotted by importing it in the MATLAB GUI described in (B.1).
APPENDIX B. GRAPHICAL USER INTERFACES
Figure B.9: Ground-station GUI : Hover Control
87
Appendix C Software Flowcharts In this chapter, the different software developed during this thesis work will be described. The developed quadrotor platform system consists of 3 main programs; The first one is the Ground-station which is a Java application executed on the Personal Computer (PC), the Quadrotor Control System (QCS) executed on the RPI and the Quadrotor Operating System (QOS) executed on the Arduino Due micro-controller.
C.1
Quadrotor Operating System
The QOS, which is an Arduino-based software developed on the quadrotor platform, was responsible for sending the control signals to the ESCs that correspond to the desired motors speed calculated by the RPI, in addition to interfacing the magnetometer and optical flow sensors to gather the sensor data which is passed on to the QCS through a SPI communication protocol. The flowchart of the program is shown in figure (C.1).
C.2
Quadrotor Control System
The QCS is a C++ software developed on the quadrotor platform to handle communication with the ground station computer, implement the attitude and position control systems, gather data from the IMU and finally communicate with the Arduino Due to retrieve the magnetometer and optical flow sensor data in addition to commanding the motor speeds calculated from the control algorithms. The flowchart of the program is shown in figure (C.2).
88
APPENDIX C. SOFTWARE FLOWCHARTS
Figure C.1: Quadrotor Operating System (QOS) program flowchart
89
APPENDIX C. SOFTWARE FLOWCHARTS
Figure C.2: Quadrotor Control System (QCS) program flowchart
90
Bibliography [1] E. Feron and E. N. Johnson, “Aerial robotics,” in Springer Handbook of Robotics (B. Siciliano and O. Khatib, eds.), ch. 44, pp. 1009–1029, Berlin, Heidelberg: Springer Berlin Heidelberg, 2008. [2] D. L. C. D. O. Marcelo, “Modeling, identification and control of a quadrotor aircraft,” Master’s thesis, Czech Technical University in Prague, 2011. [3] T. Bresciani, “Modelling, identification and control of a quadrotor helicopter,” Master’s thesis, Lund University, 2008. [4] G. M. Hoffmann, H. Huang, S. L. Wasl, and E. C. J. Tomlin, “Quadrotor helicopter flight dynamics and control: Theory and experiment,” in AIAA Guidance, Navigation, and Control Conference, 2007. [5] D. Lara, A. Sanchez, R. Lozano, and P. Castillo, “Real-time embedded control system for vtol aircrafts: Application to stabilize a quad-rotor helicopter,” in 2006 IEEE International Conference on Control Applications, pp. 2553–2558, 2006. [6] S. Bouabdallah, A. Noth, and R. Siegwart, “Pid vs lq control techniques applied to an indoor micro quadrotor,” in IEEE/RSJ International Conference on Intelligent Robots and Systems, vol. 3, pp. 2451–2456, 2004. [7] S. BouabdAllah, Design and control of quadrotors with application to autonomous flying. PhD thesis, COLE POLYTECHNIQUE FDRALE DE LAUSANNE, 2007. [8] P. Pounds, R. Mahony, and P. Corke, “Modelling and control of a large quadrotor robot,” Control Engineering Practice, vol. 18, no. 7, pp. 691 – 699, 2010. [9] J. M. B. Domingues, “Quadrotor prototype,” Master’s thesis, Instituto Superior Tecnico, Universidade Tecnica de Lisboa, 2009. [10] I. Palunko and R. Fierro, “Adaptive control of a quadrotor with dynamic changes in the center of gravity,” in Proceedings of the 18th IFAC World Congress (S. Bittanti, A. Cenedese, and S. Zampieri, eds.), vol. 18, pp. 2626– 2631, International Federation of Automatic Control, 2011. [11] N. Michael, D. Mellinger, Q. Lindsey, and V. Kumar, “The grasp multiple micro-uav testbed,” IEEE Robotics Automation Magazine, vol. 17, no. 3, pp. 56–65, 2010. 91
BIBLIOGRAPHY
92
[12] P. Pounds, R. Mahony, P. Hynes, and J. Roberts, “Design of a four-rotor aerial robot,” in Proceedings of the 2002 Australasian Conference on Robotics and Automation, pp. 145–150, November 2002. [13] L. Meier, P. Tanskanen, F. Fraundorfer, and M. Pollefeys, “Pixhawk: A system for autonomous flight using onboard computer vision,” in 2011 IEEE International Conference on Robotics and Automation, pp. 2992–2997, 2011. [14] L. Meier, P. Tanskanen, L. Heng, G. Lee, F. Fraundorfer, and M. Pollefeys, “Pixhawk: A micro aerial vehicle design for autonomous flight using onboard computer vision,” Autonomous Robots, vol. 33, pp. 21–39, February 2012. [15] H. Lim, S. Sinha, M. Cohen, and M. Uyttendaele, “Real-time image-based 6-dof localization in large-scale environments,” in 2012 IEEE Conference on Computer Vision and Pattern Recognition, pp. 1043–1050, June 2012. [16] D. Lee, H. Lim, H. J. Kim, Y. Kim, and K. J. Seong, “Adaptive image-based visual servoing for an underactuated quadrotor system,” Journal of Guidance, Control, and Dynamics, vol. 35, pp. 1335–1353, July 2012. [17] S. Grzonka, G. Grisetti, and W. Burgard, “A fully autonomous indoor quadrotor,” IEEE Transactions on Robotics, vol. 28, no. 1, pp. 90–100, 2012. [18] I. Sa and P. Corke, “System identification, estimation and control for a cost effective open-source quadcopter,” in 2012 IEEE International Conference on Robotics and Automation, pp. 2202–2209, 2012. [19] H. Lim, J. Park, D. Lee, and H. J. Kim, “Build your own quadrotor: Opensource projects on unmanned aerial vehicles,” IEEE Robotics Automation Magazine, vol. 19, no. 3, pp. 33–45, 2012. [20] S. Waslander, G. Hoffmann, J. S. Jang, and C. Tomlin, “Multi-agent quadrotor testbed control design: integral sliding mode vs. reinforcement learning,” in 2005 IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 3712–3717, Aug 2005. [21] A. Tayebi and S. McGilvray, “Attitude stabilization of a four-rotor aerial robot,” in 43rd IEEE Conference on Decision and Control, vol. 2, pp. 1216–1221 Vol.2, 2004. [22] A. Tayebi and S. McGilvray, “Attitude stabilization of a vtol quadrotor aircraft,” IEEE Transactions on Control Systems Technology, vol. 14, no. 3, pp. 562–571, 2006. [23] S. Bouabdallah, P. Murrieri, and R. Siegwart, “Design and control of an indoor micro quadrotor,” in IEEE International Conference on Robotics and Automation, vol. 5, pp. 4393–4398, 26 April-1 May 2004. [24] T. Hamel, R. Mahony, R. Lozano, and J. Ostrowski, “Dynamic modelling and configuration stabilization for an x4-flyer,” in IFAC 15th Triennial World Congress, 2002.
BIBLIOGRAPHY
93
[25] S. Salazar-Cruz, A. Palomino, and R. Lozano, “Trajectory tracking for a four rotor mini-aircraft,” in 44th IEEE Conference on Decision and Control and the European Control Conference 2005, pp. 2505–2510, Dec 2005. [26] P. Castillo, A. Dzul, and R. Lozano, “Real-time stabilization and tracking of a four-rotor mini rotorcraft,” IEEE Transactions on Control Systems Technology, vol. 12, no. 4, pp. 510–516, 2004. [27] P. Castillo, R. Lozano, and A. Dzul, “Stabilization of a mini-rotorcraft having four rotors,” in IEEE/RSJ International Conference on Intelligent Robots and Systems, vol. 3, pp. 2693–2698 vol.3, 2004. [28] P. Castillo, R. Lozano, and A. Dzul, “Stabilization of a mini rotorcraft with four rotors,” IEEE Control Systems Magazine, vol. 25, no. 6, pp. 45–55, 2005. [29] S. Bouabdallah and R. Siegwart, “Backstepping and sliding-mode techniques applied to an indoor micro quadrotor,” in IEEE International Conference on Robotics and Automation, pp. 2247–2252, 2005. [30] P. Castillo, P. Albertos, P. Garcia, and R. Lozano, “Simple real-time attitude stabilization of a quad-rotor aircraft with bounded signals,” in 45th IEEE Conference on Decision and Control, pp. 1533–1538, 2006. [31] T. Madani and A. Benallegue, “Backstepping control for a quadrotor helicopter,” in 2006 IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 3255–3260, 2006. [32] T. Madani and A. Benallegue, “Backstepping sliding mode control applied to a miniature quadrotor flying robot,” in 32nd Annual Conference on IEEE Industrial Electronics, pp. 700–705, 2006. [33] T. Madani and A. Benallegue, “Control of a quadrotor mini-helicopter via full state backstepping technique,” in 45th IEEE Conference on Decision and Control, pp. 1515–1520, 2006. [34] A. Benallegue, A. Mokhtari, and L. Fridman, “Feedback linearization and high order sliding mode observer for a quadrotor uav,” in International Workshop on Variable Structure Systems, pp. 365–372, June 2006. [35] V. Mistler, A. Benallegue, and N. M”Sirdi, “Exact linearization and noninteracting control of a 4 rotors helicopter via dynamic feedback,” in 10th IEEE International Workshop on Robot and Human Interactive Communication, pp. 586–593, 2001. [36] C. Raimundez and A. Villaverde, “Adaptive tracking control for a quad-rotor,” in Proceedings of the 6th Euromech Nonlinear Dynamics Conference, June 2008. [37] A. Mokhtari and A. Benallegue, “Dynamic feedback controller of euler angles and wind parameters estimation for a quadrotor unmanned aerial vehicle,” in 2004 IEEE International Conference on Robotics and Automation, vol. 3, pp. 2359–2366 Vol.3, 2004.
BIBLIOGRAPHY
94
[38] A. Mokhtari, A. Benallegue, and B. Daachi, “Robust feedback linearization and gh-infinity controller for a quadrotor unmanned aerial vehicle,” in International Conference on Intelligent Robots and Systems, (Alberta (Canada)), August 2-6 2005. [39] A. Satici, H. Poonawala, and M. Spong, “Robust optimal control of quadrotor uavs,” IEEE Access, vol. 1, pp. 79–93, 2013. [40] M. J. Stepaniak, A Quadrotor Sensor Platform. PhD thesis, Ohio University, 2008. [41] R. Mahony, V. Kumar, and P. Corke, “Multirotor aerial vehicles: Modeling, estimation, and control of quadrotor,” IEEE Robotics Automation Magazine, vol. 19, no. 3, pp. 20–32, 2012. [42] D. Mellinger and V. Kumar, “Minimum snap trajectory generation and control for quadrotors,” in 2011 IEEE International Conference on Robotics and Automation, pp. 2520–2525, 2011. [43] T. Lee, “Robust adaptive attitude tracking on rmSO(3) with an application to a quadrotor uav,” IEEE Transactions on Control Systems Technology, vol. 21, no. 5, pp. 1924–1930, 2013. [44] T. Lee, M. Leok, and N. H. McClamroch, “Nonlinear robust tracking control of a quadrotor uav on se(3),” Asian Journal of Control, vol. 15, no. 2, pp. 391–408, 2013. [45] T. Lee, M. Leoky, and N. McClamroch, “Geometric tracking control of a quadrotor uav on se(3),” in 2010 49th IEEE Conference on Decision and Control, pp. 5420–5425, 2010. [46] G. V. Raffo, M. G. Ortega, and F. R. Rubio, “An integral predictive/nonlinear control structure for a quadrotor helicopter,” Automatica, vol. 46, no. 1, pp. 29 – 39, 2010. [47] I. Palunko, P. Cruz, and R. Fierro, “Agile load transportation : Safe and efficient load manipulation with aerial robots,” IEEE Robotics Automation Magazine, vol. 19, pp. 69–79, Sept 2012. [48] Y. Morel and A. Leonessa, “Direct adaptive tracking control of quadrotor aerial vehicles,” in 2006 ASME International Mechanical Engineering Congress and Exposition, 2006. [49] M. Huang, B. Xian, C. Diao, K. Yang, and Y. Feng, “Adaptive tracking control of underactuated quadrotor unmanned aerial vehicles via backstepping,” in The 2010 American Control Conference, pp. 2076–2081, 2010. [50] H. Zhen, X. Qi, and H. Dong, “An adaptive block backstepping controller for attitude stabilization of a quadrotor helicopter,” WSEAS Transactions on Systems & Control, vol. 8, pp. 46–55, April 2013.
BIBLIOGRAPHY
95
[51] Z. Zuo, “Adaptive trajectory tracking control design with command filtered compensation for a quadrotor,” Journal of Vibration and Control, vol. 19, no. 1, pp. 94–108, 2013. [52] G. Antonelli, S. Arrichiello F, Chiaverini, and P. Robuffo Giordano, “Adaptive trajectory tracking for quadrotor mavs in presence of parameter uncertainties and external disturbances,” in IEEE/ASME International Conference on Advanced Intelligent Mechatronics, pp. 1337–1342, IEEE, 2013. [53] J. M. Selfridge and G. Tao, “A multivariable adaptive controller for a quadrotor with guaranteed matching conditions,” Systems Science & Control Engineering: An Open Access Journal, vol. 2, no. 1, pp. 24–33, 2014. [54] I. Sadeghzadeh, A. Mehta, and Y. Zhang, “Fault-damage tolerant control of a quadrotor helicopter uav using model reference adaptive control and gainscheduled pid,” in Guidance, Navigation, and Control and Co-located Conferences, pp. –, American Institute of Aeronautics and Astronautics, 2011. [55] Z. T. Dydek, Adaptive Control of Unmanned Aerial Systems. PhD thesis, Massachusetts Institute of Technology, 2010. [56] Z. Dydek, A. Annaswamy, and E. Lavretsky, “Adaptive control of quadrotor uavs: A design trade study with flight evaluations,” IEEE Transactions on Control Systems Technology, vol. 21, no. 4, pp. 1400–1406, 2013. [57] D. Miller, “Open loop system identificaiton of a micro quadrotor helicopter from closed loop data,” Master’s thesis, University of Maryland, College Park, 2011. [58] K. J. Astrom and R. M. Murray, Feedback systems : an introduction for scientists and engineers. Princeton, Oxford: Princeton university press, 2008. [59] G. F. Franklin, J. D. Powell, and M. L. Workman, Digital Control of Dynamic Systems. Electrical and Computer Engineering; Control Engineering, Reading Massachusetts: Addison-Wesley, second ed., 1990. A SRL reference. [60] P. Ioannou and B. Fidan, Adaptive Control Tutorial. Advances in Design and Control, Society for Industrial and Applied Mathematics, 2006. [61] A. Briod, J.-C. Zufferey, and D. Floreano, “Optic-flow based control of a 46g quadrotor,” in Workshop on Vision-based Closed-Loop Control and Navigation of Micro Helicopters in GPS-denied Environments, 2013. [62] L. A. Barford, R. S. Fazzio, and D. R. Smith, “An introduction to wavelets,” Tech. Rep. HPL-92-124, Instruments and Photonics Laboratory, HewlettPackard Company, September 1992. [63] E. Sheybani, O. Mengshoel, and S. Poll, “Removing spikes while preserving data and noise using wavelet filter banks,” in 2010 IEEE Aerospace Conference, pp. 1–10, March 2010.
BIBLIOGRAPHY
96
[64] H. Mohammad, C. Diduch, Y. Biletskiy, and L. Chang, “Filtering out spikes from sensors in power converters system using discrete wavelet transform,” in 2012 25th IEEE Canadian Conference on Electrical Computer Engineering, pp. 1–3, April 2012. [65] V. Ashok, T. Balakumaran, C. Gowrishankar, I. L. A. Vennila, and A. N. Kumar, “The fast haar wavelet transform for signal & image processing,” International Journal of Computer Science and Information Security, vol. abs/1002.21847, pp. 126–130, January 2010. [66] E. D. Ubeyli, G. Ilbay, D. Sahin, and N. Ates, “Discrete wavelet transform for analysis of spike-wave discharges in rats,” in 30th Annual International Conference of the IEEE Engineering in Medicine and Biology Society, pp. 4680– 4683, Aug 2008. [67] A. Figliola and E. Serrano, “Analysis of physiological time series using wavelet transforms,” IEEE Engineering in Medicine and Biology Magazine, vol. 16, pp. 74–79, May 1997. [68] D. Honegger, L. Meier, P. Tanskanen, and M. Pollefeys, “An open source and open hardware embedded metric optical flow cmos camera for indoor and outdoor applications,” in IEEE International Conference on Robotics and Automation, pp. 1736–1741, May 2013. [69] www.hobbyking.com/. [70] http://www.apcprop.com/. [71] www.mikrokopter.de/ucwiki/MK3538. [72] www.3dhobbyshop.com/APC-Electric-Propeller-13-x-65 p 15545. [73] www.hobbywarehouse.com.au. [74] www.le-modelisme.com/. [75] eu.mouser.com/. [76] www.raspberrypi.org/. [77] arduino.cc/. [78] playground.arduino.cc/Main/MPU-6050. [79] www.sparkfun.com. [80] pixhawk.org/modules/px4flow. [81] A. Sabatini, “Quaternion-based extended kalman filter for determining orientation by inertial and magnetic sensing,” IEEE Transactions on Biomedical Engineering, vol. 53, pp. 1346–1356, July 2006.
BIBLIOGRAPHY
97
[82] V. Renaudin, M. H. Afzal, and G. Lachapelle, “Complete triaxis magnetometer calibration in the magnetic domain,” Journal of Sensors, vol. 2010, pp. 1–10, 2010. [83] www.ngdc.noaa.gov/geomag/. [84] www.diydrones.com/forum/topics/compansating-hardiron-soft-iron-andscaling-effects-in-magnetic. [85] J. Vasconcelos, G. Elkaim, C. Silvestre, P. Oliveira, and B. Cardeira, “Geometric approach to strapdown magnetometer calibration in sensor frame,” IEEE Transactions on Aerospace and Electronic Systems, vol. 47, pp. 1293– 1306, April 2011. [86] H. Nokland, “Nonlinear observer design for gnss and imu integration,” Master’s thesis, Norwegian University of Science and Technology, June 2011. [87] P. Martin and E. Salaun, “The true role of accelerometer feedback in quadrotor control,” in 2010 IEEE International Conference on Robotics and Automation, pp. 1623–1629, 2010. [88] D. Abeywardena, S. Kodagoda, G. Dissanayake, and R. Munasinghe, “Improved state estimation in quadrotor mavs: A novel drift-free velocity estimator,” Robotics Automation Magazine, IEEE, vol. PP, no. 99, pp. 1–1, 2013. [89] D. Simon, Optimal State Estimation: Kalman, H Infinity, and Nonlinear Approaches. Wiley-Interscience, 2006.
الملخص العربي هذه الرسالة تركز علي التحديات الموجودة في التصميم و التطوير و التحكم في طائرة الكوادروتور بدون طيار. الهدف الرئيسي من نظام التحكم المصمم هو إستقرار الكوادروتور في حالة التحليق الثابت في وجود شكوك في العوامل المتغيرة التي من الممكن حدوثها في أثناء الطيران .متغير واحد محدد تمت دراسته في هذه الرسالة أال و هو الفشل الجزئي في المشغالت الميكانيكية للكوادروتور .سيتم عرض النموذج الغير خطي و النموذج الخطي و استخدامهما لتصميم بيئة محاكاة من أجل إختبار أنظمة التحكم .سيتم مناقشة و إنشاء تأثير الفشل الجزئي في أحد المشغالت الميكانيكية علي النموذج الديناميكي للكوادروتور .تم إستخدام منهاجين من أجل تصميم نظام تحكم يثبت الكوادروتور في حالة وجود متغيرات في العوامل المتغيرة .المنهاج األول هو نظام تحكم خطي مرتكز علي الطريقة التناسبية – التفاضلية – التكاملية ) (PIDو المنهاج الثاني هو متحكم متكيف بنموذج مرجعي باإلضافة إلي بعض التعديالت التي تزيد من متانة المتحكم .أداء اإلستقرار لكال المتحكمين قورن في بيئة المحاكاة .النتائج أظهرت أن المتحكم المتكيف يثمر عن أداء أفضل في نبذ اإلضطرابات المزودة علي النموذج الرمزي للكوادروتور بسبب فشل جزئي في المشغالت الميكانيكية .من أجل التحقق من صحة و كفاءة أنظمة التحكم ،تم تطوير و تجميع جهاز الكوادروتور و تم تزويده بعدة أجهزة إستشعار علي متن الطائرة لمد الجهاز بتقديرات عن هيئة الكوادروتور بدون أي أجهزة خارجية .للتغلب علي عيوب جهاز قياس المسافة بالموجات الفوق صوتية، المستخدم لقياس اإلرتفاع ،تم تصميم خوارزمية إلزالة التشويش المركب بإستخدام تحول الموجات الغير مترابط. في النهاية ،تم تطبيق المتحكم الخطي لتثبيت الوضع الجسماني للكوادروتور و النتائج أظهرت أن وضع الطائرة ثبت بنجاح.