Full text
1│ MASTER FINAL THESIS DOCUMENT: Master’s Report AUTHOR: Di Giuseppe, Gabriel Adrián TUTOR - COTUTOR: Pérez Magrané, Ramon - Morcego Seix, Bernardo DEGREE: Master's degree in Automatic Systems and Industrial Electronics Engineering EXAMINATION SESSION: Autumn, 2023 SYSTEM IDENTIFICATION OF A DRONE MOUNTED ON A GYROSCOPIC TEST BENCH
2│ ABSTRACT This dissertation applies an experimental methodology to study and identify a quadrotor mounted on a gyroscopic test bench. Its aim is to find suitable data-driven linear timeinvariant (LTI) models in both continuous and discrete time for pitching, rolling and yawing motions separately and to validate them. A literature review is done to assess the significance of UAVs in general, the interest in them, and their impact. The work also studies the current methodologies utilized in research to study, identify and control UAVs. Prior documentation and knowledge of the chosen drone is assessed to understand the building foundations of the dissertation. An experimental, drone-independent methodology is developed for the work. New userfriendly interfaces and tools for experimentation and control of the drones at UPC ESEIAAT are developed in the MathWorks’ framework, which are independent of the selected approach. Guidelines for them are written for future use. In accordance with it, basic physical parameters (i.e., friction coefficient and inertia) are estimated based on an equation that explains the motion of the drone-gyroscope system without the actuations of the motors. Thereafter, data is collected in a system identification framework, and model structures are chosen. The models are then estimated for pitch, roll and yaw separately. Based on them, Proportional-Integral-Derivative (PID) controllers are tuned using the pole placement method and iterative algorithms. Moreover, the models are successfully validated in the platform with the help of the attitude controllers. The platform demonstrates to be a useful tool for both educational and research purposes. It allows the implementation of the proposed methodology in a controlled environment. Also, the system shows signs of nonlinear behaviour, such as nonlinear proportional gains and dead zones. The first two angles linear dynamics were identified to be of second order, while the yaw proved to have a natural integrator, together with a first order dynamic. In accordance with the influence of the gyroscope’s inertia on the drone, the roll was the fastest, and the pitch was in a middle point. Both proved to have one equilibrium point, while the yaw had an infinite amount. Additionally, the rotational friction was pinpointed as the cause of its dead zone, which provoked an offset during the validation phase.
3│ RESUMEN Este trabajo final de máster aplica una metodología experimental para estudiar e identificar un cuadricóptero montado en un banco de pruebas giroscópico. Su objetivo es encontrar modelos lineales invariantes en el tiempo (LTI) basado en datos en tiempo continuo y discreto para cada ángulo de Euler y validarlos. Se realiza una revisión del estado del arte y literatura para evaluar la importancia de los Vehículos Aéreos No Tripulados (UAVs), el interés en ellos y su impacto. El trabajo también estudia las metodologías utilizadas en la investigación para estudiar, identificar y controlar los UAV. Se evalúa la documentación previa y el conocimiento del dron elegido para comprender las bases del TFM. Se desarrolla una metodología experimental independiente del dron. Se desarrollan nuevas interfaces para la experimentación y control de los drones en UPC ESEIAAT dentro de Matlab y Simulink, independientes del enfoque seleccionado. Se redactan guías para su uso. Se estiman parámetros físicos (coeficiente de fricción e inercia) en base a ecuaciones que explican el movimiento de sistema sin las actuaciones de los motores. A continuación, se recopilan datos para la identificación del sistema y se eligen las estructuras del modelo. Luego, los modelos se estiman por separado para cabeceo, alabeo y guiñada. En base a ellos, se ajustan controladores Proporcional-Integral-Derivativo (PID) utilizando el método de asignación de polos y un algoritmo iterativo. Además, los modelos se validan exitosamente en la plataforma con la ayuda de los controladores de actitud. La plataforma demuestra ser una herramienta útil tanto para fines educativos como para la investigación. Permite la implementación de la metodología propuesta en un entorno controlado. Además, el sistema muestra signos de comportamiento no lineal, como parámetros no lineales y zonas muertas. Las dinámicas lineales del cabeceo y alabeo se identificaron como de segundo orden, mientras que la guiñada demostró poseer un integrador natural, sumada a una dinámica de primer orden. El alabeo demostró tener la dinámica más rápida, con el cabeceo en segundo lugar. Ambos poseen un punto de equilibrio, mientras que la guiñada tenía una cantidad infinita. Además, se identificó que la fricción rotacional fue la causa de su zona muerta, lo que provocó un desplazamiento durante la fase de validación.
4│ INDEX Abstract ..................................................................................................................................... 2 Resumen .................................................................................................................................... 3 Index ........................................................................................................................................... 4 Table index ................................................................................................................................ 8 Equation index .......................................................................................................................... 9 Figures index............................................................................................................................11 Glossary ................................................................................................................................... 16 1. Introduction ..................................................................................................................... 18 1.1 Objectives ................................................................................................................. 20 1.2 Scope........................................................................................................................ 21 1.3 Limitations ................................................................................................................ 22 1.4 Requirements ........................................................................................................... 23 1.5 Justification ............................................................................................................... 24 2. Literature review ............................................................................................................. 25 2.1 Interest and applications........................................................................................... 25 2.2 Economic terms ........................................................................................................ 26 2.3 importance of the gyroscope .................................................................................... 26 2.4 Drone study and control techniques ......................................................................... 28 2.5 Main bibliography, prior documentation and knowledge .......................................... 30 3. Methodology ................................................................................................................... 32 4. Experimentation interface ............................................................................................. 34
5│ 4.1 Requirements ........................................................................................................... 34 4.2 Development of the interface ................................................................................... 35 4.3 Robot Operating System (ROS) ............................................................................... 36 4.3.1 First attempt .......................................................................................................... 37 4.3.2 Second attempt .................................................................................................... 38 4.4 Simulink interface for experiments ........................................................................... 42 5. Parameter estimation ..................................................................................................... 49 5.1 System data collection.............................................................................................. 49 5.2 Simulation and matching .......................................................................................... 51 5.2.1 Pitch, roll and yaw ................................................................................................ 54 6. System identification ..................................................................................................... 62 6.1 Experimentation ........................................................................................................ 63 6.1.1 Pitch angle experiments ....................................................................................... 64 6.1.2 Roll angle experiments ......................................................................................... 68 6.1.3 Yaw angle experiments ........................................................................................ 70 6.2 Models ...................................................................................................................... 74 6.2.1 Pitch angle model ................................................................................................. 80 6.2.2 Roll angle model ................................................................................................... 84 6.2.3 Yaw angle model .................................................................................................. 88 7. System control ................................................................................................................ 92 7.1 Calculations and tuning ............................................................................................ 92 7.1.1 Background .......................................................................................................... 92 7.1.2 Yaw ....................................................................................................................... 96
6│ 7.1.3 Pitch .................................................................................................................... 101 7.1.4 Roll...................................................................................................................... 106 7.2 Controller’s digital implementation ......................................................................... 109 7.3 Results of the implementation ................................................................................. 112 7.3.1 Pitch loop ............................................................................................................. 113 7.3.2 Roll loop ............................................................................................................... 114 7.3.3 Yaw loop .............................................................................................................. 116 7.3.4 Simultaneous control ........................................................................................... 118 8. Conclusions and further venues of study ................................................................. 121 8.1 Conclusions ............................................................................................................ 121 8.2 Possible further studies .......................................................................................... 124 References and bibliografy .................................................................................................. 125 Appendix ................................................................................................................................ 139 A. Budget ........................................................................................................................ 140 B. Analysis and assessment of the environmental and social impact ............................ 141 I. Environmental impact ............................................................................................. 141 II. Social impact .......................................................................................................... 146 III. Summary ................................................................................................................ 148 C. Experiment Setup ....................................................................................................... 149 I. Requirements for experimentation ......................................................................... 149 II. Matlab/Simulink environment: ................................................................................ 149 III. General comments and gyroscope output ............................................................. 151 IV. Drone powerup ....................................................................................................... 152
7│ V. Explanation of the Simulink for drone communications ......................................... 155 VI. Turning on and testing ........................................................................................ 157 VII. Shutting down the system .................................................................................. 158 VIII. Drone controller’s implementation guide ............................................................ 159 IX. Message registration .......................................................................................... 160 D. Code ........................................................................................................................... 161 I. ‘DroneSetup.m’ ....................................................................................................... 161 II. ‘MsgRegister.m’ ...................................................................................................... 165 III. Modified ‘ctrl_test.cpp’ ............................................................................................ 166 IV. Iterative tuning algorithm ........................................................................................ 169
8│ TABLE INDEX Table 1: Inner gimbal (Pitch) specifications. ..................................................................................... 55 Table 2: Plate (Roll) gimbal specifications. ....................................................................................... 56 Table 3: Outer gimbal's (yaw) specifications .................................................................................... 61 Table 4: Controller structures available in the quadrotor ................................................................. 110 Table 5: Comparison between simulated and real responses ........................................................ 112 Table 6: Budget............................................................................................................................... 140 Table 7: Comparison between different modes of transport in terms of CO2 emissions ............... 145
9│ EQUATION INDEX Equation 1: Gimbals' rotational motion ............................................................................................. 51 Equation 2: Simplified equation ........................................................................................................ 52 Equation 3: Moment of inertia. Formula. .......................................................................................... 57 Equation 4: Linear discrete-time ‘ready-made’ model ...................................................................... 77 Equation 5: Mean Square Error minimized by the algorithm ........................................................... 78 Equation 6: Fit value for the NRMSE parameter .............................................................................. 79 Equation 7: Chosen discrete-time pitch angle model ....................................................................... 82 Equation 8: Continuous model for the pitch angle ........................................................................... 84 Equation 9: Discrete-time roll angle ϕ model ................................................................................... 86 Equation 10: Continuous model for the roll angle ϕ ......................................................................... 87 Equation 11: Yaw model transfer function ........................................................................................ 91 Equation 12: Second order system. Standard form ......................................................................... 93 Equation 13: First order model with a natural integrator. Standard form ......................................... 93 Equation 14: Closed loop third order system transfer function. Standard form ............................... 93 Equation 15: Proportional factor of poles for a third order system ................................................... 94 Equation 16: Simplified second order plant model. Known parameters .......................................... 94 Equation 17: PI controller transfer function ...................................................................................... 94 Equation 18: Closed loop transfer function for a second order system with a PI controller............. 94 Equation 19: Pole placement solution .............................................................................................. 95 Equation 20: Simplified yaw model and its poles ............................................................................. 96 Equation 21: PD controller transfer function .................................................................................... 97
16│ GLOSSARY AscTec Ascending Technologies GmbH BS Back-Stepping CTC Coordinate Transformation Conversion block DOF Degree Of Freedom EC European Commission ESC Electronic Speed Controller ESEIAAT Escola Superior d’Enginyeries Industrial, Aeroespacial i Audiovisual de Terrassa ETH Swiss Federal Institute of Technology (Eidgenössische Technische Hochschule) EU European Union FLC Fuzzy Logic Controller GHG Green-house gas GWP Global Warming Potential HLP High-level processor IAE Integral Absolute Error IMU Inertial Measurement Unit IP Internet Protocol ITAE Integral Time Absolute Error LCV Light commercial vehicles LiPo Lithium Polymer (battery) LLP Low-level processor LQR Linear Quadratic Regulator LTI Linear time-invariant MIMO Multiple-input multiple-output MSE Mean Square Error NRMSE Normalized Root Mean Square Error OS Operating System PV Process value ROS Robot Operating System RST Reference Signal Tracking
17│ SF State Feedback SISO Single-input single-output SITB MathWorks’ System Identification Toolbox SP Set point SSH Secure Shell UAV Unmanned Aerial Vehicle UPC Universitat Politècnica de Catalunya
18│ 1. INTRODUCTION This dissertation aims to apply an experimental methodology to study and identify a quadrotor mounted on a gyroscopic test bench. Its aim is to find suitable data-driven linear time-invariant (LTI) models in both continuous and discrete time for each separate Euler angle of the system and to validate them. The main feature of the work is that it develops Unmanned Aerial Vehicles (UAVs) models and tests flight controllers in non-destructive experiments under controlled conditions using data-driven system identification techniques. The main equipment consists near-human-size gyroscopic test bench and a quadrotor which is mounted on top (Figure 1). This allows the study of the system’s mathematical and physical properties. The test bench consists of three outer rings or gimbals (Figure 2). Figure 1: Gyroscopic test bench with mounted quadrotor Source: [1] For these purposes, the laboratory had an Ascending Technologies Hummingbird quadrotor (Figure 3), which was modified by the professor [2] with the help of former students [3], [4]. The modification consisted of an additional board called Odroid-XU4 [5]. It
19│ had Ubuntu 16.04 installed and could run the Robot Operating System (ROS) middleware. The user could then connect to this ROS network through Wi-Fi in a safe SSH (Secure Shell) connection [6], which is also possible thanks to the board. Further details of the quadcopter, and its hardware and software configurations can be found in other studies done at the institution [7]–[9]. Figure 2: FFTGyro at UPC ESEIAAT Source: Manufacturer’s website The platform’s manufacturer Eureka Dynamics provided three 10-bit, 360° encoders, which are equally distributed across the ring’s spinning axes (Figure 1). Additionally, step motors also were provided to the university (Figure 2), which are interchangeable with the commented encoders. The motors can also provide readings of the Euler angles, although they have a dead zone between 280 and 360°. Unfortunately, the system cannot operate with a mixture of both actuators and sensors. The motors will not be used in this work. Eureka also provided a way to easily collect data through a serial communication (USB connection) built into the machine. The encoders’ readings could then be displayed through Matlab scripts or Simulink interface for further analysis, such as parameter estimation and model identification.
20│ Figure 3: Modified AscTec Hummingbird quadrotor mounted on gyroscopic test bench at UPC 1.1 OBJECTIVES The main objectives of this dissertation are: • To setup the communications channel between (chapter 4): o ROS → Matlab/Simulink o Gyroscope → Matlab/Simulink • To develop user-friendly interfaces for the communications with the quadrotor through ROS, scripts, and Simulink interfaces for use in further research and educational purposes (chapter 4, section 7.2 and Appendix C). • To determine, calculate, and estimate missing physical parameters of the platform with the mounted quadrotor (chapter 5). • To identify the system’s parametric models (chapter 6) in continuous and discrete time alike. • To develop flight controllers for the quadrotor-gyroscope system based on the identified models and test them on the real platform (chapter 7) to further validate the models. • To write a manual on how to properly experiment with the system and test controllers in the platform (Appendix C).
21│ 1.2 SCOPE The scope of the dissertation is to develop a methodology to test and validate drone models through system identification and control techniques. In system identification theory, these kinds of parameterized models are called ‘ready-made’, which are of general applicability, have no physical interpretation and are expressed in discrete time [10]. Moreover, process models are continuous time models [11], analogous to the ‘ready-made’. On the other hand, analytical models (‘tailor-made’ models in the literature) are constructed from basic physical principles and will not be within the scope of this work. These models are the most common in the scientific community for UAV identification and control [12]– [16]. The term ‘system’ will be referred to the quadrotor mounted on the test bench (Figure 3) throughout the text, unless specified otherwise. The ‘ready-made’ and process models are going to be estimated, parametrized, and validated inside the laboratory based on gathered experimental data (i.e. ‘data-driven’). Additionally, flight controllers are going to be selected, developed, analytically tuned, and tested in controlled conditions in the laboratory based on these models. This will be considered the final validation phase of the system identification process. The drone is always going to be mounted on the platform (drone-gyroscope system) throughout the experiments. The data will be gathered through safe, non-destructive experiments given the unique opportunity to test the system repeatedly without damaging the UAV or its user. For that reason, UAV simulations are not within the scope of work. A decoupler has already been developed by Ascending Technologies, the drone’s manufacturer, and will not be part of the scope of this work. In this case, the decoupler assists the user by enabling the indirect control of the quadrotor motors’ voltages, thus allowing the user to control the pitching, rolling and yawing motions of the drone. However, it should be noted that the decoupler does not replace the flight controller, which still needs to be developed and is within the scope (chapter 7). Due to safety reasons, the dissertation will not cover field tests of the controllers developed in the laboratory. As mentioned in the section 1.3, it is required by the university that a person with piloting experience in remote control of UAVs to conduct field tests. Instead, that time has been dedicated to experimentation, validation of the results, and development of interfaces with their respective guidelines. In addition, the dissertation focuses on research and development of several techniques and methodologies (chapter
22│ 3) instead of field usage. Nevertheless, the controllers could be tested in the field in the future. To assist the development of methodologies and techniques, user-friendly interfaces will developed in the MathWorks’ framework (chapter 4 and section 7.2). The main controller will be a Proportional-Integral-Derivative (PID) controller. However, the resulted models could be used for many other techniques, under similar conditions (section 1.4). Although the results centred around one of the university’s AscTec Hummingbird UAV available, the approach applied in the dissertation could prove useful to any UAV in any bench test. The drone must have angular velocity and position sensors (an IMU is sufficient), communications capabilities to its remote controller and/or a computer, and a (preferably gyroscopic) test bench, such as the ones found here or in [14]–[17]. The test bench must comply with basic safety standards to be able to evaluate the drone with any input, especially high frequency white noise such as the one utilized in chapter 6. It is not a requirement that the test bench has encoders, but it certainly helps to have a second output to the drone’s sensors to contrast and compare both measurements. If safety standards are not met, the approach cannot be applied and the standard paradigm of model-based testing of UAVs should be further utilized [18]–[20]. In addition to that, similar results of this work can be reproduced through many system identification algorithms in different frameworks. The following examples could be mentioned: Simulink’s System Identification toolbox (SITB) [21], a Python open library [22] or a C++ open library [23]. The interface developed for the dissertation can only be used for AscTec drones employing the ROS package ‘mav_framework’ [24]. 1.3 LIMITATIONS The following limitations are observed at the beginning of the dissertation: a) hardware, b) software, and c) economy (of time and money). Three quadrotors are available at the university, all of which were bought at the same time to Ascending Technologies GmbH. Two of them have received hardware and software updates but have different morphologies and physical characteristics. Nevertheless, all of them share the same basic components: motors, propellers, and so on. The third has been discarded because it does not meet the requirements of hardware and software (section 1.4).
23│ Since the identification process is of experimental nature, it is not allowed to interchange the two remaining drones. One drone is to be chosen for the study. This could prove to be a limitation in the future if there is any problem with the chosen drone. For that reason, it is advisable to proceed with caution when dealing with it. Therefore, its electronics, cables and other sensitive components should be handled with extra care; for example, it is imperative that the propellers do not collide at any moment with the cabling. If a problem were to arise in the drone used in the dissertation, the proposed work would have to start again. Additionally, the university has limited number of spare parts for its drone, and no spare parts are available in the market. More on the subject is spoken about at the end of chapter 2. The batteries for both the quadrotor and the remote controller are swollen, which is an indication that they are old and/or were misused. A limitation then arises with the estimated time of flight (or rather, experiment time) that each battery will provide. To counteract part of the problem, the remote controller will be kept plugged in and charging at all times during the tests. On top of that, according to the person responsible for the laboratory, the gyroscope had presented software and hardware difficulties in the past. This leads to believe some difficulties might arise in this subject. Note that the platform’s manufacturer is from Mexico. A hardware problem could delay the dissertation significantly until a technician fixes it. Combining all of the above limitations, if the stipulated problems were to arise during the dissertation, solving them could cost money and time, and would therefore diminish the effective time to study the quadrotor-gyroscope system. 1.4 REQUIREMENTS Basic requirements of the dissertation are: • ROS-enabled UAV with built-in Inertial Measurement Unit (IMU). • Test bench with encoders. • Linux/Ubuntu 16.04 installed on a computer. • Matlab/Simulink R2020b license with full access to MathWorks’ toolboxes.
24│ • Drone batteries with charger. • Drone controller with charger. 1.5 JUSTIFICATION In the last twenty years, there has been an exponential increase in interest in Unmanned Aerial Vehicles (UAVs), which have gained the attention from the scientific community [25], [26]. These vehicles offer high flexibility and manoeuvrability, making them attractive for various applications, mostly outdoors. For example, they have been used for reforestation [27], agriculture [28], reconnaissance and rescue [29], and aircraft inspection [30]. In 2018, due to their rapidly growing applications and interest, the EU saw the necessity to implement regulations and civil aviation rules for all UAVs, regardless of their weight [31]. Despite their incredible engineering and scientific potential, UAVs have been difficult to study and control, given their mathematical and physical complexity [32]. Nowadays, the scientific community has perfected several models that explain their behaviour [18], [19]. These are commonly utilized to develop flight controllers for quadrotors and other types of UAVs [25]. Despite that, the equations of the open-loop system are mathematically hard to comprehend and is easy to get lost in physical properties, like the inertia tensor matrix of the system [33]. Their difficulty increases after the flight controller is developed, making the closed-loop system physically unintuitive. The current methodologies for studying and controlling UAVs are based on analytical (‘tailor-made’) models, in which only the parameters are unknown [32]. This is often called the conventional model-based approach. On the other hand, the model-free approach has been understudied [34]. This dissertation aims to provide a different data-driven approach on the study, validation, and control of UAVs, which does not rely on open-field flight data nor high-fidelity simulations. To implement the approach, new tools are going to be developed and implemented. The approach will also lower the amount of experience, expertise and funds required to study UAVs. Additionally, their goal is to provide a suitable safe and user-friendly environment for educational and research purposes. In the future, new flight controller’s tuning techniques could be studied, and their results fined-tuned before they are tested in the open field.
25│ 2. LITERATURE REVIEW This chapter is dedicated to the analysis of the literature related to UAVs, their importance, common control and validation techniques, and the economic impact of drones and test benches. Additionally, prior documentation of the available quadrotor and test bench was studied to assess the possibilities and extent of the dissertation. 2.1 INTEREST AND APPLICATIONS In recent decades, Unmanned Aerial Vehicles have developed quickly. Because of this, they have become quite popular for both military and civilian purposes. They enable to reach previously inaccessible locations while also saving time and lives [35]. Their growing interest amongst industries and society alike is demonstrated through their implementation into various human activities such as: - Agriculture [28]: five key areas encompassing the primary agricultural industry are to be benefited from the use of UAVs: topographic mapping, physiological evaluations, biophysical analyses, surveillance of living organisms, and the application of plant protection products and biological inputs. - Reforestation [27]: an operation was able to plant an additional 4 million mangrove plants in 2019 alone with the help of drones. Ten drones were flown by two operators at a rate of up to 400,000 trees each day. - Rescue missions [29]: most recently, the company Garuda Aerospace deployed their UAVs on earthquake-hit Turkey, which saved countless human lives. - Inspection of aircrafts [30]: generation of 3D CAD models of aircrafts for maintenance routines such as fault finding, which replaced manual work prone to error. - Supply chain, logistics and warehouse management [36], [37]: they have reported to: a) support humanitarian logistics, b) shorten delivery time and c) augment sustainability, d) reduce cost and e) augment flexibility. These applications are only a few of many. The environmental and social impact both positive and negative are analysed thoroughly in Appendix B.
32│ 3. METHODOLOGY This chapter is dedicated to the explanation of the work methodology chosen to conduct the study. It employs a quantitative approach to collect, analyse, and present the data and results. The dissertation aims to provide a practical solution to the system identification and control of drones in a safe and controlled environment. In order to achieve this, the development of new tools and interfaces was necessary. This chapter only focuses on the step-by-step process of the dissertation and description of it. The theoretical framework and in-depth analysis will be presented within each relevant chapter. This was done to improve readability and to familiarize the reader with the topics and theory at each chapter. The equipment utilized for the study was: a) modified AscTec Hummingbird quadrotor, b) Futaba FF-7 2.4GHz remote controller, c) 2300 mAh 11.1V LiPo batteries, d) Eureka Dynamics’ gyroscopic test bench FFT Gyro 450 Pro Aluminium and its relevant documentation, e) HP ProBook 450 G5 laptop with Ubuntu and ROS software, and f) full licence for MathWorks’ products. The drone was selected because it was available at the university, and it had been studied before within the institution [7]–[9]. This meant that there was already information and tools available that could be utilized as a base for this research. The gyroscope was not previously studied nor utilized at the university. The test bench permitted the development of an experimental framework without the risks and costs associated with the test of the UAV in open field. The first step in the process was to gather the information available and what had already been studied about the quadrotor and the test bench. The study of the available documentation of the equipment showed that the documentation described the function of both to some extent. In particular, there was documentation about the UAV, which included information about the scripts to be used in an experimental framework. The test bench’s manufacturer had also developed scripts and models for the MathWorks’ framework, which were improved upon. The next step was to read the scripts upon which the experimental interface was based on, which primarily ran on C++ coding. The code utilized the ROS middleware to build up communications between the computer and the quadrotor. The communications were then meant to be carried out through the MathWorks’ framework. For that, the test bench’s manufacturer was contacted.
33│ Meetings with the manufacturer were conducted to understand the equipment. Matlab scripts and Simulink interfaces were obtained from these meetings and the manufacturer’s GitLab [67], which allowed the communication between test bench and computer through MathWorks’ framework. Documentation regarding the gyroscope were also obtained from these meetings. This included physical parameters (Table 1 and Table 2) and 3D models. Utilizing the information gathered up to that point in time, the new interface could be built. As explained earlier, the decision was taken to do it through the MathWorks’ framework. New tools, scripts, models, and guidelines were developed to that end (chapter 4 and Appendix C). Their end goal was not only to serve the main purposes of the dissertation, but to set up a user-friendly interface for educational and research purposes at Universitat Politècnica de Catalunya. The tools have already been implemented in several courses. Employing Newton’s second law of motion for rotation, an equation was developed based on physical and mathematical analysis of the quadrotor-gyroscope pair (Equation 1). Initial experiments were then conducted based on this equation and the parameters obtained from the gyroscope’s manufacturer. A series of observations, hypotheses and new parameters were produced from these initial experiments (chapter 5), which were then utilized as prior knowledge to design experiments and understand the results of chapters 6 and 7. The new series of experiments was conducted based on the results of the initial experiments (section 6.1). This was an iterative process, where different hypotheses were tested, and the experiment design was redefined as the system identification progressed. Parametrized models for each Euler angle (pitch, roll and yaw) in continuous and discrete time were identified from these experiments. They were initially validated according to the system identification methodology (section 6.2). The final validation process was based on the parametrized models, which were utilized to develop the quadrotor’s controllers (chapter 7). A new interface for the controller’s tests was developed. This enabled the final validation of the methodology utilized for the dissertation. This new interface was accompanied with guidelines, which also had educational and research purposes in mind (section 7.2 and Appendix C, item VIII). Based on the knowledge gathered during the study, conclusions were drawn (section 8.1). New study venues were advised for the future (section 8.2).
34│ 4. EXPERIMENTATION INTERFACE This chapter is dedicated to the development of the communications and experiment interface for the dissertation. It also shows how its results were affected by the past experiment interface, which was developed as executable C++ scripts. The section will also deal with communication tools such as the MathWorks’ framework, the Robot Operating System (ROS) and the programming language C++ to communicate with the drone and platform more flexibly and easier throughout experimentation. For a more intelligible understanding of the workflow in the upcoming explanation, the progress will be presented as faithful to the chronological order as possible. As a starting point, the AscTec Hummingbird quadrotor contained code written in C++ in its memory, developed by the Swiss Federal Institute of Technology (ETH) in Zurich, with relevant contributions made by the university professor and dissertation’ co-tutor, which has been used for previous papers involving the UAVs at Universitat Politècnica de Catalunya [7]–[9], [68], [69]. Those changes and additions have been documented and they include the coding of helpful control modes for the quadrotor, such as the open loop (‘DirectMotorControl’ mode in the drone’s documentation) explained on section 4.4, and a PID control algorithm, which will later be implemented as the flight controller (chapter 7 and Appendix C, item VIII). Unfortunately, the quadrotor’s manual and documentation developed at UPC have not been published and cannot be referenced. Although papers, articles and studies have used the laboratory’s UAVs, the gyroscopic test bench was not utilized previously due to hardware problems. As the current work started, the problems had to be resolved; an example for a software problem is explained on the paragraph above Figure 19 on section 4.4. The main hardware problem consisted in unforeseen severed cables, which the manufacturer had to replace. 4.1 REQUIREMENTS Aside from the platform and the quadrotor themselves, the following requirements were needed to develop the communication tools and channels explained in this section: • Laptop with Ubuntu 16.04 OS and ROS 1 Indigo releases. • Python 2.7 and CMake 3.10.x.
35│ • Matlab R2020b (modified) with the following add-ons: o ROS Toolbox o Robotics System Toolbox o Signal Processing Toolbox o Instrument Control Toolbox o Control System Toolbox o System Identification Toolbox o UAV Toolbox Matlab’s modifications will be explained in subsection 4.3.2.1. Detailed hardware requirements (e.g., batteries) are found on Appendixes A and C. 4.2 DEVELOPMENT OF THE INTERFACE A user-friendly interface for the experimentation with the drones at UPC was needed to alleviate the amount of background knowledge and experience in both control theory and programming that was required to carry out experiments. The development of one in a familiar setting for professors, students, and researchers at UPC ESEIAAT was necessary. MathWorks’ products presented themselves as an ideal substitute to replace the former interface the university had developed. Note that the university has full licence to the software. Initially, a control manual for the drone was facilitated by the professors, which documented every step of the code execution process in an Ubuntu OS. It described a short but useful guide on how to work with the UAV and its framework in open loop. Because the manual was prequel to the existence of the gyroscopic test bench, it proved insufficient for experimentation in the current setting. Therefore, an extensive step-by-step guide was therefore written as part of the dissertation’s objectives. It contains the latest advances in the experimentation process and can be found in Appendix C. It was developed as a standalone document to be used for educational and research purposes. This will avoid having to read through the main body of this dissertation. As explained earlier, this chapter only explains the decision process of the interface. Professors have already developed laboratory classes for the course
36│ ‘Modelling and Analysis of Dynamic Systems’ [70] based on this Appendix. The interface is expected to be used for numerous courses. 4.3 ROBOT OPERATING SYSTEM (ROS) The previous interface made use of the Robot Operating System (ROS), an opensource middleware. It was utilized to connect equipment such as the quadrotor with the laptop through Wi-Fi (Figure 5). The first efforts for the implementation of the interface of this dissertation were dedicated to try and run the C++ scripts upon which the ROS middleware was working on. Nevertheless, this proved to be infructuous. The second and final attempt was intended to facilitate the use of ROS by minimizing the number of C++ scripts that were executed while replacing them with Matlab scripts and Simulink interfaces. Both attempts will be explained. Figure 5: Work environment diagram Adapted from source: [8] As general information, the middleware offers all the features an operating system (OS) should have, such as hardware abstraction, low-level device control, common functionality implementation, message-passing between processes, and package management. Additionally, it offers resources and libraries for finding, creating, writing, and executing code across numerous machines [71]. The main component of its architecture is the ROS Master node, which offers naming and registration services to other nodes within the ROS framework (Figure 6). It maintains a record of publishers, subscribers, and services associated with topics. The purpose of the Master is to facilitate inter-node discovery, allowing individual ROS nodes to locate one another. Once the nodes have identified each other, they engage in peer-to-peer communication [72]. The middleware provides a mechanism for initiating the master and multiple nodes simultaneously, utilizing a launch file. This launch file is an XML document. The utilization of these type of files is prevalent in numerous ROS packages. Any system
37│ that employs more than a couple of nodes is prone to employ launch files to define and set up the nodes that are required [73]. Figure 6: ROS Master node Adapted from source: [74] 4.3.1 FIRST ATTEMPT After the decision was made regarding the software to be used for the interface, the first intention was to execute the old manuals’ scripts through the Matlab command window. For this purpose, MathWorks’ functionalities were analysed, and an attempt was made to develop a Matlab script. After some research, it was found that the software had a suitable command called ‘system’ that enables the execution of Operating System commands (in this case Linux) and returns its output in the command window, similarly to the execution of a script on a Linux terminal [75]. Prior to proceeding, certain aspects of the script will be explained to understand why the endeavour was unsuccessful. After connecting the battery and powering the quadrotor up, the ROS Master Node had to be ran inside it. To do that, a secure shell (SSH) connection through a Wi-Fi channel on a Linux terminal was established, as explained thoroughly in Appendix C, section IV. The prompt inside Matlab’s command window would look like this: command = 'ssh [email protected]' system(command) After the connection was established, the ROS master node could be executed as follows: roslaunch asctec_hl_interface fcu.launch
38│ Figure 7: Execution of ROS Master in Matlab After that, the command window began to reproduce the command’s outputs, that is, the Master Node’s status. This contained relevant information for the user, such as the IMU’s status or the topics on the network. Because of this reproduction, Matlab’s command window was taken over by the command itself and did not allow further use of the window. No further scripts were allowed to be executed. Basically, this command turns the command window of Matlab into a Linux terminal (Figure 7). This is because, as explained, the ‘system’ command returns an output for a given input. The experience then proved that the command window was not a flexible interface to work with, as it could only execute one script at a time. The execution of the ROS master node for the quadrotor was therefore not done through Matlab. It was then done through an Ubuntu terminal. An advantage of this is that the node’s status (including the battery voltage) may be consulted on necessity in the above-mentioned terminal. 4.3.2 SECOND ATTEMPT Other functionalities of the MathWorks’ framework were explored to build the interface around it. The dedicated ROS toolbox [76] was found. Note that it is still in development and software bugs are being addressed constantly by the company. However, it provided the necessary tools to build an interface after several problems were resolved. A very helpful command that the toolbox did have was ‘rosinit’, which allowed the connection of the
39│ MathWorks’ framework with the ROS Master executed on a given IP address [77], which was running on an Ubuntu terminal, as explained earlier. The command execution could look like this: ipaddress = '10.0.0.200'; % drone's IP address to which the laptop connects rosinit(ipaddress) The result of this is further explained on the corresponding code found on Appendix D, item I. The interaction of the toolbox did, indeed, set back the start of the experimentation phase because the pre-existing scripts were not executable in Matlab, and because the toolbox had major compatibility problems, as it will be explained in the following subsection. 4.3.2.1 Message registration According to the quadrotor’s control manual, a script called ‘ctrl_test.cpp’ was needed to provide the UAV with the necessary inputs. It can be found on Appendix D, item III. The script was then analysed with the intention of reproducing its contents inside Matlab and Simulink. However, a new problematic arose: the ROS messages. The middleware is built to work with compound data structures. This makes it more efficient in terms of data transfer, as the structure can have all the necessary information for a particular application. Some basic messages are built into Matlab, such as the ‘geometry_msgs/Quaternion’ message. For example, to create a new empty message of the type, the following code line can be executed on the command window: msg = rosmessage("geometry_msgs/Quaternion","DataFormat","struct") Which would output the following: Figure 8: Creation of an example ROS message inside Matlab
40│ The ROS middleware also allows the creation of custom messages, which are used to develop libraries. That was the case for the library ‘asctec_mav_framework’, coded by ETH Zurich [24], [78], and the resulting custom messages were not part of the ROS toolbox. However, Matlab did offer a solution for the problem. The toolbox had a command that enabled the registration of custom ROS messages. It was called ‘rosgenmsg’, for which a guide was available [79]. Additionally, the toolbox had inflexible requirements [80] to that end (Figure 9). The command could only be used on Matlab R2020b release or above, and the software Python 2.7 and CMake 3.15.5+ releases were expressively needed to register the ROS custom messages according to the step-by-step guide. Figure 9: ROS toolbox requirements Source: [80] These requirements presented several compatibility issues with the laboratory’s computer. First, the Matlab release installed at the time was R2018a. An update was then necessary. Secondly, it was imperative that the laptop’s CMake release stayed as it was before (release 3.10.0). This was because the quadrotor needed this particular release to compile its workspace correctly and, subsequently, execute its scripts properly. A workaround was then required to force Matlab to work on CMake 3.10.0 release instead of the 3.15.5+. The solution was documented on a step-by-step guide on Appendix C, item IX. To summarize, Matlab’s internal scripts had to be accessed and altered manually to force the software to make use of a lower release of CMake for the compilation process involved while executing the registration of messages. Note that, although it is not against MathWorks’ copyright to make the changes on internal scripts, they oppose to the idea of users altering or editing them [81], [82]. The toolbox’s Python (2.7) release requirement had
41│ no compatibility issues with the computer since they both used the same release. Note that, even though Matlab releases R2020b through R2021b could be used for the same purpose, the Ubuntu OS used in the laboratory (release 16.04) worked better with older versions of the software. After forcing the system’s compatibility, the MathWorks’ guide for the registration of custom messages [79] could be followed without further problems. The newly registered messages were then available to be employed inside the MathWorks’ framework. This allowed the creation of the ‘mav_ctrl’ message (Figure 10) used in the quadrotor’s code (Appendix D, item III). Figure 10: ‘mav_ctrl’ message after registration To turn on the motors, the ROS custom service called ‘fcu/motor_control’ was used. It was registered alongside the custom messages, as previously explained. As explained, in ROS, the services make use of a client-server type of architecture for communication (Figure 6). The client (Matlab) creates a request and sends it to the server (ROS master node running in the quadrotor). In this case, the client demands the server to turn on its blades. Then, the server produces a response, either positive or negative. The code is printed on the command window. This can be interpreted in the following Matlab code shown in Appendix D, item I: client = rossvcclient("/fcu/motor_control","DataFormat","struct"); request = rosmessage(client); request.startMotors = true response = call(client,request,"Timeout",10); if response.motorsRunning == true disp("The motors are ON")
48│ ‘Timeout’ parameter inside the Serial Configuration block. It needed to be reduced from 10 to 0,01 seconds (Figure 18) to match the sample time of the model. This lowered the data quality, as it will be explained later. The resulted signal after the solution can be observed in Figure 22. Figure 19: Encoder jumps It is important to point out that the system identification process experienced difficulties because the gyroscope’s output was unreliable for a long period of the dissertation’s timespan. Note that the angular position data collected from the encoders has a much lower noise level than the data from the quadrotor’s IMU sensors and was therefore the preferred option to work as input in the identification process. The consequences of this fact will be further explained during the system identification (chapter 6). Lastly, the system mode seen in Figure 16 displays whether the system is working with encoders (mode equal to 2) or with motors (mode equal to 1). Even though the test bench has interchangeable motors, they were not used in this dissertation because the actuators of the system are the quadrotor’s motors. Nevertheless, the gyroscope’s motors could be used in further research to simulate disturbances (i.e., wind) and see how they affect the system. This will be further commented on chapter 8. Note that the motors cannot work with encoders at the same time.
49│ 5. PARAMETER ESTIMATION This chapter is dedicated to the explanation of the gimbals’ motion through an equation. It uses it for the estimation of parameters such as inertia and friction coefficients for the gimbals. It helps to understand the quadrotor-gyroscope system before the identification process starts. This chapter uses the interface developed in the previous chapter. The platform’s manufacturer was contacted. Basic physical parameters (i.e. inertia, mass) and 3D models (Figure 20) were delivered by Eureka Dynamics. Figure 20: 3D model of the platform 5.1 SYSTEM DATA COLLECTION Before any estimation could be done, some simple tests needed to be conducted to get a glimpse of what physical elements had an effect on the system when certain initial conditions were imposed on the equipment and infer the nature of the motion through mathematical equations.
50│ Figure 21: FFTGyro at UPC ESEIAAT Source: Manufacturer’s website At first, the outer gimbal (yaw) and the plate (roll) were virtually fixed in their movement and only the inner gimbal (pitch) was moved away from its horizontal equilibrium point (Figure 21). Therefore this last axis was allowed to move freely with an initial angular velocity equal to zero. Figure 22 is a plot of one of the datasets gathered from this experiment. The gathered data has minimal noise and is not visible in this scale. Additionally, and since the gimbals’ resting position do not coincide with the encoders’ zero angle reading, the data was displaced on the pitch axis and a compensation was necessary. Figure 22: Plot of the inner gimbal motion It is clear that the gimbal has an angular velocity equal to zero for the first part of the test. This is because the system is artificially stopped and then released. There are several problems with this data as it is shown. One of them is knowing the exact moment when the
51│ ring was released, and the motion started. For that purpose, a simple data treatment was necessary. The first semi cycle going from negative to positive angles is discarded. The cusp of the first oscillation will be the starting point. This point will be regarded as 𝑡=0, as seen in Figure 23. This is because the velocity is zero by definition and only gravity and friction will influence the system at this point forward. In the following section, the use of the experimental data as shown will be further explained. Figure 23: Data treatment on one of the gathered datasets 5.2 SIMULATION AND MATCHING The end goal there is to estimate parameters of the machine with the drone strapped to it. One of the most relevant physical properties that are missing from the system is the friction coefficient. For that purpose, Newton’s 2nd law for rotational motion was used. By analysing the system, a simple yet nonlinear system was found: 𝐽𝜃=𝐹×𝑟−𝐵𝜃 Equation 1: Gimbals' rotational motion Where 𝐽= moment of inertia, kg*m² 𝜃= angular velocity, rad/s 𝜃= angular acceleration, rad/s² 𝐵= rolling friction coefficient, kg*m²/s 𝐹×𝑟= torque due to gravity, N*m 𝐵𝜃= torque due to friction, N*m 𝐹= force vector due to mass displacement, Newton
52│ 𝑟= distance between mass displacement and the system’s centre, meter Here, the torque due to friction was modelled as linear. If treated as nonlinear, the component could have a very different shape depending on the physical system at hand. Note that only linear systems and components are within the scope of the work. Additionally, 𝐹×𝑟 is the torque resulting of the displaced centre of mass for any given angle. Since the system’s mass and its distance 𝑟 cannot be measured, it will be presented as a single constant 𝐹𝑟. This is because they are both constants and cannot be separated. Moreover, little could be gain from knowing the exact values of both separately. Moving forward, the equation represents the sum of torques present in the system around a given axis, which is equal to the moment of inertia 𝐽 multiplied by the axis’ angular acceleration as follows: 𝐽𝜃=−𝐹𝑟sin𝜃−𝐵𝜃 Equation 2: Simplified equation Where −𝐹𝑟= simplified term for 𝐹×𝑟 in a given direction, N*m The simplified Equation 2 represents the motion of both the pitching and rolling. The terms are negative because they oppose the motion. For the yawing, the torque −𝐹𝑟 disappears because gravity does not act directly on this ring. The only torque acting on it is due to the friction at the joint of the spinning axis. Figure 24: Simulated system inside Simulink interface Where 1 𝑠= integrator in Laplace domain 𝜃= angular position, rad 𝜃= angular velocity, rad/s 𝜃= angular acceleration, rad/s² As expected, the machine has an equilibrium point were the sum of torques is equal to zero. Ideally that would be the horizontal plane. This is not the case in the laboratory. With
53│ and without the drone, the system was fairly unbalanced in the inner gimbal (pitch), as observed in Figure 25. Figure 25: Inner gimbal stationary unbalance The equation marked another odd effect in the machine. For example, the inner gimbal (pitch). If the centre of mass coincided perfectly with the axis, then it would mean that the first term on the right (𝐹𝑟) would be equal to zero, which in turn would render the second term (friction) equal to zero because of its dependency on angular velocity, resulting in the gyroscope’s balance. Extrapolating to every possible angle where that condition is met, the system would have an infinite number of equilibrium points. This was not the case in the laboratory and will be explained next. The reason of the practical inexistence of infinite number of equilibrium points came from the commented imbalance, which acted as a torque due to gravity. The first torque is then only equal to zero when the machine is in the horizontal plane, aside from the mass displacement, which rendered resulting resting point not equal to zero. This was true for the pitch and roll, but not for the yaw, because the yaw was not affected by gravity.
54│ Contemplating the system with or without drone, its resting point seems natural on the outside. Nevertheless, further analysis proved that the described motion was only possible when the centre of mass is below the axis in relative terms. In this case, if the roll axis were to be tilted upside down, then the torque 𝐹𝑟 would point in the opposite direction, turning the ring completely around its axis in search for its equilibrium point. After the analysis, tests were carried out to see if the equation adjusted itself fairly to the data set. The starting point of the tests was the following: the initial angle was measured, and the angular velocity was equal to zero (𝜃0=0). Additionally, the platform’s inertia was information given by the manufacturer. Adding the drone to the set could only increase the inertia of system, so the overall inertia of it when the drone is mounted would be higher than the rings’ alone. In this case, the pitch was tested first, and the results can be seen as follows. 5.2.1 PITCH, ROLL AND YAW Reproducing the previous equation inside a Simulink interface allowed for parameter estimation. For it, the Parameter Estimator App was used [83]. The toolbox allowed to set the starting point for the parameters’ constant values for the estimation. Setting a strict limit to the possible parameter values was crucial to get reliable results in this process. The inertia was the only reference of a constant value that there was prior to the experiments. To that end, and starting with the inner gimbal, its inertia (Izz in this case) was extracted from the gyroscope’s datasheet, as seen in Table 1. It was necessary to add the pitch axis’ moment of inertia to the roll axis’ moment of inertia (Table 2) around the 𝑧 and 𝑥 , respectively. The difference is that the pitch gimbal spined around its origin with respect to the 𝑧 axis and the roll gimbal does it around its centre of mass with respect to the 𝑥 axis. It is to be noted that the manufacturer only provided the characteristics of the gimbals separately, not as an assembled machine. Item Description Dimensions – L x W x H 1016,55 mm x 54,80 mm x 1082,30 mm Mass 4512,086 g Volume 7,408·105 mm³
55│ World X, Y, Z 0,00 mm, 0,00 mm, 0,00 mm Centre of mass 0,645 mm, 0,01 mm, 534,87 mm Moment of Inertia at Centre of Mass (g mm²) Ixx 5,096·108 Ixy 27,877 Ixz 1,069·106 Iyx 27,877 Iyy 1,053·109 Iyz 19,506 Izx 1,069·106 Izy 19,506 Izz 5,468E·108 Moment of Inertia at Origin (g mm²) Ixx 1,800·109 Ixy 0,001 Ixz -4,865·105 Iyx 0,001 Iyy 2,344·109 Iyz -23113,911 Izx -4,865·105 Izy -23113,911 Izz 5,468·108 Table 1: Inner gimbal (Pitch) specifications. Source: Eureka Dynamics (internal communications) Both axes were moving in the first experiment and need to be considered as a starting point for 𝐽 as follows: 𝐽=𝐼𝑧𝑧𝑝𝑖𝑡𝑐ℎ+𝐼𝑥𝑥𝑟𝑜𝑙𝑙=5,468·108𝑔𝑟·𝑚𝑚2+1,255·108𝑔𝑟·𝑚𝑚2=0,6723 𝑘𝑔·𝑚2 Where 𝐽= system’s inertia in the pitch gimbal, kg·m² 𝐼𝑧𝑧𝑝𝑖𝑡𝑐ℎ= pitch gimbal’s inertia without the drone, gr·mm² 𝐼𝑥𝑥𝑟𝑜𝑙𝑙= roll gimbal’s inertia in the pitch rotating axis without the drone, gr·mm² Item Description Dimensions – L x W x H 295,40 mm x 194,40 mm x 980,00 mm Mass 1885,897 g Volume 3,645·105 mm³ World X, Y, Z 0,00 mm, 0,00 mm, 0,00 mm Centre of mass 0,00 mm, 56,648 mm, 490,00 mm
56│ Moment of Inertia at Centre of Mass (g mm²) Ixx 1,255·108 Ixy -7,062·10-9 Ixz 10956,25 Iyx -7,062·10-9 Iyy 1,321·108 Iyz 3,752·10-7 Izx 10956,25 Izy 3,752·10-7 Izz 9,539·106 Moment of Inertia at Origin (g mm²) Ixx 5,843·108 Ixy -4,187·10-7 Ixz 10956,25 Iyx -4,187·10-7 Iyy 5,849·108 Iyz -5,235·107 Izx 10956,25 Izy -5,235·107 Izz 1,559·107 Table 2: Plate (Roll) gimbal specifications. Source: Eureka Dynamics (internal communications) The other variables (𝐹𝑟 and 𝐵 ) are expected to land in a similar range with their respective units. The following constants were established as a starting point: 𝐹𝑟=1 𝑁· 𝑚 𝐵=0,1𝑘𝑔·𝑚² 𝑠 The angle is in radians, as it is also the case inside the model seen in Figure 24. Just before the scope’s entry, there is a change of units from radians to degrees (through the 180/π gain) necessary for the unit match of both the simulation and the dataset gathered from the encoders. The experiment was set up inside the Parameter Estimation App [83] to minimize the error according to a Sum Square Error (SSE) algorithm built inside it.
57│ Figure 26: Experiment setup inside Parameter Estimator App The software had the settings as shown in Figure 26. The output is the data gathered from the experiments, and the initial states are the initial pitch angle and initial velocity. Given that both initial states were known, they were fixed at the start of the estimation. Otherwise, the system could find a local minimum to the cost function which is minimizing. This may not be the real values of the constants, which is the reason why the data from Eureka Dynamics was so important. Then, initial constant values are established as a starting point, setting the gimbal inertia to a minimum value according to its datasheet (Table 1, Izz). This value is only expected to increase due to the presence of the drone. Given the moment of inertia’s equation for a solid as follows [33]: 𝐼𝑧𝑧=∫(𝑥+𝑦)𝑑𝑚 Equation 3: Moment of inertia. Formula. Where 𝑑𝑚= infinitesimal mass, kg 𝑥= distance of the mass 𝑑𝑚 to the 𝑧 axis, m 𝑦= distance of the mass 𝑑𝑚 to the 𝑧 axis, m
64│ possible. The end goal was to find suitable models that made it plausible to tune flight controllers mathematically. A robust control technique was needed to counteract the limitations of the system identification algorithms here employed. It was decided that all input variables would be tested separately. The decoupler built in by Ascending Technologies (AscTec) allowed this type of system identification. Additionally, it was decided that the first variable to be tested was the pitch 𝜃. It would be followed by roll 𝜙 and yaw 𝜓, respectively (Figure 34). One of the hypotheses that resulted from section 5.2 was that the pitch 𝜃 and roll 𝜙 angles present a similar response to a given input. The yaw angle was left last due to the different nature of the movement. That came from the fact that gravity produced no torque opposed to the system’s rotation around the Z axis other than the friction’s torque, unlike the pitch and roll rotations. The results will be discussed later in subsection 6.2.3, where the outcome of the outer gimbal’s movement is further explained. Note that the quadrotor can have positive and negative values for all inputs in terms of percentage, from 100% to -100%. The thrust input (Z) is the only exception, with a range of 0% to 100%, because it controls the altitude of the UAV. For more information, refer to section 4.4. Figure 34: AscTec Hummingbird quadrotor’s rotations Adapted from source: [84] 6.1.1 PITCH ANGLE EXPERIMENTS The first experimentation conducted was therefore applied to the pitch input variable (X in percentage referred to Figure 33). The input and output datasets for the first iteration are displayed in Figure 35. The first 15 seconds was the stabilization period, which was carried out in every test. The data clearly shows that the pitch angle resembles a nonlinear second
65│ order system, because the jumps between 0 to 5 do not coincide with the jump between 5 to 10 and on. If it were linear, the inputs would produce the same proportional reaction in the pitch angle. That raised the question whether the initial experiments were taking the apparatus too far and into a nonlinear region of operation. The nonlinear nature was studied in chapter 5. The system’s motion around the pitch and roll gimbals is explained by Equation 2, which had nonlinear components. A change in the experiments was introduced to test this hypothesis. It assumed that the system could be regarded as linear around an equilibrium point. Note that this assumption does not work for every system [62]. Setting a threshold of ±5%, the hypothesis was that the system could be approximated as a linear system if the angles were small (sin𝜃≅𝜃, Equation 2). It was then tested with the input signal seen in Figure 36. The result (output signal) is also displayed. From these lines of experimentation two main conclusions were drawn for the system: a) it could not be regarded as linear, even if it were working around an equilibrium point, and b) it did not have a dead zone for this gimbal, which dismissed this potential source of nonlinearity. Figure 35: First iteration’s input and output Another hypothesis for this apparent nonlinearity was that the thrust in those initial experiments was insufficient to replicate the hovering state of the drone in the air. The value was set at 15% in the first iteration. To put this second hypothesis to test, a measure of the input values that produced the hovering state was needed. For that, an informal experiment was carried out. The UAV was dismounted and left on the ground. Then, while keeping the
66│ X, Y and Yaw inputs at 0%, the thrust input (Z) was increased until the hovering state was reached. The percentage value of thrust at which that happened was noted, which happened to be 42,5%. The third iteration applied the results from this test and was carried out with this value. Figure 36: Input and output signals for second iteration Some important notes gathered from the first iterations can be laid out here. It was quickly noted that the batteries did not last long with the new thrust value imposed on all tests. In fact, they only lasted up to seven minutes of raw experimentation per battery. Unfortunately, several experiments had to be stopped prematurely. Lean time was, therefore, around four minutes of useful data per battery. This was not caused by a communication problem between Matlab and the quadrotor. The problem resided in the drone’s board. Either the low-level or high-level processors (LLP, HLP) would lose connection to each other and had an impact on the motors, causing them to stop working for a brief moment (voltage drop pointed in Figure 35). This could happen at any moment during the tests and for any input and for no apparent reason. That meant that the data could only be trusted up to that timeframe, even if the processors continue to work properly. The source of the problem was found by recording the control data being published in the corresponding ROS topic (‘/fcu/control’). Matlab did publish the right commands, but the drone did not respond. Even though, it was not a MathWorks’ framework problem, and to minimize it, the implementation of the controller’s algorithm would be done exclusively inside the quadrotor. Only the setpoints (SP) would be delivered through Matlab. Fortunately, the quadrotor did have the necessary code to set up a control algorithm inside it. Controllers,
67│ such as PID or any of its variants (PD, PI, etc.), were possible with relative simplicity after tuning them (see chapter 7 for tuned algorithms). Nevertheless, the quadrotor would have to work solely based on the sensors’ measurements for that part. The test bench encoders could still be used for the model identification that is presented in this chapter. Figure 37: Pitch angle output. IMU versus encoders For all the experiments, the drone was oriented in such a way that the Euler angles coming from both data sources were inverted (Figure 37). This mistake could easily be mended by a posttreatment of data by inverting the signals. It was left at that position throughout the experimentation because this inversion would not pose any impediment. The longer the experiments lasted, the more informative the data collected from them is [54]. Because of the sudden communication failure, the experiments could only last up to 150 seconds without presenting problems, but usually they had a much shorter duration. Although the first iterations seem informative and an identification algorithm could find a model that explains it in linear terms, the inputs lacked contents in the frequency domain that would excite the system enough to call the output informative enough [54]. The inputs so far served the purpose of initial understanding of the inner workings of the system. They also gave enough information to expect a second order system resulting from the identification process for the pitch angle 𝜃. The next few iterations were modelled as white noise. As it has equal amount of energy across all the frequencies, it was the perfect input signal. An example can be seen in Figure 38 with a period of 5 seconds between jumps. It is displayed alongside the output signal collected from the encoders.
68│ Figure 38: Input and output signals for the next iterations Several tests were carried out using this type of input, ranging between ±10% of the total power of the system. They were used to identify the model for pitch 𝜃, as it will be shown on the following section. 6.1.2 ROLL ANGLE EXPERIMENTS After gathering enough data for pitch 𝜃, it was expected that the roll 𝜙 would behave similarly. To test it, the same procedure and tests was applied. One of the initial experiments is displayed in Figure 39. Varying the Y input (power reference in usage percentage) between ±5%, visual comparison between pitch 𝜃 and roll 𝜙 gave out an important initial conclusion. It was clear that the roll response was much faster than the pitch response. This dynamic characteristic was expected to be identified by the algorithm while performing the system identification in Matlab’s toolbox. The drone-gyroscope duo responded objectively faster to the same input range for this direction and had no delay. It was also an important finding in chapter 5, because inertia in this direction was smaller. The system oscillated much faster around the roll axis than around pitch axis. Another element that was clear is that roll angle 𝜙 did not have a dead zone around its equilibrium point.
69│ Figure 39: Initial input and output signals for roll Visual comparison between the data quality of the inner gimbal (pitch) and the plate (Figure 36 and Figure 39 respectively), the hypothesis arose that either: a) the noise came internally from the boards and were not due to external disturbances, b) this type of rotation was affected by some unknown source of noise which moved through the physical system and affected the motors’ performance, or c) the roll angle had a lower inertia than the pitch angle and therefore moved much faster, ergo the error was amplified. The first hypothesis was tested by comparing both the gyroscope and the encoders outputs, as seen in Figure 39. Between both signals, a difference can be seen. That difference could be imputed to the IMU readings. The problem may also be due to the drone not being entirely tightly fastened to the platform, which was intentionally done to avoid damaging its components. Because of it, the gyroscope’s readings will be favoured against the IMU’s in the identification phase. The other two hypotheses were tested in section 6.2 during the identification and validation processes. More dynamic inputs were experimented, with 5 seconds step changes in the input signal, one of which is displayed in Figure 40. The higher frequency of the input signal will allow the algorithm to better identify the dynamics around the roll axis, as done for the pitch axis. The results resemble the ones from a second order system, perhaps with a zero in the transfer function. They will be further analysed and utilized in subsection 6.2.2.
70│ Figure 40: Second iteration of roll experiments 6.1.3 YAW ANGLE EXPERIMENTS Third and last came the yaw angle or outer gimbal. As a general comment and unfortunately, the yaw output shares the namesake of its input ‘Yaw’, as displayed in Figure 12 in the Bus Assignment block, which is explained on the paragraph below it. It can also be seen in Figure 33. Physically, it was clearly different from the rest. The first difference was that it was not directly affected by gravity as the other two. Therefore, the gravity component of Equation 2 (𝐹×𝑟) is equal to zero. That means that the system had infinity amount of equilibrium points, since it was stable at any given angle of the 360º degrees of rotation for an input equal to zero. In addition, the intention behind the identification is to control the angular position of the outer gimbal. When an input signal was applied to it, the angular position constantly changed. The reason behind it was that the system has a natural integrator. Summarizing, for a given constant input, the constant output response of the system was the angular velocity of the gimbal 𝜓, not its angular position 𝜓. For the reason explained previously, the angular velocity readings were initially intended to be utilized for the system identification. Then, the integrator would be forcibly added to the resulted model, and the complete mathematical expression that related the input with the angular position 𝜓 would be obtained. To that end, three sources of angular velocity were available: a) the IMU’s angular velocity published on the ‘/fcu/imu’ ROS topic, b) the angular position coming from the same ROS topic, or c) the angular position coming from the gyroscope’s encoders. The last two options could then be differentiated to obtain the angular velocity. Unfortunately, all of them are indirect measurements of the variable,
71│ which is highly discouraged [62], [85] because of its high sensitivity to noise. Ideally, the measure should be done with a tachometer, which is more robust against noises. The differentiation of the angular position coming from the IMU was therefore discarded, because its noise would only be amplified by the mathematical operation. In the first iteration of experiments, the velocity datasets obtained from the IMU were recorded, clearly exhibiting a signal with a high noise content. The input and output signals are displayed in Figure 41 and Figure 42 respectively. Those experiments were hardly usable to identify the underlying dynamics for obvious reasons, but it did show an initial sign of a dead zone around ±5% of power usage. Figure 41: Input signal. First iteration of outer gimbal's experiments
72│ Figure 42: Output signal. First iteration of outer gimbal's experiments The second iteration followed with an extended range in the input power applied to the system, ranging between ±40%, far exceeding the previous ranges of the other two variables. This can be observed on Figure 43. The outer gimbal (yaw) was expected to be the slowest because of its high inertia with respect to the plate (roll) and inner gimbal (pitch), as commented in subsection 5.2, which also demanded the increase in the power range. It could also be hypothesized that yaw is linear in an extended range of its input, because the nonlinear angle-dependent gravity component of Equation 2 did not affect it. Figure 43: Second iteration of outer gimbal's experiments
73│ Due to the high inertia, whose influence stood out during the second iteration, it was decided that the ‘Yaw' input signal’s period needed to be increased from 5 seconds to 15 seconds. This was done to better capture the dynamics throughout the tests. Nevertheless, this impacted negatively on the information contained on the signals recorded from the experiments. This is because the increase in period meant a decrease in frequential content of the input signal. Therefore, the system could not be as energetically excited as previously expected. One way to counteract it was to extend the duration of the experiments [10]. The third iteration included this improvement. For this row of tests, an extended range of inactivity was seen beyond the ±5% dead zone discussed earlier, which will be tested further and validated in the third iteration. Note that the signal from the gyroscope (Figure 44) has the opposite direction as the signal from the IMU (Figure 45) for yaw. Figure 44: Third row of experiments The third row of experiments relied on the output data from the gyroscope instead of the IMU’s angular velocity. Studying Figure 44, the dead zone was validated, as the angle was barely sensitive around ±15%. It was to be avoided intentionally in the fourth iteration. To stay away of this nonlinearity, the lower limits were set to ±20%. In the future, this property would hinder the controller’s actions over the motors to reach and maintain the setpoint (SP). For that reason, it was expected that yaw would a hard angle to control in the future.
80│ 6.2.1 PITCH ANGLE MODEL After gathering enough data for pitch angle 𝜃 and its response to several different inputs, the model identification could begin. Alongside each test iteration, there was an adjacent identification to better understand the system. Many improvements to the tests’ design came, not only from the analysis of the data itself, but from the analysis of the identification models for each iteration. Only the most relevant findings will be shown in the following subsections. The dataset in Figure 38 was utilized to obtain a model. The raw measurements from the last row of test are like the one displayed in the mentioned figure and were used to validate the results inside the software. Adding to the previous knowledge of the system gathered in previous sections and chapters, the delay had to be calculated. After several calculations done in Matlab through its ‘delayest’ function [92], the raw data was estimated to have a delay which revolted around ±4, which means 0,04 seconds’ delay, which was negligible in practical terms. This result could mean that the command could be misinterpreting noise for delay. Even though, a second order system is expected to suit the data the best, a comparison between the models of various poles and zeros visually helped understand the system better. Figure 49: Pitch model identification. Comparison between lower-level models. The workflow (Figure 46) allowed the comparison of models with different number of poles and zeros, i.e. degrees of freedom, as seen in Figure 49. Only the most significant
81│ were left in the figure to simplify its understanding. The name of the model informs about its structure: the number of zeros (+1), poles and delay it has. For example, the ‘oe221’ has one zero, two poles and one sample delay. As explained earlier, the NRMSE fit is displayed in the figure. An early conclusion could be formulated from this result: models with one or no zero deliver similar results. This could mean that the zero on ‘oe221’ could be neglected, which was the case later, as shown in Equation 8. This is explained at the end of the subsection. Higher degrees of freedom (DOF) given to the algorithm did not improve the fit percentage by more than 1%, as it can be seen in Figure 50. It is also clear that some of these structures have a strange behaviour, such as sudden jumps and spikes, which did not correspond with the raw data. For that reason, model ‘oe321’ was discarded, even though it had a higher fit. Figure 50: Pitch model identification. Comparison between higher-level models. Four other experiments besides Figure 38 were utilized for the initial validation. One of them is displayed in Figure 51. The system with two poles and one zero performed the best versus the validation data throughout the process. As a delay equal to zero is not physically possible for a discrete model, the ‘oe220’ model was discarded and the ‘oe221’ was chosen as the pitch model moving forward. The chosen model is the following: 𝑦(𝑡)=[𝐵(𝑧) 𝐹(𝑧)]𝑢(𝑡)+𝑒(𝑡)
82│ 𝐵(𝑧)=1.115·10−5 𝑧−1 − 9.589·10−6𝑧−2 𝐹(𝑧)=1−1.998 𝑧−1+0.9978 𝑧−2 Equation 7: Chosen discrete-time pitch angle model Figure 51: Pitch model validation experiment Given that the model is an OE type structure, the noise is not modelled (Figure 47). The model may seem to have low fit values for the cases shown in Figure 49 and Figure 51. An analysis of the residual errors of the model in a histogram was due to further understand it. As it can be seen in Figure 52 and Figure 53, the noise does not appear to be completely of gaussian distribution. According to [10], [54], [88], this could be explained as follows: 1- The model (Equation 7) could be missing some of the dynamics within the real output 𝑦(𝑡) that are not explained by the estimated output 𝑦(𝑡) . Since a linear system was forced upon a nonlinear one, this outcome was inevitable. 2- Given that the cross correlation of residuals is low, the model does capture the main dynamics, that relate the input and output of the system. 3- Given that the autocorrelation of the residuals and inputs is high, it means that the disturbances are influenced by the dominant dynamics (input-output effect). This also means that the noise was not modelled correctly.
83│ That is implicit in the OE model structure selection. The noise dynamics was not modelled because the experiments were not long enough for the dynamics of both the system and the noise to be discerned from each other and correctly estimated. Further studies could prove that the noise is, in fact, white noise (filtered or otherwise). Figure 52: Residuals of the validation experiment Based on the validation experiment (Figure 51) Figure 53: Autocorrelation (left) and cross correlation (right) graphs Based on the validation experiment (Figure 51)
84│ Additionally, the definition of a ‘good model’ (i.e. model quality), is dependent on its final goal or purpose, which for this dissertation is related to the model’s use in control design [54]. A thorough statistical analysis and fine tuning of the obtained model would have not shown further improvements, given the conditions this study. Continuing with the system identification, and with the information offered by Equation 7, a continuous model could also be found. In control theory, the position of poles and zeros of the system explains its dynamics. In discrete time, their position is dependent on the sample time utilized in practice to gather the data, which does not happen in continuous time. For that reason, they are displayed in the latter, which renders them independent of the time base. The continuous time model in the Laplace domain can therefore be written as: 𝐺(𝑠)=0.01485 0.92·𝑠2+0.2012·𝑠+1 Equation 8: Continuous model for the pitch angle This model had the exact same fit value as the discrete-time model, which proves no information was lost in the transformation. In the continuous model, the zero from the discrete-time model was neglected because it did not affect the dynamics, as it was far from the origin. This could also be done for the discrete-time mathematical expression. The transfer function has the following complex conjugate pair as poles, which explains the oscillation of the system: 𝑠1,2=−0.1094 ± 1.0368𝑖 This concludes the identification and initial validation process of this angle. The continuous model (Equation 8) will be used to tune the PID controllers in chapter 7. 6.2.2 ROLL ANGLE MODEL Moving onto the roll angle 𝜙, the identification phase was done through the experiment presented on the last iteration of experiments. Particularly, the experiment shown in Figure 40 was the one used for the identification phase (Figure 54). The figure shows the posttreatment of the data, as explained for the previous angle. Without it, the fit values would drop considerably.
85│ Note that, for this angle, the output datasets are noisier than the rest. Additionally, and as stated before, the roll angle 𝜙 is expected to resemble the motion of the quadrotor decoupled from the gyroscope, because the machine did not affect (add to) its inertia, in comparison to the other Euler angles. Figure 54: Identification process for the roll angle. Low-level order systems The same workflow as for the previous angle was implemented. As seen in the identification process on Figure 54, the roll angle 𝜙 responded without delay, which was the results of the calculations done with the ‘delayest’ command of Matlab for every dataset. Second and third order systems were tried out based on previous knowledge gathered in section 6.1. No suggestion of the presence of zeros or a third pole were found during the iteration process of identification. The system is, therefore, very similar to the pitch angle, but much faster in open loop, caused by its lower inertia. The models were validated and ‘oe121’ was chosen based on the residuals (Figure 56), their autocorrelation and cross correlation (Figure 57). The analysis of this figures for the roll angle is analogous to the analysis for the pitch angle in the previous subsection. For readability, it will not be repeated.
86│ Figure 55: Initial validation process for the roll angle Using the recorded data, and using the OE model structure, the following model was found: 𝑦(𝑡)=[𝐵(𝑧) 𝐹(𝑧)]𝑢(𝑡)+𝑒(𝑡) 𝐵(𝑧)=6,144·10−5·𝑧−1 𝐹(𝑧)= 1 − 1,974·𝑧−1 + 0,9774·𝑧−2 Equation 9: Discrete-time roll angle ϕ model
87│ Figure 56: Analysis of residuals Based on validation experiment (Figure 55) Figure 57: Autocorrelation and cross correlation graphs Based on validation experiment (Figure 55) In continuous time, the model can be expressed as: 𝐺(𝑠)=0.01868 0.02961·𝑠2 + 0.06778· 𝑠 + 1 Equation 10: Continuous model for the roll angle ϕ
88│ The poles of the transfer function are the following, which clearly show the oscillatory nature of the roll angle 𝜙 by its positioning in the Laplace domain: 𝑠1,2=−1,1448 ± 5,6980𝑖 6.2.3 YAW ANGLE MODEL The last angle, yaw 𝜓, presented different dynamics compared to the other two Euler angles, which were described in sections 5.2 and 6.1. There were three sources of angular velocity available: a) the IMU’s angular velocity published on the ‘/fcu/imu’ ROS topic, b) the angular position coming from the same ROS topic, or c) the angular position coming from the gyroscope’s encoders. The last two options could then be differentiated to obtain the angular velocity. Unfortunately, they are indirect measurements of the variable, which amplified the noise within the signals. In addition, the system had an apparent dead zone around its origin. For that reason, the position measurements coming from the gyroscope (option ‘c’) were used directly (and without differentiation) to find a suitable model. Figure 45 shows the specific input and output measurements utilized to identify the model within Matlab’s toolbox SITB. A ‘ready-made’ model was not possible to find, because the software could not work under the conditions imposed by the natural integrator, as commented earlier in subsection 6.1.3. The continuous model features of the software [93], [94] did allow the implementation of the integrator. An underdamped second order system was proposed alongside it. The results can be seen in Figure 58. Figure 58: Identification process for the roll angle
89│ Although the fit value is objectively low for the identification experiment (~38%), there seemed to be an error in the graph and its value in Figure 58. The result of the algorithm’s optimization process is shown in Figure 59. The ‘Fit to estimation data’ value is the calculated with Equation 6, as explained by author Ljung [54], [86]. For some unknown reason, the displayed value and shape of the graph does not comply with the calculated data. Therefore, the correct value is ~94%. The validation experiments rendered the best results out of all the angles, reaching as low as ~82% and as high as ~94%. One of them can be seen in Figure 60. Figure 59: Results of the algorithm's optimization process for the identification experiment in Figure 58 Residual analysis can be seen in Figure 61. It cannot be considered a gaussian distribution. The noise was also interpreted through the autocorrelation and cross correlation of residuals can be seen in Figure 62. The figure resembles the findings for the pitch and roll angles (Figure 53 and Figure 57, respectively). Although the datasets for the yaw angle 𝜓 might seem noise-free, the velocity measurements certainly had noise, as seen on Figure 42 and Figure 43. Some of it could be caused by the (apparent) indirect measurement of the velocity done inside the quadrotor’s boards, which would not surface in this identification process, since those output signals are not utilized for it. Another source
96│ the effect of any significant initial errors. The minimum value of the integral may be easily seen as the system parameters are changed, making it the performance metric with the best selectivity. However, it does not provide information about the controller’s output values, since it only works with the transient response. It can be written as follows in both continuous and discrete time form (trapezoidal form): 𝐼𝑇𝐴𝐸=∫𝑡|𝑒(𝑡)|𝑑𝑡 𝑇 0 ITAE=∑𝑘|𝑒(𝑘)+𝑒(𝑘−1) 2·𝑇𝑠| 𝑀 𝑘=0 Where 𝑒 is the error between the setpoint and the output, 𝑇𝑠 is the sampling time, 𝑘 is a given sample and 𝑀 is the total amount of samples. The discrete time formula is required to implement it in the calculation software. The characteristic of a system designed according to this criterion is that it has a slight overshoot in its transitory response and that its oscillations are properly dampened. This criterion has good selectivity and is an improved version of the integral absolute error (IAE) criterion. Although it may be easily measured experimentally, it is a difficult criterion to evaluate analytically. The ITAE values should be evaluated between the possible combinations of the same model, and not between two consecutive models. 7.1.2 YAW The yaw angle model was written in Equation 11, which had a negligible pole, given its far off position in the Laplace plane. This rendered the following model and poles: 𝐺𝑝𝑌(𝑠)=0,03808 𝑠·(19,47·𝑠+1)=𝐾 𝑠·(𝑠−𝑠2)=0,0020 𝑠·(𝑠+0,51) 𝑠1=0 𝑠2=−1 𝑇=−0,51 𝐾=0,03808 19,47 =0,0020 Equation 20: Simplified yaw model and its poles After that mathematical operation, the suitable controller structure was selected. Because the system had a natural integrator, it was not necessary to add it in the controller [59]. For that reason, a PD was chosen. After the analysis carried out in last chapter regarding the output signals’ quality (for the yaw angle in particular), adding the derivative term could bring instability and poor control to the loop. On the other hand, if it were not present, the system would need a large proportional term, which could also destabilize the
97│ loop. Therefore, the term was to be kept at a minimum. Using the representation found on Figure 64, the equations can be written as: 𝐺𝑐(𝑠)=𝐾𝑝+𝐾𝑑·𝑠 Equation 21: PD controller transfer function 𝑃𝑉 𝑆𝑃=𝐺𝑐𝐺𝑝𝑌 1+𝐺𝑐𝐺𝑝𝑌=(𝐾𝑝+𝐾𝑑·𝑠)(𝐾 𝑠·(𝑠+𝑠2)) 1+(𝐾𝑝+𝐾𝑑·𝑠)(𝐾 𝑠·(𝑠+𝑠2)) 𝑃𝑉 𝑆𝑃=𝐾·𝐾𝑝+𝐾·𝐾𝑑·𝑠 𝑠2+(𝑠2+𝐾·𝐾𝑑)𝑠+𝐾·𝐾𝑝 Equation 22: Closed loop yaw transfer function The transient-response specifications were set as to induce a fast response and avoid the studied dead zone (section 6.2.3). The drawback of setting it this way was that the closed loop would have a moderate overshoot. The calculations rendered the following results: 𝑀𝑝=10% 𝑇𝑠=40𝑠 𝜉𝑑=−𝑙𝑛(𝑀𝑝 100) √𝜋2+𝑙𝑛2(𝑀𝑝 100)=0,59 𝜔𝑛𝑑=4 𝑇𝑠𝜉𝑑=0,17 Equalizing both characteristic polynomials (denominators) of Equation 12 and Equation 22 renders the following equation: 𝑠2+2·𝜉𝑑·ωnd·𝑠+ωnd 2=𝑠2+(𝑠2+𝐾·𝐾𝑑)𝑠+𝐾·𝐾𝑝 Equation 23: Yaw's pole placement solution
98│ Figure 65: Closed loop yaw angle response Therefore, the solution to the polynomial and its characteristics were: 𝐾𝑝=14,63 𝐾𝑑=76,01 𝑠1,2=−0,1±𝑗·0,1364 𝑧1=−0,1925 𝑀𝑝𝑟=17,5% 𝑇𝑠𝑟=29,4𝑠 𝑃𝑉 𝑆𝑃=0,1487·𝑠+0,02862 𝑠2+0,20·𝑠+0,02862 Equation 24: Yaw's tuned closed loop and its characteristics. First iteration. The step response, settling time and overshoot of the tuned loop can be seen in Figure 65. Its overshoot and settling time were fairly affected by the zero. This was expected, given that the PD controller has only two DOF and the system (Equation 22) has three. The high value of its gains was surprising at first, since the system already had a natural integrator [62]. The results were also against the previous desire for the derivative term’s minimization. Nevertheless, the system was simulated in Simulink using the block diagram seen in Figure 66 to observe whether the characteristics were enough to avoid the dead zone (at least for the first part). The diagram had a saturation block to limit the PID’s output (±100).
99│ Additionally, the loop also had an anti-windup technique algorithm built in, as explained in [65]. As it will be observed in the results of section 7.3, the technique did not active. Therefore, it was omitted in the simulation phase for simplicity. Figure 66: Diagram block for closed loop yaw angle Figure 67: Tuned closed loop yaw angle response. First iteration. Controller’s saturated output u’(t) (top) and response PV (bottom) The ripple at the controller’s output is clearly unwanted, as its presence destabilizes the time-discrete computational implementation. It was caused due to the high derivative term. As this response did not comply with any of the desired control signal characteristics, the PD controller was tuned again, but with more intense specifications. A hypothesis was constructed for setting the new values, which was the following: the dead zone could be used to the control’s advantage if the settling time 𝑇𝑠 was set sufficiently high. As the second necessary condition for this tune iteration, the overshoot 𝑀𝑝 needed to far exceed the first iteration given the previously explained reasons above. If the hypothesis is correct, then the system will settle faster, aided by the dead zone. Therefore, the following desired values were set:
100│ 𝑀𝑝=70% 𝑇𝑠=100𝑠 Rounding up the numbers of the results, the closed loop and its characteristics were: 𝐾𝑝=60 𝐾𝑑=15 𝑠1,2=−0,0403±𝑗·0,3402 𝑧1=−4 𝑀𝑝𝑟=69% 𝑇𝑠𝑟=93,9𝑠 𝑃𝑉 𝑆𝑃=0,02933·𝑠+0,1173 𝑠2+0,08068·𝑠+0,1173 Equation 25: Yaw's tuned closed loop and its characteristics. Second iteration. Figure 68: Closed loop yaw transfer function. Step response.
101│ Figure 69: Tuned closed loop yaw angle response. Second iteration. Controller’s saturated output u’(t) (top) and response PV (bottom) Figure 69 displays the simulated response of the closed loop utilizing the same block diagram, as in Figure 66. Based on the hypothesis, in reality, the overshoot would be high, but the settling time would be far lower. Both the intended characteristics were accomplished during simulation: a) control actions far exceeding the dead zone (±20%) and b) a relatively low derivative term. Before moving onto the test phase (section 7.3), the other two angles’ controllers will be tuned. 7.1.3 PITCH The parametric model for the pitch angle was written in Equation 8. It did not have a negligible pole. Rewriting it in standardized form (Equation 26) would render: 𝑠1,2=−0.1094 ± 1.0368𝑖 𝐺(𝑠)=𝑘 𝑠2+𝑎·𝑠+𝑏=0,01614 𝑠2+0,2187·𝑠+1,087 Equation 26: Continuous model for the pitch angle and its poles A suitable controller structure for a second order model with no integrator (unlike yaw) is a PI, since it nullifies the static error (𝑒𝑠𝑠=0) present with a proportional (P) controller [62]. The derivative term was avoided because of:
102│ a) Stability: the term has the potential to enhance high-frequency noise and disturbances, which could cause the system to become unstable. b) Robustness: the term renders PIDs more sensitive to parameter variations and model uncertainties, especially the derivative term. c) Data quality: the quality of the signals was not reliable. d) Simplicity: a PI controller is easier to tune than a PID. The same logic was applied to the roll angle transfer function (explained in the next subsection). Note that the loop was always closed within the quadrotor (e.g., it made use of the IMU’s readings) and not inside Simulink. That meant that the gyroscope’s readings were not available for the control loop. Figure 70: Closed loop for pitch and roll angles As previously explained, the closed loop system for this case is found on Equation 18. Therefore, the pole placement design can be carried out by solving Equation 19, written as follows: (𝑠2+2·𝜉𝑑·𝜔𝑛𝑑·𝑠+𝜔𝑛𝑑 2)(𝑠+𝑝)=𝑠3+𝑎·𝑠2+(𝑏+𝑘·𝐾𝑝)·𝑠+𝑘·𝐾𝑖 𝑠2→ 𝑝 + 2 · 𝜉𝑑·𝜔𝑛𝑑=𝑎 𝑠1→ 𝜔𝑛𝑑 2+2·𝜉𝑑·𝜔𝑛𝑑·𝑝=𝑏+𝑘·𝐾𝑝 𝑠0→ 𝜔𝑛𝑑 2·𝑝=𝑘·𝐾𝑖 Setting the following reasonable specifications (desired dynamics): 𝑀𝑝=2% 𝑇𝑠=40𝑠 𝜉𝑑=−𝑙𝑛(𝑀𝑝 100) √𝜋2+𝑙𝑛2(𝑀𝑝 100)=0,78 𝜔𝑛𝑑=4 𝑇𝑠𝜉𝑑=0,13
103│ The closed loop plant would not comply with any of the two desired values. The solution to the pole placement equation (Equation 19) does have negative poles, as it should have. However, the zero is positive. Therefore, the system does not comply with the transientresponse specifications (Figure 71). This is also clearly observed with the negative term of the proportional gain 𝐾𝑝. 𝐾𝑝=−66,1 𝐾𝑖=0,0191 𝑠1,2=−0,10±𝑗·0,0803 𝑠3=−0,0187 𝑧1=2,8847·10−4 𝑃𝑉 𝑆𝑃=−1,067·𝑠+0,00031 𝑠3+0,2187·𝑠2+0,02019·𝑠+0,00031 Equation 27: Closed loop for the pitch angle transfer function. Together with its gains, poles and zero Figure 71: System response for Equation 27 Even if the specifications changed (within reasonable limits), the calculations would still produce unreasonable gain values and solutions. Nevertheless, it is still considered stable because the poles are negative. As commented in section 7.1.1, the PI controller only has two DOF and Equation 18 has four parameters (third order system with a zero). Therefore, the pole placement technique renders bad results for these types of systems. The same reasoning can be applied to the roll angle since it had the same structure as Equation 18 when the loop was closed. To tackle this problem, an iterative algorithm was written for the parametrized models. It also worked with specifications such as the overshoot 𝑀𝑝 and the settling time 𝑇𝑠. The
104│ new algorithm rendered a vast number of possible combinations for 𝐾𝑝 and 𝐾𝑖 for the desired dynamics of the system in a closed loop. To better analyse the combinations, the ITAE performance index was introduced. Note that the index was not the only parameter analysed to choose the gains. The behaviour of the plant in closed loop was analysed, which consisted of the settling time, oscillations, overshoot, ITAE index and the gains themselves. Although the algorithm’s tuning is done separately for each model, they are intended to be tested simultaneously as part of the final validation phase. Additionally, the drone’s code had an anti-windup control technique built into it, but it is preferable to avoid reaching limits where its use is necessary. This is one of the advantages of the applied methodology. Additionally, the controllers’ main purpose is to validate the models. As explained in the scope of the dissertation (section 1.2), they are not intended for field usage. The desired dynamics were set as follows: 𝑀𝑝≤2% 𝑇𝑠≤40𝑠 The iterative algorithm's step size was set to 1 to reduce both the computation elapsed time and the size of the solution matrix. The exact code to reproduce this outcome can be found in Appendix D, item IV. The algorithm found four solutions and the best was chosen according to the previous explanations. The settling time and overshoot of the selected loop (Equation 28) can be seen in Figure 72. 𝐾𝑝=3 𝐾𝑖=8 𝐼𝑇𝐴𝐸=79,34 𝑠1,2=−0,052 ± 𝑗 · 1,06 𝑠3=−0,11 𝑧1=−2,67 𝑃𝑉 𝑆𝑃=0,04842·𝑠+0,1291 𝑠3+0,2187·𝑠2+1,135·𝑠+0,1291 Equation 28: Tuned closed loop pitch angle transfer function. Together with its gains, poles and zero
105│ Figure 72: Pitch response for Equation 28 The system was simulated using Simulink based on the same block diagram seen in Figure 70. The results are seen in Figure 73. The tuned gains managed to produce a progressive increase in the output of the controller. For the simulation phase, the system’s integrator did not windup. Figure 73: Tuned closed loop pitch angle response. Controller’s saturated output u’(t) (top) and response PV (bottom)
112│ section. It is recommended that only one Euler angle is controlled at a time. This is to prevent damage to the drone and the user. To accomplish this, set the PID gains for the uncontrolled Euler angles to zero. It will open their control loop. 7.3 RESULTS OF THE IMPLEMENTATION After the analysis of the quadrotor’s documentation and the development of the new controller test interface, the final validation could be completed. The experiments will be presented chronologically; that is: pitch, roll and yaw. The last subsection will present the simultaneous implementation of all the calculated controllers to analyse how they respond. Note that it was not possible to keep all the angles at a fixed position before the input signal stepped in, given the freedom the quadrotor had. The gimbals and plate were completely free during the controllers’ tests, as they were during the identification and initial validation phases. All the tests were carried out with the thrust variable (Z input, Figure 33) at ~40% to replicate the drone’s (virtual) hovering condition. All the controllers’ outputs (and therefore, the system’s input) are shown in their rightful form. That meant that the graphs are not trended (0%→100). For further details, please refer to the paragraph below Figure 12. The controllers were not fined tuned, because it is not within the scope. Overall, the tests and their results are considered the final validation phase of the identification process. To improve readability, Table 5 is presented before each result, to compare the simulated and real responses of the system. The real values are in the expected range, except yaw’s settling time 𝑇𝑠, which diverges significantly as hypothesized. Angle Pitch Roll Yaw Type Sim Real Sim Real Sim Real Kp 3 3 3 3 60 60 Ki 8 8 37 37 - - Kd - - - - 15 15 Mp (%) 0,571 0,856 0 2 69 60 Ts (sec) 37,7 26,79 5 8,1 94 19,7 Table 5: Comparison between simulated and real responses
113│ 7.3.1 PITCH LOOP To summarize the road up to this point, the model found for the pitch angle had a ~66,6% fit value for both the identification and validation experiments (Figure 49 and Figure 51). The discrete model was then approximated in continuous time through a transfer function with the same fit values. Thereafter, a PI controller was tuned for it and the closed loop was tested with a step input signal and the resulting settling time and overshoot were 37,7 seconds and 0,6%, respectively (Figure 72). To avoid stressing the quadrotor, the setpoint was established at 0,6 radians (difference between the steps shown in the figure). The pitch angle’s setpoint and response are observed in Figure 79. Comparing it with the simulated (Figure 73), both graphs have a similar shape. The drone does respond faster than the transfer function and settles in around 28 seconds approximately. Figure 79: Pitch setpoint and response. Kp = 3, Ki = 8 The controller’s output can be observed in Figure 80. Comparing it with the modelled system in Figure 73, the controller’s output had the expected behaviour, and the reasoning above applies again. The final validation phase for this angle concluded successfully for the models found on subsection 6.1.1 under the specified conditions of the experiments and system identification process overall.
114│ Figure 80: Pitch control. Kp = 3, Ki = 8 The next subsection deals with the results of the implementation of the roll angle controller. 7.3.2 ROLL LOOP Moving onto the roll angle, the model had a ~61% and ~64% fit values for the identification and validation experiments respectively (Figure 54 and Figure 55). The discrete model was then approximated in continuous time through a transfer function with the same fit values. Thereafter, a PI controller was tuned for it and the closed loop was tested with a step input signal and the resulting settling time was ~5 seconds, with no overshoot (Figure 76).
115│ Figure 81: Roll setpoint and response. Kp = 3, Ki = 37 According to Figure 81, the real response of the system did take considerably longer to settle than the simulated output, rendering a ~3,5 seconds difference between them. The real and simulated responses did maintain a strong similarity between them and did not overshoot, as specified to the iterative tuning algorithm. This could be due to the fit values. A proportional effect was observed by comparing the controller’s real output and the simulated signal (Figure 82 and Figure 77). As the system responded faster, its controller’s output was proportionally faster. The final validation phase for this angle concluded successfully for the models found on subsection 6.2.2 under the specified conditions of the experiments and system identification process overall.
116│ Figure 82: Roll controller output. Kp = 3, Ki = 37 An additional conclusion could be added to the case. As observed in the identification and validation experiments utilized for this angle (Figure 54 and Figure 55), the controlled signal also had a strong influence of noise. This effect could not be damped even by closing the loop with a control algorithm. This further proves the existence of unmodelled noise, which could also be catalogued as uncontrollable. As they are set, the controller’s gains could be fined-tuned to get the desired specifications stablished in section 7.1.4. 7.3.3 YAW LOOP The final angle was yaw. Backtracking through the process, no discrete parametrized model was found for yaw, because of the SITB algorithm’s limitations with the natural integrator. A continuous time model (a transfer function) was found, which had a ~94% MSE index value for both the identification and validation experiments respectively (paragraph below Figure 58 and Figure 60). Thereafter, a PD controller was selected and tuned, and the closed loop was tested with a step input signal. The resulting settling time and overshoot were ~94 seconds and 69% overshoot (Figure 68).
117│ Figure 83: Yaw setpoint and response. Kp = 60, Ki = 15 Analysing both the yaw response and the controller’s output (Figure 83 and Figure 84), it was observed that the angle was not able to reach its setpoint, even though the controller still output a value different than 100 (0%). Apparently, the setpoint and the response had an offset between -0,11 and -0,17 radians. Furthermore, the controller’s values at which the continuous offset happened were at the range of ~90 (-10%). Considering again the fact that this angle had a dead zone, the control offset is unavoidable as the loop is set (Figure 70). Figure 84: Yaw controller output. Kp = 60, Ki = 15
118│ 7.3.4 SIMULTANEOUS CONTROL Backtracking to the firsts paragraphs of chapter 6, the quadrotor was treated as a decoupled MIMO system equivalent to four SISO system during the identification process (identification, initial validation, and final validation phases). In reality, quadrotor-gyroscope duo was still coupled in a relative low degree. The pitch-yaw and roll-yaw pair were still coupled. This information was omitted to simplify the model identification. Further dissertations could study the system in this direction. The effects of the simplifications were observed clearly through the simultaneous implementation of all the drone’s controllers, although a further analysis will be provided at the end of the chapter. Figure 85, Figure 86 and Figure 87 show the pitch, roll and yaw setpoints and responses. The pitch angle showed an oscillatory nature, even though it was tuned to have relatively little. Figure 85: Pitch response Additionally, it was expected that the noise component of the roll angle was intensified due to the conditions it was working on (simultaneity), together with its nature (Figure 40). Note that the noise and the pitch’s oscillatory nature diminished their amplitude progressively when the yaw’s controller reduced its output (Figure 88). This spoke about the influence of the yaw movement to the other angles.
119│ Figure 86: Roll response Because the yaw reached its setpoint around the 25 second mark, it might be tempting to say that yaw’s control was successful in reaching the desired values within specifications. The hypothesis then emerged that the other controllers were contributing to the movement (not control) of this last angle. This was due to the parity of pitch-yaw and roll-yaw variables, which were coupled to a certain degree. If the experiment could have continued further, more information might have been revealed. Unfortunately, this was fairly difficult, since the actuation on all DOFs at the same time drains the battery of the drone incredibly fast. Figure 87: Yaw response All the controllers manage to reach the stablished setpoints, but only the yaw angle managed to do it within the desired specifications (if the offset is neglected). Unfortunately, the identification process as stablished in the methodology (chapter 3) proved to be unsuccessful when the simultaneity was present.
120│ Some final comments on the simultaneous implementation of the algorithms. There might have been other physical phenomena present during the final experiment of the dissertation. Equation 1 reduced the drone-gyroscope system to an equation explained through Newton’s 2nd law applied to rotation. This was done because only one DOF was studied, while the other were left static. In reality, a gyroscope is objectively more complex than this simplification. Unfortunately, the study of this phenomena is not within the scope of the dissertation but might provide further venues of study. Figure 88: Controllers’ output
121│ 8. CONCLUSIONS AND FURTHER VENUES OF STUDY This chapter is dedicated to the conclusion and results of the dissertation, its impact on the university and its laboratory, and further research paths to be considered for the additional development of tools and knowledge within the university. 8.1 CONCLUSIONS The dissertation had numerous objectives, which were all accomplished. Its most important one was the development and implementation of a drone-independent methodology on the system identification of a quadrotor mounted on a gyroscopic test bench, with the necessary development of frameworks and interfaces for the current and future studies. After the literature review done on the subject, it was concluded that interest in the development and utilization of test benches (gyroscopic or of other type) for UAV research spiked in recent years alongside the interest in UAV themselves. Nevertheless, no record was found on the utilization of the system identification techniques used for this dissertation. The research done by the scientific community utilises complex models based on physical relationships between the variables and unknown parameters of the system. The dissertation diverged from the norm to study whether a parametric model could be estimated without imposing a physical interpretation of the system. Before the identification, communication tools and user-friendly interfaces were developed successfully as a versatile package solution. They consisted of scripts and models for the MathWorks’ products Matlab and Simulink. They are accompanied by descriptive guides and plagued by good practices, to avoid their incorrect harnessing. In the present, it has already contributed to Universitat Politècnica de Catalunya, whose teaching staff already employ the interfaces and frameworks as a learning tool for students on a regular basis. In the future, the framework could be further exploited to test other types of identification and control techniques in research and dissertations alike.
128│ forests-from-the-air- 170048595.html?guccounter=1&guce_referrer=aHR0cHM6Ly93d3cuZ29vZ2xlLmN vbS8&guce_referrer_sig=AQAAADj1wWSqIUJztEHkrc5SGJnhCMDct9Ll7Dw- 91qAIgMH0eoESHIrVNOQ20NKg1ZMzf96PBOJyKA0kX9D- 5qPz5N04KzyGJ7nyt9ASYPbpF529n79Xc5iOU2WmDcMk0QGBkzKmlkFdwLX1VJ BVw5dymH7Du4JS96QP1oTAdlTWEny (accessed Mar. 08, 2023). [28] L. R. do Amaral, C. Zerbato, R. G. de Freitas, M. R. B. Júnior, and I. O. P. da Silva Simões, ‘UAV applications in Agriculture 4.0’, Revista Ciencia Agronomica, vol. 51, no. 5, 2020, doi: 10.5935/1806-6690.20200091. [29] Business Standard, ‘Drones from Garuda Aerospace to be deployed in earthquakehit Turkey | Business Standard News’, 2023. https://www.businessstandard.com/article/current-affairs/drones-from-garuda-aerospace-to-be-deployed- in-earthquake-hit-turkey-123020801051_1.html (accessed Mar. 08, 2023). [30] Y. Sun and O. Ma, ‘Automating Aircraft Scanning for Inspection or 3D Model Creation with a UAV and Optimal Path Planning’, Drones, vol. 6, no. 4, pp. 87–87, 2022, doi: 10.3390/drones6040087. [31] European Commission, ‘Unmanned aircrafts in the EU’, 2023. https://defenceindustry-space.ec.europa.eu/eu-aeronautics-industry/unmanned-aircraft_en (accessed Apr. 18, 2023). [32] S. I. Abdelmaksoud, M. Mailah, and A. M. Abdallah, ‘Control strategies and novel techniques for autonomous rotorcraft unmanned aerial vehicles: a review’, IEEE Access, vol. 8, pp. 195142–195169, 2020, doi: 10.1109/ACCESS.2020.3031326. [33] Dassault Systèmes, ‘Mass and Section Properties’, 2023. https://help.solidworks.com/2010/english/solidworks/sldworks/legacyhelp/sldworks/ parts/HIDD_MASSPROPERTY_TEXT_DLG.htm (accessed Feb. 12, 2023). [34] D. Kim and H. S. Oh, ‘Black-box Optimization of PID Controllers for Aircraft Maneuvering Control’, Int J Control Autom Syst, vol. 20, no. 3, pp. 703–714, Mar. 2022, doi: 10.1007/s12555-020-0915-6.
129│ [35] T. Elmokadem and A. V. Savkin, ‘Towards fully autonomous UAVs: A survey’, Sensors, vol. 21, no. 18, Sep. 2021, doi: 10.3390/s21186223. [36] S. Jha, M. Abhishek Manjrekar, M. S. Khapare, M. P. Jagtap, and M. V. Yadav, ‘Warehouse Inventory Management with Cycle Counting Using Drones’, 2021. [Online]. Available: https://ssrn.com/abstract=3869512 [37] A. Rejeb, K. Rejeb, S. J. Simske, and H. Treiblmaier, ‘Drones for supply chain management and logistics: a review and research agenda’, International Journal of Logistics Research and Applications, 2021, doi: 10.1080/13675567.2021.1981273. [38] European Commission, ‘Drone Strategy: Creating a large-scale European drone market’, Nov. 29, 2022. https://transport.ec.europa.eu/news/drone-strategy-creating- large-scale-european-drone-market-2022-11-29_en (accessed Apr. 18, 2023). [39] E. Cameron, ‘Skies Without Limits v2.0 - PwC UK’, 2022. https://www.pwc.co.uk/issues/emerging-technologies/drones/the-impact-of-drones- on-the-uk-economy.html (accessed Apr. 18, 2023). [40] AUVSI, ‘Economic Report’, 2013. https://www.auvsi.org/our-impact/economic-report (accessed Apr. 18, 2023). [41] Insider Intelligence, ‘Drone market outlook in 2023: industry growth trends and forecast’, Jan. 23, 2023. https://www.insiderintelligence.com/insights/drone-industry- analysis-market-trends-growth-forecasts/ (accessed Apr. 18, 2023). [42] S. Jatsun, O. Emelyanova, and A. S. Martinez Leon, ‘Design of an Experimental Test Bench for a UAV Type Convertiplane’, in IOP Conference Series: Materials Science and Engineering, Institute of Physics Publishing, Jan. 2020. doi: 10.1088/1757- 899X/714/1/012009. [43] S. Jatsun et al., ‘Hovering control algorithm validation for a mobile platform using an experimental test bench’, IOP Conf Ser Mater Sci Eng, vol. 1027, no. 1, p. 012008, 2021, doi: 10.1088/1757-899X/1027/1/012008. [44] F. Cazaurang, K. Cohen, and M. Kumar, Multi-rotor Platform Based UAV Systems. Elsevier, 2020.
130│ [45] I. Ökten et al., ‘Test Platform and Graphical User Interface Design for Vertical Take- Off and Landing Drones Test Platform and Graphical User Interface Design for Vertical Take-Off and Landing Drones Test Platform and Graphical User Interface Design for Vertical Take-Off and Landing’, 2022. [Online]. Available: https://www.researchgate.net/publication/363923815 [46] K. Cho, M. Cho, and J. Jeon, ‘Fly a Drone Safely: Evaluation of an Embodied Egocentric Drone Controller Interface’, Interact Comput, vol. 29, no. 3, pp. 345–354, May 2017, doi: 10.1093/iwc/iww027. [47] Z. S. Hou and Z. Wang, ‘From model-based control to data-driven control: Survey, classification and perspective’, Inf Sci (N Y), vol. 235, pp. 3–35, Jun. 2013, doi: 10.1016/J.INS.2012.07.014. [48] D. Kim, H.-S. Oh, and I.-C. Moon, ‘Black-box Modeling for Aircraft Maneuver Control with Bayesian Optimization’, Int J Control Autom Syst, vol. 17, no. 6, pp. 1558–1568, 2019, doi: 10.1007/s12555-018-0401-6. [49] I.-H. Choi and H.-C. Bang, ‘Adaptive command filtered backstepping tracking controller design for quadrotor unmanned aerial vehicle’, Proc Inst Mech Eng G J Aerosp Eng, vol. 226, no. 5, pp. 483–497, Oct. 2011, doi: 10.1177/0954410011415001. [50] L. Derafa, A. Ouldali, T. Madani, and A. Benallegue, ‘Non-linear control algorithm for the four rotors UAV attitude tracking problem’, The Aeronautical Journal, vol. 115, no. 1165, pp. 175–185, 2011, doi: 10.1017/S0001924000005571. [51] R. Cao, Y. Lu, and Z. He, ‘System identification method based on interpretable machine learning for unknown aircraft dynamics’, Aerosp Sci Technol, vol. 126, 2022, doi: 10.1016/j.ast.2022.107593. [52] B. C. Min, C. H. Cho, K. M. Choi, and D. H. Kim, ‘Development of a Micro Quad- Rotor UAV for Monitoring an Indoor Environment’, in Advances in Robotics, J.-H. Kim, S. S. Ge, P. Vadakkepat, N. Jesse, A. Al Manum, S. Puthusserypady K, U. Rückert, J. Sitte, U. Witkowski, R. Nakatsu, T. Braunl, J. Baltes, J. Anderson, C.-C. Wong, I. Verner, and D. Ahlgren, Eds., Berlin, Heidelberg: Springer Berlin Heidelberg, 2009, pp. 262–271.
131│ [53] E. Ebeid, M. Skriver, K. H. Terkildsen, K. Jensen, and U. P. Schultz, ‘A survey of Open-Source UAV flight controllers and flight simulators’, Microprocess Microsyst, vol. 61, 2018, doi: 10.1016/j.micpro.2018.05.002. [54] L. Ljung, System Identification: Theory for the user, 2nd ed. in Prentice-Hall information and system sciences series. Upper Saddle River: Prentice-Hall, 1999. [55] K. Åström, Computer-controlled systems : theory and design, 3rd ed. in Prentice-Hall information and system sciences series. Englewood Cliffs, NJ: Prentice-Hall International, 1997. [56] K. J. Keesman, ‘Time-varying Dynamic Systems Identification’, System Identification: An Introduction, pp. 195–221, 2011. [57] J. Awrejcewicz, Modeling, Simulation and Control of Nonlinear Engineering Dynamical Systems. Springer, 2009. [58] P. Olejnik, J. Awrejcewicz, and M. Fec kan, Modeling, Analysis and Control of Dynamical Systems with Friction and Impacts. World Scientific, 2018. [59] B. C. Kuo, Sistemas de control automático. Pearson Educación, 1996. [60] Katsuhiko. Ogata, Modern control engineering, 5th ed. Upper Saddle River, New Jersey [etc: Pearson, 2010. Accessed: Jun. 14, 2023. [Online]. Available: https://discovery.upc.edu/permalink/34CSUC_UPC/11q3oqt/alma99100368799970 6711 [61] R. C. Dorf, Modern control systems, Thirteenth edition. Harlow, England: Pearson, 2017. Accessed: Jun. 14, 2023. [Online]. Available: https://ebookcentral-proquest- com.recursos.biblioteca.upc.edu/lib/upcatalunyaebooks/reader.action?docID=5185883 [62] Katsuhiko. Ogata, Ingeniería de control moderna, 2a ed. México D.F. [etc: Prentice- Hall Hispanoamericana, 1993. [63] Ó. Reinoso García, Control de sistemas discretos. in Serie de compendios Schaum. Madrid: McGraw-Hill, 2004.
132│ [64] Ascending Technologies GmbH, ‘AscTec Hummingbird with AutoPilot User’s Manual’, 2013. https://www.yumpu.com/en/document/view/8667713/asctec-hummingbird- with-autopilot-users-manual-getting-started (accessed May 13, 2023). [65] K. Åström, PID controllers, 2nd ed. Research Triangle Park: The International Society for Measurement and Control, 1995. [66] Interdrone, ‘Intel acquires German drone company Ascending Technologies’, 2016. https://interdrone.com/news/intel-acquires-german-drone-company-ascending- technologies/ (accessed Apr. 04, 2023). [67] GitLab, ‘GitLab - FFT GYRO’, 2023. https://gitlab.com/eurekadynamics/fft-gyro (accessed Feb. 10, 2023). [68] B. Rubí, B. Morcego, and R. Pérez, ‘Quadrotor Path Following and Reactive Obstacle Avoidance with Deep Reinforcement Learning’, J Intell Robot Syst, vol. 103, no. 4, p. 62, 2021, doi: 10.1007/s10846-021-01491-2. [69] B. Rubí, B. Morcego, and R. Pérez, ‘Deep reinforcement learning for quadrotor path following with adaptive velocity’, Auton Robots, vol. 45, no. 1, pp. 119–134, 2021, doi: 10.1007/s10514-020-09951-8. [70] UPC, ‘Course guide 3200332-MASD2’, 2022. Accessed: Apr. 22, 2023. [Online]. Available: https://www.upc.edu/grau/guiadocent/pdf/ing/3200332/modelling-and- analysis-of-dinamic-systems-ii.pdf [71] Open Robotics and A. Dattalo, ‘Introduction to ROS’, 2018. http://wiki.ros.org/ROS/Introduction (accessed Jun. 20, 2023). [72] Open Robotics, ‘Master - ROS Wiki’, 2018. http://wiki.ros.org/Master (accessed May 05, 2023). [73] J. M. O’Kane, ‘A gentle introduction to ROS’, 2014, Accessed: May 09, 2023. [Online]. Available: https://jokane.net/agitr/ [74] Anderson, ‘Hands-On Introduction to Robot Operating System (ROS)’, 2020. https://trojrobert.github.io/hands-on-introdution-to-robot-operating- system%28ros%29/ (accessed May 06, 2023).
133│ [75] MathWorks, ‘“system” command’, 2023. https://www.mathworks.com/help/matlab/ref/system.html (accessed May 02, 2023). [76] MathWorks, ‘ROS Toolbox - Matlab’, 2023. https://www.mathworks.com/products/ros.html (accessed May 02, 2023). [77] MathWorks, ‘Connect to ROS network’, 2023. https://www.mathworks.com/help/ros/ref/rosinit.html?s_tid=doc_ta (accessed May 02, 2023). [78] M. Achtelik, ‘asctec_mav_framework - ROS Wiki’, 2011. http://wiki.ros.org/asctec_mav_framework?distro=indigo (accessed May 02, 2023). [79] MathWorks, ‘rosRegisterMessages - MathWorks’, 2023. https://es.mathworks.com/help/ros/ref/rosregistermessages.html (accessed Mar. 19, 2023). [80] MathWorks, ‘ROS Toolbox System Requirements’, 2023. https://www.mathworks.com/help/ros/gs/ros-system-requirements.html (accessed Feb. 10, 2023). [81] MathWorks, ‘“pythonPkgSrc” - MATLAB2020b/ROS interface’, 2020. https://es.mathworks.com/matlabcentral/answers/612056-matlab2020b-ros- interface-unrecognized-function-or-variable-pythonpkgsrc (accessed Mar. 19, 2023). [82] MathWorks, ‘“rosgenmsg” bug report’, 2021. https://www.mathworks.com/support/bugreports/2343419 (accessed May 02, 2023). [83] MathWorks, ‘Parameter Estimation in Simulink’, 2023. https://www.mathworks.com/help/sldo/parameter-estimation.html (accessed Feb. 10, 2023). [84] L. Rosa, ‘Elective in Robotics - University of Rome’, 2010. http://www.dis.uniroma1.it/~venditt/didattica/eir/02_HummingBird.pdf (accessed May 13, 2023). [85] K. Ogata, Discrete-time control systems, 2nd ed. Englewood Cliffs (New Jersey): Prentice-Hall, 1995.
134│ [86] L. Ljung and MathWorks, ‘System Identification ToolboxTM User’s Guide - Matlab R2014b’, 2014. Accessed: Jun. 21, 2023. [Online]. Available: https://scholar.google.es/citations?view_op=view_citation&hl=es&user=2lo28DgAA AAJ&citation_for_view=2lo28DgAAAAJ:Se3iqnhoufwC [87] L. Ljung, ‘Introduction to System Identification’, 2012. https://www.mathworks.com/support/search.html/videos/introduction-to-system- identification- 81796.html?fq%5B%5D=asset_type_name:video&fq%5B%5D=category:ident/inde x&page=1 (accessed May 27, 2023). [88] Matlab, ‘Linear System Identification’, 2022. https://www.youtube.com/watch?v=qC_C04SEV1E&ab_channel=MATLAB (accessed Jun. 01, 2023). [89] L. Ljung, ‘Identification for control: simple process models’, in Proceedings of the 41st IEEE Conference on Decision and Control, 2002., 2002, pp. 4652–4657 vol.4. doi: 10.1109/CDC.2002.1185112. [90] MathWorks, ‘Compare identified model output with measured output - MATLAB compare’, 2023. https://www.mathworks.com/help/ident/ref/compare.html?s_tid=doc_ta (accessed May 28, 2023). [91] MathWorks, ‘Goodness of fit between test and reference data for analysis and validation of identified models - MATLAB goodnessOfFit’, 2023. https://www.mathworks.com/help/ident/ref/goodnessoffit.html (accessed May 28, 2023). [92] MathWorks, ‘Estimate time delay (dead time) from data - MATLAB delayest’, 2023. https://www.mathworks.com/help/ident/ref/delayest.html?s_tid=doc_ta (accessed May 28, 2023). [93] MathWorks, ‘Process Models’, 2023. https://www.mathworks.com/help/ident/processmodels.html?searchHighlight=process%20models&s_tid=srchtitle_process%2520m odels_1 (accessed Jun. 03, 2023).
135│ [94] MathWorks, ‘Estimate Process Models using the SITB’, 2023. https://www.mathworks.com/help/ident/ug/estimate-process-models-using-the- app.html (accessed Jun. 03, 2023). [95] G. James, Advanced modern engineering mathematics. Wokingham, England [etc: Addison-Wesley, 1993. [96] A. O. Shuaib and M. M. Ahmed, ‘Robust PID Control System Design Using ITAE Performance Index’, Int J Innov Res Sci Eng Technol, vol. 3, pp. 15060–15067, 2014. [97] UPC, ‘Taules retributives del personal docent i investigador Any 2022’, 2022. [98] MathWorks, ‘MATLAB and Simulink - License’, 2023. https://www.mathworks.com/store/ (accessed Jun. 10, 2023). [99] Microsoft, ‘Microsoft Office 365 in Microsoft Store’, 2023. https://www.microsoft.com/es-es/microsoft-365/buy/compare-all-microsoft-365- products?tab=1 (accessed Jun. 10, 2023). [100] ECOportatil, ‘HP Probook 450 G5 15,6" i5 8250U, 8GB’, 2023. https://ecoportatil.es/producto/hp-probook-450-g5-156-i5-8250u-8gb-ssd-256gb- full-hd-a?gclid=CjwKCAjwvpCkBhB4EiwAujULMtywQWPUp- fwkPORqichXpbQzc_xZ_UJYzogAlGjoHUiWLZ4m6A85RoCD6YQAvD_BwE (accessed Jun. 10, 2023). [101] RodriguezDiego, ‘Remote Controller Futaba FF7 System 2,4GHz’, 2023. https://rodriguezdiego.com/producto/emisora-futaba-ff7-sistem-24ghz-mi41000902/ (accessed Jun. 11, 2023). [102] Amazon, ‘Tattu Batería LiPo 2300mAh 11.1V 45C 3S’, 2023. https://www.amazon.es/Tattu-Bater%C3%ADa-Multicopteros-Helic%C3%B3pteros- diversos/dp/B017GRB6B6/ref=mp_s_a_1_1?crid=1WP03F9UL1YMH&keywords=t attu+3s+2300mah&qid=1680499983&sprefix=tattu+3s+2300mah%2Caps%2C204& sr=8-1 (accessed Jun. 10, 2023). [103] HardKernel, ‘ODROID-XU4 board’, 2023. https://www.hardkernel.com/shop/odroidxu4-special-price/ (accessed Jun. 11, 2023).
136│ [104] N. Belmonte, S. Staulo, S. Fiorot, C. Luetto, P. Rizzi, and M. Baricco, ‘Fuel cell powered octocopter for inspection of mobile cranes: Design, cost analysis and environmental impacts’, Appl Energy, vol. 215, pp. 556–565, Apr. 2018, doi: 10.1016/J.APENERGY.2018.02.072. [105] L. Cozzi, O. Chen, and K. Hyeji, ‘The world’s top 1% of emitters produce over 1000 times more CO2 than the bottom 1% – Analysis - IEA’, 2021. https://www.iea.org/commentaries/the-world-s-top-1-of-emitters-produce-over-1000- times-more-co2-than-the-bottom-1 (accessed Jun. 06, 2023). [106] M. Mulero-Pázmány, S. Jenni-Eiermann, N. Strebel, T. Sattler, J. J. Negro, and Z. Tablado, ‘Unmanned aircraft systems as a new source of disturbance for wildlife: A systematic review’, PLoS One, vol. 12, no. 6, Jun. 2017, doi: 10.1371/journal.pone.0178448. [107] S. Borrelle and A. Fletcher, ‘Will drones reduce investigator disturbance to surfacenesting birds?’, 2017. Accessed: Jun. 06, 2023. [Online]. Available: https://www.researchgate.net/publication/316093269_Will_drones_reduce_investig ator_disturbance_to_surface-nesting_birds [108] J. Perry, ‘Hope to Achieve Net-Zero Emissions? Here’s How Drones Can Help - Consortiq’, 2023. https://consortiq.com/uas-resources/hope-to-achieve-net-zero- emissions-heres-how-drones-can-help (accessed Jun. 06, 2023). [109] A. A. Nyaaba and M. Ayamga, ‘Intricacies of medical drones in healthcare delivery: Implications for Africa’, Technol Soc, vol. 66, Aug. 2021, doi: 10.1016/j.techsoc.2021.101624. [110] I. ; Zubin, B. ; Van Arem, B. ; Wiegmans, and R. Van Duin, ‘Using drones in the lastmile logistics processes of medical product delivery A feasibility case study in Rotterdam Using drones in the last-mile logistics processes of medical product delivery: A feasibility case study in’, Transportation Research Board, 2020. [111] S. M. H. M. R. S. A. H. Ehsan Rashidzadeh, ‘Assessing the sustainability of using drone technology for last-mile delivery in a blood supply chain’, Journal of Modelling in Management, 2021.
137│ [112] M. A. Figliozzi, ‘Lifecycle modeling and assessment of unmanned aerial vehicles (Drones) CO2e emissions’, Transp Res D Transp Environ, vol. 57, pp. 251–261, Dec. 2017, doi: 10.1016/J.TRD.2017.09.011. [113] EnviroTec, ‘Commercial drones have the potential to half CO2 emissions for freight’, 2021. https://envirotecmagazine.com/2021/10/26/commercial-drones-have-the- potential-to-half-co2-emissions-for-freight/ (accessed Jun. 07, 2023). [114] IMechE, ‘Delivery drones “could halve freight emissions”’, 2021. https://www.imeche.org/news/news-article/delivery-drones-could-halve-freight- emissions (accessed Jun. 07, 2023). [115] D. Hrovatin and A. Žemva, ‘Exploiting solar energy during an aerial mapping mission on a lightweight uav’, Electronics (Switzerland), vol. 10, no. 22, Nov. 2021, doi: 10.3390/electronics10222876. [116] J. Wivou, L. Udawatta, A. Alshehhi, E. Alzaabi, A. Albeloshi, and S. Alfalasi, ‘Air quality monitoring for sustainable systems via drone based technology’, 2016 IEEE International Conference on Information and Automation for Sustainability: Interoperable Sustainable Smart Systems for Next Generation, ICIAfS 2016, Jul. 2016, doi: 10.1109/ICIAFS.2016.7946542. [117] J. Burgués and S. Marco, ‘Environmental chemical sensing using small drones: A review’, Science of The Total Environment, vol. 748, p. 141172, Dec. 2020, doi: 10.1016/J.SCITOTENV.2020.141172. [118] M. MacIas, C. Barrado, E. Pastor, and P. Royo, ‘The Future of Drones and their Public Acceptance’, AIAA/IEEE Digital Avionics Systems Conference - Proceedings, vol. 2019-September, Sep. 2019, doi: 10.1109/DASC43569.2019.9081623. [119] A. Vacca, H. Onishi, and F. Cuccu, ‘Drones: military weapons, surveillance or mapping tools for environmental monitoring? The need for legal framework is required’, Transportation Research Procedia, vol. 25, pp. 51–62, Jan. 2017, doi: 10.1016/J.TRPRO.2017.05.209. [120] C. Sandbrook, ‘The social implications of using drones for biodiversity conservation’, Ambio, vol. 44, pp. 636–647, Nov. 2015, doi: 10.1007/s13280-015-0714-0.
144│ Biodiversity disturbance impact Drones are relatively inexpensive nowadays, which has democratized access to highresolution remote sensing data. Drones can monitor more colonies at higher spatial and temporal resolutions than conventional field approaches. However, there are drawbacks and risks associated with their use for conservation and data collection. For example, many surface-nesting birds, particularly vulnerable to disturbances. might decrease reproductive output and raise stress reactions. Consequently, the creation of drone-operation standards is a crucial first step in limiting disturbance to surface-nesting birds [107]. B. BENEFITS Drones might cut carbon emissions down by up to 4.5 billion tons in just the transportation industry, according to the World Economic Forum [108]. They can be used for many purposes. For example, for planting trees, monitoring solar panels, delivering products, and many more. Medical support at higher efficiencies UAVs have several advantages, including quicker response times in medical emergencies, which can help save more lives, and environmental friendliness due to their lower CO2 emissions than traditional delivery methods using trucks and cars [109] The phrase "last-mile delivery" describes the last leg of a business-to-customer service, during which, goods are transported by land from a depot to a destination point using vehicles like vans and small trucks [110]. The last-mile delivery is considered as one of the most significant, expensive, and polluting segments in the entire medical supply chain, especially when dealing with perishable goods, such as blood supply [111]. Therefore, incorporating a sustainable strategy into the last-mile logistic plan will be key as the UAV industry expands. A study revealed lower emissions, which include a reduced service time and delivery costs when UAVs were added to the delivery fleet, with a reduction of 9% in CO2 emissions, 12% in service time, and 5.6% in cost per item [110]. The development of drone technology has ushered in a new era for the health sector. In the next paragraph, the benefits of delivery by drones are further investigated.
145│ Lowering the CO2 emissions significantly In most industrialized nations, a significant portion of overall green-house gas (GHG) emissions are related to transportation. The use of unmanned aerial vehicles (UAVs) could speed up deliveries and cut expenses [112]. The logistics company DHL has highlighted speedier delivery, lowered accident rates, and increased last-mile efficiency as three of the most important possible UAV benefits [112]. Commercial UAVs could reduce urban freight transport's CO2 emissions by almost half when compared to light commercial vehicles (LCVs) (Table 7), offering a more sustainably option for the logistics sector to lessen its environmental effect [113], [114]. Mode of transport CO2 emissions produced over 24 hrs Emissions reduction LCV 3,394 g CO2 (3 shifts) Large-sized UAV 1,800 g CO2 47% reduction Medium-sized UAV 2,160 g CO2 36% reduction Table 7: Comparison between different modes of transport in terms of CO2 emissions Source: [113] Using drones for surveying and monitoring: a way to reduce emissions Pipelines, solar panels, and forests are just a few of the enormous regions that drones can examine rapidly and safely. This allows businesses to identify problems more promptly than ever before. In addition, higher maintenance can provide more efficient systems, that produce significantly fewer emissions than they would otherwise. For instance, a study found that using drones to examine solar panels can reduce emissions by up to 96% when compared to conventional techniques. They can also contribute to a 15% boost in the energy production of solar panels [115]. UAVs could also be utilised to gather data from the air sampling field for a specific area in 3D space. The necessary equipment for testing air quality is installed on a drone, then, the storing and monitoring devices will receive data collected by the system. Studies have shown that this system is much more efficient than the traditional method [116].
146│ The usage of such platforms for environmental chemical sensing applications is expanding exponentially because of recent improvements in the downsizing of chemical instrumentation and in low-cost small drones. The quick uptake of chemically sensitive drones in scientific, industrial, and regulatory fields, including atmospheric research investigations, industrial pollution monitoring, and the enforcement of environmental rules, has optimized this industry [117]. II. SOCIAL IMPACT A portion of the society has always initially rejected emerging technologies. The lack of prior knowledge regarding adverse effects and peoples' psychological aversion to the unknown, in addition to other issues that the immature technology may have, have a significant impact on how well it is received. According to experts, a balance between advantageous uses and inconveniences associated with this technology governs social acceptance [118]. This section of the report focuses on the positive and negative impacts that this technology could have on the community. A. RISKS Privacy concerns The ethical ramifications and potential invasions of privacy and civil liberties of using drones for both military and civilian purposes have received a lot of attention [119]. Drones have been referred to as a "new surveillance" tool in the context of civil uses, raising the questions of being morally appropriate and crossing the line of civil rights. The ability of drones to now be slight and undetectable enough to enter areas that might otherwise be considered private is a cause for concern [120]. In addition to general privacy issues, the use of drones in touristic areas is also a cause of concern. Despite a small number of drone enthusiasts utilising them to capture their travel experiences, most of the visitors do not fly drones and might not want to be filmed. Understanding the responses of non-users would shed light on the part that drones play in influencing the destination experience. Drone annoyance is influenced by privacy worry and safety danger, which in turn has a negative impact on the traveller’s experience [121].
147│ Potential fear generators Drones have the potential to cause considerable fear, confusion, and hostility among those on the ground. In some cases, this might happen as an accidental consequence of drones being introduced. If people on the ground do not understand why drones are being introduced, they may generate worries and suspicion, particularly when they are used in remote areas of developing countries, because they might have had little or no prior exposure to this technology [120]. Potential for unethical data use The public might be worried about how and why data gathered by conservation drones is used, especially when some of it could be sold without the people’s consent for private uses, such as advertising and product marketing. Additionally, the data could be easily stolen, as it can be shot down, acquired, and destroyed by those seeking access to data [120]. B. BENEFITS Safety Since there is no pilot to suffer injuries in a crash, drones are typically thought to be safer for users than piloted aircrafts. They may also be less dangerous for anyone on the ground in an accident, because they typically crash with less damage and destruction than bigger piloted aircrafts. In addition, some drones have safety features that enable them to immediately land at a designated location after terminating a scheduled mission or if any issues arise [120]. More accessible data According to studies, using modern technology might give local organizations more power, as it gives them the tools to gather their own data, enforce norms, and refute assertions. If drones could be utilized for community-based measurements and other important data, they may offer these advantages to the local population [120].
148│ Improved healthcare quality Alongside the economic benefits mentioned in the previous section, drones also have a positive social impact in the healthcare sector. For instance, studies have shown increased information, system, and service quality, along with higher user satisfaction from the adoption of drone technology for the medical sector in developing countries. In addition, quick delivery time for drones and accessing healthcare facilities in remote areas were identified as contributing factors to improve well-being of remote communities [122]. III. SUMMARY As it was discussed in the previous sections, there are several possible uses for drones, both, in the public and commercial sectors, as well as in the industries of agriculture, business, environment, and energy. In terms of environmental impacts, it was shown by several studies that the benefits and emission reductions that drones could bring highly outweigh the environmental risks that this technology could produce. However, in terms of social impact, they can represent major security and safety threats. Therefore, it is vital to adjust existing law in addition to adopting and enforcing new legislation [119], [123]. Hence, to protect the people’s safety and property, consistent rules and regulations must be issued and adopted, and insurance responsibility is key in this regard [124]. Once this technology is more widely spread and local communities are more accustomed to it, drones could bring numerous benefits to many industries, such as healthcare and agriculture. To summarise, UAVs would bring sustainable solutions and provide further support to the whole society, from developing nations and marginalised communities.
149│ C. EXPERIMENT SETUP This Appendix is dedicated to the setup and operation of the university’s AscTec Hummingbird drones in the workbench located at the university’s TR11 building. A basic knowledge of Linux is needed to operate the system, although this guide will try to detail every step. I. REQUIREMENTS FOR EXPERIMENTATION The basic requirements to run experiments with the quadrotor are: • Charged 11.1V batteries. • Fully functioning, strapped drone. • Testing workbench. • Drone’s scripts to launch its ROS master node (here detailed). • Drone’s and gyroscope’s scripts and Simulink documents (here detailed). • Laboratory laptop properly set up to work with the drone. • Drone’s remote control with charger. Due to limited space within the drone, not all batteries may be suitable for mounting. The LiPo batteries at [102] are recommended for the drone’s compartment. II. MATLAB/SIMULINK ENVIRONMENT: Various documents are available for communicating with the UAVs, including Matlab scripts and Simulink interfaces: 1. Scripts: • ‘DroneSetup.m’: basic script to establish a communication’s channel through data structures that the drone can understand. Available at Appendix D, item I. • ‘MsgRegister.m’: script that enables the registration of custom messages of the ROS environment that are not available in Matlab by default. The script is essential for users who wish to modify the 'DroneClassEdition.slx' model on their personal computer. Available at Appendix D, item II and explained in Appendix C, item IX.
150│ • ‘SampleReadEncoder.m’: script capable of reading the machine’s encoders. It can work under any operating system (Windows, Linux, or Mac). It can be found on Gitlab [67]. 2. Simulink interfaces: • ‘NewtonSystem.slx’: this model refers to the work done in section 5.2, for the Newtonian system to explain the pitch and roll gimbal motion with the drone turned off. No connection to the drone is needed. • ‘DroneClassEdition.slx’: model capable of connecting with the drone for safe testing. It can handle any kind of test signal, such as steps, ramps and more. It can also connect simultaneously to the gyroscope. It can only be modified with the laboratory’s computer under Linux Ubuntu 16.04. • ‘SimulinkSampleEncoder.slx’: model capable of connecting to the new equipment, the gyroscope, at the laboratory. The model was retrieved from manufacturer's GitLab repository [67]. It is capable of reading the workbench’s encoders. It can work on top of any OS (Windows, Linux or Mac). • ‘SetPointsPID.slx’: model capable of sending PID setpoints (SP) to the quadrotor. Its segments are explained at section 7.2. A step-by-step for the implementation of the PID controllers is available in this Appendix, item VIII. Some of the C++ scripts were used as a guidance to understand the previous form of communication with the drone and develop a more user-friendly interface in Matlab/Simulink here explained. The original files were developed by the ETH Zürich [24], [125], and, in a later stage, edited by the university’s professor and former students to open the control loop of the built-in controllers, and additionally, implement a PID controller algorithm coded at the university. As a result, this dissertation had a foundation for the development of the communication’s channel with the drone. For the following sections, the scripts and models that are going to be used are: • ‘DroneClassEdition.slx’ model. • ‘DroneSetup.m’ script. • ‘SetPointsPID.slx’ model. Due to the nature of the Linux and ROS systems, the drone can only work inside an Ubuntu 16.04 OS in a modified Matlab R2020b, with certain conditions to be met regarding
151│ Python and CMake versions. For this reason, only the laboratory’s laptop is currently capable of communicating with the quadrotor. III. GENERAL COMMENTS AND GYROSCOPE OUTPUT To set up experiments with the drone, follow these steps: 1. Turn on the computer. It will automatically start up Ubuntu 16.04. 2. Open a Linux Terminal and enter ‘sudo matlab’ and type the computer’s password to run it as admin. This should open the default Matlab version on it, which should be the R2020b. It is necessary to do it for the correct function of the communication’s channel between the UAV and the laptop. 3. Open the ‘DroneClassEdition.slx’ model (Figure 92); it should open displaying three different segments: Drone Input, Drone Output and Gyroscope Output. Figure 92: ‘DroneClassEdition.slx’ model view Unlike Figure 92, the model has additional comments that were hidden to take the screenshot seen here. The comments will be visible in the file. Beware that they are not a replacement for this appendix, but an additional guidance for the user. 4. If the USB cable is connected to the computer, disconnect it. First connect the workbench to the power supply and turn it on. If done properly, the workbench’s three orange lights should start turning on and off in a straight order. If this is not the case, try again. 5. Connect the USB cable to any USB port of the computer. By default, it should be named ‘/dev/ttyACM0’. All the files (scripts and models) are set up to work with this USB port.
152│ 6. When done correctly, all the gyroscope’s orange lights turn on at the same time. If this is not the case, go back to step 4, disconnecting the USB cable from the laptop’s port. 7. At this point, the encoders’ data logging begins (Figure 93). Please, comment the Drone Input and Drone Output segments for safety reasons. This can be done by selecting the blocks and pressing the buttons Ctrl + Caps Lock + X. It can be undone (uncommented) in the same way. Figure 93: Gyroscope output segment IV. DRONE POWERUP After this, the drone’s setup can begin. For that, a fully charged battery is needed and the system must be horizontally balanced. This is because the UAV’s IMU sensor detects unbalances, and an alarm goes off. 8. Place and connect the drone’s battery. After connecting it, the drone is partially powered on. If the drone’s switch was previously left on the ON position, the drone’s alarm will go off. 9. If that happens, disconnect the battery, and turn the switch to the OFF position.
153│ Figure 94: Drone's switch location 10. Hold the drone and the gyroscope to prevent it from moving from the horizontal position. Turn on the drone’s power switch. The drone’s blades should slightly move. This is an indication that the Electronic Speed Controller (ESC) for the motors work. 11. Two scenarios can occur in this point: a. First scenario: When switching the power on, the drone was perfectly horizontally balanced and motionless. This means that it will beep once and implies that the drone is correctly powered on. b. Second scenario: When switching the power on, the drone was not balanced and will start beeping nonstop. Then, switch the power off and try again. At this step, the user can turn on the drone using the remote control. 12. Plug the remote control to the grid to have enough battery for the experiments. 13. Turn on the remote control. Its voltage level will show on the screen. If it is below 8,4V, it will start beeping. The user should then change the battery or wait until it recharges. 14. At this point, the quadrotor can be turned on. Warning: Check to see if the cables are in the sweep area of the blades and reposition them. This is critical to avoid damage to the quadrotor.