University of Cincinnati

mechanical and materials engineering

Novel control techniques for a quadrotor based on the Sliding Mode Controller

A thesis submitted to the Graduate school of the University of Cincinnati in partial fulfillment of the requirements for the degree of

Master of Science

in the Department of Mechanical and Materials Engineering of the College of Engineering and Applied Science by

Madhavan Sudakar

M.S. University of Cincinnati

Nov 11, 2020

Committee Chair: Manish Kumar, Ph.D. Abstract

The thesis focuses on formulating novel mathematical control designs and implementing them on a quadrotor UAV (). The novel designs are based on the sliding mode control technique. The conventional sliding mode controller uses information from a sliding surface which comprises of a combination of state errors and a fixed set of stable coefficients. In this thesis, two different sets of objectives are achieved by modifying the conventional architecture. For the first objective, resistance to high external wind disturbance during outdoor quadrotor flight is attempted. This is achieved by incorporating information from not just the sliding surface but also the derivative of the sliding surface into the control input.

The second objective involves using a sliding surface whose coefficients are not fixed but variable in nature. It is desired to generate a PD controller that stabilizes the quadrotor dur- ing flight by using this form of sliding surface. To achieve the second objective, two control architectures are presented. In the first, the process of adaptation of the sliding coefficients occurs to reduce the magnitude of state errors to zero. The second algorithm keeps adapting the sliding mode coefficients to the point where they converge at values which form a stable sliding surface.

CASE - I

Quadrotor belongs to the class of multi-rotor UAV (Unmanned Aerial Vehicle). Its increas- ing uses in the commercial world for image capturing, package delivery, and defense is making it an invaluable type of drone in today’s world. However, during these operations, fluctuation in the system parameters such as loss in motor thrust or natural disturbances like wind and gusts may occur. These may result in the quadrotor deviating from its desired trajectory which results in a loss of accuracy. These factors necessitate a robust controller which can resist varied sorts of disturbances.

This study was chosen to be based on the sliding mode control since it has an inherent robustness to start off with. Sliding Mode Controller falls under the category of non-linear

iii controllers. Its design makes it inherently robust and resistant to external disturbances. To achieve this, however, rapid switching of the control input is applied. This uses a lot of energy and is a cause for concern when implemented on hardware (rapid switching of the motor may result in its wear and tear). This novel control design aims to largely reduce the magnitude of the back and forth switching of the control input while attempting to ensure a similar degree of robustness to external disturbances. To achieve this, two sliding surfaces, as opposed to the conventional usage of just one, is considered.

Firstly, the concept of multiple sliding surface is introduced. Its difference as compared to the conventional sliding mode is explained. Its theoretical implementation and stability when applied for quadrotor position and attitude control is shown mathematically using Lyapunov theory. Lastly, waypoint navigation is attempted in the presence of simulated wind and distur- bances in all 6 axis. The results are obtained, analyzed and bench marked against a PID and a conventional sliding mode controller. The motor control input behavior of the novel algorithm under the influence of wind gusts is also looked into. Possible drawbacks of the algorithm and the reasons for them are analyzed. Future work is also discussed.

CASE - II

The PD (Proportional Derivative) controller is basic in its structure and is the most widely used controller in UAV hardware. One major challenge in its implementation is the tuning of its gains for the 3 rotational and 3 translation degrees of freedom. For quadrotor waypoint navigation, a PD controller has shown to achieve good performance for waypoint navigation and trajectory tracking. However quadrotor’s complex, coupled, non-linear dynamics makes the tuning of its gains a time intensive and arduous process.

We have tried to address the above mentioned issue in this study. In order to do so, the concept of sliding surface, similar to the one used in sliding mode control, has been considered.

Only in this case, the coefficients of the sliding surface are not fixed but have the ability to vary.

iv The coefficients are made to relate with the gains of a PD controller.

The study proposes two designs to determine the method by which these coefficients are made to vary. In the first case, the study adapts the gains in a manner so that the value of the sliding surface as well as all state errors converge to zero in the process of quadrotor flight. The second adapts the gains in a manner so that their combined form creates a stable sliding surface at the end of the quadrotor flight. The study presents these two adaptations occur successfully irrespective of the value of the coefficients that we begin with. Therefore, even when started off with a random set of coefficients (or gains) manual tuning is not required.

In the thesis, firstly the theoretical formulation for the first of the two controller is pre- sented. This is mathematically derived from Lyapunov stability analysis. Next, to test its va- lidity, the algorithm has been applied in three cases presented. In these scenarios, the quadrotor has been assigned a random set of gains initially before its flight. Without adaptation some of them lead to an oscillatory response while in other cases, the quadrotor goes unstable. On applying the algorithm formulated in the thesis, good system stabilization is achieved. Per- formance before and after application of the algorithm is compared. Conclusions and future works are discussed.

v

Acknowledgements

Firstly my heartfelt thanks to the person who guided me through the process, head of mechanical engineering department, Professor Manish Kumar. It was first in his class of decision engineering that I had him as a teacher. I took a liking to his remarkable patience during his lectures and his intuitive way of explaining concepts. Accordingly, I wished to take up my research under him and was glad to be accepted into his lab group. The process was far from what I consider the ideally ”smooth” case. An undecided final target and a hurried literature review were a few things that I did not clearly do from the very beginning. These resulted in the research process stretching for a long period of time. I am really grateful to Professor Manish Kumar for giving me the time and space to perform. It was due to his patience that I feel I have been able to finish off on a strong note. His consistent support during my research helped me face the ups and downs during the course. Continuous insistence by him to structurally document everything regularly, a habit I had to de- velop, still rings in my head. I gradually inculcated this trait towards the later half of my research, and it has helped a lot. His guidance provided direction to my research. Being a student in a couple of his classes was also an enjoyable experience. I thank you Professor for the patience and the faith you have shown in me throughout. I am grateful to Professor Rajnikant Rajsharma for his support. It was his teaching in some of the courses like modern control and non-linear controls that helped me build a strong foundation in the domain of controls. Also thank you Professor for guiding me like a friend and mentor. You provided valuable suggestions and inputs when I really needed them.

Regards to my lab mates in the CDS lab who helped by suggesting different approaches through the course of my research. Rumits help, Siddarths dedication and interest, Gaurangs insistent effort to stuff concepts in my head and Shraddhas calmness helped a lot along the way. Thank you all ! My time with Fly UC provided me some interesting insights into the commercial real world applications of what I was learning. I am glad to have got an opportunity to work alongside Hayden

vii and an enthusiastic Heath. Being in Fly UC taught me a portion of organizational side of a project along with the technical details. A thanks to the CEAS department for giving the opportunity as a MATLAB grader for a semester. It provided me the opportunity to understand a section of the course and education system for undergrads. I am grateful to all my roommates for the fun times when things got rough. They helped pro- vide me the support to go about the process with more calm. Special thanks to Ajith, Ananth, Abhishek, Vijay, Mehul, Subbu and Ketan for putting up with my complaining and trying to cheer me up whenever things went downhill.

Lastly, I am thankful to my parents. Their encouraging words even so far off from India helped boost confidence and morale during challenging times. My sisters philosophical lectures on how to remain cheerful and not stress myself even during uncertain times did have a good steadying effect on me. All their persistent encouragement and motivation that things would go well are certain aspects to be grateful for.

viii Contents

Abstract iii

Acknowledgements vii

List of figures xii

List of tables xiii

1 Introduction 1

1.1 Motivation and objectives of this thesis ...... 1 1.2 Contributions ...... 3 1.3 Thesis Organization ...... 4

2 Background of control in the field of quadrotors 5

2.1 Evolution and use of Unmanned Aerial Vehicles ...... 5 2.2 Sliding Mode Control ...... 8 2.3 Sliding Mode Control in quadrotors ...... 10 2.4 Evolution of Adaptive Control ...... 11 2.5 Adaptive Control for Sliding Mode ...... 13

3 Dynamic Model of a Quadrotor 15

4 Control Design I - Multiple sliding surface for robust disturbance handling 18

4.1 Motivation for the design ...... 18 4.2 Literature review and introduction ...... 19 4.3 Algorithm implementation on a quadrotor and theoretical stability analysis . . . . . 21 4.4 Results and conclusions ...... 25

5 Control Design II - Proportional Derivative Controller with self adaptive gains 38

5.1 Motivation for the design ...... 38

ix 5.2 Literature review and introduction ...... 38 5.3 Intuitive understanding ...... 40 5.4 Algorithm implementation on a quadrotor and theoretical stability analysis . . . . . 41 5.5 Results and conclusions ...... 48

6 Control Design III - Proportional Derivative Controller with auto-tuned gains 56

6.1 Traditional PD Controller ...... 56 6.2 Algorithm implementation on a quadrotor and theoretical stability analysis . . . . . 58 6.3 Results and conclusions ...... 63

7 Conclusions 69

8 Future Work 71

References 72

x List of Figures

1 Quadcopter UAV ...... 15 2 Control Architecture ...... 25 3 Position and Orientation of quad - Higher Order SMC - Sign Function ...... 27 4 Position and Orientation of quad - Classical SMC - Sign Function ...... 27 5 Wind Force (N) - Case I ...... 29 6 Position and Orientation of Quad - Higher Order SMC - Case I ...... 30 7 Force generated by each motor of the quad - Higher Order SMC - Case I ...... 30 8 Position and Orientation of Quad - Classical SMC - Case I ...... 31 9 Position and Orientation of Quad - PID - Case I ...... 31 10 Wind Force (N) - Case II ...... 33 11 Position and Orientation of Quad - Higher Order SMC - Case II ...... 33 12 Position and Orientation of Quad - Classical SMC - Case II ...... 34 13 Position and Orientation of Quad - PID - Case II ...... 34 14 Motor Speeds obtained from Higher Order SMC - Case I ...... 36 15 Control Architecture ...... 48 16 Position and Orientation of Quad - Adaptive PD Without adaptation - Case - I . . . 49 17 Position and Orientation of Quad - Adaptive PD With adaptation - Case - I . . . . 50 18 Coefficients of the sliding surfaces - Adaptive PD With adaptation - Case - I . . . . 50 19 Position and Orientation of Quad -Adaptive PD- With adaptation - Case - II . . . . 51 20 Coefficients of the sliding surfaces - Adaptive PD- With adaptation - Case - II . . . 52 21 Position and Orientation of Quad - With adaptation - Case - III ...... 53 22 Coefficients of the sliding surfaces - With adaptation - Case - III ...... 53 23 Position and Orientation of Quad -Adaptive PD- With adaptation - Case - IV . . . . 54 24 Coefficients of the sliding surfaces - Adaptive PD - With adaptation - Case - IV . . 55 25 Control Architecture ...... 59 26 Position and Orientation of Quad - Autotuner - Without adaptation - Case - I . . . . 64

xi 27 Position and Orientation of Quad - Autotuner - With adaptation - Case - I . . . . . 64 28 Coefficients of sliding surface - Autotuner - With adaptation - Case - I ...... 65 29 Position and Orientation of Quad - Autotuner - With adaptation - Case - II . . . . . 66 30 Coefficients of sliding surface - Autotuner - With adaptation - Case - II ...... 66 31 Position and Orientation of Quad - Autotuner - With adaptation - Case - III . . . . 67 32 Coefficients of sliding surface - Autotuner - With adaptation - Case - III ...... 68

xii List of Tables

1 Control Architecture I - Quadrotor Parameters ...... 26 2 Control Architecture II - Quadrotor Parameters ...... 49 3 Control Architecture III - Quadrotor Parameters ...... 63

xiii 1 Introduction

This chapter presents the reader with the motivation and the objectives of this thesis, followed by the contributions of this research work and the overall organization of this thesis.

1.1 Motivation and objectives of this thesis

