scieee AI-readable full text Open interactive document viewer

Contribution to the model and navigation control of an autonomous underwater vehicle

González Agudelo, Julián

Abstract

This thesis deals with the further development of an existing underwater vehicle for autonomous navigation. The vehicle was conceived to navigate over the sea surface and, at certain fixed points, to dive vertically in order to obtain a profile of a water column. The main objectives of the thesis are the improvement of the hardware and software of the vehicle in order to make it fully operational, and the design and implementation of control techniques for autonomous navigation. The problem of autonomous navigation is addressed first with the calculation of an hydrodynamic model in 3DoF. An extensive study about the selection of the coefficients is performed, using a linearized model. The calculation of the coefficients is done using two approaches: a geometric one and another one based on least squares techniques applied to experimental data obtained during sea trials. The least squares method gives satisfactory results and the simulations fits the experimental data. The resulting hydrodynamic model is completed with the physical constraints of the actuators of the vehicle. Solving the autonomous navigation problem requires the design of controllers for both the inner loop (dynamic) and the outer loop (kinematic). Several solutions based on type-1 TSK fuzzy control are presented for velocity control, yaw control, pure pursuit navigation, and path following. The fuzzy controller is used to manage different linear controllers designed for specific conditions. The hydrodynamic model plays an important role in the design of the controller for the inner loop. In addition, a gain scheduled controller is designed to validate a particular case of the fuzzy controller in the inner loop. Regarding the finishing of the vehicle to be fully operational, the improvements begin with a new driver for the lateral thrusters because they lacked backwards movement capability. Additionally, upgrades in the handling of the vehicle had to devised. In this respect, a wireless on/off system is presented to power the vehicle, and a WiFi connection is adapted to manipulate the software of the vehicle remotely. Furthermore, a study of the currents and power of the immersion system in order to reduce the power consumption is performed, and the hardware is improved with the inclusion of some commercial devices, like an IMU, CTD, and acoustic localization system. The software is improved in several aspects. First, some problems derived from previous works are debugged. The system is then restructured with a multithread development, which provides robustness and modularity. As the system needed an extension of the protocol communication for easy handling, a robust protocol communication is implemented with the possibility to execute scripts. Finally, the existing graphical user interface is simplified in order to provide only the information required by the operator. In order to improve the buoyancy of the vehicle, several foams are designed, adjusted to the geometry of the vehicle, and a ballast system is also included for fine adjustment. Finally, several tests in the laboratory, a swimming pool, a channel, and at sea are performed in order to check the performance of the vehicle. Results show a correct behavior of hardware and software, and also validate the performance of the controllers designed for autonomous navigation.

Full text

Departament d’Enginyeria Electrònica Contribution to the Model and Navigation Control of an Autonomous Underwater Vehicle Juli´ an Gonz´ alez Agudelo PhD Thesis in Electronic Engineering July 2015 Contribution to the Model and Navigation Control of an Autonomous Underwater Vehicle Juli´ an Gonz´ alez Agudelo PhD Thesis Electronic Engineering Department Universitat Polit`ecnica de Catalunya Supervisor: Dr. Spartacus Gom´ariz Co-Supervisor: Dr. Carles Batlle Thesis submitted in partial fulfillment of the requirement for the PhD Degree issued by the Universitat Polit`ecnica de Catalunya, in its Electronic Engineering Program. July 2015 Juli´an Gonz´alez Agudelo, 2015 c 2015 by Juli´an Gonz´alez Agudelo. Contribution to the model and navigation control of an autonomous underwater vehicle. This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/. A copy of this PhD thesis can be downloaded from: http://www.tdx.cat/ http://upcommons.upc.edu/ Date of defense: Date of this version: July 1, 2015 Juli´an Gonz´alez Agudelo SARTI Research Group Universitat Polit`ecnica de Catalunya Rambla de l’Exposici´o 24 Edifici C, 08800 Vilanova i La Geltr´u, Spain <[email protected]> Abstract This thesis deals with the further development of an existing underwater vehicle for autonomous navigation. The vehicle was conceived to navigate over the sea surface and, at certain fixed points, to dive vertically in order to obtain a profile of a water column. The main objectives of the thesis are the improvement of the hardware and software of the vehicle in order to make it fully operational, and the design and implementation of control techniques for autonomous navigation. The problem of autonomous navigation is addressed first with the calculation of an hydrodynamic model in 3DoF. An extensive study about the selection of the coefficients is performed, using a linearized model. The calculation of the coefficients is done using two approaches: a geometric one and another one based on least squares techniques applied to experimental data obtained during sea trials. The least squares method gives satisfactory results and the simulations fits the experimental data. The resulting hydrodynamic model is completed with the physical constraints of the actuators of the vehicle. Solving the autonomous navigation problem requires the design of controllers for both the inner loop (dynamic) and the outer loop (kinematic). Several solutions based on type-1 TSK fuzzy control are presented for velocity control, yaw control, pure pursuit navigation, and path following. The fuzzy controller is used to manage different linear controllers designed for specific conditions. The hydrodynamic model plays an important role in the design of the controller for the inner loop. In addition, a gain scheduled controller is designed to validate a particular case of the fuzzy controller in the inner loop. Regarding the finishing of the vehicle to be fully operational, the improvements begin with a new driver for the lateral thrusters because they lacked backwards movement capability. Additionally, upgrades in the handling of the vehicle had to devised. In this respect, a wireless on/off system is presented to power the vehicle, and a WiFi connection is adapted to manipulate the software of the vehicle remotely. Furthermore, a study of the currents and power of the immersion system in order to reduce the power consumption is performed, and the hardware is improved with the inclusion of some commercial devices, like an IMU, CTD, and acoustic localization system. The software is improved in several aspects. First, some problems derived from previous works are debugged. The system is then restructured with a multithread development, which provides robustness and modularity. As the system needed an extension of the protocol communication for easy handling, a robust protocol communication is implemented with the possibility to execute scripts. Finally, the existing graphical user interface is simplified in order to provide only the information required by the operator. In order to improve the buoyancy of the vehicle, several foams are designed, adjusted to the geometry of the vehicle, and a ballast system is also included for fine adjustment. Finally, several tests in the laboratory, a swimming pool, a channel, and at sea are performed in order to check the performance of the vehicle. Results show a correct behavior v vi of hardware and software, and also validate the performance of the controllers designed for autonomous navigation. Keywords: Autonomous underwater vehicle, hydrodynamic model, autonomous navigation and control, TSK fuzzy control, PID control, gain scheduling control, vehicle hardware, vehicle software. Acknowledgements I would like to thank a large number of people that in many different ways have helped me in the accomplishment of this PhD thesis. In first place, I wish to thank my supervisor Professor Spartacus Gom´ariz, who first welcomed me in Barcelona, for his constant help and support. He has always provided excellent scientific guidance to cover all the topics. I appreciate the confidence he has placed in me, and his patience in listening to all my questions and problems and his effort in revising all my work. I also would like to thank my co-supervisor Professor Carles Batlle for his help in the resolution of the modeling, mathematical and control issues and his assistance in writing this work. I would like to thank the people of the SARTI group, and my friends Ivan Masmitj`a, Oriol Pallar´es, David Sarri´a, Normandino Carreras and C´esar Galarza, with which I shared so many lunches, great laughs, and endless discussions on the most diverse topics. Thanks for sharing the enthusiasm and values of friendship and collaboration. My special thanks to Ivan for his involvement in the project, his initiative in improving the vehicle, and his collaboration in the field tests. I wish to thank the scholarship program of the UPC for the FPI grant that was given to me for my stay and for the completion of the doctoral thesis in Barcelona. During the Autumn of 2013 I had the chance to spend three wonderful months at the Group of Ocean Robotics of the Institute for Systems and Robotics (ISR) of the Instituto Superior T´ecnico, Lisbon, Portugal. I am indebted to Professor Antonio Pascoal for making this visit possible, for treating me like one of his students, and specially for his support to correct and to finish the hydrodynamic model of the vehicle. My special gratitude to the professor who put me in touch with the SARTI group to perform this work, Professor Gerard Olivar of the National University of Colombia - Manizales Campus. I cannot forget all my friends and professors I met in this university, great people and talents, who shared with me their motivation, good research, and invaluable appreciation and friendship. And last, but not least, my gratitude to my parents, to all my family and friends for trusting me and for their support during all these years. Finally, a very special and sincere thanks goes to Idalia, my love, for her unconditional support. I would like to dedicate this thesis to her and my son Joaquim, you are my inspiration. vii viii LIST OF FIGURES xv 7.16 Real movement and simulation in straight line and turns (b) . . . . . . . . . 102 7.17 Real movement and simulation in straight line and turns (c) . . . . . . . . . . 103 7.18 Physical constraints of Guanay II AUV..................... 106 7.19 Steady state map — forward velocity u..................... 108 7.20 Steady state map — lateral velocity v...................... 109 7.21 Steady state map — angular velocity r...................... 109 7.22 Maximum forward velocity uregarding the radius of curvature . . . . . . . . 110 8.1 Guidance, Navigation and Control, and the main associated research lines . . 114 8.2 Basic motion tasks. a) Trajectory/path tracking. b) Path following. c) Point stabilization. d) Pure pursuit and Line-of-Sight . . . . . . . . . . . . . . . . . 117 8.3 Representation of a fuzzy set . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 8.4 Basic operations on fuzzy sets. a) intersection. b) union. c) complement . . . 118 8.5 type-2fuzzyset................................... 118 8.6 Architecture of a fuzzy controller . . . . . . . . . . . . . . . . . . . . . . . . . 119 8.7 Map of control laws using a type-1 TSK fuzzy controller . . . . . . . . . . . . 121 8.8 pole-zero map of the transfer function Gψu0(s) for different u0........ 123 8.9 Block diagram of the closed loop system for the yaw control . . . . . . . . . . 123 8.10 Root locus of the different Gψ(s) and pole displacement using the controllers CP(s) ........................................ 125 8.11 Step response of the different feedback systems using the controllers CP(s) . . 125 8.12 Root locus of the different Gψ(s) and pole displacement using the controllers CPD(s) ....................................... 127 8.13 Step response of the different feedback systems using the controllers CPD(s) . 128 8.14 Root locus for Gψ0.3(s) and Gψ2.0(s), and pole displacement using the controllers CPD0.3(s) and CP2.0(s) .......................... 129 8.15 Step response of the systems Gψ0.3(s) and Gψ2.0(s) using the controllers CPD0.3(s) and CP2.0(s) in a feedback loop . . . . . . . . . . . . . . . . . . . . 129 8.16 Step response of the nonlinear model using the controllers CPD0.3(s) and CP2.0(s) in a feedback loop, and forced to navigate at 0.3 m/s and 2 m/s . . . 129 8.17 Block diagram of the closed loop system for the velocity control . . . . . . . . 130 8.18 Root locus for Gu0.3(s) and Gu2.0(s), and pole displacement using the controllers TPI0.3(s) and TPI2.0(s)........................... 132 8.19 Step response of the systems Gu0.3(s) and Gu2.0(s) using the controllers TPI0.3 and TPI2.0inafeedbackloop ........................... 132 8.20 Step response of the nonlinear model using the controllers TPI0.3and TPI2.0 in a feedback loop, and using 0.3 m/s and 2 m/s as input references . . . . . 132 8.21 Fuzzy control — velocity and yaw control regarding the forward velocity u. . 133 8.22 Fuzzy set. Membership functions µland µh................... 134 8.23 Comparative of the step response for the yaw using the fuzzy controller and linearcontrollers .................................. 136 8.24 Comparative of the step response for the forward velocity using the fuzzy controller and linear controllers . . . . . . . . . . . . . . . . . . . . . . . . . . 136 8.25 Gain scheduling control — velocity and yaw control regarding the forward velocity u...................................... 137 8.26 Gain scheduled parameters to control the yaw and forward velocity . . . . . . 138 8.27 Comparative of the step response for the yaw using the gain schedule controller andthelinearcontrollers ............................. 138 8.28 Comparative of the step response for the forward velocity using the gain schedule controller and linear controllers . . . . . . . . . . . . . . . . . . . . . . . . 139 xvi LIST OF FIGURES 8.29 Torque comparative of the step response for the yaw . . . . . . . . . . . . . . 140 8.30 Fuzzy control regarding the yaw error . . . . . . . . . . . . . . . . . . . . . . 141 8.31 Yaw error fuzzy set. Membership functions µl,µhand µh........... 142 8.32 Step response of the yaw and torque using kp1.................. 143 8.33 Step response of the yaw and torque using kp2.................. 144 8.34 Step response of the yaw and torque using kp3.................. 144 8.35 Step response of the yaw and torque using Fuzzy controller . . . . . . . . . . 145 8.36 Pure pursuit regarding the radius of curvature . . . . . . . . . . . . . . . . . 146 8.37 Outer loop — pure pursuit regarding the radius of curvature . . . . . . . . . 147 8.38 Responses using the pure pursuit regarding the radius of curvature. Path 1 . 148 8.39 Responses using the pure pursuit regarding the radius of curvature. Path 2 . 149 8.40 Responses using the pure pursuit regarding the radius of curvature. Path 3 . 149 8.41 Pure pursuit — fuzzy control . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 8.42 Membership functions of the fuzzy set of the Outer loop . . . . . . . . . . . . 151 8.43 Outer loop — pure pursuit using a fuzzy controller . . . . . . . . . . . . . . . 152 8.44 Responses using pure pursuit with fuzzy controller. Path 1 . . . . . . . . . . 153 8.45 Responses using pure pursuit with fuzzy controller. Path 2 . . . . . . . . . . 154 8.46 Responses using pure pursuit with fuzzy controller. Path 3 . . . . . . . . . . 154 8.47Pathfollowing ................................... 155 8.48 Calculation of ψref onpathfollowing....................... 156 8.49 Membership functions of the fuzzy set of path following . . . . . . . . . . . . 157 8.50 Outer loop — path following . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 8.51 Responses using the path following controller. Path 4 . . . . . . . . . . . . . 159 8.52 Responses using the path following controller. Path 5 . . . . . . . . . . . . . 160 9.1 Field tests. Outer loop radius of curvature. Inner loop CFuzzy1. Path 1. u= 0.3m/s ..................................... 164 9.2 Field tests. Outer loop radius of curvature. Inner loop CFuzzy1. Path 1. u= 0.6m/s ..................................... 165 9.3 Field tests. Outer loop radius of curvature. Comparative of CFuzzy1 with CGainS. Path 2. u= 0.3m/s............................ 166 9.4 Field tests. Outer loop radius of curvature. Comparative of CFuzzy1 with CGainS. Path 2. u= 0.6m/s............................ 167 9.5 Field tests. Outer loop radius of curvature. Comparative of CFuzzy2 with proportional controllers. Path 2. u= 0.3m/s .................. 169 9.6 Field tests. Outer loop fuzzy control. Comparative of CFuzzy2 with proportional controllers. Path 1. u= 0.3m/s ...................... 170 9.7 Field tests. Outer loop fuzzy control. Comparative of CFuzzy2 with proportional controllers. Path 1. u= 0.6m/s ...................... 171 9.8 Field tests. Outer loop fuzzy control. Comparative of CFuzzy2 with proportional controllers. Path 1. u=1m/s ....................... 172 9.9 Field test using the path following technique. u= 0.3m/s ........... 173 9.10 Final test. Navigation data . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 9.11 Final test. Salinity record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 9.12 Final test. Temperature record . . . . . . . . . . . . . . . . . . . . . . . . . . 175 9.13 Photos during the final test off the coast of Vilanova i La Geltr´u . . . . . . . 176 List of Tables 2.1 ROVcategories................................... 10 3.1 Vehiclemassesinair................................ 18 4.1 Root mean squared deviation of the regressions of the pressure sensor . . . . 32 4.2 Cylinder currents and times without the use of an air chamber . . . . . . . . 35 4.3 Maximum operating depth by component . . . . . . . . . . . . . . . . . . . . 38 6.1 Maximum consumptions of the Guanay II ................... 58 7.1 Myring parameters for Guanay II ........................ 76 7.2 Center of buoyancy wrt origin at vehicle nose . . . . . . . . . . . . . . . . . . 77 7.3 Center of gravity wrt origin at CB . . . . . . . . . . . . . . . . . . . . . . . . 77 7.4 Sirene AUV coefficients (IST) . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 7.5 Axial added mass parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 7.6 Theoretical coefficients of the Guanay II AUV ................. 90 7.7 Final coefficients for Guanay II AUV ...................... 96 7.8 Comparison: Final coefficients and theoretical calculation . . . . . . . . . . . 104 8.1 Fuzzy control 1 — Outputs of the different rules . . . . . . . . . . . . . . . . 135 8.2 Comparative of the overshoot and settling time for the yaw using the fuzzy controller and linear controllers . . . . . . . . . . . . . . . . . . . . . . . . . . 136 8.3 Comparative of the overshoot and settling time for the forward velocity using the fuzzy controller and linear controllers . . . . . . . . . . . . . . . . . . . . 137 8.4 Comparative of the settling time and noise in the torque using the fuzzy controller and proportional controllers . . . . . . . . . . . . . . . . . . . . . . . . 145 8.5 The control rules for the velocity reference . . . . . . . . . . . . . . . . . . . . 152 8.6 The control rules for the velocity reference in path following . . . . . . . . . . 157 xvii xviii LIST OF TABLES Chapter 1 Introduction The study of the sea and oceans has gained considerable importance among fishers and biologists since the marine species change their behavior depending on environmental variables such as temperature, salinity, ph, chlorophyll, nitrate, among others [145] [80]. Some fishes, for example, are euryhaline, which implies that they can adapt to variations in the salinity concentration according to the season; and other types of fish are stenohaline, that is to say they do not support these variations and have to emigrate to other waters [38]. These environmental measurements also depend on the depth where terms like haloclines, vertical zone in which salinity changes rapidly, or thermoclines, vertical zone in which temperature changes rapidly, are studied [159] and it is necessary to obtain profiles of water columns in order to estimate the emigrations or fish population in a determinated area. Additionally, as cited in [13], knowledge of the salinity distribution and its variability in the ocean are crucial in understanding the role of the ocean in the climate system. It is well known that ocean currents and air-sea heat fluxes regulate our climate. For these oceanographic observations there are different tools used. One of them are the satellites, which make measurements of the ocean a global level from the aerospace. However, the observations are only over the surface but not underwater, therefore there is too much data that can not be registered. Another alternative are the oceanographic ships because they are in direct contact with the ocean and can take measurements underwater. However the actual planning and mission deployment required to obtain a satisfactory spacial-time resolution data are very expensive. As a solution to these needs, these tools are migrating towards the creation of autonomous marine vehicles such as Gliders, AUV (Autonomous Underwater Vehicles) and ASV (Autonomous Surface Vehicles) [86] [16]. Since they are unmanned they are of small dimensions and the mission deployment is more cheaper than the oceanographic ships. Thereby, the research in this field is focused on autonomous navigation, which envelops vehicle modeling and control. 1.1 Previous work The Technological Development Center of Remote Acquisition and Data Processing Systems (SARTI Group), attached to the Electronics Department of the Universitat Polit`ecnica de Catalunya, have been developing an autonomous underwater vehicle during the last years under the project Guanay. It is a vehicle conceived for shallow water, and it is conceived to navigate over the surface making vertical immersions at preestablished waypoints. 1 2CHAPTER 1. INTRODUCTION The project started with a first prototype [51]. However, the vehicle had some problems with the tightness and therefore a new structure was designed [48] and manufactured. This prototype was called Guanay II. Next the hardware and software were reformed and improved [82], with good results but not enough to be fully operational when commanded manually. 1.2 Motivation The idea of an autonomous underwater vehicle for oceanographic observation is almost finished, and this development is the principal motivation of the present thesis. The vehicle can be used as a complement to the Expandable Seafloor Observatory OBSEA (www.obsea.es) [94] which is located 4 km off the coast of Vilanova i La Geltr´u (Barcelona). The Guanay II can be used as an added element to the sensor network, taking into account that the principal aspect of a sensor network compared with a simple set of sensors is its cooperative behavior and the capacity of processing all the data in conjunction. The motivation of this thesis is twofold. First the need to complete the development of an operating vehicle for marine observation, that is, the hardware and software; and second the need to develop navigation control techniques in order to give autonomy to the vehicle, taking into account its physical characteristics and operational requirements. Regarding the first objective, the vehicle needs further developments in the buoyancy system, the hardware for the lateral thrusters so that it can go backwards, an inertial navigation system, a circuit to measure and study the power consumption, and an improvement of the software of the base station and the vehicle in order to have more simplicity and robustness. Regarding the second objective, the navigation control is an important step in order to give autonomy to the vehicle. First of all, a good hydrodynamic model is required in order to estimate its performance against forces and torques. The principal problem with the modeling is selection of the hydrodynamic coefficients to be included and their calculation. Prestero [105] proposes a methodology to calculate them using a set of equations based on the vehicle’s geometry, and these equations can be used for the Guanay II. Additionally, other works calculate the hydrodynamic model using maximum-likehood estimation [134], least squares [112], and a Kalman filter [144], among other techniques. Regarding the automatic control, the state of the art shows that the problems to be solved include techniques like point stabilization,trajectory tracking,path following,path tracking, among others. All of them can be achieved by means of several control strategies which, however, must be selected according to the vehicle’s physical characteristics and required performance. Guanay II should have an electronic control system for autonomous navigation. Given a pre-established definition and scheduling of the path, the vehicle should be capable to follow it without human intervention in a robust way, able to deal with different environment perturbations and minimizing the energetic cost. The review of the state of the art shows that controllers can be designed for a specific forward velocity in order to simplify the control. This is all right for a vehicle that navigates in open water normally, where the operating velocity is constant. However, if it navigates near the coast, in the subsoil or inside a harbor, it would be interesting to change the forward velocity, and thus to change the operation point for which the controller is designed. In this way, the path can be adjusted, keeping the benefits of the trajectory tracking technique. Lyapunov methods have also been used in the literature, but they lead to quite cumbersome and complex control laws. Moreover, non-linear methods in general do not enjoy the same level of popularity as the their linear counterparts among the designers. 1.3. GOAL OF THE THESIS 3 An alternative approach is presented by Silvestre [125], where controllers are designed for different velocities and they are later integrated into a single law using linear matrix inequalities in an infinity norm framework. The approach selected in this work is the application of the gain scheduling methodology [119] and the use of fuzzy control as an alternative for the integration of the different linear controllers [120] [126]. The use of the fuzzy control method is feasible since it establishes rules for activation and deactivation (defining activation as the effective contribution of a rule to the control action) which can be controlled. This is known as “mapping” of the space of the input variables [32], which allows to assign control actions for different system operation points or to reduce large perturbations near their settling state. Therefore the design of control systems for the tracking of paths for the navigation of autonomous underwater vehicles can be enclosed in the context of system control where the system is a piecewise linear system, and opens a way for the application of fuzzy control techniques with their capacity of assignation of differentiated control actions (“zonal” control). 1.3 Goal of the thesis After the description of the research antecedents and motivation, the goal of this thesis is stated. The general purpose is summarized as: “The improvement of the hardware and software of an autonomous underwater vehicle in order to be fully operational. The calculation of an hydrodynamic model. And the design and implementation of control techniques for autonomous navigation”. 1.4 Thesis main contributions Part I. Operability of Guanay II AUV •Chapter 3. Buoyancy –Design of foams for buoyancy –Ballast system for fine adjustment •Chapter 4. Hardware –Lateral thruster driver to go forward and backward –RF remote control on-off of the power system –Studies in the forces and electric currents for the immersion system –Addition of a WiFi connection for easy handling –Adaptation of commercial devices: IMU, CTD, acoustic locatization system. •Chapter 5. Software –Multithread operation –Robustness and ampliation of the protocol communication –Incorporation of a script execution –Improvement of the graphical user interface 4CHAPTER 1. INTRODUCTION Part II. Hydrodynamic model and control •Chapter 7. Modeling –Calculation of the hydrodynamic model of Guanay II AUV in 3DoF, comprising the selection of the coefficients and their calculation –Issues of physical constraints •Chapter 8. Automatic control –Design of a type-1 TSK fuzzy controller to control the yaw and the forward velocity as an interpolator of different linear controllers –Design of a type-1 TSK fuzzy controller for pure pursuit navigation –Design of a type-1 TSK fuzzy controller in conjunction with another controller for path following Part I Operability of Guanay II AUV 5 2.2. GUANAY II AUV 13 2.2 Guanay II AUV The Guanay II AUV is a vehicle developed by the Technological Development Center of Remote Acquisition and Data Processing Systems (SARTI for its acronym in spanish), and it is the basis for the research of this thesis. Figure 2.7: Guanay II AUV 2.2.1 Purpose This vehicle was conceived to navigate on shallow water, up to 40 m. Its operational principle is to navigate over the sea surface following preestablished waypoints or a continuous path, stop at the required point, and then make a vertical immersion to take data on salinity, temperature, or other variables. The vehicle goes then up to the surface and continues with the path. This type of movement can be seen in figure 2.8. The data collection is useful for biologists and oceanographers for different studies, for instance the determination of haloclines or thermoclines, which are closely linked to the migration of fish. Figure 2.8: Principle of motion 14 CHAPTER 2. REVIEW OF UNMANNED VEHICLES AND GUANAY II AUV 2.2.2 Vehicle parts As shown in figure 2.9, the external hull is a torpedo-shaped structure made of fiberglass, measuring 2.3 m long by 0.32 m wide. This hull is not watertight, as it has small holes through which water enters. Inside there is a module of aluminum, which is watertight and has all the hardware (see chapter 4for further details). The module’s tightness is ensured with an O-ring, and the attachment to the top is by pressure. Watertight module External hull Thrusters Fins Watertight module Electronics Batteries Immersion system Figure 2.9: Parts of Guanay II AUV The vehicle has three thrusters, which classify the Guanay II as a propelled AUV. The principal thrust engine, from Seaeye Company [141], is located in the stern and on the longitudinal axis of the vehicle. Two thrusters by Seabotix Company [142] have been placed on both sides of the stern to control the direction of the vehicle. For immersion, the vehicle has a cylinder located inside of the watertight module. When the vehicle goes down the cylinder takes water to make the vehicle more dense than water. Conversely, when it goes up, the cylinder is emptied to make the vehicle less dense than water. The using of a cylinder has been chosen, instead of a vertical thruster, for two important reasons. First for energy saving, because a vertical thruster would imply a constant current consumption while the cylinder does not. And second, because the data collection of salinity needs minimum perturbations in the environment, which would not be guaranteed if a vertical thruster were used. Finally, the vehicle has 5 fins, two pairs of them in a horizontal position to minimize rolling, and one in vertical position, a keel, to provide stability going forward. 2.2. GUANAY II AUV 15 2.2.3 Evolution of the project The SARTI group has been working in the development of an AUV for some time (see ´ Alvarez and Olivar [4] for one of the first publications). This project was born with the name Cormor´an [114] because there is a family of aquatic birds with this name that catch the prey by diving from the surface. The funds of the project were shared with the IMEDEA institute. However, it was renamed to Guanay, a species of cormorants of South America, in order to differentiate it from the vehicle developed by the IMEDEA. Works by Prat et al. [104] and Vidal et al. [152] show the design of the first prototype, which had a structure of PVC. This vehicle was finished and tested in a swimming pool with the work of Galo [46], and Vi˜nolo and Pallar´es [153], which was published in [51] [49] [50]. The resulting prototype had, however, serious tightness problems with. Figure 2.10 shows this first prototype developed by the SARTI group. Figure 2.10: Guanay project: First prototype Hydrodynamic studies were started in order to design the second prototype of the vehicle [48], which was called Guanay II, and the external structure was changed to fiber glass, and the hardware was encased in a module with a robust tightness. The hardware was extended and improved by Masmitj`a and Masmitj`a [82], and further developed in [81]. 2.2.4 Problems and needs for the operability The latests developments made in the vehicle were very satisfactory. However, there remained some problems and needs to be solved in order to guarantee the operability of the vehicle. These needs can be divided into four groups: buoyancy, hardware, software, and autonomy. •Buoyancy. The vehicle needed the addition of foams to improve buoyancy. These foams had to be designed taking into account the geometry of the vehicle and its weight. Additionally, a ballast system was required for fine adjustment. •Hardware. The hardware adjustments can be further divided into 6 groups: Control unit, power, communication, navigation, actuators, and safety. First it was necessary to devise a new driver for the lateral thruster in order to enable it to thrust backwards, which would also improve the turning capabilities. Next, it was necessary to perform a complete study of capabilities for diving, that is, the electric power associated to diving maneuvers and the maximum depth attainable. A new system to start the vehicle for easy handling and a sensor for power consumption was also needed. Respect to communications, it was necessary to include a WiFi connection to access the operating system remotely, avoiding the need to open the watertight module. Finally, it needed some calibration of the sensors and the addition of some commercial devices. 16 CHAPTER 2. REVIEW OF UNMANNED VEHICLES AND GUANAY II AUV •Software. The software had to be restructured and improved. First, it required multithread operation, that is, one thread for each task in order to interact with different sensors at different frequency acquisition. Second, it needed more commands to configure and to control the vehicle from the base station. The software lacked scripting capability, which is very useful to facilitate the work of the operator. Finally, the software had several bugs to be solved, and a new, more intuitive graphical interface had to be designed. •Autonomy. The vehicle required a satisfactory controller for autonomous navigation. It was necessary to calculate the hydrodynamic model of the vehicle in 3DoF to determine its behavior in front of different situations in the surface, and a controller had to be designed using this model as a base. Chapter 3 Buoyancy The vehicle needs an adjustment in its buoyancy, because the components that it uses, like aluminum, batteries, electronics, thrusters and so on, are more dense than water. This chapter will explain the foam and ballast system added to the vehicle in order to produce a positive buoyancy for the vehicle and to stabilize it in pitch movement. 3.1 Foams Archimedes’ principle indicates that the upward buoyant force that is exerted on a body immersed in a fluid, whether fully or partially submerged, is equal to the weight of the fluid that the body displaces. This force is given by B=ρgV (3.1) where ρis the density of the fluid, gthe gravity and Vthe volume of the body immersed (or the volume of fluid that the body displaces). 3.1.1 Initial buoyant force Table 3.1 shows the mass of the different components of the vehicle. They add up to 92.6 kg, which gives a total weight of W=mg = 907.48 N.(3.2) On the other hand, the Guanay II AUV was modeled in the CAD software NX in order to compute its volume. The results showed that the total volume of the vehicle is V= 0.075615995 m3.(3.3) Assuming that the density of the seawater is 1025 kg/m3, and applying equation (3.1), the buoyancy force on the AUV is B=ρgV = 1025(9.8)(0.075615995) = 759.56 N (3.4) As the weight Wis bigger than the force B, the vehicle does not float and goes down. 17 18 CHAPTER 3. BUOYANCY Table 3.1: Vehicle masses in air Vehicle part Value Units External hull 27.1 kg Main thruster 4.3 kg Lateral thrusters 1.4 kg Watertight module 59.8 kg 3.1.2 Calculation of the volume of foam As the buoyancy force is not enough it is necessary the use of foams, which are much less dense than water. In this section we calculate the volume of foam Vfneeded. We also take into account its density ρf. When water goes into the cylinder the vehicle must dive, that is, W > B (m+ρfVf+ρVc)g > ρg(V+Vf) m+ρfVf+ρVc> ρ(V+Vf) Vf<m−ρV +ρVc ρ−ρf Vf<16.6311 1025 −ρf where Vcis the volume of water that can take the cylinder (1.5 L). On the other hand when the cylinder expels the water the vehicle must float, W < B (m+ρfVf)g < ρg(V+Vf) m+ρfVf< ρ(V+Vf) Vf>m−ρV ρ−ρf Vf>15.0936 1025 −ρf Hence 15.0936 1025 −ρf < Vf<16.6311 1025 −ρf (3.5) The inequality (3.5) indicates that the volume of foam must be between the two values in order to guarantee the principle of diving. The subtraction of these two values is approximately Vc, the volume of water that the cylinder can take. Preliminary tests were made in a pool in order to confirm these calculations (see Figure 3.1). The volume of foam used was about 16 L (or 0.016 m3). Taking into account that the density of the foam is about 20 kg/m3, this volume are between the values of the inequality (3.5), thus the calculations coincides with the field tests. These tests also serve to align the center of gravity with the center of buoyancy so that the vehicle has no pitching. For this, 11 L must be at the stern and 5 L at the bow. 3.1. FOAMS 19 Figure 3.1: First foams used for the buoyancy A material of polyurethane with high resilience, with commercial name H130, and with a density of 130 kg/m3and operating depth up to 85 m was chosen for the foams. Using inequality 3.5 the volume of foam must be between 16.86 L and 18.58 L. The design was made using SolidWorks software. The profile of each block of foam follows the Myring profile (see section 7.2.1) adapted to the bow, center and stern of the vehicle, with a volume of 1.11 L, 4.58 L and 11.32 L respectively (see figures 3.2 -3.6). The sum of all blocks is 17.01 L. Taking this into account, the new mass of the vehicle is m= 92.6 kg + 130 kg/m3(0.017 m3) = 94.8 kg (3.6) 30.96◦ 98 70 196 Units [mm] Figure 3.2: Foam A — Bow 3.1.3 Payload In order to have a margin to put more weights without losing the buoyancy, another block of foam of 4.58 L (foam B - center) was designed for the center of the vehicle. The resulting payload can be used for more sensors or batteries. Denoting by Wpf the weight of the pair payload-foam, and by Bpf the buoyancy force for this pair, the condition of equilibrium implies that 20 CHAPTER 3. BUOYANCY 400 80 R135 R158 23 78 274.809 179.154 Units [mm] Figure 3.3: Foam B — Center 10 514 249 60 80 R156 10 156 Units [mm] Figure 3.4: Foam C — Stern Wpf =Bpf (mp+mf)g=ρg(Vp+Vf) mp−ρVp=ρVf−mf Payload =ρVf−mf Payload = (ρ−ρf)Vf = (1025 −130)(0.00458) = 4.1 kg (3.7) Notice that the payload is not the weight in air but the weight in water. 3.2. BALLAST SYSTEM 21 3.2 Ballast system The purpose of a ballast system is twofold. First, the possibility of adding a small weight in order to make small increases in the density of the vehicle and hence adjust the buoyancy. And second, to move this weight along the vehicle in order to adjust the pitch to zero, that is, to vertically align the center of gravity with the center of buoyancy. We opted for an sliding lineal system, consisting of a guide of aluminum with an attached car that moves along it. The car has a screw to manually fix its position, and has a perforated platform to attach different weights. The model selected is a Drylin W by Igus [59] (see figure 3.5). Figure 3.5: Drylin linear guide for the ballast system The ballast system was situated at the bottom of the vehicle to lower the center of gravity, and also increase the stability in roll movement. Regarding the longitudinal position it is at the center of the vehicle in order to obtain a major rank to adjust the pitch inclination. The dimensions of the guide are 50 cm in length by 5 cm in width. Figure 3.6 shows the final disposition of the ballast system and the blocks of foam. Buoyancy Ballast Figure 3.6: Ballast system 22 CHAPTER 3. BUOYANCY 4.2. POWER SYSTEM 29 40 20 0 -20 -40 0 1 2 3 45 ×10−5 time [s] Duty 55% Voltage [v] 2.17V PWM Average 9.8V 18.3V -17.8V Duty 75% Duty 90% Duty 10% 40 20 0 -20 -40 40 20 0 -20 -40 40 20 0 -20 -40 Figure 4.6: PWM signals with different duty cycles for the lateral thrusters 4.2 Power system The power system of the Guanay II AUV can be improved in some aspects. In this section we describe a RF remote control on-off to facilitate the starting, and a sensor to monitor the power consumption by the actuators. 4.2.1 RF remote control on-off One of the problems with the hardware architecture of the Guanay II AUV is the switch to start the vehicle. As can be seen in Figure 4.7 it consists of a HPDC4M interrupter by Subconn [135] that makes a bridge between the batteries and the electronics. If an operator needs to do a reset to all the system, the vehicle has to be pulled from the water, the bottom lid as to pe opened(in a reduced space), and the interrupter has to be disconnected/reconnected manually. A RF remote control on-off has been implemented in order to solve this problem. It is a HIR6-433 device by RF-solutions [54], which consists of an encoder and a AM receptor. This device activates a relay that connects the batteries with the rest of electronics. Figure 4.8 shows the circuit made for this module. The circuit with its antenna has been located out of the watertight module, specifically in the main antenna of the vehicle, and it is wired through a Subconn connector. 30 CHAPTER 4. HARDWARE 24V 12V 5V GND Switch Batteries Electronics Figure 4.7: Original switch to power the electronics manually R1 3k8 R2 220 5V VIN 1 2 VBAT 1 2 VAUX RELAY 1N4001 D1 1N4001 D2 OPTO U1 Control Vout Vin U2 GND UM2211 VIN 5V 1 2 VOUT U1 HIR6-433 Vcc-RF GND-RF ANT GND-RF GND-AF RSSI O/P-AF VCC-DIGI GND-DIGI MCLR Latch/Mom SerialData O/P1 Learn/LED O/P2 O/P3 O/P4 Run/Sleep 5V R3 220 LED D1 S1 MagneticSW 5V Control Ant C1 470uF C2 470uF Figure 4.8: RF on-off schematic 4.2.2 Power consumption sensor The Guanay II is a vehicle in development phase. For this reason, we have considered appropriate to add a power consumption sensor to monitor the consumption of the actuators of the vehicle. It is divided in two parts: First, a resistance of 0.01 Ω in series, whose small voltage is directly proportional to the current, so it can be used to measure the current; and second, a voltage divisor in order to measure the voltage. These two sensors are at the beginning of the power lines in the actuators box, so it measures the voltage and current of all the actuators together. Finally, the voltages of these signals are sensed by the DAQ board. 4.3 Immersion system The immersion system of the Guanay II AUV is a important part for its navigation. We present first a calibration of the pressure sensor. Second, an study of the use of an air chamber is presented in order to reduce the energy consumption when the vehicle is emerging. And finally, the maximum operating depth of the vehicle is discussed. 4.3. IMMERSION SYSTEM 31 4.3.1 Calibration of pressure sensor The pressure sensor is powered by 12 V and following the indications of the manufacturer it has a sensitivity of 0.5 V/bar. Several tests have shown that this sensor needs a calibration in order to get good data. For this, we have connected the pressure sensor to a compressor where can be set to different pressures. Figure 4.9 shows a relation between the pressure and the voltage of the sensor. 0 0.2 0.4 0.6 0.8 1 0 0.5 1 1.5 2 2.5 Linear reg Quadratic reg Cubic Voltage [V] Pressure [Bar] p1 p2 p3 p1= 2.15v+ 0.22 p2=−0.36v2+ 2.53v+ 0.17 p3= 2.13v3−3.80v2+ 3.90v+ 0.09 Experimental data Figure 4.9: Relation of the pressure and voltage in the pressure sensor, and three polynomial regressions. It also shows three different polynomial regressions. The first one is a linear regression, represented by a green line. It coincides with several values but has an offset of 0.22 bar, which is very different from reality, i.e. for 0 V the sensed pressure must be 0 bar. The quadratic regression (displayed in red) also coincides at several points and has an offset of 0.17 bar. On the other hand, the cubic regression (represented by a cyan line) has an undesired oscillation but has a smaller offset. Although these two regressions have good performance the manufacturer mention that its regression must be linear, that is, for values greater than 2.5 bar the above regressions will not coincide with the reality. It is important to note that the linearity can be seen clearly but it has a drastic change in values near to 0 V. Figure 4.10 shows another regression composed by two lines: One for voltages less than 0.08 V and the other for values greater than 0.08 V. This regression shows a better performance compared with the above regressions. Table 4.1 shows the root mean squared deviation of each regression respect to the experimental data. From them the segmented regression presents the smallest deviation. 4.3.2 Study of the use of a chamber The vehicle uses the cylinder in the process of diving. It is a double actuated cylinder, model is CRDNG-100-200-PPV-A by Festo [132] (100 mm of diameter and 200 mm of length). One port is connected to the seawater in order to fill the cylinder, and the other port connects 32 CHAPTER 4. HARDWARE 0 0.2 0.4 0.6 0.8 1 0 0.5 1 1.5 2 2.5 Segmented reg Voltage [V] Pressure [Bar] p p=6.25vif v≤0.08 1.9553v+ 0.3303 if v > 0.08 Experimental data Figure 4.10: Segmented regression for the calibration of the pressure sensor Table 4.1: Root mean squared deviation of the regressions of the pressure sensor Regression RMSD Units Linear 0.1189 bar Quadratic 0.1122 bar Cubic 0.0948 bar Segmented 0.0699 bar with the interior of the watertight module, as can be seen in figure 4.11. When the cylinder is full of water, the air pressure in the interior of the watertight module is slightly above atmospheric pressure. Watertight module Air Seawater Motor Figure 4.11: Immersion system The consumption of energy is related to two cases: Going down and going up. When the vehicle is in the surface, the cylinder is subjected to the atmospheric pressure present in the seawater and the interior of the watertight module, and it uses little power in the immersion. On the other hand, when the vehicle is underwater, the cylinder is subjected to high pressure present due to the seawater column and the atmospheric pressure present in the watertight 4.3. IMMERSION SYSTEM 33 module. In this order, the cylinder uses more power consumption when the vehicle goes up. At higher depths there is a risk of shipwreck if the batteries have little power. Additionally, one has to take into account the features of the motor of the piston, a lineal motor ATL-08 by Servomech [74], whose maximum current is 9 A. One solution is the use of an air chamber instead of connecting the cylinder with the interior of the watertight module. The idea is accumulate energy in the immersion (compress the air and concentrate pressure) in order to use it when the vehicle goes up. Although the batteries will use more energy in the immersion, they will use much less going up. This air chamber is a PVC tube of 2.66 cm of diameter and 65 cm of length. The volume of the compressed air V(x) consists of the sum of the air chamber Vch and the cylinder Vcyl(x), which is in function of the position of the piston x, V(x) = Vch +Vcyl(x) =Vch +πr2x(4.2) where ris the radius of the cylinder. Denoting by Lthe total movement of the piston, the air pressure can be calculated using Boyle’s law: Pa(x) = Pe V(L) V(x) =P0 Vch +πr2L Vch +πr2x(4.3) where P0is the pressure when the cylinder is full of air and coincides with the atmospheric pressure (1 bar). The accumulated pressure can go from 1 to 5.3 bar. When the piston is moving the sum of forces must be equal to zero in order obtain a constant velocity v. Denoting by Fathe force of the air chamber, Fwthe force of the water and Fmthe force of the piston (see figure 4.12), we obtain that Fm+Fa−Fw= 0 PmA+PaA−PwA= 0 Pm=Pw−Pa.(4.4) Notice that as we apply these forces to the same area A, this relation can be seen as a sum of pressures. In order to eject the water, the piston pressure Pmmust be a little bigger than Pw−Pa, but when the cylinder takes the water in it must be a little lower than Pw−Pa. Pm Pw Pa L 0 x v Vch Figure 4.12: Pressures acting on the piston This piston pressure is directly related to the direction of movement and the current given to the engine. This current must be the same whether the pressure to overcome is in 34 CHAPTER 4. HARDWARE one direction or the other. For example, the current used to move the piston forward when there are 2 bar in the air chamber and 3 bar in the sea, is the same current used to move the plunger in backwards when there are 3 bar in the air chamber and 2 bar in the sea. We define pas the pressure to overcome with respect to the direction of movement: p=dPm(4.5) where dis the direction of movement (that is +1 to empty or −1 to fill). Therefore, the current iis a function of this pressure: i=f(p) i=f(dPm) (4.6) In order to determine this relation several tests were made. They are separated into two groups: 1. Without the use of the chamber, as is observed in figure 4.11. The air is compressed in the watertight module and the pressure is approximately the atmospheric pressure (1 bar). Since the watertight module is large pressure changes very little. 2. Using the air chamber, as is observed in figure 4.12. Where the air is compressed from 1 to 5.3 bar. The signals of the magnetic sensors have been adapted to the DAQ board in order to monitor the final position of the piston. The watertight module and the motor-cylinder ensemble have been placed inside of an hyperbaric chamber, which is an infrastructure to test the performance at different pressures of water. Figure 4.13 shows the infrastructure used. Figure 4.13: Watertight module and hyperbaric chamber Table 4.2 summarizes the current and the time to move the total plunger stroke in the case of not using the air chamber, where the pressure changes are minimal and the current is almost constant. The relation of the current to the pressure is shown in Figure 4.14. Each point corresponds to a specific condition of the water pressure Pw, the direction of movement dand the position of the piston x(empty cylinder of full cylinder). The pressure pcombines these conditions using the equations (4.3) - (4.5). This figure also shows that for a pressure of 4 bar a current of 8.5 A is needed, which is near to the maximum current allowed by the motor. 4.3. IMMERSION SYSTEM 35 Table 4.2: Cylinder currents and times without the use of an air chamber d Pw[bar] i[A] t[s] -1 1 1.25 10.38 -1 2 0.5 10.5 -1 3 0.5 10.31 -1 4 0.5 9.2 1 1 1.25 11.15 1 2 2.2 12.25 1 3 4.0 14.65 1 4 6.0 18.75 0 2 4 6 8 Regression Experimental data Pressure p[Bar] Current [A] -4 -3 -2 -1 0 1 2 3 4 Figure 4.14: Current of the cylinder as a function of the pressure p It is important to note that when pis negative the current tends to 0.5 A, which is the minimum current necessary to move the plunger. For instance, when the movement ejects the water (d= 1) and the air pressure is bigger than the water pressure (Pw−Pa<0), the current used is minimum since the air pressure helps to move the plunger. The same result is achieved when the direction of movement is such that water (d=−1) goes in and the water pressure is bigger than the air pressure (Pw−Pa>0). The regression analysis of the data has been separated into two segments: i=0.1566p2+ 1.1814p+ 1.0203 if p≥ −0.47 0.5 if p < −0.47 (4.7) In the same way, using the total plunger stroke and the time of travel, the relation of the plunger velocity vand the pressure phas been calculated as v=−0.0002p2−0.0017p+ 0.0181 if p≥ −1.4 0.02 if p < −1.4(4.8) 36 CHAPTER 4. HARDWARE Notice that both current and velocity are described with respect to the pressure p. On the other hand, this pressure is in function of the water pressure Pw, direction of movement dand position of the plunger x. In this way, it is possible to simulate the current iin time by setting conditions of water pressure and direction of movement. Figure 4.15 shows the actual tests and simulations of the filling process for different conditions. When the water pressure is at the sea surface (1 bar) the cylinder needs 1 A of current without the air chamber, but needs a growing current from 1 to 5 A using the air chamber since the compression of the air impedes the movement. In this case the air chamber earns potential energy. Following with the tests, when the water pressure corresponds to 10 m of deep (2 bar) the cylinder needs 0.5 A of current without the air chamber. This is because the seawater helps the movement. If the air chamber is used, the current starts at 0.5 A, but as the air is compressed the current grows up to 4 A. In a similar way, when the water pressure is that of 20 m of depth (3 bar) the current is 0.5 A without the air chamber. If the air chamber is used the current starts at 0.5 A during a prolonged time, and grows when the air pressure overcomes the water pressure. The analysis at 4 and 5 bar is similar to the above. The difference is that the cylinder needs less and less power to fill it due to the higher water pressure. Figure 4.16 shows the actual tests and simulations of the emptying process for different 0 5 10 15 0 5 Without air chamber 0 5 10 15 0 5 0 5 10 15 0 5 0 5 10 15 0 5 0 5 10 15 0 5 With air chamber 0 5 10 15 0 5 0 5 10 15 0 5 0 5 10 15 0 5 0 5 10 15 0 5 E= 359.4J E= 144.6J E= 150.9J E= 123.5J E= 700.7J E= 418.0J E= 231.3J E= 165.7J E= 133.1J Simulation Real data time [s] Current [A] Pw= 1 bar time [s] Pw= 2 bar Pw= 3 bar Pw= 4 bar Pw= 5 bar (10 m deep) (sea surface) (20 m deep) (30 m deep) (40 m deep) Figure 4.15: Current of the cylinder in the filling process at different conditions 4.3. IMMERSION SYSTEM 37 conditions. In all cases where the air chamber is used, the initial condition is 5.3 bar of compressed air, which is a potential energy that will help to eject the water. When the water pressure is that of the sea surface (1 bar) the cylinder needs 1 A of current without the air chamber. If the air chamber is used the current starts at 0.5 A during a prolonged time, and grows when the air pressure decreases near to the atmospheric pressure. In a similar way, the other cases of 10, 20 and 30 m of depth show a constant current without the use of the air chamber, and a small current that increases in time when the air chamber is used. At the same time, less time is needed to empty the water when using the air chamber. These results satisfy the initial objective of reducing the current when the vehicle is underwater and is going to emerge. Figures 4.15 and 4.16 also show the energy used in each case to perform the action, which is given by E=Zt 0 Power dt E= 24 Zt 0 i dt (4.9) The equation calculates the energy based on the power used by the cylinder. The power consists of the product of the voltage and current, with a constant voltage of value 24 V, and 0 5 10 15 20 0 5 Without air chamber 0 5 10 15 20 0 5 0 5 10 15 20 0 5 0 5 10 15 20 0 5 0 5 10 15 20 0 5 With air chamber 0 5 10 15 20 0 5 0 5 10 15 20 0 5 0 5 10 15 20 0 5 0 5 10 15 20 0 5 E= 366.3J E= 613.1J E= 1350.2J E= 2479.3J E= 174.2J E= 372.8J E= 866.2J E= 1717.2J E= 2853.9J Simulation Real data time [s] Current [A] Pw= 1 bar time [s] Pw= 2 bar Pw= 3 bar Pw= 4 bar Pw= 5 bar (10 m deep) (sea surface) (20 m deep) (30 m deep) (40 m deep) Figure 4.16: Current of the cylinder in the emptying process at different conditions 38 CHAPTER 4. HARDWARE a current which depends on time. The energy saving δis calculated as the reduction of energy to empty the cylinder when the air chamber is used: δ=En−Ech En×100 (4.10) where Enis the energy used without the air chamber and Ech the energy with the air chamber. According to the above results, the energy savings are about 39.2%, 35.8% and 30.7% when the vehicle is at depths of 10, 20 and 30 m, respectively. 4.3.3 Maximum operating depth As said, the Guanay II AUV was conceived to operate at shallow waters, and the maximum operating depth depends on several limitations. The first of them is the operating depth of the thrusters. The main thruster, being a thruster used for big ROVs, can be submerged up to 1000 m; instead the lateral thrusters, used for small ROVs, can be submerged up to 150 m. The second limitation is the tightness of the Guanay II. The module that contains all the electronics is made of aluminum, and the manufacturer estimates that its o-rings can support pressures up to 300 m. The next limitation is regarding the buoyancy. The foams have a safety factor for crush pressure, which corresponds to 85 m of depth. The final limitation is the force of the motor of the cylinder to eject water; in the last section we have shown that this limit is about 40 m of depth, which corresponds to the maximum motor current (9 A). Table 4.3 resumes the maximum operating depths by component. As the cylinder motor is the most restrictive limitation, the maximum operating depth of the Guanay II is 40 m. Table 4.3: Maximum operating depth by component Component Value Units Main thruster 1000 m Lateral thrusters 150 m Watertight module 300 m Foams 85 m Cylinder motor 40 m 4.4 Adapting commercial devices 4.4.1 Inertial Measurement Unit An inertial measurement unit (IMU) is a device that has 3-axis acceleration and 3-axis gyroscope sensing. It is used to estimate the position and attitude of the vehicle as an alternative to GPS when the vehicle is underwater. The device used is a IG-500A-G3A1P1- B unit by SBG Systems [58] (see figure 4.17), which has a measurement range of ±2 g in the accelerometers and ±300 ◦/s in the gyroscopes. The position can be calculated using integrals over the time from the acceleration and gyroscope data. This is called inertial navigation, the error in the position will increase over the time and has to be actualized by an absolute system, like a GPS. However, further tests in the Guanay II AUV have shown that the noise present in the device greatly affects the 5.1. VEHICLE SOFTWARE 45 •The cluster variable with all the data was ungrouped in several global variables. This change decentralizes the information and prevents conflicts between threads. •There is a new option to emulate the global position, attitude, depth, and cylinder position. This option allows testing and debugging the software regardless of the sensors. •There is a new option to run the vehicle in automatic mode. •We solved several problems and bugs, specially with synchronization and variable assignation, giving robustness and fast response. •We created more options and functions to improve the versatility. •The GUI works in an independent thread. Since the graphical interface does not make sense in the vehicle software, this thread can be suppressed, if necessary, in the future. We describe next some specific improvements in the software. 5.1.1 Command function The vehicle had initially three commands, which were very limited to configure and control the vehicle. In the revised version we have added more parameters and consequently more commands to configure the operation of the vehicle. To implement it we use a subroutine dedicated to interpret and modify the parameters, the command function. This function implements the communication between the threads. To avoid conflicts trying to access the same resources, this function works as a lock, so there is a synchronization accessing the parameters. Additionally, this command function works as message-response, that is, every command has a response, with the function sending an OK in the case of instructions, or data information in the case of petitions. This operation improves the synchronization in messaging, one of the problems mentioned in the introduction (see figure 5.3). Base station Vehicle local time local time Base station Vehicle local time local time (a) (b) Figure 5.3: Temporal diagram of the protocol communication. a) Old approach. There is no synchronization between the nodes. b) New approach. For each message there is a synchronized response Commands are divided in seven groups, as follows: 1. “SET:variable=new value”. This type of command is used to configure the parameters of the vehicle, like type of automatic control, maximum velocity, constraints to the main thruster, continuous data transmission, among others. If the assignation is correct the function returns SETACK. 2. “GET:variable”. This type of command is used to get the actual value of a parameter. Additionally, it is used to get the sensors data. 46 CHAPTER 5. SOFTWARE 3. “MAN:MainT_RightT_LeftT”. This is conceived to be used by the operator. The command modifies the propulsion of the three thrusters. The values must be between -100 and 100. The function returns data from the sensors, in order to show the performance of the vehicle to the operator. 4. “IMM:TargetDepth_MaxTimeUW”. This command initializes the immersion task of the vehicle. The arguments are the target depth and the maximum time allowed to be underwater. When one of these parameters is reached the vehicle goes up. The function returns IMMACK. 5. “AUT:option”. This command manages the autonomous operation of the vehicle. The response depends on the option argument. It starts/stops the operation, gets important information, or sets up the aborting operation, which sends the vehicle back home. Chapter 8is dedicated to the autonomous navigation. 6. “RUN:file”. This command executes a script stored in a file, so the configuration of the parameters and the operation of the vehicle can be greatly simplified. Further details are shown in section 5.1.4. The function returns RUNACK. 7. “CMD:command”. This command sends a command to the console of the operating system. This is very useful when the WiFi connection fails (maybe due to the distance) and we want to get some information or to do some configuration. For instance, CMD: cat file.txt returns the data stored in a file. A complete description of the commands and options can be found in appendix B. 5.1.2 Sensors There are 6 different threads to sense the data of the sensors, and their main improvements are described next. GPS This thread manages the data from the GPS. It consists of a while loop which performs the lecture from the sensor, data storage in a file, and error management (see figure 5.4). Additionally, it includes the variables emulLat and emulLong to emulate a GPS frame for testing. Figure 5.4: Principal loop of the GPS sensor 5.1. VEHICLE SOFTWARE 47 IMU This thread manages the IMU. Since this sensor is a new one, this thread has been developed from scratch. A new library was required because the manufacturer only supports the LabVIEW blocks for Windows operating system. This development consists in the implementation of the low level protocol to communicate with the sensor by RS232 using frames up to 512 bytes. The thread includes the lecture of the sensor, data storage, and error management. Figure 5.5 shows the main while loop of the thread. Figure 5.5: Principal loop of IMU sensor Compass This thread manages the data from the compass. It consists of a while loop which does the reading of the sensor, data storage in a file, and error management (see figure 5.6). Additionally, it includes the variable emulYaw to emulate a compass frame for testing. Finally, we have added the possibility to calibrate the measure loading a calibration curve stored in a file. Figure 5.6: Main loop of the compass sensor 48 CHAPTER 5. SOFTWARE DAQ This thread manages the information from the data acquisition board. Like in the IMU case, a new library was required to be created because the manufacturer only supports the LabVIEW blocks for Windows operating system. The communication at low level with the hardware was established using libcomedi0 package [73]. This thread reads the voltage of 6 signals and normalize them to the correct units. 4 of them are analogue (pressure, humidity, drivers voltage, and drivers current), and 2 are digital (magnetic sensors to sense the ends of the cylinder). The routine also includes some variables to emulate the sensing. Figure 5.7 shows the principal routine of the thread. Figure 5.7: Principal loop of the data acquisition board Battery This thread manages the information from the battery. It consists of a while loop which reads the sensor, performs data storage in a file, and error management (see figure 5.8). The measure of the charge of the battery is made by Coulomb counting. This means that the measure is relative to the incoming/outcoming current and it is not cent per cent reliable. For this reason we have added a special initialization. Thanks to the voltage measure it is possible to estimate if the battery is empty of full by measuring 23 or 28 V respectively, so there is a module to verify these limits and to rewrite the charge lecture. Data of main thruster This thread manages the data acquisition from the main thruster, i.e. current and revolutions per minute. It consists of a while loop which does the lecture of the sensor, data storage in a file, and error management (see figure 5.9). 5.1. VEHICLE SOFTWARE 49 Figure 5.8: Principal loop of the battery sensor Figure 5.9: Principal loop to acquire data from the main thruster 5.1.3 Actuators There are 3 different threads to control the actuators: Main thruster, lateral thrusters, and cylinder. Main thruster This thread manages the actuation of the main thruster. It consists of a while loop which has the protocol to control it, and error management (see figure 5.10). Figure 5.10: Principal loop to actuate the main thruster Lateral thrusters This thread manages the actuation of the lateral thrusters. As we saw in section 4.1.2 there are two instructions to control them. Figure 5.11 shows the while loop with this protocol and the error management. 50 CHAPTER 5. SOFTWARE Figure 5.11: Principal loop to actuate the lateral thrusters Cylinder This thread manages the actuation of the cylinder thrusters. For this version this thread uses the magnetic sensors, which are sensed by the DAQ board (section 5.1.2), in order to know when the cylinder is full or empty, and thus to continue with the operation going down or going up. Figure 5.12 shows the principal loop of this thread to change between the states and to manage the errors. Figure 5.12: Principal loop to actuate the cylinder 5.1.4 Management This section presents the high level management of the entire system. Formerly the code consisted of a single module, the base station communication. For this version we have created three threads: base station communication, navigation, and scripts. Base station communication This thread has the task of communicating the vehicle with the operator in the base station. It receives a frame by the radio modem, does the instruction, and finally sends a response to the base station. The thread consists of a while loop which reads the bytes in the port until an end of line (EOL) is received. Next, using the command function it sends the instruction to the appropriate module. Like the above, this thread has an error management for possible problems with the port. Figure 5.13 shows the principal loop of this module. 5.1. VEHICLE SOFTWARE 51 Figure 5.13: Main loop of the base station module Scripts In order to simplify the operation of the vehicle we have added this thread to implement several instructions sequentially. The idea is to save a file in the hard disk of the vehicle, containing a sequence of instructions. The operator selects then the file with the command SET:SCRIPTFILE=file.txt, and finally runs the script with the command RUN. While in previous thread the standard output (stdout) was the base station, in this thread it is a log file. The file stores the time, command, response, and the waypoints reached if the vehicle works in automatic mode. Figure 5.14 shows the principal loop of this thread. Navigation This thread controls the navigation of the vehicle. Among the high level management threads, and as a safety feature and to avoid conflicts, this is the unique thread that modifies the action of the cylinder and thrusters. The way to act on the actuators depends on the operation mode, which can be manual or automatic. For this thread we have created an automatic module with several options and types of guidance (Chapter 8is dedicated to the autonomous navigation). Waypoints are taken from a file in the vehicle. As a security feature the thrusters are stoped if any of following conditions is met: 1) The vehicle is underwater (configurable by the parameter DEPTHSURFACE), 2) There is no GPS signal (configurable by the parameter MAXTGPS), 3) There is no compass signal (configurable by the parameter MAXTCOMPASS), 4) There is no communication with the base station (configurable by the parameters MAXTMOT and MAXTAUTGET for manual mode and automatic mode respectively). This thread also calculates the actual velocity and maximum depth reached. Finally, all values of the actuators are saved to a file. Figure 5.15 shows the principal loop of the thread. 52 CHAPTER 5. SOFTWARE Figure 5.14: Principal loop of the Script module Figure 5.15: Principal loop of the Navigation module 5.2. BASE STATION SOFTWARE 53 5.2 Base station software The operator is in the base station. For this reason it is necessary to have a software with a robust graphical user interface (GUI) which facilitates the operation of the Guanay II AUV. The software works with 3 threads. One of them is dedicated to manage events related with the radio modem in order to establish communication with the vehicle. The second thread manages the visualization of indicators and warnings. And the third thread is used to interact with the joystick. This thread is necessary because the joystick does not has event handlers. The GUI is very intuitive, since all controls and sensors are shown in a single reduced window without losing functionality, as it can be shown in figure 5.16. There are several panels: Compass Diving GPS and forward velocity Radiomodem frames Manual/automatic interface Time elapsed since the last reception Indicators and warnings interface Command-line Menu interface Figure 5.16: Base station software. Graphical user interface •Manual/automatic interface. The panel has two bars to control the thrusters. The vertical bar controls the main thruster, and the horizontal bar controls the lateral thrusters. These bars can be handled by the keyboard, the mouse, or more preferably, by the joystick. The horizontal bar works in conjunction with 3 buttons, located on the left, which determine the way that the thrusters are actuated. Finally, the panel includes buttons and indicators for the automatic mode. •Diving interface. This panel has the bars and controls to set the diving motion. It has indicators to know the elapsed time of the last immersion, the maximum depth reached, and if the cylinder is full or empty. •Radiomodem frames. This panel shows the last frame sent and the last frame received. 54 CHAPTER 5. SOFTWARE Additionally, it shows the elapsed time since the last frame reception and receiving data from the different sensors. •Compass. It shows the heading, roll and pitch of the vehicle. •GPS and velocity. It shows the latitude and longitude of the vehicle, the number of satellites used, and the forward velocity of the vehicle. •Indicators and warnings. It shows the state of some vehicle sensors (battery, inside temperature, inside humidity, and pressure), and the state of the base station ports (radio modem and joystick). •Command-line interface. This interface allows the operator to send commands to the vehicle (see appendix Bfor the communication protocol). On the right, there is a combo box with some useful commands (configurable with predefcommands.txt), and a button to clear the command history of the console. •Menu. It has a menu to diagnose the connection with the vehicle. Additionally it has a button to start Google Earth in parallel. 5.3 Complementary software We added some complementary software to facilitate the operation of the vehicle. •Google Earth. This software is used in the base station to see the path tracked by the vehicle. It works in real time: the software of the base station updates a kml file continuously with the vehicle position and the waypoints. Then Google Earth opens this file and shows the travel in the map. •FTP connection. The vehicle has installed vsftpd, which is a software to establish a FTP server. This allows an easy way to download the stored files in the vehicle after a mission. A client node is required in the base station (like FileZilla or a browser). •SSH connection. The base station has installed putty, a client to establish a secure shell connection (SSH). This software is used to access the console of the vehicle operating system remotely. •TeamViewer. This software is used to control remotely the operating system of the vehicle. Since it shares the desktop, it allows for an easier manipulation. 5.4 Conclusions The new software has improved and simplified the manipulation of the Guanay II AUV. Figure 5.17 shows the new software architecture in both the vehicle and the base station. The main improvements are summarized as follows. •The software of the vehicle has been developed to work in Linux. Libraries were created to manage the IMU and the DAQ. •The vehicle uses one thread for each task. This helps to interact with different frequency acquisition and to strengthen the software. 6.4. IMMERSION AT THE OBSEA 61 Figure 6.6: Photos during the tests in swimming pool 6.4 Immersion at the OBSEA Another test with the vehicle was made in the OBSEA [94], a marine observatory located 4 km off the coast of Vilanova i la Geltr´u, Spain. The test consisted of realizing several immersions at different depths taking temperature data, as can be seen in Figure 6.7. The results showed good performance. The vehicle reached the depths 5 m, 10 m, 15 m and 20 m (maximum depth of the sea at this point) in a satisfactory way. The descent speed was about 0.07 m/s and the ascending one about 0.11 m/s. Regarding attitude, the vehicle had a slight deviation between the center of buoyancy and the center of gravity when the cylinder takes in water, prompting an inclination in the pitch of about 10◦going down and 5◦going up. Although there is an unwanted small pitching angle, it does not produce any effective horizontal displacement of the vehicle since the vertical speed is slow and the design of the fins is for stabilization only. The roll movement is close to zero degrees. The yaw movement, despite not being automatically controlled, was stable over several time periods, with some deviations due to the currents. Figure 6.7 also shows the consumption during the immersions. When the vehicle takes water in, the cylinder consumes 55 W ([email protected]) during a short period, and has a higher consumption when climbing. This is because it has to overcome the pressure caused by coming up from the depths: For 5 m it uses 130 W ([email protected]), in 10 m it uses 158 W ([email protected]), in 15 m it uses 167 W ([email protected]), in 20 m it uses 187 W ([email protected]). We noticed that these powers were greater than the powers seen at the hyperbaric chamber (see section 4.3.2). However, we realized that the constant use of the cylinder caused the salt water impurities to adhere to the walls, causing an increase in the current. To avoid this problem the cylinder needs rigorous cleaning periodically. 62 CHAPTER 6. FIELD TESTS: OPERABILITY Depth [m] and Temperature [◦C] 21.5 21 20.5 20 19.5 [◦C] time [s] 0 200 400 600 800 1000 1200 1400 1600 1800 2000 0 5 10 15 20 20 10 0 -10 10 5 0 26 24 22 150 0 -150 -300 Curr. [A] θ, φ [◦] Depth [m] pitch (θ) roll (φ) yaw (ψ) Current [A] and Voltage [V] Attitude [◦] 0 200 400 600 800 1000 1200 1400 1600 1800 2000 0 200 400 600 800 1000 1600 1800 2000 current voltage 1200 1400 ψ[◦] Volt. [V] Figure 6.7: OBSEA: Depth test 6.5 Catalonia Olympic Channel The Catalonia Olympic Channel is a seawater channel located in Castelldefels [157]. Its dimension is 1200 m in length and 200 m in width, which is enough to perform navigation maneuvers with the vehicle. Additionally, its platform allows to set up the infrastructure, including the base station, comfortably. The tests made in this site allowed to validate all changes and new features, namely the driver for the H-bridge for the lateral thrusters, the WiFi communication, the remote control to turn on/off, and the improvements in the software, among others. Figure 6.8 shows some pictures made during these tests. Thanks to the characteristics of the channel (low currents and thus low perturbations) we used it to test the navigation and maneuverability of the vehicle. This allowed us to determine the hydrodynamic model of the vehicle. Additionally, we used the channel to test the controllers for autonomous navigation. The second part of this thesis provides a detailed study of these issues. 6.6. LESSONS LEARNED 63 Figure 6.8: Photos during the tests on the Catalonia Olympic Channel 6.6 Lessons learned The experience acquired during the laboratory and field tests have taught us several lessons, which would have been very helpful if we had known before. Take into account that the development of this vehicle, unlike a commercial one with minimum guarantees of operation, was made in the research group, and we have to found all the little mistakes and solve them. The principal lesson learnt is that a campaign in the sea is very exigent, and minor inconveniences presented in the laboratory or swimming pool can be a serious problem at sea. The work at sea is difficult due to the waves that move the ship, the reduced spaces that make it difficult to work comfortably, the absence of electricity, the weather conditions which may be rainy or poor visibility, or due to the stress of all these things together. For this reason the manipulation of the vehicle must be as simple as possible. In the case of the hardware the starting system needs to be simple and remote. The vehicle needs a WiFi connection to control its desktop remotely, likewise it needs a joystick to input motion commands easily. All connections must be very robust and nowhere delicate, because there may be sharp movements in the vehicle. The tightness must be ensured at all points. The way to charge the batteries must be of type connect/disconnect, so that there is no need 64 CHAPTER 6. FIELD TESTS: OPERABILITY to disassemble things. Additionally, a protocol, including a tracking system, should be established for emergency cases. In the case of the software all of the modules must be robust. The software at the base station must be intuitive and very simple without losing functionality. The fewer clicks the better, trying to do as much as possible automatically. Adding functions to emulate a real test in the laboratory helps to detect and solve bugs. With all of these improvements the operator can work more relaxed and the desired minimum operating conditions to work at open sea are achieved. 6.7 Conclusions In this chapter we have showed the performance of the Guanay II AUV after implementing the improvements of buoyancy, hardware and software. First, at the laboratory, we found that with the change of the operating system to Linux, the starting time, including establishing communication with the base station, was reduced by 64%. Similarly, we have tested the power consumption of the different devices at the laboratory, with the result that the vehicle has an autonomy of 16 h without using any actuator. The vehicle have been tested at sea, in the Mar Menor lagoon, where we observed an steady movement through the water and a good stabilization both in roll and pitch. The CTD was tested obtaining good results. This test also served to identify some possible improvements in hardware and software, regarding the handling of the vehicle, which were then implemented. The vehicle was improved with new foams designed to be resistant under water. Additionally, it was upgraded with a WiFi connection and an RF remote control on/off for easy handling. Tests in a swimming pool showed good performance and easy manipulation. Further tests at sea showed a good performance of the immersion system. The vehicle was tested up to 20 m of deep, reaching a descending and ascending speeds of 0.07 m/s and 0.11 m/s, respectively. Finally, several tests were performed at the Catalonia Olympic Channel, mainly to check the behavior of the thrusters when following established paths. The new driver of the lateral thrusters worked very well, providing better maneuverability. Additionally, the improvements in the software helped to control the vehicle faster and in an easier way. From these results we concluded that the vehicle was fully operative, both in surface and under water, and that the operator can control, and get information from, the vehicle in a convenient and flexible way. Part II Hydrodynamic Model and Control 65 Chapter 7 Modeling This chapter presents a mathematical model for the Guanay II AUV. Mathematical models are necessary in order to simulate the performance of the vehicle in open loop and to design controllers for autonomous navigation. For vehicles in general, one can, in principle, separate the modeling of the kinematics from that of the dynamics. Kinematics refers to the vehicle’s movement given its acceleration, from which its velocity and position can be computed. On the other hand, dynamics refers to the forces and torques that generate those accelerations. In the case of marine vehicles there are several forces and torques generated by the movement inside a fluid that must be taken into account, and the calculation of some coefficients related to them is one of the main steps in the modeling process. Modeling of marine vehicles is developed in works by Fossen [42] [43], Wadoo [156], Perez [100], Nikolai [67], among others, where the coefficients, forces and torques needed in the characterization of a general ship are described. For a given vehicle one encounters two main difficulties: first the selection of the coefficients and then their calculation. It is difficult to know which coefficients are relevant for the characterization of a specific vehicle, such as the Guanay II AUV. The master’s thesis of Prestero [105] can be used as a guide s because it uses a set of coefficients adapted to the Remus AUV, which is a vehicle with the same geometry as the Guanay II. Prestero models and linearizes the Remus in the vertical plane, therefore he doesn’t need the linear damping coefficients and he only uses the quadratic damping. However, although this assumption simplifies the modeling, the dynamics when it is linearized in the horizontal plane is not very good. Additionally, it is important to remember that the matrices and coefficients of the external forces and torques acting on a marine vehicle correspond to an approximation of a more complex dynamics of the surrounding fluid. Triantafyllou and Hover, professors of MIT, mention that “the method of hydrodynamic coefficients is a somewhat blind series expansion of the fluid force... the intractability of the governing equations of motion of viscous fluid prohibits, at least today and in the near future, a computation of these forces” [147, Chap. 3], and mention that the actual assignation of the coefficients are taken from a Taylor series, and other necessary terms that can be found empirically, like the coefficient Y|v|v, which is associated with the modulus of the speed in the y-axis. With respect to this, we have found an unstability in the modeling of the Guanay II when it is moving backwards, which, up to our knowledge, is not mentioned in the literature in a detailed way. Our study shows that the model must be symmetric in order to stabilize the movement of the vehicle when it goes backwards. The second problem is the calculation of the coefficients, which are strongly coupled, 67 68 CHAPTER 7. MODELING making its individual computation quite difficult. Moreover, the navigation sensors of the Guanay II , that is GPS and compass, are not good for recording the vehicle dynamics because the frequency of the GPS and the compass is 1 Hz, and the calculation of velocity and acceleration with this data is not good at all. The thesis of Prestero [105] proposes a method of calculation using directly the geometry of the vehicle. For this, he proposes the computation of a set of integrals and multiplications for vehicles that have the Myring profiles [91], which coincide with the Guanay II geometry and can be used as reference. Each of these formulas calculate the coefficients one by one, which is very useful. However, these theoretical computations must be compared with experimental data, and the results can be quite different. In fact, Prestero mentions that some coefficients for his vehicle were corrected with the results from field experiments, but he does not mention the method used to do that. Other authors do the identification with different methods using experimental data and fitting it to the equations of marine vehicles. The work of ˚ Astr¨om and K¨allstr¨om [134] proposes a method of identification using the Maximum-likehood estimation (MLE). The work of Ridao et al. [112] shows a method of identification of underwater vehicles using Least Squares (LS). The method of Least Squares can approach the identification in a satisfactory way, and it does not need the coefficients to be well decoupled into sub-systems. On the other hand, Fauske et al. [39] propose a particular formula based in non-linear least squares (NLS), but this method can only be used for decoupled sub-systems. The work of Alessandri et al. [3] shows a technique using two steps, namely Least Squares (LS) and Extended Kalman Filter (EKF). Again, this method requires the coefficients of the system to be fairly decoupled, making it difficult to implement. Tiano et al. [144] also propose the use of the Kalman Filter for the identification of the Hammerhead AUV. Finally, the use of a cost function is also proposed by Tiano in [143]. Knowing all these problems and limitations in the modeling of marine vehicles, both in selection of coefficients and in their calculation, in this work we use the set of coefficients of Prestero due its similarity with the Guanay II, but including the linear damping coefficients in order to exploit in a better way the dynamics when it is linearized in the horizontal plane. The formulas of Prestero are used for a theoretical calculation as a preliminary way, but afterwards we employ an LS method derived from Ridao’s paper, using experimental data of the vehicle in order to compare with the theoretical values. Throughout this work, we use he notation of SNAME (1950) [129], which is widely employed in the literature. 7.1 Review of modeling of marine vehicles 7.1.1 Kinematics Kinematics treats the geometrical aspects of motion, once the forces and torques, and hence the accelerations, have been specified. A marine vehicle is a 6 degrees of freedom (DoF) system, since 6 independent coordinates are necessary to determine the position and orientation, three for axial movement and three for angular movement: “surge”, the displacement in the x-direction, “sway” in the y-direction, “heave” in the z-direction, “roll”, the rotation about the x-axis, “pitch”, the rotation about the y-axis, and “yaw”, the rotation about the z-axis. 7.1. REVIEW OF MODELING OF MARINE VEHICLES 69 Reference frames It is convenient to work with two reference frames, one frame fixed to the vehicle, called “body frame”, in order to manipulate all the forces and accelerations induced in the vehicle; and another frame fixed to the Earth, in order to calculate the vehicle movement. There are several frames fixed to the Earth, such as the ECI frame, the ECEF frame and the NED frame [43]. In this thesis we will use the NED frame. The body frame consists of a frame with origin in the center of buoyancy CB of the vehicle, and such that the x-axis points to the bow, the y-axis points to starboard and the z-axis points to the bottom. On the other hand, the NED frame has its origin in the surface of the sea, with the x-axis pointing to the North, the y-axis to the East and the z-axis pointing down. Figure 7.1 shows these two frames. The positions, velocities and forces, as defined by SNAME (1950) [129], are: NED position: pn=  n e d Attitude (Euler angles): Θ=  φ θ ψ  Body-fixed linear velocity: vb=  u v w  Body-fixed angular velocity: ωb=  p q r  Body-fixed force: fb=  X Y Z Body-fixed torque: mb=  K M N  (7.1) pitch q, M sway v, Y heave yaw r, N w, Z roll surge p, K n e d θ ψ φ North East Down u, X yaw pitch roll BODY frame NED frame Figure 7.1: Body frame and NED frame The general motion of a marine vehicle in 6 DoF is described by the following vectors: η=pn Θ,ν=vb ωb,τ=fb mb.(7.2) 70 CHAPTER 7. MODELING Transformation between BODY and NED A rotation matrix Ris used to rotate the coordinates in order to change from a frame to another. The parameters of the rotation are the Euler angles roll (φ), pitch (θ) and yaw (ψ), and multiplying the rotation matrices for each one of them (the interested reader is advised to consult Fossen [43]) the following general formula to rotate from the body frame to the NED frame is obtained: Rn b(Θ) =   cψcθ−sψcφ+ cψsθsφsψsφ+ cψcφsθ sψcθcψcφ+ sφsθsψ−cψsφ+ sθsψcφ −sθcθsφcθcφ (7.3) where subscript ·band superscript ·nrepresent the notation “from body frame to NED frame”, and s·= sin(·) and c·= cos(·). The rotation matrix Ris orthogonal, and hence the inverse rotation matrix is given by R−1=R|. 7.1.2 Dynamics Dynamics deals with the forces and torques that generate the accelerations. For simplicity they are calculated in the body frame and are given in function of the velocity vector ν. Fossen [42] proposes the following equation for the dynamics: M˙ ν+C(ν)ν+D(ν)ν+g(η) = τ+g0+w(7.4) where M- system inertia matrix (including added mass) C(ν) - Coriolis-centripetal matrix (including added mass) D(ν) - damping matrix g(η) - vector of gravitational/buoyancy forces and torques τvector of control inputs g0- vector used for pretrimming (ballast control) wvector of environmental disturbances (wind, waves and currents) The terms in (7.4) take into account the inertial and non-inertial contributions from the rigid body of the vehicle and the contributions from the fluid around the vehicle. Rigid body Rigid body dynamics must take into account the Coriolis and centrifugal effects brought in by the fact that the body frame is not an inertial one: MRB ˙ ν+CRBν=τhyd.(7.5) Here MRB is the rigid body inertia matrix, CRB is the rigid body Coriolis and centripetal matrix and τhyd is the generalized vector of external forces and torques. The matrices MRB and CRB are shown in equations (7.6) and (7.7). Notice that MRB does not depend of the vector state ν. MRB =         m0 0 0 mzg−myg 0m0−mzg0mxg 0 0 m myg−mxg0 0−mzgmygIx−Ixy −Ixz mzg0−mxg−Iyx Iy−Iyz −mygmxg0−Izx −Izy Iz         (7.6) 7.3. LINEAR SYSTEM 77 Table 7.2: Center of buoyancy wrt origin at vehicle nose Parameter Value Unit xb1.21 m yb0 m zb0 m Table 7.3: Center of gravity wrt origin at CB Parameter Value Unit xg0 m yg0 m zg0.01 m 7.3 Linear system Control design for non-linear models, although well developed in the literature, is inherently difficult to use and sometimes yields very complicated and unintuitive control laws which are not easily grasped and tuned, even for experienced engineers. An alternative is the linearization of the model around a working point, which yields a linear model whose behaviour is not very different from that of the full, non-linear one, provided that the system state is sufficiently close to the working point. In our case, the idea is to define a linear system around a fixed velocity vector and consider only small deviations from it. The purpose of this section is to linearize the model using matrix notation, and to discuss the need to include the linear damping matrix in order to better exploit the dynamics in the horizontal plane. Let ν0be the constant velocity of the vehicle in forward movement: ν0=  u0 0 0 (7.31) and ∆νthe small variations around ν0 ∆ν=  ∆u ∆v ∆r .(7.32) The linearized model can be calculated from the equation (7.23) as (MRB +MA)∆ ˙ ν+∂fc ∂νν0 ∆ν+∂fd ∂νν0 ∆ν= ∆τ(7.33) where fc= (CRB +CA)ν,fd=Dnν.(7.34) The calculation using these equations implies to solve the vectors fcand fdbefore to apply the partial derivatives, which can be calculated easily for this case. However, it would be interesting to use a tool to break down that derivative before solve these vectors. 78 CHAPTER 7. MODELING Definition 1 If x= [x1x2. . . xn]Tis a vector of nvariables and F(x)is a matrix of p×q elements that are a function of x, we define the partial derivative of F(x)with respect to x as ∂F(x) ∂x=h∂F(x) ∂x1 ∂F(x) ∂x2··· ∂F(x) ∂xni(7.35) Notice that each ∂F(x) ∂xiis a p×qmatrix. Theorem 1 Let x= [x1x2. . . xn]Tbe a vector of nvariables, H(x)a vector of qelements dependent on x, and F(x)a matrix of p×qelements also dependent on x. Then ∂(FH) ∂x=F∂H ∂x+∂F ∂x(In⊗H) (7.36) where Inis the identity matrix of nelements and ⊗is the Kronecker product. Proof 1 The multiplication FH by definition is FH =   f11 ··· f1q . . ..... . . fp1··· fpq      h1 . . . hq    =   f11h1+···+f1qhq . . . fp1h1+···+fpqhq    The partial derivative (or Jacobian matrix) of this multiplication is ∂(FH) ∂x=    ∂(f11h1+···+f1qhq) ∂x1··· ∂(f11h1+···+f1qhq) ∂xn . . ..... . . ∂(fp1h1+···+fpq hq) ∂x1··· ∂(fp1h1+···+fpq hq) ∂xn     Using the multiplicative and additive properties of the partial derivatives we have: ∂(FH) ∂x=                 f11 ∂h1 ∂x1+h1∂f11 ∂x1+ +···+ +f1q ∂hq ∂x1+hq ∂f1q ∂x1   ···    f11 ∂h1 ∂xn+h1∂f11 ∂xn+ +···+ +f1q ∂hq ∂xn+hq ∂f1q ∂xn    . . ..... . .    fp1∂h1 ∂x1+h1∂fp1 ∂x1+ +···+ +fpq ∂hq ∂x1+hq ∂fpq ∂x1   ···    fp1∂h1 ∂xn+h1∂fp1 ∂xn+ +···+ +fpq ∂hq ∂xn+hq ∂fpq ∂xn                 ∂(FH) ∂x=    (f11 ∂h1 ∂x1+···+f1q ∂hq ∂x1)··· (f11 ∂h1 ∂xn+···+f1q ∂hq ∂xn) . . ..... . . (fp1∂h1 ∂x1+···+fpq ∂hq ∂x1)··· (fp1∂h1 ∂xn+···+fpq ∂hq ∂xn)    + +    (h1∂f11 ∂x1+···+hq ∂f1q ∂x1)··· (h1∂f11 ∂xn+···+hq ∂f1q ∂xn) . . ..... . . (h1∂fp1 ∂x1+···+hq ∂fpq ∂x1)··· (h1∂fp1 ∂xn+···+hq ∂fpq ∂xn)     7.3. LINEAR SYSTEM 79 ∂(FH) ∂x=   f11 ··· f1q . . ..... . . fp1··· fpq    p×q    ∂h1 ∂x1··· ∂h1 ∂xn . . ..... . . ∂hq ∂x1··· ∂hq ∂xn    q×n + +    ∂f11 ∂x1··· ∂f1q ∂x1 . . ..... . . ∂fp1 ∂x1··· ∂fpq ∂x1 ··· ... ··· ∂f11 ∂xn··· ∂f1q ∂xn . . ..... . . ∂fp1 ∂xn··· ∂fpq ∂xn     p×qn              h1··· 0 . . ..... . . hq··· 0 . . ..... . . 0··· h1 . . ..... . . 0··· hq              qn×n ∂(FH) ∂x=F∂H ∂x+h∂F ∂x1··· ∂F ∂xni   H··· 0 . . ..... . . 0··· H    ∂(FH) ∂x=F∂H ∂x+∂F ∂x(In⊗H) The proof is complete.  It is important to note that this result can be used to linearize the hydrodynamical model of the vehicle in a modular way, which is very useful since the coefficients are highly coupled, for example in the model with 6DoF. If we apply this result to the equations (7.34) we have ∂fc ∂ν=∂(CRBν) ∂ν+∂(CAν) ∂ν ∂fc ∂ν=CRB +∂CRB ∂ν(I3⊗ν) + CA+∂CA ∂ν(I3⊗ν) ∂fc ∂ν=CRB +CA+∂CRB ∂ν+∂CA ∂ν(I3⊗ν) (7.37) and ∂fd ∂ν=∂(Dnν) ∂ν ∂fd ∂ν=Dn+∂Dn ∂ν(I3⊗ν) (7.38) 80 CHAPTER 7. MODELING where ∂CRB ∂ν=  0 0 0 0 0 −m0 0 −mxg 0 0 m0 0 0 0 0 0 0−m0m0 0 mxg0 0   ∂CA ∂ν=  0 0 0 0 0 Y˙v0 0 Y˙r 0 0 −X˙u0 0 0 0 0 0 0X˙u0−Y˙v0 0 −Y˙r0 0   ∂Dn ∂ν=−  X|u|usgn(u)000 0 000 0 0 0 0 0 Y|v|vsgn(v) 0 0 0 Y|r|rsgn(r) 0 0 0 0 N|v|vsgn(v)000N|r|rsgn(r)  (7.39) Using the Laplace transform, the linearized model 7.33 can be writen as: (MRB +MA)s+CRB +CA+Dn+ +∂CRB ∂ν+∂CA ∂ν+∂Dn ∂ν(I3⊗ν)ν0 ν(s) = τ(s) (7.40) Solving for the matrices we have   mus−2|u|X|u|u−mvr−mvv−2mY˙rr mur mvs−2|v|Y|v|vmY˙rs+muu−2|r|Y|r|r −muvv+mY˙rr mN˙vs−muvu−2|v|N|v|vmrs+mY˙ru−2|r|N|r|r ν0 ν(s) = τ(s) (7.41)   mus−2|u0|X|u|u0 0 0mvs mY˙rs+muu0 0mN˙vs−muvu0mrs+mY˙ru0 ν(s) = τ(s) (7.42) where mu=m−X˙u mv=m−Y˙v muv =mu−mv=Y˙v−X˙u mY˙r=mxg−Y˙r mN˙v=mxg−N˙v (7.43) 7.3.1 Stability The stability can be determined calculating the poles of the linearized model 7.40. If all the poles have negative real part the system is stable, but if at least one pole has positive real part then the system is unstable. Equating the determinant of the matrix in equation (7.42) to zero we get  mus−2|u0|X|u|u0 0 0mvs mY˙rs+muu0 0mN˙vs−muvu0mrs+mY˙ru0 = 0 (mus−2|u0|X|u|u) (mvs(mrs+mY˙ru0)−(mN˙vs−muvu0)(mY˙rs+muu0)) = 0 (7.44) The first pole is 7.3. LINEAR SYSTEM 81 mus−2|u0|X|u|u= 0 s= 2|u0|X|u|u mu .(7.45) In order to guaranty its negativity it is necessary that X|u|u m−X˙u <0 (7.46) This condition is always achieved since the dynamic drag implies the negativity of the coefficients X|u|uand X˙u. The calculation of the other two poles is as follows: mvs(mrs+mY˙ru0)−(mN˙vs−muvu0)(mY˙rs+muu0) = 0 (mvmr−mY˙rmN˙v)s2+ (mY˙r(muv +mv)−mN˙vmu)u0s+mumuvu2 0= 0 (mvmr−mY˙rmN˙v)s2+ (mY˙rmu−mN˙vmu)u0s+mumuvu2 0= 0 (mvmr−mY˙rmN˙v)s2+mu(mY˙r−mN˙v)u0s+mumuvu2 0= 0 (mvmr−mY˙rmN˙v)s2+mu(N˙v−Y˙r)u0s+mumuvu2 0= 0 s2+mu(N˙v−Y˙r)u0 (mvmr−mY˙rmN˙v) | {z } B s+mumuvu2 0 (mvmr−mY˙rmN˙v) | {z } C = 0 (7.47) Thus, the other two poles are s1,2=−B 2±√B2−4C 2.(7.48) If B2−4C < 0 the poles are complex conjugate. Thus the real part −B 2determines its negativity, which is achieved if B > 0. Also notice, that C > 0 because B2<4C. On the other hand, if B2−4C≥0 the poles are real, and they are negative if −B 2±√B2−4C 2≤0 B≥ ±pB2−4C B≥0 and also B≥ ±pB2−4C B2≥B2−4C C≥0 For this reason, the stability is directly linked to the positivity of the values Band C. Take as an example the Sirene AUV [127], a vehicle developed at the “Instituto Superior T´ecnico (IST)”. Its Bvalue is zero while Cis negative, which indicates that it is unstable and cannot maintain the straight line without the use of a torque. The coefficients of Sirene AUV are described in table 7.4. 82 CHAPTER 7. MODELING Table 7.4: Sirene AUV coefficients (IST) Parameter Value Units m4000 kg Iz2660 kg·m2 X˙u-290 kg Y˙v-310 kg Y˙r0 kg·m/rad N˙v0 kg·m N˙r-95 kg·m2/rad Xu-360 kg/s Yv-420 kg/s Yr0 kg·m/rad·s Nv0 kg·m/s Nr-110 kg·m2/rad·s X|u|u-805 kg/m Y|v|v-1930 kg/m Y|r|r0 kg·m/rad2 N|v|v0 kg N|r|r-555 kg·m2/rad2 7.3.2 Transfer functions The transfer functions relate the velocity vector ν(s) to the inputs τ(s) in the complex domain s. From equation (7.42) we can extract: ν(s) τ(s)=  mus−2|u0|X|u|u0 0 0mvs mY˙rs+muu0 0mN˙vs−muvu0mrs+mY˙ru0  −1 ν(s) τ(s)=      1 mus−2|u0|X|u|u0 0 0 0   mrs+mY˙ru0−mY˙rs−muu0 −mN˙vs+muvu0mvs   (mvmr−mY˙rmN˙v)s2+mu(N˙v−Y˙r)u0s+mumuvu2 0       (7.49) The transfer functions of major interest are that of the forward velocity with to respect the propulsion, and that of the angular velocity with respect to the applied torque, u(s) Prop(s)=1 mus−2|u0|X|u|u (7.50) r(s) Torque(s)=mvs (mvmr−mY˙rmN˙v)s2+mu(N˙v−Y˙r)u0s+mumuvu2 0 (7.51) They can be used to study the behavior of the vehicle near a specific forward velocity u0. Figure 7.5 shows the performance of the Sirene AUV for the uvelocity. The model 7.3. LINEAR SYSTEM 83 was linearized at 0.5 m/s and simulated in two cases, namely step response and response to a sinusoidal signal. The nominal propulsion applied is 200 N, which is the value needed to reach u0. On the other hand, Figure 7.6 shows similar simulations for the angular velocity r, linearizing the model at 0 m/s and using only the torque input. 0 10 20 30 40 200 250 Prop [N] Step response 0 10 20 30 40 0.5 0.55 u[m/s] Nonlinear Linear 0 10 20 30 40 100 200 300 Sin response 0 10 20 30 40 0.48 0.5 0.52 time [s] time [s] Figure 7.5: uvelocity in Sirene AUV: non-linear and linear model at u0=0.5 m/s 0 20 40 60 80 100 0 5 10 Torque [Nm] Step response 0 20 40 60 80 100 0 0.1 0.2 r[rad/s] Nonlinear Linear 0 5 10 15 20 0 20 Sin response 0 5 10 15 20 0 0.01 0.02 time [s] time [s] -20 Figure 7.6: rvelocity in Sirene AUV: non-linear and linear model at u0=0 m/s Problem with the transfer function r(s) Torque(s) The final value theorem establishes that the asymptotic time value for a function F(s) with all the poles in the left half-plane can be calculated as f(∞) = lim s→0sF(s) (7.52) In the case of the vehicle dynamics, calculating the variations in the angular velocity r by a step in the torque, and supposing the poles in the left half-plane, we have 84 CHAPTER 7. MODELING ∆r(t=∞)= lim s→0sr(s) Torque(s)Torque(s) = lim s→0smvs (mvmr−mY˙rmN˙v)s2+mu(N˙v−Y˙r)u0s+mumuvu2 0·1 s = lim s→0 mvs (mvmr−mY˙rmN˙v)s2+mu(N˙v−Y˙r)u0s+mumuvu2 0 ∆r(t=∞)=∞if u0= 0 0 if u06= 0 (7.53) If we assume that a constant torque is applied, the angular velocity should tend to a constant value greater than zero because it is rotating. However, the above result indicates that the angular velocity tends to zero or infinity. This is because the linear system is a good approximation to the non-linear one near the nominal velocity of linearization, but it is not accurate under other conditions. Notice that the result is due to the transfer function has a zero located at the origin. This problem can be seen in the figure 7.6, where the linear model tends to infinity when a step is applied. 7.4 Linear system 2: Adding linear damping coefficients The linear system showed in the last section was extracted using the equations proposed by Prestero [105] since he uses a vehicle with similar characteristics to Guanay II AUV. However, problems with the transfer function of the angular velocity have shown that the dynamic model is not well approximated in the linearization at the xy-plane. In order to solve this, in this section we include a linear damping coefficient, as recommend Fossen [43]. Simplifying the model to 3 DoF and neglecting some coefficients due the xz-plane simmetry, the matrix 7.14 can be represented as Dl=−  Xu0 0 0YvYr 0NvNr (7.54) The model with 3 DoF is represented as (MRB +MA)˙ ν+ (CRB +CA)ν+ (Dl+Dn)ν=τ(7.55) Similar to the last section, the linearized model that is obtained is given by (MRB +MA)s+CRB +CA+Dl+Dn+ ∂CRB ∂ν+∂CA ∂ν+∂Dn ∂ν(I3⊗ν)ν0 ν(s) = τ(s) (7.56) Solving for the matrices we get   mus−2|u0|X|u|u−Xu0 0 0mvs−YvmY˙rs+muu0−Yr 0mN˙vs−muvu0−Nvmrs+mY˙ru0−Nr ν(s) = τ(s) (7.57) 7.4. LINEAR SYSTEM 2: ADDING LINEAR DAMPING COEFFICIENTS 85 7.4.1 Stability The poles of the linear system 7.57 are given by  mus−2|u0|X|u|u−Xu0 0 0mvs−YvmY˙rs+muu0−Yr 0mN˙vs−muvu0−Nvmrs+mY˙ru0−Nr = 0 (mus−2|u0|X|u|u−Xu)(mvs−Yv)(mrs+mY˙ru0−Nr)+ −(mN˙vs−muvu0−Nv)(mY˙rs+muu0−Yr)= 0 (7.58) The first pole is mus−2|u0|X|u|u−Xu= 0 s= 2|u0|X|u|u mu +Xu mu s= 2|u0|X|u|u m−X˙u +Xu m−X˙u (7.59) This pole is always negative since the dynamic drag implies the negativity of the coefficients X˙u,Xuand X|u|u. The calculation of the other two poles is as follows: (mvs−Yv)(mrs+mY˙ru0−Nr)−(mN˙vs−muvu0−Nv)(mY˙rs+muu0−Yr)=0 (mvmr−mY˙rmN˙v)s2+ + (mv(mY˙ru0−Nr)−mrYv+mY˙r(muvu0+Nv)−mN˙v(muu0−Yr))s+ −Yv(mY˙ru0−Nr)+(muvu0+Nv)(muu0−Yr)=0 (mvmr−mY˙rmN˙v)s2+ + (mY˙ru0(mv+muv)−mvNr−mrYv+mY˙rNv−mN˙v(muu0−Yr))s+ −Yv(mY˙ru0−Nr)+(muvu0+Nv)(muu0−Yr)=0 (mvmr−mY˙rmN˙v)s2+ + (mY˙ru0mu−mvNr−mrYv+mY˙rNv−mN˙v(muu0−Yr))s+ −Yv(mY˙ru0−Nr)+(muvu0+Nv)(muu0−Yr)=0 (mvmr−mY˙rmN˙v)s2+ + (mu(N˙v−Y˙r)u0−mvNr−mrYv+mY˙rNv+mN˙vYr)s+ −Yv(mY˙ru0−Nr)+(muvu0+Nv)(muu0−Yr)=0 As2+Bs +C= 0 (7.60) where A=mvmr−mY˙rmN˙v B=mu(N˙v−Y˙r)u0−mvNr−mrYv+mY˙rNv+mN˙vYr C=−Yv(mY˙ru0−Nr)+(muvu0+Nv)(muu0−Yr) (7.61) The Avalue is generally positive due the large positive values of mvand mr. Thus, similar to the development made with the equation (7.48), the stability is achieved when B≥0 and C≥0. Taking again as an example the Sirene AUV (see table 7.4) its Bvalue is positive but the Cvalue continues to be negative, which indicates instability. 86 CHAPTER 7. MODELING 7.4.2 Transfer functions From equation (7.57) we can extract ν(s) τ(s)=  mus−2|u0|X|u|u−Xu0 0 0mvs−YvmY˙rs+muu0−Yr 0mN˙vs−muvu0−Nvmrs+mY˙ru0−Nr  −1 ν(s) τ(s)=      1 mus−2|u0|X|u|u−Xu0 0 0 0   mrs+mY˙ru0−Nr−mY˙rs−muu0+Yr −mN˙vs+muvu0+Nvmvs−Yv   As2+Bs +C       (7.62) where A,B, and Care the coefficients of the equations (7.61). From these transfer functions we extract two important functions, one for the forward velocity and the other for the angular velocity u(s) Prop(s)=1 mus−2|u0|X|u|u−Xu (7.63) r(s) Torque(s)=mvs−Yv As2+Bs +C(7.64) Some simulations of the Sirene AUV have been made in order to study the performance. Figure 7.7 shows the performance for the uvelocity. The model was linearized at 0.5 m/s and simulated in two cases, step response and response to a sinusoidal signal. On the other hand, figure 7.8 shows similar simulations for the angular velocity r, linearizing the model at 0 m/s and using the torque as input. Observe that, unlike the simulation in figure 7.6, in this simulation the value of rconverges for the step response. 0 10 20 30 40 380 400 420 440 Prop [N] Step response 0 10 20 30 40 0.5 0.55 u[m/s] 0 10 20 30 300 350 400 450 Sin response 0 10 20 30 0.48 0.5 0.52 time [s] time [s] Nonlinear Linear Figure 7.7: uvelocity in Sirene AUV (considering linear damping coefficients): non-linear and linear model at u0=0.5 m/s 7.5. COEFFICIENT CALCULATION 93 PS =Q P+PS =P+Q (P|P)−1P|PS = (P|P)−1P|Q S= (P|P)−1P|Q(7.79) The LS method shows that this calculation minimizes the sum of the squares of the errors made in the results of every single equation. In a similar way, from equation (7.23) we have (m−Y˙v)˙v−Y˙r˙r−Yvv−Y|v|vv|v|−Yrr−Y|r|rr|r|+ (m−X˙u)ur = 0 (7.80) (Iz−N˙r) ˙r−N˙v˙v−Nvv−N|v|vv|v|−Nrr−N|r|rr|r|−(Y˙v−X˙u)uv −Y˙rur =Torque (7.81) These two equations are highly coupled and have a lot of coefficients. Additionally, they are related to the velocities vand rwhich correspond to lateral movements and turns. Assuming that we know the coefficient X˙u, the equations can be reordered in a way that the left side contains the unknown coefficients and the right side the known values: (m−Y˙v)˙v−Y˙r˙r−Yvv−Y|v|vv|v|−Yrr−Y|r|rr|r|=−(m−X˙u)ur (7.82) (m−Y˙v)uv + (Iz−N˙r) ˙r−N˙v˙v−Nvv−N|v|vv|v|−Nrr+ −N|r|rr|r|−Y˙rur =Torque + (m−X˙u)uv (7.83) Note that we split (Y˙v−X˙u) as (m−X˙u)−(m−Y˙v) in order to have the same term (m−Y˙v) in the two equations. One way to calculate the coefficients using the LS method is as follows:           ˙v10 0 − ˙r1 − v1|v1| − r1|r1|0 0 − v1 − r10 0 . . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . . ˙vn0 0 − ˙rn − vn|vn| − rn|rn|0 0 − vn − rn0 0 u1v1˙r1 − ˙v1u1r10 0 − v1|v1| − r1|r1|0 0 − v1 − r1 . . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . . unvn˙rn − ˙vnunrn0 0 − vn|vn| − rn|rn|0 0 − vn − rn                               m−Y˙v Iz−N˙r N˙v Y˙r Y|v|v Y|r|r N|v|v N|r|r Yv Yr Nv Nr                     =           −(m−X˙u)u1r1 . . . −(m−X˙u)unrn Torque1+ (m−X˙u)u1v1 . . . Torquen+ (m−X˙u)unvn           (7.84) 94 CHAPTER 7. MODELING where the values (Torquei, ui, vi, ri,˙vi,˙ri) are each of the records taken in the field test at time i. In order to have a better fitting of the experimental data of lateral movements and turns with the equations, it is better to use the three equations. Assuming that we know the coefficients X˙u,Xuand X|u|u, we can add the information of the equation (7.76) to the above matrix equation (7.84) as follows:                  − v1r10 0 r2 10 0 0 0 0 0 0 0 . . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . . − vnrn0 0 r2 n0 0 0 0 0 0 0 0 ˙v10 0 − ˙r1 − v1|v1| − r1|r1|0 0 − v1 − r10 0 . . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . . ˙vn0 0 − ˙rn − vn|vn| − rn|rn|0 0 − vn − rn0 0 u1v1˙r1 − ˙v1u1r10 0 − v1|v1| − r1|r1|0 0 − v1 − r1 . . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . . unvn˙rn − ˙vnunrn0 0 − vn|vn| − rn|rn|0 0 − vn − rn                  | {z } P                     m−Y˙v Iz−N˙r N˙v Y˙r Y|v|v Y|r|r N|v|v N|r|r Yv Yr Nv Nr                     | {z } S =                  Prop1−(m−X˙u) ˙u1+Xuu1+X|u|uu1|u1| . . . Propn−(m−X˙u) ˙un+Xuun+X|u|uun|un| −(m−X˙u)u1r1 . . . −(m−X˙u)unrn Torque1+ (m−X˙u)u1v1 . . . Torquen+ (m−X˙u)unvn                  | {z } Q (7.85) Data preprocessing The GPS gives the position in latitude/longitude coordinates. The position in meters can be calculated as follows: North: n=rlat (7.86) East: e=rlong cos(lat) (7.87) where ris the earth radius, and the latitude and longitude are given in radians. Using equations (7.16), it is possible to calculate the different accelerations and velocities by applying derivatives: 7.5. COEFFICIENT CALCULATION 95 ˙ η=hdn dt de dt dψ dt i| (7.88) ν=R(ψ)˙ η(7.89) ˙ ν=hdu dt dv dt dr dt i| (7.90) Note that since the GPS and compass give their data at discrete time, these derivatives give the average velocity νbetween two samples and average acceleration ˙ νbetween three samples. Experimental data and fitting Several field tests of the Guanay II AUV were taken in the Catalonia Olympic Channel (see section 6.5). Since it is very quiet the perturbations due the currents are small. Additionally, the channel size is enough to maneuver the vehicle. The tests consisted in recollecting data from two movements to apply the LS technique described above: a) Forward movement, in order to calculate the first group of coefficients in equation (7.77); and b) Movement with turns, in order to calculate the second group of coefficients in equation (7.85). The total amount of data that was taken corresponds to about 2 hours, and all the sensors worked correctly. These tests also revealed a small difference between the powers of the lateral thrusters, with the right thruster performing at more power than the left thruster. This implies a recalculation of the coefficients crgt and clft. Due to this, the process of coefficient identification consisted in an iterative calculation, using the following steps: 1. Assignation of the values clft and crgt for the lateral thrusters. 2. Calculation of the coefficients X˙u,Xuand X|u|utaking the experimental data in forward movement, and using the least square method with equations (7.77) and (7.79). 3. Calculation of the other hydrodynamic coefficients taking the experimental data for turns, and using the least square method with equations (7.85) and (7.79). 4. Check the performance of the coefficients calculating the mean squared error (MSE) of the fitted data with the vehicle simulations. If ˆ Xis the vector of nvalues of the simulation, and Xthe vector of the experimental values, then the MSE is: MSE = 1 n n X i=1 (ˆ Xi−Xi)2(7.91) 5. In function of the results, repeat from step 1 using other values for clft and crgt. 96 CHAPTER 7. MODELING After this process, we found that the correct values for the coefficients clft and crgt are 0.0027 and 0.0029, respectively. The final values for all the hydrodynamic coefficients are the Table 7.71. The MSE of the steps 2 and 3 are: Step 2: MSE = 0.002306 (7.92) Step 3: MSE = 320.2684 (7.93) Step 2 uses a Qaround the acceleration ˙u, so that the root square of 0.002306 is an error regarding the forward acceleration. Step 3 uses a Qaround the forces and torques, and hence the root square of 320.2684 (that is ∼17.9) is an error regarding these forces. This is the reason of the large difference between these two errors. At this point, we can evaluate the condition of stability presented in Section 7.4.1. The calculation of the equations (7.61) using these coefficients yields B > 0 and C > 0, which implies stability in the forward movement. Table 7.7: Final coefficients for Guanay II AUV Parameter Value Units m168.2000 kg Iz52.7000 kg·m2 X˙u-452.6809 kg Y˙v-415.9546 kg Y˙r-518.5884 kg·m/rad N˙v18.3217 kg·m N˙r-231.9244 kg·m2/rad Xu-0.2992 kg/s Yv-45.3418 kg/s Yr105.3055 kg·m/rad·s Nv-3.3604 kg·m/s Nr-56.9228 kg·m2/rad·s X|u|u-152.6010 kg/m Y|v|v-399.4271 kg/m Y|r|r-899.5579 kg·m/rad2 N|v|v21.1978 kg N|r|r-284.1011 kg·m2/rad2 afin 0.5000 m cmain 0.0127 kg·m/s2 clft 0.0027 kg·m/s2 crgt 0.0029 kg·m/s2 1For the reader’s interest, these coefficients are calculated by running GuanayIICoefCalculation.m, which is attached in the CD. 7.5. COEFFICIENT CALCULATION 97 Figures (7.10 -7.17) show some intervals of the experimental data and the simulation made with the vehicle. All of them present the propulsion used in each experiment and the velocities obtained. The initial conditions in the simulations correspond to those of the experimental data. Tests are separated in two groups: forward movement and movement with turns. Figures 7.10 and 7.11 show two tests with 60% of power in the main thruster. The velocity reached is about 0.5 m/s in both cases, and the settling time is about 5 s. The simulation has a little error respect the experimental data, but it is very adjusted to the reality. 0 5 10 15 20 25 30 35 40 0 50 100 λmain [%] 0 5 10 15 20 25 30 35 40 0.2 0.4 0.6 u[m/s] exp sim time [s] Figure 7.10: Real movement and simulation in straight line (a) 0 10 20 30 40 50 60 0 50 100 λmain [%] 0 10 20 30 40 50 60 0 0.2 0.4 0.6 u[m/s] exp sim time [s] Figure 7.11: Real movement and simulation in straight line (b) 98 CHAPTER 7. MODELING When the vehicle is set to 100% in the main thruster the velocity reaches 1 m/s with a settling time around 5 s; see Figure 7.12. This test has an undesired initial velocity of 0.25 m/s, due the currents in the water channel. 0 10 20 30 40 50 60 70 80 0 50 100 λmain [%] 0 10 20 30 40 50 60 70 80 0 0.5 1 u[m/s] exp sim time [s] Figure 7.12: Real movement and simulation in straight line (c) 7.5. COEFFICIENT CALCULATION 99 If the vehicle is commanded to perform turns, it implies a movement in 3 degrees of freedom for u,vand r. Figure 7.13 shows the performance of the right thruster at 100 % of power. The radius of curvature is about 10 m although the vehicle describes a semi-oval in the experimental data maybe due the currents. The forward velocity is 0.45 m/s and the angular velocity is -0.05 rad/s. 0 50 100 0 50 100 Thrust [%] 0 50 100 0 0.5 u[m/s] 0 50 100 0 0.1 0.2 v[m/s] 0 50 100 0 0.05 r[rad/s] 0 5 10 15 20 5 10 15 20 25 30 North [m] XY λmain λrgt λlft time [s] East [m] time [s] exp sim -0.05 -0.1 -0.1 Figure 7.13: Left movement and simulation using the right thruster 100 CHAPTER 7. MODELING Figure 7.14 shows the performance of the left thruster at 100 % of power. The radius of curvature is about 10 m although the vehicle describes again an oval in the experimental data due the currents. The forward velocity is 0.4 m/s and the angular velocity is 0.04 rad/s. Notice that in this figure as well as in the other tests the XY path displays a significant difference between the simulation and the experimental data. This is because they only coincides at the beginning and as the simulation is an integration over the time, the position and direction will be more and more different. The noise in the GPS and compass are responsible for this error. 0 50 100 150 0 50 100 Thrust [%] 0 50 100 150 0 0.5 u[m/s] 0 50 100 150 0 0.5 v[m/s] 0 50 100 150 0 0.1 r[rad/s] 0 5 10 15 20 0 5 10 15 20 25 North [m] XY -0.1 -0.5 time [s] time [s] λmain λrgt λlft exp sim East [m] Figure 7.14: Right movement and simulation using the left thruster 7.5. COEFFICIENT CALCULATION 101 Figure 7.15 shows different power combinations of the three thrusters, starting with the lateral thrusters at 50 % in left and -50 % in right, and the main thruster at 30 %. In this period the simulation almost describes a complete circle, while in the field test describes a semi-oval. Notice that at this point the position and direction is very different between them. The propulsion continues with 100 % in the main thruster and 0 % in the lateral thrusters. In this period the vehicle describes a straight line. Regarding the velocities, the simulation fits very well the experimental data. 0 100 200 0 100 Thrust [%] 0 100 200 0 0.5 1 u[m/s] 0 100 200 0 0.5 v[m/s] 0 100 200 0 0.1 r[rad/s] 0 10 20 30 0 5 10 15 20 25 North [m] XY λmain λrgt λlft time [s] East [m] exp sim time [s] -0.5 -0.1 -100 -5 Figure 7.15: Real movement and simulation in straight line and turns (a) 102 CHAPTER 7. MODELING Figure 7.16 shows the test for one turn and two straight lines. The main thruster uses 50 % of power for the two lines. Notice that using this propulsion the forward velocity is 0.6 m/s. However, the field test in Figure 7.11 shows a velocity of 0.5 m/s using more propulsion (60 %). This slight difference is due to the currents. On the other hand, the simulation shows a velocity below 0.5 m/s which is the expected value. Regarding the turn, both simulation and experimental data display a half turn using about 50 % in the right thruster and -50 % in the left thruster during 50 s. 0 50 100 150 0 100 Thrust [%] 0 50 100 150 0 0.5 1 u[m/s] 0 50 100 150 0 0.5 v[m/s] 0 50 100 150 0 r[rad/s] 0 10 20 0 10 20 30 40 North [m] XY λmain λrgt λlft time [s] East [m] exp sim -0.2 time [s] -0.1 -0.5 -100 -10 Figure 7.16: Real movement and simulation in straight line and turns (b) 7.6. PHYSICAL CONSTRAINTS 109 Torque [Nm] Prop [N] v[m/s] 200 150 100 50 0 -50 -100 -150 -200 -30 -20 -10 0 10 20 30 0.2 0.15 0.1 0.05 0 -0.05 -0.1 -0.15 -0.2 -0.25 0.25 0.01 -0.18 0.20 -0.20 0.01 0.18 Figure 7.20: Steady state map — lateral velocity v Torque [Nm] Prop [N] r[rad/s] 200 150 100 50 0 -50 -100 -150 -200 -30 -20 -10 0 10 20 30 0.2 0.15 0.1 0.05 0 -0.05 -0.1 -0.15 -0.2 -0.001 0.04 0.20 0.04 0.001 -0.04 -0.20 -0.04 Figure 7.21: Steady state map — angular velocity r 110 CHAPTER 7. MODELING 7.6.3 Radius of curvature When the vehicle turns it describes a certain radius R. The path traveled is calculated as l=Rθ, where θis the angle of the circular section given in radians. It is easy to see that the derivative of θis the same angular velocity r, because the vehicle’s movement is perpendicular to the radius. Also, the derivative of lcorresponds to the norm of the velocity. Then dl dt =Rdθ dt pu2+v2=Rr R=√u2+v2 r.(7.104) While rincreases the radius decreases, and while uincreases the radius increases. This leads us to calculate the maximum velocity upossible given a specific radius R. We have calculated different radii at steady state from the velocities at steady state. From this calculation we have extracted the maximum values for u. Figure 7.22 displays the relation of them respect the radius R. 1 10 20 30 40 50 0 0.5 1 R[m] u[m/s] Figure 7.22: Maximum forward velocity uregarding the radius of curvature Using a polynomial regression, we obtain that umax = 0.0000162R3−0.00183R2+ 0.0698R+ 0.0677.(7.105) 7.7 Conclusions In this chapter we have related several contributions to the hydrodynamic model of the Guanay II AUV. First we focused on a model proposed by Prestero, which does not contemplate the linear damping matrix. Next, this model was linearized and an analysis of stability was developed. We have seen that the transfer functions of the yaw respect to the torque has a zero located at the origin, which is not good because the angular velocity does not tend to a constant value when a step is applied. In order to solve this problem we have taken into account a hydrodynamic model with the linear damping matrix. Again, a linearization and an study of stability were made. In this case the response of the yaw is more situated to the desired values. 7.7. CONCLUSIONS 111 After that we have dealt with the calculation of the coefficients of the Guanay II, first using a theoretical method that takes into account the geometry of the vehicle. However, simulations with these coefficients were not good at all, so we used a method, based on least squares of experimental data, to calculate them. The results were very good, with simulations coinciding with experimental data with a very small error. Finally, we have dealt with the physical constraints of the vehicle. The limits are shown in a map of propulsion and torque. At the same time we showed different maps of the steady state of the velocity components using all ranges of propulsion and torque. We closed the constraints analysis with a study about the minimum radius of curvature respect to the forward velocity. 112 CHAPTER 7. MODELING Chapter 8 Automatic Control Guanay II must be capable of autonomous navigation. After defining and scheduling a path, the vehicle must be able to follow it without human intervention, and to cope with any environmental perturbations present in the sea. Works of Fossen [43] and Antonelli et al. [9] present the concept of Guidance, Navigation and Control System (GNC), which is the set of programs responsible of carrying out a mission. As the name says, it is divided into three main layers or subsystems (see figure 8.1): •Guidance system. This is the high level control of the vehicle during the mission. The mission is decomposed into a sequence of sub-goals which generate the desired settings: a reference trajectory (position, velocity and acceleration). It has a waypoint generator which establishes the desired waypoints according to information about the mission, operator decision, weather, amount of power available, etc. There are several lines of research in this area, among which one can cite path planning, mission planning, obstacle avoidance, and multi-vehicle collaboration. •Navigation system. This system receives the sensor data and computes the actual position, velocity and acceleration. Lines of research work on GPS/IMU integration, short baseline (SBL), ultra-short baseline (USBL), long baseline (LBL), simultaneous localization and mapping (SLAM), among others (see [96] [101] [11] [111]). •Control system. This system processes information to infer the state of the vehicle and to generate an appropriate command for the actuators so as to reduce the difference between the actual and desired trajectories. A complete survey of GNC systems can be found in Kendowl [64], and Moreno et al. [89]. The form to combine and to manage these systems relies on the control architecture. See [113], [89], [99], [85] for further details and classification. We reviewed in chapter 5the software of the vehicle. This corresponds with the guidance system of the Guanay II. It has the high level management that communicates with the operator and defines a set of instructions or sub-goals. In this chapter on automatic control we will focus in the intermediate layer, the control system. The control system can have different operation modes, and depending on the type of operation performed by the vehicle, the controller can combine (or be switched into) the different modes: path following,path tracking,trajectory tracking,point stabilization,pure 113 114 CHAPTER 8. AUTOMATIC CONTROL Guidance IMU/GPS USBL LBL SLAM Sonar waypoints actuators sensors VehicleControl Path planning Obstacle avoidance Mission planning Navigation goal technique PID LQR Gain scheduling Fuzzy Neural networks Backstepping Adaptative control Pure pursuit (PP) Point stabilization Path following Trajectory tracking Path tracking Line-of-Sight (LOS) Multi-vehicle collaboration Figure 8.1: Guidance, Navigation and Control, and the main associated research lines. This chapter focuses on the topics in bold. pursuit,line-of sight and constant bearing. These type of movements are tightly linked with the guidance system. Further details can be found in Breivik and Fossen [20], and Duc and Pan [30]. The way to deal with these control problems covers all type of controllers, including linear control [150] [12], sliding control [161] [123] [130], fuzzy control [128] [31] [108], gain scheduling control [119] [149]; LQR [84], adaptative control [6] [7]; robust control [26], nonlinear laws based on Lyapunov functions (backstepping) [18] [8] [36] [71] [29], and neural networks [65] [56] [41], among others. Most of the works about the state of the art [150] [84] [123] design the controllers referencing the hydrodynamic model of the vehicle when it travels at a specific forward velocity in order to simplify the control design. This is right for a vehicle that habitually navigates at open sea where its velocity will be mainly constant. However, if it navigates near the coast, on the sea floor, or in the interior of ports and channels, the variation of the forward velocity becomes relevant, and it is then important to be able to vary working point of the controller in order to adjust the paths to these environments and keep an uniform performance across several environments. Some of the works that propose a solution to this problem use techniques based of Lyapunov functions [71] [19]. These solutions lead to a loss of simplicity of the control laws. Moreover, these nonlinear techniques do not enjoy the same diffusion and popularity as their linear counterparts. An alternative is the work of Silvestre and Pascoal [125], where they design linear controllers for different forward velocities, and thereafter use a gain scheduling controller to integrate them. The application of this methodology is the motivation of the present work, but applying a fuzzy controller to integrate the different linear controllers. Regarding fuzzy controllers, several papers use it for obstacle avoidance, like in Dong et al. [31] and Liu et al. [75], who design memberships in function of the distance to the obstacle and the forward velocity. On the other hand, there are other works focused on using the advantages of Gain Scheduling controllers but applying the fuzzy framework to manage them, like in Zhang et al. [163] and Jun et al. [62], who develop a fuzzy controller for AUVs in a way that it manages several linear controllers to be actuated at specific conditions of velocity. 8.1. REVIEW OF CONTROL SYSTEM 115 However, they do not calculate the parameters of the controller using an analytic procedure but using a linguistic interpretation. In Reddy et al. [109] we can see a comparative of the fuzzy controller technique in regard to gain scheduling. They show that fuzzy controllers have similar behaviour and performance when compared to gain scheduling ones. Thus, due to the good performance of the fuzzy controller serving as interpolator of linear controllers, we propose in this work the use of a fuzzy controller of type TSK in order to manage different linear controllers designed for specific conditions of forward velocity. We also present an analytic development to calculate different parameters. The fuzzy controller allows us to establish activation zones (understood as the effective contribution of one rule of the controller) which can be controlled through fuzzy sets (Driankov et al. [32]; Takagi and Sugeno [138]; Mittal et al. [88]). For the control system, we split the controller into two loops: inner loop and outer loop. The first loop is responsible for setting the yaw ψand the forward velocity u, given a reference (ψref, uref). At this level we develop the fuzzy controller mentioned above. The second loop is responsible to set the reference for yaw and forward velocity for a given path. The structure of this chapter is as follows: First we deal with linear controllers to control the yaw and forward velocity on the inner loop. These controllers are based on the hydrodynamic model. Next, we introduce the fuzzy controller as interpolator of these controllers. This development is compared with the gain scheduled controller. Next we present some problems related to the physical limitations of the Guanay II and we propose a change in the inner loop for heading using a fuzzy controller based on the yaw error. From this point we deal with the outer loop, which consists of two methods to implement a pure pursuit, and one method to implement path following. 8.1 Review of control system 8.1.1 Basic motion tasks The classification of the control system regarding the motion is divided into 7 tasks. They are very linked with the guidance system because they define the type of movement, but we classify them in the control system because they start after the definition of the way-points. Trajectory tracking Trajectory tracking is a frequent control problem both in marine vehicles and in land and aerial vehicles. Its principal goal is to follow a virtual vehicle, that is, to follow a trajectory with timing conditions. Let p(t) be the actual position of the vehicle, and let pd(t) : [0,∞]) →R2be the position of the reference virtual vehicle. The error e=kp(t)−pd(t)k(8.1) needs to be decreased to zero in a finite time [2]. Path following Path following is similar to trajectory tracking but without the timing restrictions. Its goal is to follow a geometric reference path starting from a given initial configuration. Let pd(ζ)∈R2be a path parametrized by ζ∈R, and let vr(ζ)∈Rbe a desired velocity. The error e=kp(t)−pd(ζ(t))k(8.2) 116 CHAPTER 8. AUTOMATIC CONTROL needs to be decreased to zero [37]. Notice that there is not an explicit restriction on time. Path tracking Path tracking, like trajectory tracking, has a timing law to converge to the path, but not necessarily using a virtual vehicle. Encarna¸cao and Pascoal [37] present it as a combination between trajectory tracking and path following. The desired position pd(π) is parametrized by π, which is defined as follows. π(p, t) = arg min ζ∈R(1 −λ2)||p−pd(ζ)||2 P+λ2(t−ζ)2(8.3) where λis a weight used to interpolate between the two motion tasks. In this way, when λ is zero we obtain path following, but when λis 1 we obtain trajectory tracking. Point stabilization Point stabilization consists in stabilizing the position of a vehicle at a given point and attitude. For vehicles with nonholonomic constraints (like Guanay II) it is not achievable with constant state-feedback control and they need of using more complex controllers [21]. This is not a problem for fully-actuated vehicles, contrary to underactuated ones [52]. Pure pursuit (PP) Pure pursuit guidance only considers the target (waypoint) and the vehicle. The method is quite intuitive, whereas the heading angle is calculated only based on the current position of the vehicle and the next waypoint. The concept of pure pursuit can be traced in early technical literature regarding the problem of a missile pursuing a target [121]. In the pure pursuit course, the missile velocity vector is always directed toward the instantaneous target position. Line-of-Sight (LOS) The basic idea behind line-of-sight (LOS) guidance algorithms is to define a LOS setpoint on the straight line between two waypoints pkand pk+1. The vector from the vehicle’s current position to the setpoint is known as the LOS vector and its direction implicitly also becomes the course of the vehicle [60]. All of these motion tasks are summarized in figure 8.2. Take into account that it is possible to combine these tasks, for instance, LOS with path following [44]. 8.1.2 Fuzzy logic Fuzzy logic is a form of many-valued logic which deals with reasoning that is approximate rather than fixed and exact. Compared to traditional binary sets (where variables may take on true or false values), fuzzy logic variables may have a truth value that ranges in degree between 0 and 1. Fuzzy logic has been extended to handle the concept of partial truth, where the truth value may range between completely true and completely false. Furthermore, when linguistic variables are used, these degrees may be managed by specific functions. The term “fuzzy logic” was introduced by Zadeh [162]. A fuzzy set µof Xis a function from the reference set Xto the unit interval, i.e. µ:X→[0,1]. 8.1. REVIEW OF CONTROL SYSTEM 117 Path Parameter ζ Path Time t Start Goal PP LOS (a) (b) (c) (d) Figure 8.2: Basic motion tasks. a) Trajectory/path tracking. b) Path following. c) Point stabilization. d) Pure pursuit and Line-of-Sight F(X) denotes the set of all fuzzy sets of X. In general, fuzzy sets merely have an intuitive basis as a formal description of vague data. Figure 8.3 shows an example of this concept. A human can be considered ‘tall’ if his height is near to 2 m, but he is not ‘tall’ if his height is 1 m. In the case of 1.5 m we say that the condition of ‘tall’ is partial truth, and numerically is 0.7. µtall 0.5 1 1.5 20 1 0.7 Figure 8.3: Representation of a fuzzy set The basic operations on fuzzy sets are intersection, union and complement. They are defined as follows (see figure 8.4). (µ∩µ0)(x) = min{µ(x), µ0(x)}(intersection) (µ∪µ0)(x) = max{µ(x), µ0(x)}(union) ¯µ(x) = 1 −µ(x) (complement) (8.4) 118 CHAPTER 8. AUTOMATIC CONTROL µ1(x)∩µ2(x)µ1(x)∪µ2(x) ¯µ(x)µ(x) (a) (b) (c) Figure 8.4: Basic operations on fuzzy sets. a) intersection. b) union. c) complement Types of fuzzy sets There are two types of fuzzy sets, namely: Type-1 and type-2. The first one has memberships functions in two dimensions, that is, the membership grade for each element is a crisp number in [0,1]. The type-2 fuzzy set is characterized by a three dimensional membership function and a footprint of uncertainty (FOU) [120] [61]. Hence, the membership value (or membership grade) for each element of this set is a fuzzy set in [0,1]. This allows to associate uncertainties of the sensors measurements, linguistic uncertainties (words means different things to different people), or uncertainties associated with the change in the operation conditions due to varying load and environment conditions [53]. Figure 8.5 shows a graphical representation of a type-2 fuzzy set. It is bounded by a upper membership function (UMF) and a lower membership function (LMF). 0 1 x0x u UMF( ˜ A) FOU( ˜ A) LMF( ˜ A) MF2(x0) MF1(x0)MF2(x0)MF1(x0)u µ˜ A(x0) Figure 8.5: type-2 fuzzy set 8.1.3 Fuzzy control As explained by Kruse [69], fuzzy control is seen as a way of defining non-linear tablebased control systems, where the definition of the non-linear transition function can be made without the need to specify each entry of the table individually. The development can be viewed as a kind of knowledge-based interpolation technique. The analysis of the table-based controller can be performed by standard methods of control engineering. Let ξ1, . . . , ξnby the input variable, which consists of the measurements of different sensors. Let γby the control variable. The measurements are used to determine an actual value of γ. In addition, we assume that the measured input ξi,i= 1, . . . , n, is a value of the set Xi, and that the control variable is in the set Y. The solution of the control 8.2. LINEAR CONTROLS FOR DIFFERENT VELOCITIES 125 2 0-2 -4 0 -2 Real Imaginary 0-2 -4 0-2 -4 Real Real Gψ 0.3 (s)Gψ 0.9 (s)Gψ 2.0 (s) CP 0.3(s) CP 0.9(s) CP 2.0(s) Figure 8.10: Root locus of the different Gψ(s) and pole displacement using the controllers CP(s) Although these root locus show that the controllers seem to be zonally differentiated, it is important to test their performance in time. Figure 8.11 shows the step responses of the different linearizations using the different controllers in a closed loop. Travelling at 0.3 m/s, the controller CP0.3(s) does not yield any overshoot. However, controller CP0.9(s) seems to provide a better response, although it has some overshoot. A similar situation is obtained in the second linearization: at 0.9 m/s the controller designed for this case, CP0.9(s), yields a good response without overshoot. However, controller CP2.0(s) leads to a lower settling time and to a small overshoot. Finally, the responses in the third linearization, at speed 2 m/s, clearly show that the best controller is CP2.0(s), since it has the lower settling time and has no overshoot. Knowing these particular situations, we can say that this set of proportional controllers is not zonally differentiated. 0 10 20 30 0 0.5 1 1.5 0 20 40 0 0.5 1 1.5 0 50 100 0 0.5 1 1.5 Gψ 0.3 (s)Gψ 0.9 (s)Gψ 2.0 (s) Yaw [rad] time [s] time [s] time [s] CP 0.3(s) CP 0.9(s) CP 2.0(s) Figure 8.11: Step response of the different feedback systems using the controllers CP(s) 126 CHAPTER 8. AUTOMATIC CONTROL PD Controller A proportional-derivative controller (PD) consists of a gain for the yaw error eψand a zero which allows fast response: CPD u0 (s) = kds+kp(8.23) where the subscript PD denotes “proportional-derivative” and u0is the velocity chosen for the linearization. This type of control has the great advantage that it can move the two dominant poles to more negative values, which represents better performance. The root locus has two types of diagrams for stable systems: 1. Zero located between the two poles. In this case, the dominant pole will go to zero, and the other to infinity. The advantage is that no matter the gain, the resulting poles are real. The disadvantage is that the resulting position of the dominant pole, and consequently the speed of response, is limited by the position of the zero. 2. Zero located to the left of the two poles. In this case, the movement of the poles has three parts. First, the poles approach each other until they reach a breakaway point; then one has two complex branches enclosing the zero in an oval; and third one real pole goes to zero and the other to infinity. The advantage with this design is that the two poles can be at the left of the zero, and consequently one gets a fast response. The disadvantage is that the fast response requires high gains, and also the possibility of having conjugated poles that create large oscillations. The closed loop poles can be calculated from Hψ(s) equating its denominator to zero: 1 + CP(s)Gψ(s) = 0 1+(kds+kp)mvs−Yv As3+Bs2+Cs = 0 As3+Bs2+Cs + (kds+kp)(mvs−Yv) = 0 As3+ (B+mvkd)s2+ (C+mvkp−Yvkd)s−Yvkp= 0 (8.24) For the controller design, it is better to locate the zero at the left of the two poles in order to obtain a fast response, and the gain should be a constant which leads the poles to the breakaway point at the left of the zero. Similarly to the Pcontroller design, this point is achieved when two poles are the same. Comparing the disposition of two equal poles and a real pole (equation 8.20) and the equation (8.24), we obtain the equation system 2a+b= (B+mvkd)/A a2+ 2ab = (C+mvkp−Yvkd)/A a2b=−Yvkp/A (8.25) which has four unknowns, a,b,kd, and kp. As the equation system is under-determined, it is necessary to define one of these values. In this case we will set the zero, that is −kp/kd, at the left of the more negative pole through the formula −kp kd = 1.1p1(8.26) where p1is the more negative pole. 8.2. LINEAR CONTROLS FOR DIFFERENT VELOCITIES 127 Solving this system for the values of the transfer functions (8.16), we obtain CPD 0.3(s) = 408.8266(s+ 0.8039) CPD 0.9(s) = 1012.4791(s+ 2.0165) CPD 2.0(s) = 2109.6664(s+ 4.2279) (8.27) Figure 8.12 shows the root locus of the linearized systems for 0.3, 0.9 and 2 m/s using the different zeros of the PD controllers. The green lines mark the root locus when the zero is placed at −0.8, and the green triangles show the particular case when controller CPD0.3(s) is used. The blue lines mark the root locus when the zero is placed at −2.0, and the blue squares show the particular case when controller CPD0.9(s) is used. Finally, the red lines mark the root locus when the zero is placed at −4.2, and the red stars show the particular case when controller CPD2.0(s) is used. For the first system Gψ0.3(s), controller CPD0.3(s) moves the real poles to a more negative zone. Controller CPD0.9(s) moves the poles to a much more negative zone but the poles are complex, leading to overshoot and oscillations. Finally, controller CPD0.9(s) moves the poles to −3.9±3.8i(not seen in the figure), leading again to underdamped responses but placing the poles at a very negative values. For the second system Gψ0.9(s), controller CPD0.3(s) is not very good because the dominant pole is near the imaginary axis. Controller CPD0.9(s) is in a better situation because it moves the poles to a more negative zone while keeping them real. Finally, controller CPD2.0(s) moves the poles to −4.4±3.1i(not seen in the figure), which is much more to the left but with complex values. For the third system Gψ2.0(s), the two controllers CPD0.3(s) and CPD0.9(s) are not very good because their dominant poles are not moved far away from the imaginary axis. On the other hand, controller CPD2.0(s) moves the real poles to very negative values. Real Imaginary Real Real Gψ 0.3 (s)Gψ 0.9 (s)Gψ 2.0 (s) CPD 0.3(s) CPD 0.9(s) CPD 2.0(s) -1.5 1.5 1 0 -1 -4 -2 0 -4 -2 0 -4 -2 0 Figure 8.12: Root locus of the different Gψ(s) and pole displacement using the controllers CPD(s) The above analysis shows that when a controller is used in the zone for which it was designed the poles are moved to negative real values. On the other hand, crossing the 128 CHAPTER 8. AUTOMATIC CONTROL controllers, the poles can be moved to much more negative values but they become complex. This situation makes it difficult to see if the controllers are zonally differentiated. Figure 8.13 helps to distinguish this. It shows the step responses of the different linearizations using the different controllers in a closed loop. At 0.3 m/s, controller CPD0.3(s) does not yield overshoot. However, controller CPD2.0(s) seems to have a better response although it has some overshoot. In the second linearization, at 0.9 m/s, the controller designed for this case, CPD0.9(s), yields a better response than the others. However, controller CPD2.0(s) leads to a very similar response with a small overshoot. Finally, the responses in the third linearization, for 2 m/s, clearly show that the best controller is CPD2.0(s) since it has the lower settling time and has no overshoot. From all this, it is not clear that this set of controllers is zonally differentiated. 0 2 4 0 0.5 1 0246 0 0.5 1 0 5 10 15 0 0.5 1 Gψ 0.3 (s)Gψ 0.9 (s)Gψ 2.0 (s) Yaw [rad] time [s] time [s] time [s] CPD 0.3(s) CPD 0.9(s) CPD 2.0(s) Figure 8.13: Step response of the different feedback systems using the controllers CPD(s) Zonally differentiated controllers The controllers designed above have shown that, as the forward velocities increases, the controller needs higher gain. On the other hand, when a controller designed for high velocities is used at low velocities the response is underdamped but faster. At the same time, the use of three velocities makes it difficult to see a good differentiation between the controllers. To solve this, we have opted to use two velocities to design the controllers, 0.3 m/s and 2 m/s. The controllers chosen for each velocity are CPD0.3(s) and CP2.0(s) respectively. Figure 8.14 shows the root locus for each case. When the vehicle travels at 0.3 m/s the first controller, CPD0.3(s), moves the two poles to −1 while the second, CP2.0(s), to −0.4±1.8i. In this case, the benefits of the first controller are clear. On the other hand, when the vehicle travels at 2 m/s the first controller moves the dominant pole to −0.3 while the second controller moves the two poles to −2; in this case, the benefits of the second controller are clear. Regarding the response in time, figure 8.15 shows the step response using these controllers. For the first linearization, controller CPD0.3(s) yields a better performance than the second one, which has an underdamped and slow response. For the second linearization, the controller CP2.0(s) yields a faster response than the first one. In conclusion, we can say that this set of controllers is zonally differentiated, which is what we wanted to obtain. Figure 8.16 shows the step response but this time on the nonlinear model. The vehicle is forced to navigate to two velocities, 0.3 and 2 m/s, obtaining similar results as above. 8.2. LINEAR CONTROLS FOR DIFFERENT VELOCITIES 129 Real Imaginary Real Gψ 0.3 (s)Gψ 2.0 (s) CPD 0.3(s) CP 2.0(s) -4 -2 0 2 0 -2 2 0 -2 -1 -0.5 0 Imaginary Figure 8.14: Root locus for Gψ0.3(s) and Gψ2.0(s), and pole displacement using the controllers CPD0.3(s) and CP2.0(s) 0 5 10 15 0 0.5 1 1.5 0 20 40 0 0.5 1 1.5 Gψ 0.3 (s)Gψ 2.0 (s) CPD 0.3(s) CP 2.0(s) Yaw [rad] time[s] Yaw [rad] time[s] Figure 8.15: Step response of the systems Gψ0.3(s) and Gψ2.0(s) using the controllers CPD0.3(s) and CP2.0(s) in a feedback loop 0 5 10 15 0 0.5 1 1.5 0 20 40 0 0.5 1 1.5 CPD 0.3(s) CP 2.0(s) Yaw [rad] time[s] Yaw [rad] time[s] u= 0.3 m/s u= 2.0 m/s Figure 8.16: Step response of the nonlinear model using the controllers CPD0.3(s) and CP2.0(s) in a feedback loop, and forced to navigate at 0.3 m/s and 2 m/s 130 CHAPTER 8. AUTOMATIC CONTROL 8.2.3 Transfer function of the forward velocity In the chapter on modeling, we introduced the transfer function of the forward velocity with respect to the propulsion (see equation 7.63), which only has one pole. This can be expressed as Gu u0 (s) = u(s) Prop(s)=1 mus−2|u0|X|u|u−Xu (8.28) where the subindex u0in the notation Guu0(s) represents the velocity at which the model is linearized. Equations (8.29) show three of them when the model is linearized at 0.3, 0.9 and 2 m/s. Gu 0.3(s) = 0.001611 s+ 0.148 Gu 0.9(s) = 0.001611 s+ 0.4429 Gu 2.0(s) = 0.001611 s+ 0.9836 (8.29) 8.2.4 Control of the forward velocity The velocity control consists of a definition of a reference uref, which is compared with the actual velocity uin order to establish an error. The principal idea is to bring this error to zero using a controller T(s) that actuates the thrusters. The general block diagram can be seen in figure 8.17. T(s) + −Gu(s) uref euuProp Figure 8.17: Block diagram of the closed loop system for the velocity control Denoting by Hu(s) the transfer function of the velocity with respect to the reference, it can be calculated as Hu(s) = u(s) uref(s)=T(s)Gu(s) 1 + T(s)Gu(s),(8.30) and the error function is eu(s) uref(s)=1 1 + T(s)Gu(s).(8.31) The first condition to design the controller is to guarantee zero error in steady state for a step response. Using a proportional controller, and employing the final value theorem, we have lim t→∞ eu(t) = lim s→0seu(s) uref(s) 1 s = lim s→0 1 1 + k Gu(s) =2|u0|X|u|u+Xu 2|u0|X|u|u+Xu−k 8.2. LINEAR CONTROLS FOR DIFFERENT VELOCITIES 131 As the result is not zero, it is necessary to use another control. The proportional-integral controller (PI) is a good option for this case because it adds an integrator. Applying the same calculation we have lim t→∞ eu(t) = lim s→0seu(s) uref(s) 1 s = lim s→0 1 1 + kps+ki sGu(s) = lim s→0 s(mus−2|u0|X|u|u−Xu) mus2+ (kp−2|u0|X|u|u−Xu)s+ki = 0 which proves that the error is zero in steady state. Taking this into account, we set this controller as follows, TPI u0 (s) = kps+ki s(8.32) where the subscript PI denotes “proportional-integral” and u0is the velocity at which the model as been linearized. Notice that the use of a PI controller implies a root locus with two poles and one zero, which is similar to the disposition obtained in the yaw control using a PD controller. Hence, the same design process can be used for this controller. Figure 8.18 shows the root locus of two controllers calculated for two transfer functions at 0.3 m/s and 2 m/s. The main idea is that they be zonally differentiated, in order to have the best pole disposition using the correct controller at the right conditions of velocity. For the first transfer function, Gu0.3(s), the poles are moved to −0.35 using the controller TPI0.3(s), while they are moved to −0.34±0.68iusing the controller TPI2.0(s). The real poles represent a better option compared with the complex conjugated poles. On the other hand, for the second transfer function, Gu2.0(s), the dominant pole is moved to −0.08 using the controller TPI0.3(s), which is very near to the imaginary axis, while the poles are moved to −1.4 using the controller TPI2.0(s), which guarantees fast response. Notice that this design moves the poles at the right breakaway point and not to the left; this is because the left breakaway point needs a large gain which compromises the zonal differentiation (a large gain implies better performance at the first transfer function Gu0.3(s)). The designed controllers are TPI 0.3(s) = 337.6657(s+ 0.2200) s, TPI 2.0(s) = 327.7492(s+ 1.0820) s. (8.33) Regarding the response in time, figure 8.19 shows the step response for 0.3 m/s and 2 m/s using these controllers. For the first linearization, controller TPI0.3(s) yields a small overshoot but better performance than the second one, which has a more underdamped response. On the other hand, for the second linearization, controller TPI2.0(s) yields a faster response than the first one. Similar results are obtained when the nonlinear model is used, as can be seen in figure 8.20. 132 CHAPTER 8. AUTOMATIC CONTROL Real Imaginary Real Gu 0.3(s)Gu 2.0(s) TPI 0.3(s) TPI 2.0(s) Imaginary 0.5 0 -0.5 -1.5 -1 -0.5 0 0.5 0 -0.5 -1.5 -1 -0.5 0 Figure 8.18: Root locus for Gu0.3(s) and Gu2.0(s), and pole displacement using the controllers TPI0.3(s) and TPI2.0(s) 0 10 20 30 0 0.1 0.2 0.3 0.4 0 20 40 60 0 1 2 3 time[s] time[s] Gu 0.3(s)Gu 2.0(s) TPI 0.3(s) TPI 2.0(s) u[m/s] u[m/s] Figure 8.19: Step response of the systems Gu0.3(s) and Gu2.0(s) using the controllers TPI0.3(s) and TPI2.0(s) in a feedback loop 0 10 20 30 0 0.1 0.2 0.3 0.4 0 20 40 60 0 1 2 3 time[s] time[s] uref = 0.3 m/s uref = 2 m/s TPI 0.3(s) TPI 2.0(s) u[m/s] u[m/s] Figure 8.20: Step response of the nonlinear model using the controllers TPI0.3(s) and TPI2.0(s) in a feedback loop, and using 0.3 m/s and 2 m/s as input references 8.3. INNER LOOP: FUZZY CONTROL (FIRST APPROACH) 133 8.3 Inner loop: Fuzzy control (first approach) Alternatively to classical control engineering, it seems convenient to simulate the behaviour of a person who is able to control the given process. We call this development of a model of a human ‘control expert’ knowledge-based analysis. To make such an analysis the expert may be questioned directly. The expert then specifies his knowledge in form of linguistic rules. Instead of directly interviewing the expert it is also possible to observe his behaviour and extract from the observation protocol the necessary information. The results of this procedure can be used to provide appropriate (linguistic) rules that control the process [69] [32]. The fuzzy control is a tool used for these purposes. As we introduced in the review of this chapter the type-1 TSK fuzzy controller uses crisp functions in the output instead of linguistic terms, which is very effective and reduces the computational calculation. Its importance stems from its ability to be adapted to the development of linear controllers, like the controllers P, PD and PI of section 8.2. In the case of the Guanay II this control can be used to control the velocity and the yaw. The above results have shown the importance of using different controllers depending of the forward velocity u. The use of this control expert can be used to change between the different controllers, in other words, fuzzy control is presented as an interpolating controller. A block diagram of this concept is presented in figure 8.21. It has two controllers. The first one, called C(u) Fuzzy1, takes the velocity error euand uses the linear controller T(s) to control the velocity. The parameters of T(s) are dynamically modified by a fuzzy block which has uref as input. Notice that we could use uas input, but the reference uref is similar to the step response with the simulations made using the lineal controllers, while uchanges over time causing different responses. The second controller, called C(ψ) Fuzzy1, takes the yaw error eψand uses the linear controller C(s) to control the yaw. The parameters of C(s) are dynamically modified by a fuzzy block which has the forward velocity uas input. This input uis the basis of the designed controllers in the previous section. + − uref euu Prop Fuzzy u C(s) + − ψref eψψ Torque T(s) Guanay II Gu(s) Gψ(s) Fuzzy γu γψ C(u) Fuzzy1 C(ψ) Fuzzy1 Figure 8.21: Fuzzy control — velocity and yaw control regarding the forward velocity u The development of controllers C(u) Fuzzy1 and C(ψ) Fuzzy1 is detailed below. 8.3.1 Fuzzification The velocities uand uref need to be transformed to a linguistic terms in order to be controlled in a fuzzy way. Generally, these terms have 5 o 7 connotations (for instance, large negative, small negative, zero, small positive, and large positive), but the linear controllers designed 134 CHAPTER 8. AUTOMATIC CONTROL in the last section have shown that the Guanay II only needs two: 0.3 m/s and 2 m/s, considered as ‘low’ and ‘high’ velocity. The guarantee of zone differentiation prevents the use of more connotations. There are many ways to define the fuzzy sets. Fuzzy sets of ‘low’ and ‘high’ are presented in equations (8.34) and (8.35) respectively. They are segmented in piecewise linear functions. Likewise, figure 8.22 shows a graphical representation of these membership functions. µl(u) =    1 if u < 0.3 10(2−u) 17 if 0.3≤u≤2 0 if u > 2 (8.34) µh(u) =    0 if u < 0.3 10u−3 17 if 0.3≤u≤2 1 if u > 2 (8.35) u[m/s] 0 0.3 2 2.3 0 1 µl µh Figure 8.22: Fuzzy set. Membership functions µland µh 8.3.2 Inference The expert specifies his knowledge in form of linguistic rules. The advantage of this conception is the ease to define the rules and outputs. For instance, in the case of the Guanay II , we know that some controllers have to be used at low velocities, CPD0.3(s) and TPI0.3(s) (see equations 8.27 and 8.33), and other controllers at high velocities, CP2.0(s) and TPI2.0(s) (see equations 8.22 and 8.33). The linguistic rules of C(ψ) Fuzzy1 to control the yaw are: R1:if uis µlthen C(s)is CPD0.3(s) R2:if uis µhthen C(s)is CP2.0(s) while the linguistic rules of C(u) Fuzzy1 to control the velocity are given by R1:if uref is µlthen T(s)is TPI0.3(s) R2:if uref is µhthen T(s)is TPI2.0(s) From equation (8.5) we have seen the fuzzy operator “min” as a logical conjunction between the membership functions of two or more input variables. In the case of Guanay II , as we only need one variable, this value is simplified to the membership function of the rule. That is, to control the yaw we have αψ1=µl(u) αψ2=µh(u)(8.36)