My journey started by joining the CDS (Cooperative distributed systems) research lab in the year 2016. The research in this lab was in the area of robotic systems. During this period, the research in the lab was to develop new algorithms for UAV flight and create hardware platforms to test these algorithms. There were 3 main areas of on going research in the lab which were related to UAV development. UAV controller design , new techniques for simultaneous localization and mapping (SLAM) and novel path planning methods. The aspect of influencing systems in order to modify their behaviour in a manner favourable to us was of great interest to me. The manipulation of dynamical systems to produce desired outcomes was a concept that was of great importance. Correspondingly, the area of novel control algorithm development for Unmanned Aerial Vehicles (UAVs) seemed the right place to be. Quadrotors are very popular and have many uses. Surveillance, package delivery, coordinated object transport, recreation and image capturing were some of the various uses. However, during these processes, aerodynamic drag and wind disturbances act on the quadrotor causing it to deviate from its path, lose balance when crucially required or in some cases become unstable. This is highly undesirable. For instance, image capturing by a camera on a quadrotor (refer) needs perfect stability of flight without sudden jumps or oscillations to avoid blurred images. This was observed (Aerial UAVs) while attempting waypoint navigation of a fixed wing aircraft. Winds caused the fixed wing to wobble as well as deviate from its path. This caused the gimbal of the camera to behave uncertainly thereby leading to poor image capture. Quadrotors used for package delivery (refer) in crowded cities may run into obstacles if wind disturbance causes them to divert too much away from their path. Package shifting on the quadrotor may also take place due to the same

1 reason (refer). Collaborative transport of an object by multiple quadrotors (refer) requires that each quadrotor moves precisely as desired. Deviation away from the desired process may result in the swaying and motion of the suspended object which may correspondingly cause confusion in the other quadrotors holding the object. All this necessitates the need for the quadrotor to develop a strong resistance to wind and gust disturbance. This was an interesting aspect to look at. Further the idea of developing a design which ensured that the system performed well even in the face of unknown unpredictable external events interested me. It was a problem to work upon. The process of coming up with a new algorithm involved understanding of how controller de- signs like the PD (Proportional Derivative), MRAC (Model Reference Adaptive Control) and SMC (Sliding Mode Controller) worked. Studying the way in which the sliding mode controller worked provided me with the insight that its structure/mechanism of functioning provided robustness by its nature itself. However , it was seen that the input for the sliding mode control consumed a lot of energy and rapid switching in the control input was undesirable (chattering). Primary motivation for doing project 1 of this thesis comes from the above. A control architecture to retain the ro- bust property of the sliding mode control but make it much more energy efficient than the existing design was attempted. As mentioned before during this process, PD control design was explored. It was seen that the while the PD controller was easy to design for smaller systems, implementing it on large, complex dynamical system becomes challenging. This is because the gains for the PD controller have to be carefully tuned the larger the system gets. Also larger the system, more the number of gains to be tuned manually. This process of tuning manually is time taking and arduous. Also, re-tuning of the gains is required every time there is a change in a physical parameter of the system. This prompted me to come up with control structures that kept automatically varying/tuning the gains of the quadrotor during its flight. Project 2 and Project 3 is motivated from the need explained above.

2 1.2 Contributions

The thesis focuses on Unmanned Aerial Vehicles (UAV), specifically the quadrotor. There are 2 areas in this domain where research contributions have been made.

The first novel controller presented is based on the sliding mode control design. The novel design is created with an aim to be more energy efficient than the conventional sliding mode control and perform well in the case of external wind disturbances. Linearized local stability of the novel control architecture has been presented mathematically through the Lyapunov stability analysis. Effective state convergence even in the presence of exter- nal disturbance has been mathematically shown. This design provides a new structure that is based on efficiently countering wind disturbances than an energy inefficient brutal suppression technique as seen in the conventional sliding mode controller case. An extra feedback loop provides this. This structure can be improved upon. The flight of a well tuned PID (Proportional Integral Derivative) and a conventional sliding mode control (with wind disturbances) is simulated and compared with our architecture. It is ob- served that better quadrotor tracking is seen in our design as compared to the other two. This marks an excellent improvement over the standard existing techniques.

The second and third controller designs enable automatic waypoint navigation of a quadrotor without the need of tuning its gains. Here, waypoint navigation is started off with a random set of gains. The second design provides a structure which ensures that the gains of the quadrotor keep adapting and taking appropriate values through the flight to ensure that the objective is achieved (waypoint navigation). The third design provides a structure that achieves a similar objective by ensuring that the gains of the quadrotor quickly adapt and converge to stable PD controller values during flight. Both the designs are shown to be stable when the dynamics is assumed to be linear. This is done mathematically through the Lyapunov stability analysis. Results for each case is presented. Effective waypoint navigation is shown even when a random

3 set of gain values for both position and attitude control is started off with. A comparison is made between the 2 methods.

1.3 Thesis Organization

The thesis is presented in 9 chapters. Chapter 1 states the motivation of the thesis and its contributions. Chapter 2 introduces Unmanned Aerial Vehicles and their history. The literature of the sliding mode control in quadrotors is also presented in this chapter since the concept of sliding surface is used in the three research topics presented. Chapter 3 explains the dynamical modelling of of the quadrotor. The mathematical structure of the dynamics is presented in this unit. Chapter 4 presents the novel control architecture based off the sliding mode control design. The novel design is tested in the presence of wind disturbance and its performance is compared with a PD and conventional sliding mode control design. Chapter 5 explains the concept of adaptation and its application in sliding mode control. These are explained in order to set up the required foundation for the two controller designs in the fol- lowing chapters. Chapter 6 is a controller design to create an adaptive PD controller. This control structure attempts to adaptively vary the gains of the quadrotor during its flight thereby eliminating the need of manual tuning. Chapter 7 presents another control structure to eliminate the need for manual tuning of the gains. A design for an auto-tuner for a quadrotor PD controller is presented. A comparative study of the methods are done. Conclusions is presented in chapter 8 Future work is presented in chapter 9.

4 2 Background of control in the field of quadrotors

2.1 Evolution and use of Unmanned Aerial Vehicles

An Unmanned Aerial Vehicle (UAV) is effectively a flying robot that can be remote controlled or autonomously flown. UAVs started out long back in the 19th century (1850s) and is continued to be used until today. Its usage has vastly been in the military and for defence for most of this period. It is only in the last 20 years that it has branched out heavily for a variety of civilian and other purposes.

Its initial usage in a highly rudimentary form was in the year 1849 in warfare. They were used in the form of floating gas filled balloons. These balloons, sent by Austria, were carrying explosives and were meant to be dropped over the city of Venice, Italy by the Austrians during war. It was this sort of thinking that pushed for technological advancements in the area of UAV/drones in the years to come. Not surprisingly, even decades later, UAVs were considered largely from a military point of view. In the battle of Neuve Chapelle in 1915, the British used aerial photography to capture images of German trenches during war. The first pilot-less aircraft were built towards the end of in the year 1916. Pilotless military drones used a newly developed radio guidance system that had been developed by British engineer Archibald Low. The planes could be launched from the back of the truck and guided by a radio. Shortly after this, the US army came up with a fixed wing UAV design, the Kettering Bug. This was a remote controlled UAV and was navigated by using gyroscopic controls. The main purpose of this was to use it as an aerial torpedo. The UAV with the bomb attached to it was made to crash into the desired target thereby blowing it up. During 1930-1945, there was massive production of such UAVs in the US. This and the need for technological advancement was spurred due to the World War II. During this period, a radio controlled aircraft that could fly out of sight was developed. This was a great improvement, as

5 previously, remote controlled UAVs could be flown only within visual sight of the person con- trolling it. Edward, the person who patented the information used a ground terminal to track the movements of the aeroplane. Towards the end of world war II, the Germans developed the first pulse jet driven UAV, a step towards the modern day cruise .

In the Vietnam war of 1951, drones were used for the first time for reconnaissance. They were continued to be used heavily for the purpose of spying and image photography of enemy territory well until the cold war (1980s). Also drones were starting to be used for other operations within the military. Decoys in combat operations, platforms for firing against fixed targets and dropping leaflets over large areas to convey messages for psychological operations are some of the uses. It is to be noted that the fixed wing design was used extensively during this time. Its ability to fly fast and long distances made it valuable for missile strikes and long distance surveillance.

Breakthrough in transistor technology in the 1960s enabled the radio controlled components to be miniaturized and sold at a reduced price. Drones could start being used for recreational purposes and could be bought at affordable prices. Even until the 1980s, though there was improvement in technology, drones were seen as un- reliable and expensive. This perspective changed after the war of 1982 when the Israelis defeated the Syrian air force with minimal losses by using drones as support to the fighter pilots in aerial combat. The value of drones in warfare became immensely apparent to the US post this. They have made every effort to improve drone technology and make UAVs more affordable and equipped for the military to use.

In the past twenty years, the uses of drones have been more diverse. Multi-rotor design has become extremely prominent.They are more slow moving and easier to maneuver than the fixed wing aircraft. Hence, they are very useful in today’s time, specially in crowded cities where there is a space constraint. Quadrotor is a type of multi rotor. Quadrotors are being used for many

6 purposes like package delivery, image capturing and collaborative transport. Image capturing and identification plays an important role and has many applications. It helps in applications like traf- fic monitoring and facial recognition. One example of collaborative transport is when quadrotors collectively work by carrying people and transporting them away from disaster struck zones.

An increasing need for more accurate control and maneuverability is required for the challeng- ing tasks to be accomplished in today’s complex environment. Hence, research for newer models with a greater degree of control like the tilt rotor quadrotor and variable pitch quadrotor are being looked into. Models for greater flexibility like the fold-able quadrotors are also being looked into.

7 2.2 Sliding Mode Control

The origin of feedback control dates back to the ancient world, with the advent of level control, water clocks, and pneumatic/hydraulics systems. From early 1600s, temperature control systems in furnaces, the mechanical functioning of mills and steam engine regulation were seen. In the 1950s and 1960s, a different approach to dynamic modelling was developed in the Soviet Union. This was based on the works of Poincare´ and Lyapunov. Modern control theory and state space dynamics were developed during this time. Feedback control in the linear form like PD, PID were studied and starting to be widely used. However, during this time it became apparent that linear feedback control was a useful form of controlling system dynamics but failed to efficiently do so in the event of uncertain or varying system parameters. Also, the linear feedback design law operated in in a manner that did not really account for external disturbances understanding or handling. This motivated people to search for a solution to this.

Variable structure control (VSC) is a nonlinear control with a discontinuous form. The method applies a switching control of high frequency which channels the dynamics of the system. This state-feedback control law is a discontinuous function of time; it switches between two conditions. So the the control law depends based on the position of the state trajectory. The method keeps changing from one smooth control law to another. VSC and its related sliding mode behaviour was first researched in early 1950s by Emelyanov and several co-researchers in the Soviet Union.

The sliding mode controller works on a similar principle as the VSC. It first defines a sliding surface with compensated dynamics. These compensated dynamics ensure that the states converge to their desired values asymptotically. And to ensure that system dynamics reached this sliding surface and is maintained there, a switching control input is applied. This switching control in- put ensures that the sliding surface stays at zero. It also ensures that it has a magnitude strong enough to potentially overcome any external disturbance. This thereby ensures that the states in the compensated dynamics behave the way they are supposed to, unhindered by the external dis-

8 turbance. Hence, sliding mode control has the characteristics of not being affected by any external disturbance. The control input acts as a barrier to external interference and tries to maintain the condition of the compensated dynamics at all points of time. This is why it is known as a robust controller. Also the dynamics of the system is determined by the surface that we choose. So, that aspect too is in the hand of the designer.

9 2.3 Sliding Mode Control in quadrotors

This section explains the methodology in which the sliding mode control design has been imple- mented on quadrotors. A sliding mode controller has been designed in [1]. This thesis helps us understand the basic structure when sliding mode control is used to control a quadrotor system. Sliding mode control. [2] designs a controller for a linearized quadrotor system where the sliding coefficients are determined by the system dynamics to ensure stability. Hurwitz stability criteria is used to determine this. In the above case, it is expected that the system handles parameter changes well. This is because the sliding coefficients keep varying to ensure stability based on the system parameters. Integral sliding mode controller for a quadrotor [3] was also seen to face disturbances well. Adaptation can be applied to the sliding mode controller to achieve new goals. For example in [4], it is shown that adaptation is used in the sliding mode control design when the parameters of the quadrotor are unknown or slowly changing. Adaptive sliding mode for a quadrotor is also used for getting a measure of how much disturbance acts on a systems and then countering it effectively. This is seen in [5]. In quite some of these cases, the discontinuous input of the sliding mode control has been ap- proximated to a continuous function [6]. This eliminates chattering and reduces wear and tear in a physical system. These help reject wind disturbances in with a smoother more energy efficient control input

Higher order sliding mode control [7], [8] uses more than a single surface for controlling the dynamics of he system. It means that the dynamics will be constrained to follow multiple slid- ing surfaces. This helps bring about a greater efficiency since there are more number of variables involved. These are seen to be robust and handle external disturbances well. The control archi- tecture stated in the thesis is based on the concept of higher order sliding mode. However, in this architecture acceleration in addition to position and velocity feedback is considered. Also, here the derivative of the control input is computed first and then the actual control input is integrated from

10 it.

2.4 Evolution of Adaptive Control

To adapt, in the general sense, means to change one’s behaviour to best suit the external environ- ment. Biologically, adaptation theory is equivalently known as survival theory. It represents an organism’s capability to adapt to environmental changes surrounding it and adjust to these over time. This attribute enables the organism to respond to external circumstances well. On similar lines, the process of adaptation to control dynamical systems enables the controller to understand how the dynamics is behaving. Hence enabling it to perform better with time. This ability to understand subtle changes in system dynamics makes adaptation a powerful tool to balance the effect of changing parameters or resist an external disturbance.

The benefits of adaptive controls are numerous as compared to fixed gain controllers. Firstly, system models in general have a certain degree of uncertainty. This is due to the fact that they do not completely capture the dynamics of the physical system. It is good to have a control design that accepts this fact. In the real world, apart from modelling errors, unforeseen external disturbances also creates uncertainties, result in component failures and structural damage. The fixed-gain con- troller static by nature. Performance cannot be improved based on past and current measurement. Generally systems are dynamic and variable with time. Adaptive control depends less on the sys- tems mathematical model accuracy . On the other hand, fixed gain controllers rely on on the fact that system parameters remain static and do not vary though the process. A fixed gain controller may function well in one operating area of the system. But the more non linear the dynamics is, and higher the variance, greater the chance of the fixed gain controller performance falling. Lat- est trends in modern control systems is heading towards the development of flexible controllers. These are designed with an aim to easily accommodate system changes (plant characteristics and disturbance models).

11 Adaptive control has had a long history with intense debates about its working. It originated around the period of 1950. Attempts were made to design autopilots for supersonic air-crafts. Autopilots having constant-gain, linear feedback worked well in certain specific conditions but not over the whole operating flight dynamics. This is since the dynamics was highly non linear. There was also a need for automatic tuning of controllers which were simple in structure. Large amount of research in the 1950s and early 1960s contributed to theoretical understanding of adap- tive control. Many aspects of adaptation were captured by dynamic programming (Bellman 1961). Feldbaum introduced the notion of dual control. This meant that control should be directing and should attempt to test different outcomes. The controller thus injects test signals to try to obtain better information. Tsypkin showed that a common framework existed for learning and adapta- tion (Tsypkin 1971). Widrow developed a neural network (Adaline) for adaptive control (Widrow 1962) from Gabor’s work on adaptive filtering (Gabor et al. 1959) . Widrow’s adaptation mech- anism came from Hebbian learning seen in biological systems (Hebb 1949). Kalmans work at the Engineering Research Laboratory at DuPont (Kalman thesis 1958) brought about the idea of self-tuning regulator. He took up the challenge of building a machine which auto adjusts to control an arbitrary dynamic process. This symbolized the early beginning of adaptive control.

The period of 1950s and 1960s was when a lot of research for adaptive control was prominent. However, in 1967 the powered X15-3 crashed. This was using Honeywell’s MH-96 self- oscillating adaptive controller. Funding cuts for research of adaptive control followed after this incident. However, the self-oscillating adaptive control system has been successfully in launching several missiles. 1970s saw the re-emergence of adaptive control with two successful algorithm schemes, the Model Reference Adaptive Control (MRAC) and Self Tuning Regulators (STR). Advances in sta- bility theory and system identification spurred research. An intensive period of research from the late 1970s through the 1990s followed. Insight and conceptual understanding of stability, conver-

12 gence, and robustness increased. Adaptive control is being researched with renewed vigour ever since the expansion of flight controls. There is a requirement for adaptation in autonomous systems to make them efficient. Adaptive control has been used in the area of quadrotors for improving resistance to wind disturbance. This can be seen in [9]. Adaptive fuzzy control is seen to provide excellent resistance to wind as seen in [10]. L1 adaptive control is used for wind gust rejection [11]. A similar case is seen in the case of geometric adaptive control [12]. The following sections use the principle of adaptation to vary the coefficients of the sliding surface to reduce the magnitude of state errors.

2.5 Adaptive Control for Sliding Mode

Adaptive Control can be implemented on top of other control schemes to increase the control pre- cision (e.g., robust and optimal controls). The Model Reference Adaptive Control (MRAC) is a classic example where the adaptation is applied on top of a fixed gain PD or PID controller. The gains of the PD controller then vary adaptively to follow the reference model in MRAC. Adaptation is applied on top of a linear PD controller in the MRAC [13] system and its stability is analysed through linear methods. In a similar manner, adaptation can be applied to non linear controls such as backstepping [14] and robust controls such as sliding mode [5].

While robust control such as the sliding mode control is effective to overcome parameter vari- ations and uncertainties in the system dynamics, its effectiveness depends on the range of the uncertainty. A larger amount of variance in uncertainty needs a much more stringent control input to be tackled completely. There is a lower chance of this happening practically. A smaller uncer- tainty however has a greater chance of being handled effectively. Adaptive control on top of the sliding mode control helps the system face a wide range of uncertainties when robust control solely cannot give the desired outcome. This can be seen in the sliding mode process[15] where adap-

13 tation helps in partly combating uncertainty thereby reducing the need for a large control input. Putting adaptive control on top of robust control systems significantly improves the performance of the system [5]. Another application of adaptive sliding mode control is that this design does not need informa- tion on the bounds of the uncertainty. It can understand the plant system by its self and tune the robust control automatically to effectively nullify the variation with time. This can be seen when adaptive sliding mode control is applied on a quadrotor in [5]. Adaptive control is concerned with changes in control i.e., to learn the plant correctly, track plant parameter variations and adjust to them. This can be seen in [16] where adaptation is used along with the sliding mode controller to effectively counter drag force and gyroscopic effects acting on the quadrotor. We see that the method discussed above is a powerful form of control and has various applications.

14 3 Dynamic Model of a Quadrotor

Figure 1: Quadcopter UAV

The dynamics of the quadrotor model are provided in this section. The free body diagram is shown in Figure 1. The world frame W denotes the inertial frame and the body frame is represented by B. The quadrotor is a ‘plus (+)’ type configuration where the arm of the motor-propeller 1 coincides with the body frame +x axis, arm of propeller 4 coincides with body frame +y axis and the +z axis is pointed upwards according to right-hand convention. Thrust force by each motor is generated upwards while the weight of the quadrotor acts downwards in the body frame z axis. Moment-reaction produced by each motor-propeller on the vehicle is opposite to the direction of rotation of each propeller. This is generated in the plane in which the quadrotor lies. Equations of motion for the linear directions are given by:

15             x¨  0   0              y¨ = RBW  0  +  0  (1)             z¨ T/m −g

Here,x ¨, y¨, z¨ are the linear accelerations in the inertial frame. m is the mass of the quadrotor and g is acceleration due to gravity. The length of each quadcopter arm is l. T is the total thrust

Pn=4 2 generated by the four motors of the quadrotor. T = n=1 Fi, Fi = KFwi where wi is the angular

th speed of the i rotor and KF is the coefficient of thrust. The Euler angle transformations are defined

by roll (φ), pitch (θ) and yaw (ψ). RBW is the rotation matrix that converts the accelerations from the body frame to the inertial frame. cθ refers to cos(θ) and sφ refers to sin(φ) respectively.

    cθcψ sφsθcψ − cφsψ cφsθcψ + sφsψ     RBW = cθsψ sφsθsψ + cφcψ cφsθsψ − sφcψ      −sθ sφcθ cφcθ 

The angular accelerations of the quadrotor system in body frame are written as follows:

            p˙ Uφ/Ixx ((Iyy − Izz)/Ixx)(q)(r)             q˙ = Uθ/Iyy  + ((Izz − Ixx)/Iyy)(r)(p) (2)             r˙ Uψ/Izz  ((Ixx − Iyy)/Izz)(p)(q)

Here, p, q and r are the angular velocity rates of the quadrotor in the body frame about x, y

and z axes. The above equation defines the angular acceleration of the quadrotor. Iii is the moment

of inertia matrix about the x, y and z axes accordingly. Uφ, Uθ, Uψ are the torques responsible for angular accelerations about the angles φ, θ and ψ respectively and are used for controlling the system. They are shown below:

16 Uφ = (F4 − F2)l (3)

Uθ = (F3 − F1)l (4)

Uψ = M2 + M4 − M1 − M3 (5)

2 Mi = KM(wi) , where KM is the coefficient for motor torque. Mi is motor reaction moment produced due to angular motion of the propellers. φ, θ, ψ are Euler angles with respect to each of their frames. Equation (6) converts the body angular velocities into angular rates in each respective frame.

            φ˙ 1 sφtanθ cφtanθ p             θ˙ = 0 cφ −sφ  q (6)             ψ˙ 0 sφsecθ cφsecθ r

17 4 Control Design I - Multiple sliding surface for robust distur-

bance handling

4.1 Motivation for the design

The motivation for this thesis study paper is in 2 parts. The first is an initially observed real world challenge relating UAV flight. The second objective sought to be achieved is improved performance of the system. The second gave rise to the choice of the base controller which would be best suited to achieve the objective. It was seen that the base controller lacked a certain aspect. The task at hand was to develop a control algorithm which would overcome the drawback observed in the base controller and at the same time solve the real world challenge. Quadrotors are a class of multi-rotor UAVs. Its importance is growing more and more in todays world. Image capturing, package delivery, collaborative object transport, wildfire identification, traffic monitoring and entertainment are some of its uses. We see that in many of its objectives, it is required that the quadrotor remain steady in its attitude and true to its path. Such instances are explained. An example would be image capturing where it is essential that the quadrotor does not vibrate or wobble too much if accurate images are to be captured. A steady control is required in the face of external disturbances for this process. A similar reason hold true in the case of collaborative transport of an object suspended by multiple UAVs. Strong winds and gusts could destabilize the entire system. External disturbances such as wind could also cause the quadrotor to deviate heavily from its path in the case of package delivery. This could be more risky in cluttered urban environments where the chance of obstacle collision is higher. All this necessitates the need to need for the quadrotor to be much more resisting to external wind and gust disturbances.

Sliding mode control was seen to function in such a manner that it kept the dynamics on the sliding surface even in the event of external disturbances. This is the reason that the sliding mode control technique was explored. However, on making this choice, it was observed that the control

18 input of the sliding mode control undergoes rapid switching or chattering which makes the con- troller energy inefficient.

The novel control technique designed attempts to overcome this challenge and to also respond well to wind disturbances alongside.

4.2 Literature review and introduction

The quad-rotor is an under actuated system. It has 6 states to be controlled and just 4 control inputs. This implies that the 6 states cannot be controlled independently. The states of the quad- rotor are highly coupled. This makes controlling it a challenging task. While control algorithms have been developed for its applications for waypoint navigation and to fly outdoors, there are very few controllers developed which can make the quadrotor handle very high wind disturbances. Our aim is to develop a robust controller for the quadrotor to handle worst wind and gust disturbances so that it can it can carry out its objectives with minimmum path deviation. Some of the techniques used to control the quadrotor have been the PD design developed by researchers in [17] or the PID control design as implemented in [18] [19]. These controllers are basic in structure and have less computation. The Linear Quadratic Regulator (LQR) control tech- nique developed by Bouabdallah et. al in [20] tries to achieve tracking at the same time optimize input effort. However, the above controllers are obtained purely from state feedback error. They are susceptible to both parametric changes as well as external disturbances. Non-linear techniques like backstepping control by Bouabdallah et. al in [1] and feedback linearization presented by Voos in [21] have also been shown to fly quadrotors effectively. Global stability of the system can be proved for these controllers. However when external disturbances act in the above techniques, the quadrotor is seen to deviate from its path. The Sliding Mode Controller design ensures that the dynamics balances on the sliding surface

19 even in the presence of external disturbances. The results on its implementation on quadrotors by many researchers is seen in [1] [22] [2] [23] [24]. They show that the sliding mode controller is effective against perturbations like aerodynamics forces and moments and air drag. Ramirez- Rodriguez et al. has shown that sliding mode control works well against external wind forces and gusts in [23]. Lee et al. and Sridhar et al. have shown SMC to also be effective against sensor noise in [25] and [26] respectively. Sliding mode controller which uses multiple sliding surfaces has been tested on a quadrotor in [27]. In literature, most sliding mode controllers have been designed based on information from a single sliding surface. This sliding surface is generally taken as the linear combination of state errors. The concept of Higher Order Sliding Mode brings about the idea of basing the controller on more than one single sliding surface (two surfaces are commonly used). The concept of higher order sliding mode is useful. It formulates the control input based on multiple surfaces rather than just one as observed in the conventional sliding mode controller. It also gives more freedom to modify the control architecture (since there are 2 control surfaces). This aspect opens doors to achieving a greater variety of specific objectives. This is seen in [28] where the concept of multiple sliding surfaces is used for constructing optimal controllers (sub-optimal sliding mode) , chatter free controllers (super-twisting sliding mode) and drift algorithm. Some controllers using two slid- ing surfaces, implemented in literature, base their design by incorporating the integral, proportional and derivative errors into the sliding surfaces. This controller does incorporate more information than the conventional sliding mode control since the integral of error is also considered. How- ever, large chattering does theoretically exist since the design is such that the input consists of the switching terms (sign). Our proposed novel controller design uses multiple sliding surfaces to come up with the con- trol law. The design presented in this thesis adds an extra derivative state in the feedback control loop. In a generic conventional sliding mode, if position and velocity are the states, the force acts as the control input to control both the states. In our novel controller design, we consider position, velocity and acceleration to be the states and jerk to be the control input. We require that the jerk

20 control input drive the all state errors, including acceleration error to zero (since state errors are a part of the sliding surface). This is in high contrast to the conventional sliding mode controller which does not try to control acceleration. Since our proposed control design has jerk as an input, it controls acceleration too. It can be said that its input tries to take values that can effectively counter disturbance. This is in contrast to the conventional sliding mode control where the input (Force) concerns itself only about the velocity variation with position. The papers control de- sign formulates the derivative of the required control input (which includes the discontinuous sign term). Upon integration, this paper obtains a control input which theoretically has a much lesser magnitude of chattering than the conventional SMC. This is inspired from the research presented in [29].

4.3 Algorithm implementation on a quadrotor and theoretical stability anal-

ysis

Classical Sliding Mode Controller The stabilizing classical sliding mode control laws used in this study are presented below. For further information on control surfaces S , parameter λ, error laws e, and for any further clarifica- tion, please refer to [22].

ux = −k1 sign(S x) + x¨r + λ1e2

uy = −k2 sign(S y) + y¨r + λ2e4 ! m u = − k3 sign(S z) + z¨r + g + λ3e6 cx9cx11

τψ = −k4 sign(S ψ) + ψ¨ r + λ4e8

τθ = −k2 sign(S θ) + θ¨r + λ5e10

τφ = −k1 sign(S φ) + φ¨r + λ6e12

21 Proposed Higher Order Sliding Mode Controller

z˙ = Vz (7) T V˙ = −g + (cφcθ) + D (8) z m z

where T is total thrust generated by all the motors of the quadrotor, Dz is the disturbance acting on the quadrotor in the z direction. Vz corresponds to the velocity in the z direction.

des des S z = (Vz − Vz) + λz(z − z) (9)

des des S˙z = (V˙z − V˙z) + λz(˙z − z˙) (10)

des des S¨z = (V¨z − V¨z) + λz(¨z − z¨) (11)

Substituting the derivatives of equations (7) and (8) in equation (11), we obtain,

Tc˙ θcφ Tθ˙sθcφ Tφ˙cθsφ S¨ = V¨ des − + + (12) z z m m m  !  des T  − D˙z + λz z¨ − −g + cθcφ + Dz   m 

To derive the control law, we condider Lyapunov stability. The Lyapunov function is defined as:

1 L = K S 2 + K S sign(S ) + S˙ 2 (13) 2 z1 z z2 z z z

L˙ = S˙z(Kz1S z + Kz2 sign(S z) + S¨z) (14)

22 Substituting S¨z from equation (12) in equation (14), the suitable control input T˙ is provided in equation (15). We obtain L˙ as stated in equation (16).

m Tθ˙sθcφ Tφ˙cθsφ T˙ = V¨ des + + (15) cφsθ z m m ! !! T + λ z¨des − − g + cθcφ + K S z m z1 z ! + Kz2 sign(S z) + Kz3 sign(S˙ z) + Kz4S˙ z

L˙ = −S˙z(D˙z + λzDz + Kz3 sign(S˙z) + Kz4S˙z) (16)

If the gain Kz3 > (D˙z + λzDz), L˙ < 0. However, while implementing the algorithm on the quadrotor, the tuning parameter λz was required to be very high in the attitude control design

to ensure effective tracking convergence. In such a scenario, the value of Kz3 would have to be very high, thereby leading to instability of the quadrotor. Hence, the term Kz4S z is introduced

which reduces the need for a high Kz3 value without compensating too much on accurate tracking.

This also ensures Lyapunov stability (negative definite L˙ of the system. The value Kz3 was tuned manually. In a manner similar to what was applied for the z dynamics, the derivations for position control (x,y dynamics) and attitude control ( φ, θ, ψ dynamics ) are applied.

23 des des S x = (Vx − Vx) + λx(x − x) (17)

m Tc˙ φsθ T(−sφ)φ˙sθ θ˙des = − − (18) Tcφcθ m m des des + V¨x + λx(x ¨ − x¨) + Kx1S x + Kx2 sign(S x) ! + Kx3 sign(S˙ x) + Kx4S˙ x

des des S y = (Vy − Vy) + λy(y − y) (19)

m −T˙ sφ φ˙des = − λ (¨ydes − y¨) − K S (20) Tcφ m y y1 y ! des − V¨y − Ky2 sign(S y) − Ky3 sign(S˙ y) − Ky4S˙ y

where Vi corresponds to the velocities in each direction.

des des S φ = (φ˙ − φ˙) + λφ(φ − φ) (21)

−qr˙ (Iyy − Izz) qr˙(Iyy − Izz) τ˙φ = Ixx − (22) Ixx Ixx des des + p¨ + λφ(φ¨ − φ¨) + Kφ1S φ + Kφ2 sign(S φ) ! + Kφ3S˙ φ + Kφ4 sign(S˙ φ)

des des S θ = (θ˙ − θ˙) + λθ(θ − θ) (23)

−rp˙ (Izz − Ixx) rp˙(Izz − Ixx) τ˙θ = Iyy − (24) Iyy Iyy des des + q¨ + λθ(θ¨ − θ¨) + Kθ1S θ + Kθ2 sign(S θ) ! + Kθ3S˙ θ + Kθ4 sign(S˙ θ)

des des S ψ = (ψ˙ − ψ˙) + λψ(ψ − ψ) (25)

−pq˙ (Ixx − Iyy) pq˙(Ixx − Iyy) τ˙ψ = Izz − (26) Izz Izz des des + r¨ + λψ(ψ¨ − ψ¨) + Kψ1S ψ ! + Kφ2 sign(S ψ) + Kψ3S˙ ψ + Kφ4 sign(S˙ ψ)

24 Figure 2: Control Architecture

The controller is designed based on the architecture presented in Figure 2. The only external input required for waypoint navigation are the desired x,y and z coordinates which the quadrotor has to achieve. From the equations of position control shown in equations (15) - (20), we obtain the the derivatives of desired thrust, T˙ and the required angles φ˙des, θ˙des from y and x dynamics respectively. These values are integrated to obtain φdes and θdes respectively. T is obtained in the similar manner by integrating T˙. φdes, θdes are then passed through the attitude control loop as shown in Figure 25 and in equations (21) - (26) where the same algorithm is applied to compute

τ˙φ, τ˙θ, τ˙ψ. On integratingτ ˙φ, τ˙θ, τ˙ψ, we obtain τφ, τθ, τψ. Along with T, these are the four control inputs to the system.

4.4 Results and conclusions

In this section, we provide a comparative study of the performance of the proposed SMC with respect to the classical SMC and traditional PID controller. All the controllers have been imple- mented and simulated in MATLAB R2018b. The system is tested against 2 different type of wind disturbances, one in the angular direction and one in the linear direction. The novel control de- sign’s response to these disturbances is observed. The quadrotor parameters are listed in Table 3. The UAV’s control objective is to reach the waypoint (1,1,1) from the initial waypoint (0,0,0) in all

25 the simulations. Section 4.4 shows the performance using the sign function to demonstrate that the usage of the sign term for the sliding mode controller. Massive switching and oscillations of states for the conventional SMC as seen in Figure 4. While rapid switching exists even in our novel de- sign, we see that it is of much smaller magnitude than the conventional SMC and converges much better as seen in Figure 3. However, to show effective convergence, saturation function has been used for all our simulations of sliding mode (conventional and novel) and sign function has been avoided. Such saturation functions have also been used in literature [30].

Parameter Value Parameter Value −4 m 1.08 kg k f 2.2x10 −6 l 0.12 m km 5.4x10 2 2 Ix = Iy 0.0311 kg − m Iz 0.0622 kg − m

Table 1: Control Architecture I - Quadrotor Parameters

The proposed controller using sign function in the sliding mode controller

26 Figure 3: Position and Orientation of quad - Higher Order SMC - Sign Function

Figure 4: Position and Orientation of quad - Classical SMC - Sign Function

27 In this section, a comparison between the classical SMC and the design proposed in this paper is presented with sign function sign(s) = (s/|s|) being used in all the surfaces. However, further on, results generated were using the saturation function sat(s) = s/(|s| + η), where s is the sliding surface and η is a small positive constant. In Figure 4, the disturbances act on the accelerations in 3 linear directions. The z dynamics is not as coupled as the x and y dynamics. The x and y dynamics are more interlinked with θ and φ dynamics respectively. This more complicated dynamics results in x and y It is observed that our higher order SMC (Figure 3) achieves better tracking than the classical SMC (Figure 4) when wind disturbance (Figure 10) is applied. The switching as well as oscillation of the angles are smaller in the case of the proposed control design than the classical SMC.

Disturbance Case - 1

28 Figure 5: Wind Force (N) - Case I

29 Figure 6: Position and Orientation of Quad - Higher Order SMC - Case I

Figure 7: Force generated by each motor of the quad - Higher Order SMC - Case I

30 Figure 8: Position and Orientation of Quad - Classical SMC - Case I

Figure 9: Position and Orientation of Quad - PID - Case I

31 In this case, a force acts at the end of motors 1 and 4 (along the motor axis perpendicular to the frame of the quadrotor ) during different time intervals as shown in Figure 5. This causes an upward push as well a torque imbalance in the system. It can be related to a random pitching and rolling force when the wind acts. The wind forces used for this case study are inspired from the CFD results on a quadrotor arm conducted in the CDS (cooperative distributed systems) lab facility previously, and published in ACC 2019 [31]. The proposed controller as shown in Figure 6 performs exceptionally well in the presence of these disturbances. While a small drift exists in z direction, a very strong tracking in x and y directions is achieved. To confirm this, Figure 7 depicts the force generated by each motor of the quadrotor during its flight. It can be seen, by comparing Figure 5 and Figure 7, that the motors modify their thrusts appropriately to counter the effect of disturbances. It is also observed that the proposed novel controller performs better than the classi- cal SMC (Figure 8) and the traditional PID (Figure 9) when this type of disturbance is applied.

Disturbance Case - 2

32 Figure 10: Wind Force (N) - Case II

Figure 11: Position and Orientation of Quad - Higher Order SMC - Case II

33 Figure 12: Position and Orientation of Quad - Classical SMC - Case II

Figure 13: Position and Orientation of Quad - PID - Case II

34 Varying disturbances (Figure 10) along the centre of mass of the quadrotor are applied in the x, y and z directions. Wx = 4sin(t/5) cos(t/2) sin(t/9), Wy = sin(2t) + 1.6 cos(t/2) + sin(3 cos(t/3)) and Wz = 2 sin(t/2) cos(t/5) corresponds to the wind forces (N) acting in x, y and z directions respectively. Such wind is taken in order to observe the performance of the controller in the event of continuous but ever varying disturbances. Discontinuous disturbances is introduced in Case-1. Figure 11 corresponds to the output of the proposed algorithm. Great tracking in the presence of external disturbances is achieved due to the fact that the design of the control input is based off a combination of the sliding surface as well its derivative. The inclusion of acceleration feedback in the system enables it to handle disturbances better than the classical SMC (Figure 12) and PID con- troller (Figure 13). While the classical SMC makes an attempt to track the waypoint, the quadrotor however deviates 5-15 cm for the given disturbances in all the directions.

35 Variation of Control Input With Wind

Figure 14: Motor Speeds obtained from Higher Order SMC - Case I

The wind disturbance applied in this section is the same as shown in Figure 5. While in Section 4.4, it is shown that effective stability and tracking was achieved, here, the control inputs reaction to such disturbances is presented. The results are shown in Figure 14. When steadily increasing wind acts from t = 10 to t = 30, the proposed controller counters the disturbance effectively. Similar results are observed when sinusoidal disturbances are applied. However, when a sudden gust is applied at t = 40, it is seen that the motor speeds oscillate before settling and the proposed controller does not react effectively. Similar results are observed when a switching disturbance is applied on motor 1 towards the end of the simulations. This is due to the fact that, in equation

16, it was seen that the derivative of the Lyapunov function depends on not just Dz but D˙z as

well. If the rate of change of disturbance (D˙z) is too high, L˙ may not be negative. This may lead to instability. This validates the behavior of the proposed controller where it performs better to

continuous disturbances (lower D˙z ) than abruptly changing ones (higher D˙z). It was also observed

36 that as the value of the parameter λz (obtained from tuning for stable flight) was increased, the controller became less efficient in tracking and deviated more from its desired waypoint. This too, correlates well with the theoretical understanding presented in equation 16 (Larger λz may result in a non negative L˙ ). The plan to examine this claim will be done in future studies.

37 5 Control Design II - Proportional Derivative Controller with

self adaptive gains

5.1 Motivation for the design

A Proportional Derivative (PD) controller is basic in its form and has simple structure. It is easy to implement in hardware too. This makes the PD or PID controller highly desirable and a widely used controller to use for dynamical systems. The PD controller is constructed through a sum of combination of the current state error and its derivatives. Each of these is given a weighting which is determined by the assigned gain value. These gain values for the controller determine the response behaviour of the system. Values appropriately taken result in an efficient response. On the other hand, values way off from the correct values can result in the system going unstable. Hence it becomes important to choose a right set of gains in order to achieve good convergence of the states to their desired values. This process of tuning the gains has to be done manually. Now, in the case of a quadrotor, there is a need to control 6 Degrees of Freedom, 3 linear (x,y,z) and 3 angular (φ, θ, ψ). Each of the systems behave approximately like second order systems. This necessitates the need for 12 gains if a PD controller was used. Now these 12 gains have to be tuned manually. This tuning process has to be done accurately in order to to ensure that the states con- verge to their desired values. This is a hard task since the quadrotor dynamical system is large and is highly non linear. Further incorrect tuning of even a single gain can result in the entire system going unstable sine the dynamics is highly coupled.

5.2 Literature review and introduction

Various types of control designs have been applied to quadrotors. Each method has its own set of benefits and drawbacks. The PD controller as developed in [17] has a simple structure. A similar

38 structure is seen in the PID controller as seen in [18]. Though their implementation is simple, their performance reduces when the angles of the quadrotor start taking larger values. Also their stability about a linear region can be proved, not globally. Though the PID performs better than the PD in the event of steady state disturbances, they both fail to cope well with parametric uncertainty. Re-tuning of the gains may be required in the event of a parameter change. Both controllers do not handle varying disturbances well. The Linear Quadratic Regulator (LQR) control technique developed by Bouabdallah et. al in [20] works in a way similar to the PD control. The input control effort is optimized in the LQR control by minimizing a cost function [19]. Nonlinear controllers have also been implemented on quadrotors. Some of the research done on sliding mode control is seen in [1] [22] [2] [23] [24]. It is seen that the sliding mode control follows its own dynamics which is pre-determined by its sliding surface. It also possesses a certain robustness which helps it combat parametric uncertainties and disturbances. Backstepping con- troller as seen in [1] is also a nonlinear controller which is effective in controlling the dynamics of the quadrotor. Backstepping helps analyse each step and make modifications at every level with ease. These nonlinear controllers can be shown to bring about global stability and work well at larger angles too. Despite the above advantages of non linear controllers, a linear controller is much more basic in its structure and simpler to implement. It cuts down complicated mathematics and is easier for proving stability. It is also easier to test on hardware. Hence, in this thesis, a decision has been made to use the PD controller for controlling the quadrotor. A big challenge for creating the PD controller is selecting the right set of gains. This task becomes harder the larger the system becomes. Also a highly coupled non linear system such as a quadrotor makes this challenging. Further since a PD control is susceptible to parameter variation, the gains have to be re-tuned ev- ery time a change in a parameter is made. The challenge of tuning of the gains for a quadrotor is addressed in this thesis.

Various methods have been proposed for the autotuning of a PD controller. Loop shaping is

39 one such technique [32], [33]. Optimization algorithms such as the cuttlefish optimization [34] and gradient decent optimization [35] are implemented. Search algorithms such as the fibonacci search algorithm [36] and particle swarm search algorithm [37] are implemented.

In this research, a method using a sliding surface is proposed. Adaptation to vary the gains of the PD controller during its flight is implemented. This has been achieved without starting with a predetermined set of gains. Adaptation is a technique through which the control algorithm keeps varying some of its parameters to best perform in a real world scenario. In [38] [15] [5], it is witnessed that adaptation when combined with a base control structure like sliding mode or backstepping can prove to be very effective in modifying the controller to the situation. This enhances its usefulness against external changes.

5.3 Intuitive understanding

The concept used here is intuitively linked to the the way the sliding surface (PD form) is chosen in the sliding mode control design. A surface is a linear combination of state errors (PD form). The coefficients for each state error is chosen in such a manner that when the sliding surface value is maintained at zero, the states ensure that they stabilize internally. This is considered to be a stable sliding surface. This can be seen in [22]. When the sliding surface is unstable (coefficients are chosen randomly), the system goes unstable. So we infer that the coefficients of the surface have to take stable values for the system to perform well. The following paragraph explains how exactly this is done.

In Chapter 6 (Control Design 2), a set of not fixed, but variable coefficients for the sliding sur- face are chosen. The coefficients are made to vary adaptively in such manner so that the individual state errors also converge to zero as the sliding surface is driven to zero. This is done by choosing the appropriate Lyapunov function and then adapting the gains ac- cordingly. It is assumed that even if the coefficients are unstable to begin with, since they adapt in a

40 manner to reduce all state errors, they will keep varying and take suitable values to ensure efficient state convergence.

In Chapter 7 (Control Design 3) too, a set of gains for the sliding surface that can vary with time are chosen. In this case, the constraint that is applied, is on the variance of the coefficients. It is desired that the coefficients adapt as the sliding surface moves away from zero at the same time stop their variance with time. A Lyapunov function to satisfy this criteria is chosen. It is assumed that even if the coefficients are unstable to begin with, they will start adapting to stabilize the sliding surface once its value increases (states diverge). Also, the constraint put on them to stop varying will ensure that they try to converge quickly to stable values so that there is no need to continue to adapt indefinitely with time.

5.4 Algorithm implementation on a quadrotor and theoretical stability anal-

ysis

Adaptive PD control design In this section, the proposed control methodology is illustrated. Waypoint navigation is at- tempted. The quadrotor dynamics is divided in the following manner. A controller is designed, each, for the z (height dynamics) and the ψ (yaw) dynamics. The position x and angle θ dynam- ics are coupled into one system and a single controller is formulated for the system. Likewise, y and φ are coupled and a joint PD controller is used. Each subsystem has a sliding surface. The coefficients of the sliding surface are randomly chosen initially. The adaptation process tunes the coefficients during the quadrotors flight.

Traditional PD Controller

The PD control laws used in this study are presented below. The entire quadrotor dynamics

41 is divided into z,(y, φ), (x, θ) and ψ dynamical systems whose corresponding control inputs are

U1, U2, U3, and U4. For further information on these laws and any other parameters mentioned or for an understanding of the working of the PID controller, please refer to [39]. The following design is for waypoint navigation.

φdes = θdes = ψdes = 0 (27)

pdes = qdes = rdes = 0 (28)

des des des Vz = Vy = Vx = 0 (29)

des des U1 = kp,z(z − z) + kd,z(Vz − Vz) (30)

des des U2 = kp,φ(φ − φ) + kd,φ(p − p) (31)

des des +kp,y(y − y) + kd,y((Vy) − Vy)

des des U3 = kp,θ(θ − θ) + kd,θ(q − q) (32)

des des +kp,x(x − x) + kd,x((Vx) − Vx)

des des U4 = kp,ψ(ψ − ψ) + kd,ψ(r − r) (33)

The formulated sliding surfaces for the proposed controller

The quadrotor system is divided into 4 subsystems and each of them have a sliding surface. Sliding surfaces with randomly initialized coefficients are taken in the beginning. It is shown in [2] that the coefficients of the sliding surface vary based on the changing dynamics of the system. However, in this thesis, the sliding surface coefficients of the linearized system were varied to emulate a sliding surface which was stable according to the Routh Hurwitz criteria. In the proposed controller, no such stable surface was considered as a reference. Here, the sliding surface adapts

42 its coefficients and tries to attain stability purely based on the state errors.

des des S z = Cz1 (z − z) + Cz2 (Vz − Vz) (34)

des des S y = Cby1 (y − y) + Cby2 ((Vy) − Vy) (35)

des des + Cby3 (φ − φ) + Cby4 (p − p)

des des S x = Cbx1 (x − x) + Cbx2 ((Vx) − Vx) (36)

des des + Cbx3 (θ − θ) + Cbx4 (q − q)

des des S ψ = Cψ1 (ψ − ψ) + Cψ2 (r − r) (37)

To ensure convergence of the four sliding surfaces, ideally, four control architectures, each with an adaptation scheme should be designed. On tuning the adaptation parameters, the surfaces should converge to steady states. However, in the proposed control architecture, predetermined coefficients of values 1 for the z and yaw (ψ) dynamics have been taken. This step is optional and not a necessity .It is taken in order to reduce the number of parameters to be tuned. All coefficients

of the ψ and z dynamics (Cz1 , Cz2 , Cψ1 , Cψ2 ) are assumed to be one. Taking these gains equal to one is a sensible choice since the 2 systems are roughly second order and such gain values ensure state convergence . The coefficients for the ‘x − θ’ and ‘y − φ’ systems are varied adaptively in the manner stated previously. A sliding mode control design with a set of fixed sliding coefficients is implemented on the ψ and z systems.No adaptation is performed for ψ and z sub-systems. Ac- cordingly, the Lyapunov stability analysis is proved in the following subsection for the ’z’ (without adaptation) and ‘x − θ’ (with adaptation) dynamics. In this section, the z and ‘x − θ’ dynamics are linearized in order to prove linear stability for the PD controller [39]. Adaptation takes place based on the combination of value of sliding surface ’S’ and the state errors.

43 z and ψ dynamics

The z dynamics can be written as:

                  " #    z˙  0 1  z   0   0    =     +   U +   (38)         1   V˙z 0 0 Vz (1/m) −g

des ez = (z − z)

des Vez = ((Vz) − Vz)

S z = Cz1 (ez) + Cz2 (Vez) (39)

Control input U1 obtained through Lyapunov function

2 Lz = (1/2)(S z) ˙ ˙ ˙ des ˙ Lz = S z(Cz1 (ez) + Cz2 ((Vz) − (Vz)) (40) ˙ ˙ ˙ des Lz = S z(Cz1 (ez) + Cz2 ((Vz) − ((1/m)U1 − g)) (41)

In order for the z subsystem to be globally stable we choose our control input U1 to be

˙ des ˙ U1 = m(g + (Vz) + (1/Cz2 )(Cz1 (ez) + Kz(S z))) (42)

2 On substituting Equation (74) in Equation (73), we obtain, L˙ = −Kz(S z) . S z in Equation (71) is the sliding surface for the z dynamics. It comprises of state errors. As can be seen, the system will remain stable for any value of Kz. We choose this value to be 1.

Similarly, linearizing ψ dynamics about the operating point (zero), the control input U4 is derived in a similar manner. The value of Kψ is also taken as 1.

44 des ˙ U4 = Iz(˙r + (1/Cψ2 )((Cψ1 (ψe) + Kψ(S ψ))) (43)

x − θ and y − φ dynamics Equation (76) represents the linearized dynamics of the ‘x − θ’ subsystem of the quadrotor.

                 x˙  0 1 0 0  x   0           ˙        " # Vx 0 0 g 0 Vx  0    =     +   (44)         U3  θ˙  0 0 0 1  θ   0                   q˙  0 0 0 0  q  (1/Iy)

des ex = (x − x)

des Vex = ((Vx) − Vx)

eθ = (θdes − θ)

des eq = (q − q)

S x = Cbx1 (ex) + Cbx2 (Vex) + Cbx3 (eθ) + Cbx4 (eq) (45)

Here, x, Vx, θ and q are position, velocity, tilting angle and angular rate of the quadrotor respectively. Iy and g are the moment of inertia about the y axis and gravity respectively. U3 is the torque created by the motors that causes rotational motion of the angle θ. The desired states (des) of position, velocity and tilting angle are taken as zero in the derivation. S x in Equation (77) is the sliding surface for x − theta dynamics and is defined by the sum of state errors of the states S x , x −theta and their derivatives. The proposed controllers sliding surfaces are initially (t = 0) chosen randomly. They are updated based on the state errors as the quadrotor flies to its desired waypoint.

Hence, they are represented with a ‘hat’ as shown in the Equation (77). γx1 , γx2 , γx3 , γx4 are the adaptation gains of the system. In the previous section, for the control design for z dynamics, a

45 Lyapunov candidate (Lz) has been taken as a function of our sliding surface (S z) only. This is because the z coefficients are taken constants and do not keep varying. However in the ‘x − θ’

dynamics, our sliding surface (S x) coefficients are intended to be varied appropriately to achieve

stability. In order to find out how to vary these coefficients, our Lyapunov function (LX) is taken as a combination of the sliding surface (S x) and the square of our state errors too. This enables us to

find out the law for adapting the coefficients. The proposed control input U3 is obtained through the Lyapunov function as shown below:

2 2 2 Lx = (1/2)(S x) + (γx1 /2)(ex) + (γx2 /2)(Vex) (46)

2 2 + (γx3 /2)(eθ) + (γx4 /2)(eq) ˙ ˙ ˙ ˙ ˙ Lx = S x[Cbx1 (ex) + Cbx2 (Vex) + Cbx3 (eθ) + Cbx4 (eq) (47) ˙ ˙ ˙ ˙ + Cbx1 (ex) + Cbx2 (Vex) + Cbx3 (eθ) + Cbx4 (eq)] ˙ ˙ ˙ ˙ + γx1 (ex)(ex) + γx2 (Vex)(Vex) + γx3 (eθ)(eθ) + γx4 (eq)(eq) ˙ ˙ ˙ ˙ Lx = S x[Cbx1 (ex) + Cbx2 (Vex) + Cbx3 (eθ) − Cbx4 ((1/Iy)U3)] (48) ˙ ˙ ˙ ˙ + (ex)[Cbx1 (S x) + γx1 (ex)] + (Vex)[Cbx2 (S x) + γx2 (Vex)] ˙ ˙ ˙ ˙ + (eθ)[Cbx3 (S x) + γx3 (eθ)] + (eq)[Cbx4 (S x) + γx4 (eq)]

It is desired that the derivative of the Lyapunov function is negative in order to bring the sliding surface S x and the state errors to zero. The adaptation and control input chosen in order to satisfy

46 this is as follows:

˙ ˙ ˙ U3 = (Iy/Cbx4 )[Cbx1 (ex) + Cbx2 (Vex) + Cbx3 (eθ) (49)

+ (Kx)(S x)] ˙ ˙ Cbx1 = −γx1 (ex)/(S x) (50) ˙ ˙ Cbx2 = −γx2 (Vex)/(S x) (51) ˙ ˙ Cbx3 = −γx3 (eθ)/(S x) (52) ˙ ˙ Cbx4 = −γx4 (eq)/(S x) (53)

2 On substituting Equations (81), (86), (87),(88) and (89) in Equation (80), we get, L˙x = −(Kx)(S x) .

A similar procedure is followed to obtain the control input U2 from the linearized y - φ dynam- ics. The coefficients Kx and Ky are arbitrarily taken as 1. The control input U2 is given by:

˙ ˙ ˙ U2 = (Ix/Cby4 )[Cby1 (ey) + Cby2 (Vey) + Cby3 (eφ) (54)

+ (Ky)(S y)] ˙ ˙ Cby1 = −γy1 (ey)/(S y) (55) ˙ ˙ Cby2 = −γy2 (Vey)/(S y) (56) ˙ ˙ Cby3 = −γy3 (eφ)/(S y) (57) ˙ ˙ Cby4 = −γy4 (ep)/(S y) (58)

Overall proposed control architecture of the system is shown in Fig. 25.

47 Figure 15: Control Architecture

5.5 Results and conclusions

It is observed that the adaptation process is highly nonlinear and coupled. It was observed that the values of the sliding coefficients taken initially affect the outcome of the adaptation process. Hence, in this section, we show the quadrotor performing waypoint navigation for three different cases. In each of the cases, the sliding surface for ‘x − θ’ and ‘y − φ’ dynamics are initialized with a random set of coefficients. Each set of coefficients produce a different result without the application of adaptation. In the first case, the system output is highly oscillatory in nature. In the second and third case, the coefficients chosen initially, lead the quadrotor to become unstable quickly. Adaptation is then applied to each of the cases to show convergence. We have the adaptation

parameters γx1 , γx2 , γx3 , γx4 and γy1 , γy2 , γy3 , γy4 . On tuning these, convergence is achieved. In this thesis, to simplify the tuning process, the four adaptation gains for x dynamics are taken equally as γx and the four gains for y dynamics are taken equally as γy. Only two parameters are tuned. However, since this simplification is made, the gains used in this thesis are highly sensitive to any sort of changes. The results for the three cases are presented below. The desired waypoint is (0.5, 0.5, 0.5) for all cases. Corresponding graphs for the position and attitude control are presented. The variation of the sliding coefficients with time is also shown.

48 Table 2: Control Architecture II - Quadrotor Parameters

Parameter Value Parameter Value −4 m 1.08 kg k f 2.2 x 10 −6 l 0.12 m km 5.4 x 10 2 2 Ix = Iy 0.0311 kg − m Iz 0.0622 kg − m

Case - I

Figure 16: Position and Orientation of Quad - Adaptive PD Without adaptation - Case - I

49 Figure 17: Position and Orientation of Quad - Adaptive PD With adaptation - Case - I

Figure 18: Coefficients of the sliding surfaces - Adaptive PD With adaptation - Case - I

50 In this case, the sliding surface coefficients taken initially are Cbx1 = Cbx2 = Cbx3 = Cbx4 = 1 and Cby1 = Cby2 = −1, Cby3 = Cby4 = 1. If adaptation is not applied to the process, the quadrotor continues to oscillate for a long period of time as shown in Figure 16. We see in Figure 17 that, on application of our controller, the system performs much better and converges faster. The variation of coefficients of the sliding surface is shown in Figure 18. It is also seen that the coefficients converge to a set of values which result in a stable set of gains.

Case - II

Figure 19: Position and Orientation of Quad -Adaptive PD- With adaptation - Case - II

51 Figure 20: Coefficients of the sliding surfaces - Adaptive PD- With adaptation - Case - II

In this section, the sliding surface coefficients taken initially are Cbx1 = 1, Cbx2 = (1/2), Cbx3 =

1, Cbx4 = 2 and Cby1 = −2, Cby2 = −1, Cby3 = 0.3, Cby4 = 1. These coefficients are of the correct sign needed for stability. However, their values are far from the ideal values needed for the quadrotor to achieve stable flight. Without any adaptation, the system quickly spirals into instability. The proposed algorithm is seen to stabilize the quadrotor system. It is seen in Figure 19 that the states of the quadrotor converge to the desired waypoint (0.5, 0.5, 0.5) after some deviation. This is achieved due to the variation of coefficients as seen in Figure 20.

Case - III

52 Figure 21: Position and Orientation of Quad - With adaptation - Case - III

Figure 22: Coefficients of the sliding surfaces - With adaptation - Case - III

53 In this section, the sliding surface coefficients taken initially are Cbx1 = 1, Cbx2 = −(1/2), Cbx3 =

1, Cbx4 = 3 and Cby1 = 1, Cby2 = −1, Cby3 = 0.3, Cby4 = 1. In this case, Cbx2 and Cbx2 have opposite signs of what is needed for stability. Hence, this makes the system highly unstable. Naturally, it spirals quickly to instability if adaptation is not applied. On the application of adaptation, conver- gence is achieved as seen in Figure 21. We see that the quadrotor deviates to an extent before con- vergence. This is expected since we are starting off with a highly unstable set of gains. However, the algorithm could stabilize the system, when initially, the randomly assigned set of coefficients were rendering the system unstable. The variation of coefficients is shown in Figure 22. In this case too, the coefficients finally converge to stable values after the adaptation process. We see in the results that the coefficients obtained at the end of the simulation constitute stable gains of a PD controller. Though the Lyapunov stability proof does not specifically mention sliding coefficients convergence to stable values, it is observed in most cases.

Case - IV

Figure 23: Position and Orientation of Quad -Adaptive PD- With adaptation - Case - IV

54 Figure 24: Coefficients of the sliding surfaces - Adaptive PD - With adaptation - Case - IV

In this section, we are trying to show that at the end of the adaptation process, the gains con- verge on to a stable set of values. The first step is to make the quadrotor achieve the first waypoint (1/2,1/2,1/2) when started from an unstable set of gains. Once the quadrotor achieves this, at t=45s, gain adaptions are set to zero, and next step is to go to a new waypoint (1, 1, 1). It important to note that no adaptation is made to occur during the latter step (Adaptation gains are made zero).

In this section, the sliding surface coefficients taken initially are Cbx1 = 1, Cbx2 = −(1/2), Cbx3 =

1, Cbx4 = 3 and Cby1 = 1, Cby2 = −1, Cby3 = 0.3, Cby4 = 1 It is seen that the quadrotor reaches the first waypoint (1/2,1/2,1/2) smoothly despite starting with an unstable set of gains. At the end of tracking this waypoint, at t=45s, we observe that the gains had converged to specific values. As it moves towards the next waypoint, the state errors of the quadrotor come to zero while the controller behaves like a PD controller. This PD controller ensures convergence though in an oscillatory manner. The results are shown in Figures 10 and 11.

55 6 Control Design III - Proportional Derivative Controller with

auto-tuned gains

6.1 Traditional PD Controller

The PD control laws used in this study are presented below. The entire quadrotor dynamics is di-

vided into z, y, φ, x, θ and ψ dynamical systems whose corresponding control inputs are U1, U2, U3, and U4. For further information on these laws and any other parameters mentioned or for an un- derstanding of the working of the PID controller, please refer to [39]. The following design is for waypoint navigation.

φdes = θdes = ψdes = 0 (59)

pdes = qdes = rdes = 0 (60)

des des des Vz = Vy = Vx = 0 (61)

des des U1 = kp,z(z − z) + kd,z(Vz − Vz) (62)

des des U2 = kp,φ(φ − φ) + kd,φ(p − p) (63)

des des +kp,y(y − y) + kd,y((Vy) − Vy)

des des U3 = kp,θ(θ − θ) + kd,θ(q − q) (64)

des des +kp,x(x − x) + kd,x((Vx) − Vx)

des des U4 = kp,ψ(ψ − ψ) + kd,ψ(r − r) (65)

The formulated sliding surfaces for our controller For a standard sliding mode controller, sliding surfaces with a predetermined set of stable slid- ing coefficients are taken [22]. There is no variation of these sliding coefficients. In the proposed design however, the sliding coefficients are not fixed but have the ability to vary. Such a char- acteristic is seen in literature. It is shown in [2] that the coefficients of the sliding surface vary based on the changing dynamics of the system. However, in this thesis, the sliding coefficients of

56 the linearized system was varied to emulate a sliding surface with an already predetermined stable set of coefficients. In our controller, no such stable surface was considered as a reference point. Instead, the sliding surface keeps modifying itself and tries to attain stability purely based on the state errors.

des des S z = Cz1 (z − z) + Cz2 (Vz − Vz) (66)

des des S y = Cby1 (y − y) + Cby2 ((Vy) − Vy) (67)

des des + Cby3 (φ − φ) + Cby4 (p − p)

des des S x = Cbx1 (x − x) + Cbx2 ((Vx) − Vx) (68)

des des + Cbx3 (θ − θ) + Cbx4 (q − q)

des des S ψ = Cψ1 (ψ − ψ) + Cψ2 (r − r) (69)

In reality, to ensure convergence of the four sliding surfaces, ideally, we should design four control architectures with individual adaptation schemes. On tuning of the adaptation parameters correctly, the surfaces converge to steady states. However, in our control architecture, we have taken predetermined coefficients for the z and yaw (ψ) dynamics. This is taken in order to reduce

the number of parameters to be tuned. All coefficients of the ψ and z dynamics (Cz1 , Cz2 , Cψ1 , Cψ2 ) are assumed to be one. This is a reasonable assumption to make since such gains for the roughly second order systems result to stability. Also a calculated guess is made that the coefficients for the ‘x − θ’ and ‘y − φ’ systems vary/adjust accordingly to take into account the above constraint. Considering the above reasoning, the step of not performing adaptation for ψ and z sub-systems has been implemented this work. However, this step is not necessary and highly optional. The Lyapunov stability analysis is proved in the following subsection for the z and ‘x − θ’ dynamics. In the section, the z and ‘x, θ’ dynamics are linearized in order to prove local stability for the PD controller [39]. Adaptation takes place based on a combination of the sliding surface and the state errors.

57 6.2 Algorithm implementation on a quadrotor and theoretical stability anal-

ysis z and ψ dynamics The z dynamics can be written as:

                  " #    z˙  0 1  z   0   0    =     +   U +   (70)         1   V˙z 0 0 Vz (1/m) −g

des ez = (z − z)

des Vez = ((Vz) − Vz)

S z = Cz1 (ez) + Cz2 (Vez) (71)

Control input U1 obtained through Lyapunov function

2 Lz = (1/2)(S z) ˙ ˙ ˙ des ˙ Lz = S z(Cz1 (ez) + Cz2 ((Vz) − (Vz)) (72) ˙ ˙ ˙ des Lz = S z(Cz1 (ez) + Cz2 ((Vz) − (1/m)U1 − g) (73)

In order for the z subsystem to be globally stable we choose our control input U1 to be

˙ des ˙ U1 = m(g + (Vz) + (1/Cz2 )((Cz1 (ez) + Kz(S z))) (74)

2 On substituting Equation (74) in Equation (73), we obtain, L˙ = −Kz(S z) . S z in Equation (71) is the sliding surface for the z dynamics. It comprises of the errors of the states. As can be seen, the system will remain stable for any positive value pf Kz. We choose this value to be 1.

Similarly, linearizing ψ dynamics about the operating point (zero), the control input U4 is derived in a similar manner. The value of Kψ is also taken as 1.

58 des ˙ U4 = Iz(˙r + (1/Cψ2 )((Cψ1 (ψe) + Kψ(S ψ))) (75)

Figure 25: Control Architecture

x − θ and y − φ dynamics Equation (76) represents the linearized dynamics of the ‘x − θ’ subsystem of the quadrotor.

                 x˙  0 1 0 0  x   0           ˙        " # Vx 0 0 g 0 Vx  0    =     +   (76)         U3  θ˙  0 0 0 1  θ   0                   q˙  0 0 0 0  q  (1/Iy)

des ex = (x − x)

des Vex = ((Vx) − Vx)

eθ = (θdes − θ)

des eq = (q − q)

S x = Cbx1 (ex) + Cbx2 (Vex) + Cbx3 (eθ) + Cbx4 (eq) (77)

59 Here, x, Vx, θ and q are position, velocity, tilting angle and angular rate of the quadrotor respectively. Iy and g are the moment of inertia about the y axis and gravity respectively. U3 is the torque created by the motors that causes rotational motion of the angle θ. The desired states

(des) of position, velocity and tilting angle are taken as zero in the derivation. S x in Equation (77) is the sliding surface for x − theta dynamics and is defined by the sum of state errors. Our sliding surfaces are initially (t = 0) chosen randomly. They are updated based on the value of the sliding surface and surface coefficient variation as the quadrotor flies to its desired waypoint. Hence, they

are represented with a ‘hat’ as shown in the Equation (77). γx1 , γx2 , γx3 , γx4 are the adaptation gains of the system. In the previous section, for the control design for z dynamics, we have taken

our Lyapunov candidate (Lz) as a function of our sliding surface (S z) only. This is because the z coefficients are constants and do not keep varying. However in our ‘x − θ’ dynamics we intend

to vary our sliding surface (S x) coefficients appropriately to achieve stability. In order to find out

how to vary these coefficients, our Lyapunov function (LX) is taken as a combination of the sliding surface (S x) and the rate of change of sliding surface coefficients. This enables us to find out the law for adapting the coefficients. Our control input U3 is obtained through the Lyapunov function as shown below:

60 2 ˙ 2 ˙ 2 Lx = (1/2)(S x) + (γx1 /2)(Cbx1 ) + (γx2 /2)(Cbx2 ) (78)

˙ 2 ˙ 2 + (γx3 /2)(Cbx3 ) + (γx4 /2)(Cbx4 ) ˙ ˙ ˙ ˙ ˙ Lx = S x[Cbx1 (ex) + Cbx2 (Vex) + Cbx3 (eθ) + Cbx4 (eq) (79) ˙ ˙ ˙ ˙ + Cbx1 (ex) + Cbx2 (Vex) + Cbx3 (eθ) + Cbx4 (eq)] ˙ ¨ ˙ ¨ ¨ ¨ + γx1 (Cbx1 )(Cbx1 ) + γx2 (Cbx2 )(Cbx2 ) + γx3 (Cbx3 )(Cbx3 ) ¨ ¨ + γx4 (Cbx4 )(Cbx4 ) ˙ ˙ ˙ ˙ Lx = S x[Cbx1 (ex) + Cbx2 (Vex) + Cbx3 (eθ) − Cbx4 ((1/Iy)U3)] (80) ˙ ¨ ˙ ¨ + (Cbx1 )[(ex)(S x) + γx1 (Cbx1 )] + (Cbx2 )[(Vex)(S x) + γx2 (Cbx1 )] ˙ ¨ ˙ ¨ + (Cbx3 )[(eθ)(S x) + γx3 (Cbx3 )] + (Cbx4 )[(eq)(S x) + γx4 (Cbx4 )]

We desire that the derivative of the Lyapunov function is negative in order to bring the sliding surface S x and the state errors to zero. The adaptation and control input chosen in order to satisfy this is as follows:

˙ ˙ ˙ U3 = (Iy/Cbx4 )[Cbx1 (ex) + Cbx2 (Vex) + Cbx3 (eθ) (81)

+ (Kx)(S x)] ¨ Cbx1 = −(1/γx1 )(ex)(S x) (82) ¨ Cbx2 = −(1/γx2 )(Vex)(S x) (83) ¨ Cbx3 = −(1/γx3 )(eθ)(S x) (84) ¨ Cbx4 = −(1/γx4 )(eq)(S x) (85)

61 2 On substituting Equations (81), (82), (83),(84) and (85) in Equation (80), we get, L˙x = −(Kx)(S x) .

We observe that when the above control input and adaptation gains are applied, the systems ends up going unstable in quite some cases. The reason for this still has to be looked into. However, for ensuring convergence the system, a stabilizing factor has been added to the adaptation as shown.

¨ ˙ Cbx1 = −(1/γx1 ) [(ex)(S x) + (η1)Cbx1 ] (86) ¨ ˙ Cbx2 = −(1/γx2 ) [(Vex)(S x) + (η2)Cbx2 ] (87) ¨ ˙ Cbx3 = −(1/γx3 ) [(eθ)(S x) + (η3)Cbx3 ] (88) ¨ ˙ Cbx4 = −(1/γx4 ) [(eq)(S x) + (η4)Cbx3 ] (89)

˙ 2 ˙ 2 ˙ 2 ˙ 2 ˙ 2 which in effect results in Lx = −(Kx)(S x) − η1(Cbx1 ) − η2(Cbx2 ) − η3(Cbx3 ) − η4(Cbx4 ) .

A similar procedure is followed to obtain the control input U2 from the linearized y - φ dynam- ics. The coefficients Kx and Ky are arbitrarily taken as 1. The control input U2 is given by:

˙ ˙ ˙ U2 = (Ix/Cby4 )[Cby1 (ey) + Cby2 (Vey) + Cby3 (eφ) (90)

+ (Ky)(S y)] ¨ ˙ Cby1 = −(1/γy1 ) [(ey)(S y) + (β1)Cby1 ] (91) ¨ ˙ Cby2 = −(1/γy2 ) [(Vey)(S y) + (β2)Cby2 ] (92) ¨ ˙ Cby3 = −(1/γy3 ) [(eθ)(S y) + (β3)Cby3 ] (93) ¨ ˙ Cby4 = −(1/γy4 ) [(ep)(S y) + (β4)Cby3 ] (94)

62 Overall, the proposed architecture is shown in figure 25

6.3 Results and conclusions

We see that the adaptation process is highly nonlinear, coupled and is of order two. In this section, we show the quadrotor performing waypoint navigation for three different cases. In each of the cases, we initialize the sliding surface for ‘x − θ’ and ‘y − φ’ dynamics with a random set of coef- ficients. Each set of coefficients produces a different result without the application of adaptation. In the first case, the system output is highly oscillatory in nature. In the second and third case, the coefficients chosen initially, lead the quadrotor to become unstable quickly.

Adaptation is then applied to each of the cases to show convergence. We have the adaptation

parameters γx1 , γx2 , γx3 , γx4 , η1, η2, η3, η4 for x−θ and γy1 , γy2 , γy3 , γy4 , β1, β2, β3, β4 for y−φ dynam- ics. On tuning these gains, convergence is achieved. In this thesis, to simplify the tuning process,

the four adaptation gains γ’s for x dynamics are taken equally as γx and η’s is taken η. The four

γ’s for y dynamics are taken equally as γy and β’s as β. Hence, overall four parameters are tuned. The results for the three cases are presented below. The desired waypoint is (1, 1, 1) for all cases. Corresponding graphs for the position and attitude control are presented. The variation of the slid- ing coefficients with time is also shown.

Table 3: Control Architecture III - Quadrotor Parameters

Parameter Value Parameter Value −4 m 1.08 kg k f 2.2 x 10 −6 l 0.12 m km 5.4 x 10 2 2 Ix = Iy 0.0311 kg − m Iz 0.0622 kg − m

Case - 1

63 Figure 26: Position and Orientation of Quad - Autotuner - Without adaptation - Case - I

Figure 27: Position and Orientation of Quad - Autotuner - With adaptation - Case - I

64 Figure 28: Coefficients of sliding surface - Autotuner - With adaptation - Case - I

In this case, the sliding surface coefficients taken initially are Cbx1 = Cbx2 = Cbx3 = Cbx4 = 1 and

Cby1 = Cby2 = −1, Cby3 = Cby4 = 1. If adaptation is not applied to the process, the quadrotor oscillates for a period of time as shown before stabilizing. This is seen in Figure 16. We see in Figure 17 that, on application of our controller, the system performs much better and converges faster. The variation of coefficients of the sliding surface is shown in Figure 18. It is also seen that the coeffi- cients converge to a set of values which result in a stable set of PD controller gains.

Case - 2

65 Figure 29: Position and Orientation of Quad - Autotuner - With adaptation - Case - II

Figure 30: Coefficients of sliding surface - Autotuner - With adaptation - Case - II

66 In this section, the sliding surface coefficients taken initially are Cbx1 = 1, Cbx2 = 1, Cbx3 =

0.4, Cbx4 = 1 and Cby1 = −2, Cby2 = −0.5, Cby3 = 1, Cby4 = 1. Their values are far from the ideal val- ues needed for the quadrotor to achieve stable flight. Without any adaptation, the system quickly spirals into instability. Our design stabilizes the quadrotor system. It is seen in Figure 19 that the states of the quadrotor converge to the desired waypoint (1, 1, 1) despite starting off with a set of gains that destabilizes the system. This is achieved due to the variation of coefficients as seen in Figure 20.

Case - 3

Figure 31: Position and Orientation of Quad - Autotuner - With adaptation - Case - III

67 Figure 32: Coefficients of sliding surface - Autotuner - With adaptation - Case - III

In this section, the sliding surface coefficients taken initially are Cbx1 = 1, Cbx2 = (1/2), Cbx3 =

1, Cbx4 = 2 and Cby1 = −2, Cby2 = −1, Cby3 = 1, Cby4 = 3. In this case too, the values that the quadrotor starts of with are highly unstable. If the quadrotor behaves as a PD controller without our algorithm or the adaptation process taking place, the system goes unstable quickly. Our design stabilizes the quadrotor system. It is seen in Figure 19 that the states of the quadrotor converge to the desired waypoint (1, 1, 1) in finite time. This is achieved due to the variation of coefficients as seen in Figure 20. So we conclude that the algorithm has the capacity to stabilize an inherently unstable system. Further at the end of the the first waypoint navigation, adaptation is stopped and a second waypoint navigation is attempted. This is to demonstrate that the final gains that the quadrotor converged to form a stable PD controller. The second waypoint navigation is seen to have been performed well.

68 7 Conclusions

This thesis document presents three different novel control architectures.

The first control architecture was designed on the concept of multiple sliding surfaces. It was designed with an intent to improve upon the existing sliding mode control design. The novel con- trol architecture aims to make the new form of the sliding mode controller more energy efficient. The design was proposed and global stability was proved using the Lyapunov function. This con- troller was implemented on a quadrotor and waypoint navigation of the quadrotor was attempted. The algorithm performs this desired task. It was also seen that the quadrotor stabilized well in the presence of wind disturbances and did not deviate away from the desired waypoint. This is even when wind was simulated to act on it in multiple axes at the same time.

The second controller was designed with an objective to adaptively keep varying the gains of any dynamical system automatically till the states converge to their desired value. This eliminates the need to tune them manually. The theoretical design is developed and Lyapunov stability is proved for its linearized form. Its implementation is shown on a quadrotor system. A quadrotor being a large and highly non linear dynamical system makes manual tuning of the gains a difficult and time taking task to accomplish. The algorithm keeps adaptively varying the gains of quadro- tor for state convergence during its flight. We see that the quadrotor performs well when initially started off with a random set of gain values.

As mentioned earlier, the tuning of the gains of a quadrotor system is a arduous and time time taking task owing to its highly coupled non linear dynamics. The third control design presented attempts to automatically tune the gains of the quadrotor system. In this architecture, a sliding surface, similar to the one used in the classical sliding mode control is considered. Here, the co- efficients of the sliding surface effectively correlate to the gains of the quadrotor. Stabilization of this sliding surface translates to the gains of the quadrotor effectively converging at their desired

69 value. In this case too, the theoretical design is developed and Lyapunov stability is proved for its linearized form. Here, it is shown that the gains keep adapting during flight and successful waypoint navigation is achieved.

A key difference between the second and the third control architecture is the following. In the second, the gains are continuously varied during flight purely in order to reduce the state errors to zero. Its design does not necessarily imply that they converge to specific values at the end of the flight. However, the third control architecture specifically aims to get the gains to converge at a fixed set of values post the flight. Here, it is desired that the controller obtained at the end of the simulation is a fixed gain stable PD controller.

70 8 Future Work

The possible future work is discussed in this section of the thesis. The first control architecture introduces the concept of an additional sliding surface to control acceleration as well as position and velocity. This enables efficient handling of disturbance. A control input is formulated using the fore-mentioned concept and the theoretical convergence of the states for the derived control input is shown (Lyapunov Stability). Our future work would be to understand the response of each state individually in the system and mathematically derive their response. We also wish to use the process of adaptation to see if the controller would be able to react to wind disturbances in a smoother manner. As for control architectures 2 and 3, their stability has been proved for a linearized dynamical system. Our next objective would be to see if global stability can be proved and achieved in simu- lation. Also we noted that the system is sensitive to changes in the adaptive gain. Understanding why that happens despite the Lyapunov stability is something that needs to be looked into. Another future direction is to implement all 3 controller designs in hardware and experimen- tally verify the effectiveness of thw proposed control designs.

71 References

[1] S. Bouabdallah and R. Siegwart. Backstepping and sliding-mode techniques applied to an in- door micro quadrotor. In Proceedings of the 2005 IEEE International Conference on Robotics and Automation, pages 2247–2252, April 2005.

[2] En-Hui Zheng, Jing-Jing Xiong, and Ji-Liang Luo. Second order sliding mode control for a quadrotor UAV. ISA Transactions, 2014.

[3] Heriberto Ramirez-Rodriguez, Vicente Parra-Vega, Anand Sanchez-Orta, and Octavio Garcia-Salazar. Robust backstepping control based on integral sliding modes for tracking of quadrotors. Journal of Intelligent & Robotic Systems, 73(1-4):51–66, 2014.

[4] Hakim Bouadi, S Simoes Cunha, Antoine Drouin, and Felix Mora-Camino. Adaptive slid- ing mode control for quadrotor attitude stabilization and altitude tracking. In 2011 IEEE 12th International Symposium on Computational Intelligence and Informatics (CINTI), pages 449–455. IEEE, 2011.

[5] Sudhir Nadda and A Swarup. On adaptive sliding mode control for improved quadrotor tracking. Journal of Vibration and Control, 24(14):3219–3230, 2018.

[6] Ivan´ Gonzalez,´ Sergio Salazar, and Rogelio Lozano. Chattering-free sliding mode altitude control for a quad-rotor aircraft: Real-time application. Journal of Intelligent & Robotic Systems, 73(1-4):137–155, 2014.

[7] Salah Laghrouche, Franck Plestan, and Alain Glumineau. Higher order sliding mode control based on integral sliding mode. Automatica, 43(3):531–537, 2007.

[8] Filiberto Munoz,˜ Ivan´ Gonzalez-Hern´ andez,´ Sergio Salazar, Eduardo S Espinoza, and Roge- lio Lozano. Second order sliding mode controllers for altitude control of a quadrotor uas: Real-time implementation in outdoor environments. Neurocomputing, 233:61–71, 2017.

72 [9] C Nicol, CJB Macnab, and A Ramirez-Serrano. Robust adaptive control of a quadrotor helicopter. Mechatronics, 21(6):927–938, 2011.

[10] C Coza, C Nicol, CJB Macnab, and Alejandro Ramirez-Serrano. Adaptive fuzzy control for a quadrotor helicopter robust to wind buffeting. Journal of Intelligent & Fuzzy Systems, 22(5, 6):267–283, 2011.

[11] Ramon´ A Suarez´ Fernandez,´ Sergio Dominguez, and Pascual Campoy. L 1 adaptive control for wind gust rejection in quad-rotor uav wind turbine inspection. In 2017 International Conference on Unmanned Aircraft Systems (ICUAS), pages 1840–1849. IEEE, 2017.

[12] Mahdis Bisheban and Taeyoung Lee. Geometric adaptive control for a quadrotor uav with wind disturbance rejection. In 2018 IEEE Conference on Decision and Control (CDC), pages 2816–2821. IEEE, 2018.

[13] Alexandru Brezoescu, Tadeo Espinoza, Pedro Castillo, and Rogelio Lozano. Adaptive tra- jectory following for a fixed-wing uav in presence of crosswind. Journal of Intelligent & Robotic Systems, 69(1-4):257–271, 2013.

[14] Brian Whitehead and Stefan Bieniawski. Model reference adaptive control of a quadrotor uav. In AIAA Guidance, Navigation, and Control Conference, page 8148, 2010.

[15] Daewon Lee, H Jin Kim, and Shankar Sastry. Feedback linearization vs adaptive sliding mode control for a quadrotor helicopter. International Journal of control, Automation and systems, 7(3):419–428, 2009.

[16] Hakim Bouadi, S Simoes Cunha, Antoine Drouin, and Felix Mora-Camino. Adaptive slid- ing mode control for quadrotor attitude stabilization and altitude tracking. In 2011 IEEE 12th International Symposium on Computational Intelligence and Informatics (CINTI), pages 449–455. IEEE, 2011.

73 [17] N. Michael, D. Mellinger, Q. Lindsey, and V. Kumar. The grasp multiple micro-UAV testbed. IEEE Robotics Automation Magazine, 17(3):56–65, Sep. 2010.

[18] J. Li and Y. Li. Dynamic analysis and PID control for a quadrotor. In 2011 IEEE International Conference on Mechatronics and Automation, pages 573–578, Aug 2011.

[19] Rumit Kumar, Matthew Dechering, Abhishek Pai, Austin Ottaway, M Radmanesh, and Man- ish Kumar. Differential flatness based hybrid PID/LQR flight controller for complex tra- jectory tracking in quadcopter UAVs. In 2017 IEEE National Aerospace and Electronics Conference (NAECON), pages 113–118. IEEE, 2017.

[20] S. Bouabdallah, A. Noth, and R. Siegwart. PID vs lq control techniques applied to an in- door micro quadrotor. In 2004 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS) (IEEE Cat. No.04CH37566), volume 3, pages 2451–2456 vol.3, Sep. 2004.

[21] H. Voos. Nonlinear control of a quadrotor micro-UAV using feedback-linearization. In 2009 IEEE International Conference on Mechatronics, pages 1–6, April 2009.

[22] Zeghlache SAMIR. Sliding mode control strategy for a 6 dof quadrotor helicopter. In Journal of Electrical Engineering.

[23] H. Ramirez-Rodriguez, V. Parra-Vega, and A. et al. Sanchez-Orta. Robust backstepping control based on integral sliding modes for tracking of quadrotors. Journal of Intelligent Robotic Systems, 73:51–66, Jan. 2014.

[24] Siddharth Sridhar, Rumit Kumar, Kelly Cohen, and Manish Kumar. Fault Tolerance of a Reconfigurable Tilt-Rotor Quadcopter Using Sliding Mode Control. volume 3 of Dynamic Systems and Control Conference, Sept. 2018. V003T37A009.

[25] D. Lee, H. Jin Kim, and S. Sastry. Feedback linearization vs. adaptive sliding mode con- trol for a quadrotor helicopter. International Journal of Control, Automation and Systems, 7(3):419–428, Jun. 2009.

74 [26] Siddharth Sridhar, Rumit Kumar, Mohammadreza Radmanesh, and Manish Kumar. Non- linear sliding mode control of a tilting-rotor quadcopter. In Dynamic Systems and Control Conference, volume 58271, page V001T09A007. American Society of Mechanical Engi- neers, 2017.

[27] Ilyas˙ Eker. Second-order sliding mode control with experimental application. ISA Transac- tions, 49(3):394 – 405, 2010.

[28] Leonid Fridman, Arie Levant, et al. Higher order sliding modes. Sliding mode control in engineering, 11:53–102, 2002.

[29] Arie Levant. Sliding order and sliding accuracy in sliding mode control. International Journal of Control, 58(6):1247–1263, 1993.

[30] Sudhir Nadda and A Swarup. On adaptive sliding mode control for improved quadrotor tracking. Journal of Vibration and Control, 24(14):3219–3230, 2018.

[31] S. Sridhar, G. Gupta, R. Kumar, M. Kumar, and K. Cohen. Tilt-rotor quadcopter xplored: Hardware based dynamics, smart sliding mode controller, attitude hold wind disturbance scenarios. In 2019 American Control Conference (ACC), pages 2005–2010, July 2019.

[32] Hilton Tnunay, M Qodar Abdurrohman, Yuliyanto Nugroho, Reka Inovan, Adha Cahyadi, and Yoshio Yamamoto. Auto-tuning quadcopter using loop shaping. In 2013 International Conference on Computer, Control, Informatics and Its Applications (IC3INA), pages 111– 115. IEEE, 2013.

[33] ATIKAH SURRIANI. SISTEM KENDALI PD AUTOTUNING BERBASIS LOOP SHAPING PADA WAHANA UDARA TANPA AWAK QUADROTOR. PhD thesis, Universitas Gadjah Mada, 2015.

75 [34] Wojciech Giernacki, Tadeo Espinoza Fraire, and Piotr Kozierski. Cuttlefish optimization algorithm in autotuning of altitude controller of unmanned aerial vehicle (uav). In Iberian Robotics conference, pages 841–852. Springer, 2017.

[35] Ivan Kirilenko and Aleksandr Kapitonov. Quadrotor control parameters optimization using gradient descent method. 2019.

[36] Wojciech Giernacki, Dariusz Horla, Toma´sˇ Ba´ca,ˇ and Martin Saska. Real-time model- free minimum-seeking autotuning method for unmanned aerial vehicle controllers based on fibonacci-search algorithm. Sensors, 19(2):312, 2019.

[37] Nicolas Gomez, Victor Gomez, Enrique Paiva, Jorge Rodas, and Raul Gregor. Flight con- troller optimization of unmanned aerial vehicles using a particle swarm algorithm. In 2020 International Conference on Unmanned Aircraft Systems (ICUAS), pages 588–593. IEEE, 2020.

[38] Lars Sonneveldt, QP Chu, and JA Mulder. Nonlinear flight control design using constrained adaptive backstepping. Journal of Guidance, Control, and Dynamics, 30(2):322–336, 2007.

[39] M Belkheiri, A Rabhi, A El Hajjaji, and C Pegard. Different linearization control techniques for a quadrotor system. In CCCA12, pages 1–6. IEEE, 2012.

76