scieee AI-readable full text Open interactive document viewer

Simultaneous AUV navigation and tracking with satellite ASVs

Real Vial, Marta,real vial

Abstract

The navigation of Autonomous Underwater Vehicles (AUV) presents a series of challenges, being the location due to the inaccessibility of GPS signal one of them. A solution is the use of several surface vehicles equipped with hydrophones to locate and track an AUV that emits an acoustic signal. This Master’s Thesis addresses this solution with the objective to optimize the energy consumption of 2 Autonomous Surface Vehicles (ASV) while maintaining a preferred geometry of the formation to reduce the uncertainty of the position estimation of the AUV. To control these surface vehicles, 2 approaches of Reinforcement Learning (RL) have been implemented, Deep Deterministic Policy Gradient (DDPG) and Multi-Agent Deep Deter- ministic Policy Gradient (MADDPG). The aim of using these 2 algorithms is to test if the inclusion of the multi-agent element is necessary in this case. The RL algorithms control the linear and angular velocities of each robot. The environment used for the training of the robots is created specifically for this project using Python. A weighted sum of Gaussian functions is designed for the reward function, which contains all the elements related to the optimization of energy consumption and the formation of the AUV. To analyse several aspects of the final models of each robot a total of 4 different tests were done. These tests focus on the analysis of the distribution of the weights in the reward func- tion and the ability to adapt to difficult scenarios. The tests are done as simulations. The re- sults show that the ASVs trained with these implementations of RL modify their behaviour depending on the weight configuration and can adapt to more difficult scenarios depending on aspects of the training such as the noise applied to the actions. Moreover, the performance between the DDPG and MADDPG is compared. A discussion with similar works that have treated this problem is done using the final results.

Full text

Master Thesis Master’s Degree in Automatic Control and Robotics (MUAR) Simultaneous AUV navigation and tracking with satellite ASVs Author: Marta Real Vial Directors: Dr. Nuno A. Cruz & Dr. Gerardo G. Acosta Tutor: Dr. Ramon Costa Castelló Call: April 2022 Escola Tècnica Superior d’Enginyeria Industrial de Barcelona Simultaneous AUV navigation and tracking with satellite ASVs p. 1 Abstract The navigation of Autonomous Underwater Vehicles (AUV) presents a series of challenges, being the location due to the inaccessibility of GPS signal one of them. A solution is the use of several surface vehicles equipped with hydrophones to locate and track an AUV that emits an acousticsignal. ThisMaster’s Thesisaddresses thissolutionwiththe objective tooptimizethe energy consumption of 2 Autonomous Surface Vehicles (ASV) while maintaining a preferred geometry of the formation to reduce the uncertainty of the position estimation of the AUV. To control these surface vehicles, 2 approaches of Reinforcement Learning (RL) have been implemented, Deep Deterministic Policy Gradient (DDPG) and Multi-Agent Deep Deterministic Policy Gradient (MADDPG). The aim of using these 2 algorithms is to test if the inclusion of the multi-agent element is necessary in this case. The RL algorithms control the linear and angular velocities of each robot. The environment used for the training of the robots is created specifically for this project using Python. A weighted sum of Gaussian functions is designed for the reward function, which contains all the elements related to the optimization of energy consumption and the formation of the AUV. To analyse several aspects of the final models of each robot a total of 4 different tests were done. These tests focus on the analysis of the distribution of the weights in the reward function and the ability to adapt to difficult scenarios. The tests are done as simulations. The results show that the ASVs trained with these implementations of RL modify their behaviour depending on the weight configuration and can adapt to more difficult scenarios depending on aspects of the training such as the noise applied to the actions. Moreover, the performance between the DDPG and MADDPG is compared. A discussion with similar works that have treated this problem is done using the final results. p. 2 MUAR Thesis Contents 1 Introduction 9 1.1 Objectives ....................................... 10 1.2 Motivation....................................... 11 2 Background and State of the Art 13 2.1 Robots ......................................... 13 2.1.1 ASVsModel.................................. 13 2.1.2 Position estimation strategies . . . . . . . . . . . . . . . . . . . . . . . . 14 2.2 ReinforcementLearning ............................... 16 2.2.1 Generalconcepts:............................... 16 2.2.2 PartsofRL: .................................. 17 2.2.3 Formulation.................................. 17 2.2.4 Deep Deterministic Policy Gradient . . . . . . . . . . . . . . . . . . . . 18 2.2.5 Multi-Agent Deep Deterministic Policy Gradient . . . . . . . . . . . . . 20 2.3 SimilarWorks ..................................... 20 3 Problem Statement 23 3.1 Problem ........................................ 23 3.2 Satellite ASVs considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.3 Figuresofmerit .................................... 24 3.4 Application of RL in this project . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 4 Implementation 29 4.1 Python ......................................... 29 4.2 RLimplementation.................................. 29 4.2.1 DDPG and MADDPG adaptation and parameters . . . . . . . . . . . . 29 4.2.2 Environment ................................. 31 4.2.3 Simulation................................... 33 4.3 Reward function and weights . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 5 Results 41 5.1 WeightAnalysis.................................... 41 5.1.1 Position estimation configuration . . . . . . . . . . . . . . . . . . . . . . 41 5.1.2 Energy consumption configurations . . . . . . . . . . . . . . . . . . . . 41 5.1.3 Trajectory configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 5.1.4 Results and Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 5.2 Difficulty and Configuration Analysis . . . . . . . . . . . . . . . . . . . . . . . 43 5.2.1 Difficultysetup................................ 44 5.2.2 Disturbances ................................. 51 5.2.3 Trajectories .................................. 54 5.3 Comparison between DDPG and MADDPG . . . . . . . . . . . . . . . . . . . . 61 6 Discussion 63 7 Economic study 65 7.1 EngineeringCosts................................... 65 8 Environmental study 67 3 p. 4 MUAR Thesis 9 Conclusions and Future Work 69 10 Acknowledgements 71 A Code 77 List of Figures 1 SomeexamplesofAUV. ............................... 9 2 SomeexamplesofASV................................. 10 3 NED coordinate system [1] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4 BODY reference frame for a 6 DOF [1] . . . . . . . . . . . . . . . . . . . . . . . 13 5 LBL schematic extracted from [2] . . . . . . . . . . . . . . . . . . . . . . . . . . 14 6 USBL schematic extracted from [2] . . . . . . . . . . . . . . . . . . . . . . . . . 14 7 Screenshot of the Atari Breakout environment from OpenAi Gym. . . . . . . . 17 8 DDPGAlgorithmfrom[3]. ............................. 19 9 DDPGmainstructure. ................................ 20 10 MADDPG Algorithm from [4]. . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 11 Position estimation with 2 sensors. . . . . . . . . . . . . . . . . . . . . . . . . . 25 12 Position estimation with 4 sensors . . . . . . . . . . . . . . . . . . . . . . . . . 26 13 Visualization example using turtle library . . . . . . . . . . . . . . . . . . . . . 34 14 Distance between ASV and AUV Penalty Function . . . . . . . . . . . . . . . . 34 15 Distance between ASVs Penalty Function . . . . . . . . . . . . . . . . . . . . . 35 16 Angle Error Penalty Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 17 Surge Power Penalty Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 18 Yaw Rate Power Penalty Function . . . . . . . . . . . . . . . . . . . . . . . . . . 37 19 Energy Consumption Penalty Function . . . . . . . . . . . . . . . . . . . . . . . 38 20 Distance ASV to AUV in Test 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 21 AngleErrorinTest1 ................................. 45 22 Velocity Difference in Test 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 23 Heading Difference in Test 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 24 Distance ASV to AUV in Test 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 25 AngleErrorinTest2 ................................. 47 26 Velocity Difference in Test 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 27 Heading Difference in Test 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 28 Distance ASV to AUV in Test 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 29 AngleErrorinTest3 ................................. 49 30 Velocity Difference in Test 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 31 Heading Difference in Test 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 32 Distance ASV to AUV in straight trajectory. . . . . . . . . . . . . . . . . . . . . 55 33 Angle Error in straight trajectory. . . . . . . . . . . . . . . . . . . . . . . . . . . 55 34 Velocity Difference straight trajectory. . . . . . . . . . . . . . . . . . . . . . . . 56 35 Heading Difference in straight trajectory. . . . . . . . . . . . . . . . . . . . . . 56 36 Distance ASV to AUV in sinus trajectory. . . . . . . . . . . . . . . . . . . . . . . 57 37 Angle Error in sinus trajectory. . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 38 Velocity Difference in sinus trajectory. . . . . . . . . . . . . . . . . . . . . . . . 58 39 Heading Difference in sinus trajectory. . . . . . . . . . . . . . . . . . . . . . . . 58 40 Distance ASV to AUV in circle trajectory. . . . . . . . . . . . . . . . . . . . . . . 59 41 Angle Error in circle trajectory. . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 42 Velocity Difference in circle trajectory. . . . . . . . . . . . . . . . . . . . . . . . 60 43 Heading Difference in circle trajectory. . . . . . . . . . . . . . . . . . . . . . . . 60 44 Sinusoidal trajectory with the DDPG models. . . . . . . . . . . . . . . . . . . . 61 45 Sinusoidal trajectory with the MADDPG models. . . . . . . . . . . . . . . . . . 61 5 List of Tables 1 Combinationsofweights. .............................. 38 2 Performance of the DDPG models of the ASV 1 with different weight combinations.......................................... 42 3 Performance of the DDPG models of the ASV 2 with different weight combinations.......................................... 42 4 Performance of the MADDPG models of the ASV 1 with different weight combinations......................................... 43 5 Performance of the MADDPG models of the ASV 2 with different weight combinations......................................... 43 6 Randomized variables of each test for the difficulty analysis. . . . . . . . . . . 44 7 Velocity components of each disturbance test. . . . . . . . . . . . . . . . . . . . 51 8 Results of the DDPG model with low noise. . . . . . . . . . . . . . . . . . . . . 51 9 Results of the DDPG model with high noise. . . . . . . . . . . . . . . . . . . . 52 10 Results of the MADDPG model with low noise. . . . . . . . . . . . . . . . . . . 52 11 Results of the MADDPG model with high noise. . . . . . . . . . . . . . . . . . 52 12 Engineeringcosts.................................... 65 6 Simultaneous AUV navigation and tracking with satellite ASVs p. 7 Acronyms ASV Autonomous Surface Vehicle. 5, 6, 9–11, 13, 15, 18, 20–23, 25–27, 32–37, 41–44, 47, 49, 51, 52, 54, 55, 57, 59, 63, 69 AUV Autonomous Underwater vehicle. 5, 9–11, 15, 20–25, 27, 31–35, 37, 41, 42, 44, 47, 49, 54, 55, 57, 59, 63, 69 DDPG Deep Deterministic Policy Gradient. 6, 18–21, 29, 30, 42, 43, 51, 52, 61, 63 DOF Degrees of Freedom. 13 DPG Deterministic Policy Gradient. 18, 19 DQN Deep Q-Network. 18, 19 EC Energy Combination. 42, 43 EKF Extended Kalman Filter. 15 FC Formation Combination. 42, 43 GPS Global Positioning System. 9, 14, 23, 24 LBL Long BaseLine. 14, 22 MADDPG Multi-Agent Deep Deterministic Policy Gradient. 6, 20, 29, 30, 42, 43, 52, 54, 61, 63 MDP Markov Decision Process. 17 NN Neural Network. 30 PC Power Combination. 42, 43 RL Reinforcement Learning. 3, 10, 11, 16–18, 20, 21, 26, 29, 30, 69 TC Trajectory Combination. 42, 43 USBL Ultra Short BaseLine. 14, 15, 22 p. 14 MUAR Thesis 2.1.2 Position estimation strategies There exist several methods of underwater acoustic positioning that use acoustic receivers to locate an emitting source. Usually, these methods use static beacons, like in Long BaseLine (LBL) or Ultra-Short BaseLine (USBL). On one hand, the LBL system consists of the use of an array of transponders placed on the seabed and a transducer fixed in a vessel. The transducer emits an acoustic signal that the transponder beacons receive and respond to it. Depending on the emitting and receiving time, the distance from each beacon to the transducer can be computed and therefore the position of the vessel. These beacons are placed around the area where the vessel with the transducer will operate and they provide high levels of accuracy. Figure 5: LBL schematic extracted from [2] An implementation of this system can be checked at [16], where the LBL is tested in shallow water and the deep sea. Their results show an average deviation between the estimated position and the GPS outputs of 0.885 m in shallow water and 1.547 m in deep sea. Moreover, an analysis of the sources of error derived from this method is done in [17]. On the other hand, the USBL method consists of the use of an array of transducers attached to the vessel to be monitored and a transponder that from the acoustic signals of the transducers it computes the distance and direction. It is called Ultra-Short due to the separation between transducers, which can be up to 10 cm. This method simplifies the deployment of beacons in the seabed, nonetheless, it faces greater error in the location of the target. This error is a result of the higher number of sensors needed and the fixed angle position to detect the direction of the target. Figure 6: USBL schematic extracted from [2] Simultaneous AUV navigation and tracking with satellite ASVs p. 15 An example of implementation of this system is encountered in [10], where an USBL system is used in combination with two EKF to estimate the position of an AUV. The authors of this research compare the USBL raw data with the combination EKF and show that the USBL alone achieves an average error during the trajectory of approximately 0.5 m. The main disadvantage with static systems is that the area of operation is bounded and that their position estimation accuracy is related to the geometry of the beacons. Thus, by using a dynamic acoustic positioning system these problems can be solved. In this case, the use of autonomous vehicles with acoustic receivers offers a wider range to operate for the AUV and reduces the uncertainty in the position estimation by adapting the geometry of the formation to the AUV trajectory. This system is referred to as Satellite ASVs in this project. p. 16 MUAR Thesis 2.2 Reinforcement Learning 2.2.1 General concepts: Reinforcement Learning (RL) is an approach of machine learning focused on a goal-directed learning from interaction [18]. These interactions are done between a learning agent and an environment through actions, states and rewards. Actions are generated by the agent, executed without external commands and produce changes in the environment. The environment uses the changes done by the actions to assess how "good" or "bad" are they with a numerical value, named reward. The state is usually a selection of information from the situation of the agent in the environment in form of values in an array. For example, a state element could be the distance between the agent and a target it wants to reach or the data provided by a sensor of the robot. By using this information, combined with the reward, the agent can build a map between the actions and the possible states, called policy. The objective of the policy is to achieve some goal or goals. The advantage of this method is that without knowing entirely the dynamics of the system or the problem that takes place, it can be achieved optimal control. It also does not need supervision or previously created data to learn. It can be used either to control small parts of a system or the whole system. Another concept that plays an important part in RL is the balance between exploration and exploitation. Exploration is usually done by executing random actions and gathering information by trial and error. Exploitation seeks to execute optimal actions with the information obtained up until that moment. Usually, at the beginning of a training, the agents need more exploration, given that it does not have much information about the environment. However, as the training progresses, the actions tend to be more exploitative. This can be executed in diverse ways and apart from gathering information it also helps to avoid local minimum behaviours of the agent if some level of exploration is maintained during the whole training. The training can be separated into episodes, where the agent executes actions until a certain event happens or just if time is up. These separations can be related to the goal, for example by ending the episode when the agent has reached a certain amount of reward or a state that fulfils that goal. Example: To test implementations and new approaches of RL, simple computer games are used as environments so the agent learns to play them. For example, in the Atari Breakout environment where a paddle needs to destroy a wall of bricks on top of it by bouncing a ball against it. The paddle is situated at the bottom of the screen and the ball can fall out of it if it does not collide with the paddle. The paddle can only move in two directions, left or right. The game ends once the wall is fully destroyed or if the ball is lost a number of times. Thus, the goal is to control the movement of the board so the ball does not fall and the wall is destroyed. Figure 7 shows an example of the Atari Breakout and the elements involved. In this case, the agent controls the movement of the paddle, which has three possible actions, move left, move right and not move. The reward is related to the distance between the paddle and the ball, so the closer the paddle is to the ball the more rewarded is the agent. The states are the position of the paddle, the position of the ball and the components of its velocity, the number of bricks left and the number of lives left. An example of implementation for this environment can be checked at [19]. Simultaneous AUV navigation and tracking with satellite ASVs p. 17 Figure 7: Screenshot of the Atari Breakout environment from OpenAi Gym. 2.2.2 Parts of RL: RL is composed of 4 main parts: Policy: a map that correlates actions taken with the next state and future rewards. It is what is reached after training. Once a policy is built, the agent takes the actions depending on the state it perceives. Reward signal: value obtained from the environment after an action is executed. It defines what the goal is and the objective is to maximize the total reward in a training episode. Therefore, the reward is what defines which are the good or bad actions depending on the current state. Value function: is the expected amount of total reward in an entire training episode from the current state. It encompasses all the different rewards and computes the estimation of how much future rewards will be obtained. Model of the environment: given a current state and action, it predicts which will be the next state and computes the reward associated. 2.2.3 Formulation RL is presented as an extension of the Markov Decision Process (MDP) since it includes the same basic elements: •A set of states s∈S •A set of actions a∈A(s) •A set of rewards r∈Rassociated with the change from state stto st+1 by the action at, expressed as r(st, at) •A probability of p(s′, r) = Pr(st=s′, rt=r|st−1=s, at−1=a)that at a time tthere will be a transition from state sto state s′by the action awith a reward r The policy is formulated as the probability of applying action awhen in state s: p. 18 MUAR Thesis π(a, s) = Pr(at=a|st=s)(2) The action-state value function is the expected return after applying action ain state swith the policy π: Qπ(s, a) = E(Rt|st=s, at=a)(3) Where Rtis the expected return at episode k: Rt= ∞ X k=0 γkr(st, at)(4) This resulting value of function 3 can be called Q-value. The parameter γis the discount factor, which will be explained in the Implementation section. 2.2.4 Deep Deterministic Policy Gradient Due to the characteristics of the figures of merit and the kinematics of the ASVs, the RL approach studied and applied is Deep Deterministic Policy Gradient. DDPG is a model-free algorithm for learning continuous actions based on the actor-critic strategy [3]. It appears as the combination between Deep Q-Network (DQN)andDeterministicPolicyGradient (DPG) by working on continuous spaces and applying Experience Replay and slow-learning target networks. To understand DDPG, first the two other algorithms’ main characteristics are going to be briefly explained. DQN is a method that works on the discrete domain and that combines Q-learning with deep neural networks to compute the Q-value. Q-learning is an algorithm based on the Bellman’s equation [20] that given a set of actions and the states and rewards produced by them updates the Q-value. ˙ Q(st, at) = Q(st, at) + α(rt+γ max aQ(st+1, at)−Q(st, at)) (5) In this case αis the learning rate, and the concept will be explained in the Implementation section. At the beginning of an RL process, the Q-value is initialized with an arbitrary value and in each step, it is updated until the process ends. Apart from this, another interesting factors of this method are the use of Experience Replay, which consists of the storage of data such as actions, states and rewards, and it uses them to update the Q-value instead of the most recent data obtained. Moreover, it applies target Simultaneous AUV navigation and tracking with satellite ASVs p. 19 model networks, used to make the learning process more stable. It is considered an off-policy method. DPG is a method used for continuous spaces and actions. The main difference from other policy gradient methods is that instead of modelling the policy function as a probability distribution, it is modelled as a deterministic policy a=µθ(s)[21]. Due to it being a policy gradient method, it treats the problem as an optimisation problem that needs to find the parameters θthat maximize the value function J(µθ): J(µθ) = ZS ρµ(s)r(s, µθ(s))ds =E[r(s, µθ(s)] (6) Where ρµ(s)is a discounted state distribution. Compared to the greedy method, wherein continuous spaces it presents problems when maximizing the Q-value, here the Q-value is updated in the direction of the gradient of Q. This way the process is more stable although it can lead easily to a local minimum. As previously mentioned, DDPG applies a strategy called Actor-Critic. In this method, there are two parts at work. The first one, the actor, is the one in charge to produce the action when provided a state, therefore is the one that learns the policy. The second is the critic, which gives feedback on how good the actions taken are in relation to the state by predicting the future reward. Of these two parts, the only one used after training is the actor. In essence, DDPG takes the data structure of the DQN and the use of deep neural networks and applies them to the computation of DPG. Figure 8: DDPG Algorithm from [3]. p. 20 MUAR Thesis Figure 9: DDPG main structure. 2.2.5 Multi-Agent Deep Deterministic Policy Gradient Multi-agent refers to when the system to be trained involves 2 or more agents that either compete or collaborate (or both) to accomplish an objective [4]. This means the sharing of certain information from the other agents and to take into account the changes in the environment done by the other agents. An example of this approach is the exploration of an area by several robots that work together, by sharing information they do not go to the same locations so the exploration takes less time and resources. Applying this approach in the case of multiple agents solves the problem of having a non-stationary environment, which hinders the learning of a policy by those agents. MADDPG is the application of this concept in conjunction with the characteristics of DDPG. This concept is applied by providing the combined state of both ASVs from the environment to both critics instead only the state of each particular ASV to their respective critics. 2.3 Similar Works Many works that have attempted a similar approach as this project, either in the implementation of RL for the control of marine vehicles or the use of ASVs to track an underwater target. However, as far I know, the is no work inthe literature that presents a strategy identical to this project. Thereafter, a list of similar works is presented next along with their contributions and differences. As for the use of RL to optimize control of a marine vehicle, there are some examples that I am going to refer: 1. Three-Dimensional Path Tracking Control of Autonomous Underwater Vehicle Based on Deep Reinforcement Learning [22]: In this case, the idea is to optimize the path tracking by using DDPG. The main differences with this project are that it is applied to a single AUV and that the objective is to follow a fixed trajectory by controlling the surge, and the horizontal and vertical rudders. Therefore, the training is only used in one kind of trajectory and the agent is only tested with the same trajectory without any change in velocity or other aspects. An interesting contribution is the implementation of a disturbances observer in coordination with the DDPG used to reduce the error Simultaneous AUV navigation and tracking with satellite ASVs p. 21 Figure 10: MADDPG Algorithm from [4]. caused by the disturbances. 2. Autonomous Surface Vehicle Control Method Using Deep Reinforcement Learning [23]: Here the RL is applied to an ASV with four thrusters. In this case, they train an ASV to always go to a fixated point instead to follow a trajectory, and after it is trained it shows how it can also follow trajectories. Even though the objective at the end is to coordinate several ASVs to move in formation, they only use DDPG and train the ASVs alone without information from the other vehicles, can lead to collisions with the other ASVs once they are tested together. 3. Trajectory tracking algorithm for autonomous vehicles using adaptive reinforcement learning [24]: In this work the RL method presented is an online Gaussian Process, which is a bit different from the project here presented. It explains a more generalist algorithm to attain trajectory tracking policy starting with a random policy at the moment of the deployment of the autonomous vehicle in the real environment. In this case, the agent is also trained with only one trajectory and only tested with the same trajectory. The main point of interest is the use of a Gaussian function as the reward function. 4. AUV Position Tracking Control Using End-to-End Deep Reinforcement Learning [25]: This article presents an implementation of DDPG to guide an AUV to different way pointswithout the needfor re-training. Theresultsshowthe adaptability ofthe method by testing it with different start configurations and simulating thruster failure. In this case, to facilitate the training of the agent, at the beginning of the training a bigger target is used, and as the training progresses, this target becomes smaller. This way, the difficulty of the environment is higher as the agent has learnt the basics. p. 22 MUAR Thesis For the case of the use of surface robots to track and/or locate an underwater target, here are some examples: 1. A multi-user underwater acoustic positioning system – experiments using ASVs and miniature acoustic transceivers [26]: This work presents a method where several ASVs act as beacons in an LBL system. They are displayed around the area of operation and stay in their programmed positions for the duration of the mission. The results shown in the paper are quite good and avoid installing the beacons of the LBL on the sea floor. Since they do not move once they are in position and they use transmitters with short range, the area of operations is limited. 2. Cooperative ASV/AUV system exploiting active acoustic localization [11]: Here, only one ASV equipped with a USBL is used in coordination with the target AUV. Also, the AUV and ASV communicate more information, like the position of the AUV from ASV, since they have to maintain a specific formation between them to reduce errors in of the USBL measurements and to not lose information during the transmission. The short range of communication and the communication losses make this process slower and gives the AUV its own position with delay, increasing error in the position estimation. 3. Cooperative Surface/Underwater Navigation for AUV Path following missions [27]: In this work, the authors combine 2 underwater agents, an AUV and a diver, with the help of an ASV as a communication and absolute navigation beacon. The USBL is installed in the AUV, and the ASV has a receiver modem. The ASV positions itself in relation to the location of the AUV or the diver, depending on the mission. The positioning and controller system of the ASV is based on the Artificial Potential Field in order to follow the target but avoid being above it at the same time. Like the previous work, this one also has problems with communication drop-out due to the use of only one surface vehicle and short range communications. Simultaneous AUV navigation and tracking with satellite ASVs p. 23 3 Problem Statement 3.1 Problem The project analyses the problem of the location and tracking of an underwater target, an AUV in this case, with the use of 2 surface vehicles, the ASVs. Since the self-location of the AUV when it is underwater presents some challenges, the use of the ASVs is meant to help locate the AUV and obtain a more accurate position of the trajectory. 3.2 Satellite ASVs considerations In this case, the ASVs used are equipped with GPS and two hydrophones each in order to self-locate and detect the distance they are from the AUV, which generates an acoustic signal. That signal is time synchronised between the three robots so when the ASVs detect it, the distance can be computed. By using two ASVs and knowing the depth at which the AUV is navigating, the position of the AUV can be estimated. The accuracy of the computation of the location of the AUV is sensitive to the relative positions of the satellites [28]. Other sensors used for this application are a digital compass to know the heading of the robot and an accelerometer to compute the velocity. The characteristics of the GPS and other sensors installed are taken from the ASVs Zarco and Gama from [9]. Although this system presents some advantages over the previously mentioned methods, there are some considerations and constraints to take into account. One thing to take into account is energy consumption. In comparison to the static methods, satellite ASVs’ consumption of energy is higher due to their movement. They need to be able to follow the target during the whole trajectory and return to the port afterwards if necessary. Another consideration isthe called"ping range", whichis the range within whichthe acoustic signal of the AUV can be propagated without attenuation. This means that for the ASVs to be able to detect the distance they are from the AUV, they have to stay within a minimal distance. This minimal distance can be around 2 km. This range and energy consumption are the only two variables with a hard constraint. As explained before, the geometry of the formation between the ASVs and the AUV affects the accuracy of the position estimation of the AUV. This means that the ASVs have to maintain a fixed formation and also adapt to the movements of the AUV. This geometry has been studied and described in [28], where it is explained that to reduce uncertainty in estimation, the sensors should be positioned at an angle of 45ºwith respect to the target, forming an angle of 90ºwith the whole formation. Also, these sensors, a total of 4 sensors, 2 in each ASV, need to be placed in a perpendicular way to improve the accuracy of estimation, as shown in [29]. Related to the maximum velocities of the ASVs it has been considered that the maximum linear velocity of the ASVs is 2.5 m/s (5 knots approximately), and the maximum yaw rate is established as 22º/s (π/8rad/s). Also, the surge velocity can only be positive, and the yaw rate can move left and right. Other considerations more related to the programming in this project are that models of the ASVs are trained with specific information that can be extracted or calculated in different p. 30 MUAR Thesis –32 for the states’ input and 64 for the hidden layer of the states –64 for the action input –256 for the first hidden layer after concatenation –512 for the second hidden layer –1 for the output •Activation functions: ReLu for all minus the output, which is linear. •All layers are fully connected Noise: Usually, there is a parameter called epsilon decay which depending on a randomly generated number decides to use a random action or an action produced by the actor. Instead in this case noise is applied to each action during the training process. This noise refers not to the disturbances of the sea currents, but a small variation of the actions produced by the actor in order to try to avoid local minimum. This noise is modelled as a Ornstein-Uhlenbeck process, which is a correlated normal distribution. The idea is that it creates a small perturbation dependent on the previous one and as the training progresses, these values tend to 0. The formula is as follows: nt=θ(µ−nt−1)dt +σWt(18) Here, the ntis the noise, µand σare the mean and standard deviation of the noise, respectively, and Wtis a random number from a normal distribution. Like other aspects, the noise also needed a bit of tuning, which consisted in testing different values for the standard deviation σand analysing how it affected the training and the models produced. The other parameters were left with the same values that are used in [3]. Hyperparameters: The hyperparameters are the set of parameters that affect the behaviour of the RL process. Each different RL approach counts with different parameters, although some of them are used in more than one approach. In the case of DDPG and MADDPG, the hyperparameters used are the next: •Learning rate α: the rate at which the Q-values are updated. As smaller this rate goes, the more stable the NNs are but the slower they learn. Since there are two kinds of NNs at work, there are two different values, one per each. •Gamma γ: determines the level of greediness or importance given to future rewards when updating the critic’s weights. If it is closer to 0 it prioritizes the immediate rewards, and if closer to 1 it gives more weight to future rewards. •Tau τ: the rate at which the target weights are updated. The idea is to use a small Simultaneous AUV navigation and tracking with satellite ASVs p. 31 number so that the target parameters are updated slowly and therefore they are more stable. •Buffer capacity: Maximum data storage size. If big enough it helps to avoid local optimums by reducing the continuity of the state in the learning data [22]. •Batch size: Number of random samples from past steps that are going to be used in the experience replay function. •Minimum size buffer: Number of stored data at which the update process starts. For each one of these hyperparameters, there has been a process of testing to find the values that work better for the environment implemented. To start, values taken from similar research works and implementations were used, such as [3] or [22], in order to facilitate finding the correct values as quick as possible. Also, to simplify the comparison between values, only one hyperparameter was tested at a time and it was used in the same configuration of the environment (reward weights and difficulty of training). The resulting values for each hyperparameter are the next: •Learning rate: –Actor’s learning rate: 5e-4 –Critic’s learning rate: 6e-4 •Gamma: 0.99 •Tau: 0.001 •Buffer capacity: 100000 •Batch size: 64 •Minimum size buffer: 30000 4.2.2 Environment The environment is the part of the code that computes the next state of the robots by using the actions provided by the actor and computes the reward associated with this new state. It also sets the initial state and stores data like the actions taken in an episode and the rewards obtained for future analysis. In this environment, each episode represents a trajectory of the AUV. Once the AUV has reached a determined point or it has surpassed a number of steps, the episode is over. Since the actions provided are in a range between -1 and 1, there needs to be a transformation to the respective range of the surge and the yaw rate. In the case of the surge, the range goes from 0 to 2.5 m/s, so the transformation equation is: u= 1.25x+ 1.25 (19) Here xrepresents the first action provided by the agent. p. 32 MUAR Thesis The yaw rate instead does have negative values to be able to turn in both directions. The range is between -22ºto 22º, or −π/8to π/8radiant. The transformation equation is: r=yπ 8(20) In this case, yis the second action provided by the agent. After the actions are transformed, the next position of the ASVs is computed using the kinematic equations: θt=θ′ t−1+r(21) xt=xt−1+ucos(θt)(22) yt=yt−1+usin(θt)(23) with θ′ t−1being the normalization of θt−1as: θ′ t−1=θt−1+π 2π−π(24) Another important part of the environment is the trajectory of the AUV and the difficulty set for the ASVs. This difficulty is set in the reset function, used at the beginning of each episode. The difficulty depends on a series of parameters that can be randomized so the training contemplates different situations. Depending on the number of randomized parameters and which ones are randomized, the training is more or less difficult. This also can be changed during the whole training, applying different phases so the ASVs face more challenging scenarios after learning more basic ones. The progression of the challenge is called curricular learning, and it mostly helps with learning and adapting to more difficult conditions which could not work if applied at the beginning of the training. The only problem with this strategy is that it takes a bit longer to train since you need to make sure that it has enough time with each phase. The parameters to be randomized can either affect the initial state of the ASVs, the trajectory of the AUV or the general environment. These parameters are: •Initial position of the ASVs: They are set in a random coordinate within an area. •Velocity of the AUV: the velocity is generated at the beginning of the episode and it is maintained during the trajectory. •Angle of the AUV: The angle that the AUV will follow during the trajectory in a straight line from its initial position •Shape of the trajectory: if the AUV will move in a straight line or if it will move in a circle. The most basic phase does not have any of the parameters randomized and the trajectory follows a straight line. This difficulty is the one used in the tests of hyperparameters. As the Simultaneous AUV navigation and tracking with satellite ASVs p. 33 difficulty progresses, the elements listed above are introduced, taking into account that are some incompatibilities between parameters. States: The state consists of 7 different parameters. •Absolute distance in coordinate x from the ASV to the estimated position of the target. •Absolute distance in coordinate y from the ASV to the estimated position of the target. •Absolute quadratic distance between ASVs. •Normalized error from the 45ºformation. •Normalized error of heading between the AUV trajectory and the ASV heading. •Difference between the velocity of the ASV and velocity estimated from the target. •Percentage of energy consumed. The use of relative distances between vehicles instead of the actual coordinates helps to reproduce the same behaviour in different parts of the trajectory, so the actions produced do not depend on the coordinates but on the distance. This idea also applies to the distance between ASVs. On the contrary, the energy consumed doeshave this effect of acting depending on how far the trajectory has gone. Other states were considered and tested, such as the previously taken actions or the Euclidean distance between the ASV and the AUV, but the results did not improve. Thus it was decided to use the minimum number of states necessary. Also, the states used are all related to a part of the reward function, which simplifies the correlation between action, state and reward obtained. 4.2.3 Simulation Simulation refers to the tests with the model and the visualization of the trajectories the robots take in each case. Also, it is where some parameters are calculated during these trajectories in order to analyse the results, like the energy consumed. This part of the code is very similar to the training code, but instead of creating and training model, it uses the already trained models to produce the actions. Only one trajectory is done each time and the environment used in this case is the one that computes the variables for analysis. The visualization of the trajectory is done with a library called turtle, which is an easy to use library from Python that helps draw simple shapes. In each step, the movement of the ASVs is computed and the tokens used to represent them are placed in their new state. Although simple, this library has a lot of useful tools, which help create good representations of the movement of the robots. Also, it has been considered that since this library works with pixels, each pixel is the equivalent of a meter. Figure 13 shows an example of how a simulation looks like. The pink and orange arrows represent the ASVs and their trajectory. The purple arrow is the estimated position of the AUV and the light blue arrow that is below the purple one is the actual position of the AUV. p. 34 MUAR Thesis Figure 13: Visualization example using turtle library 4.3 Reward function and weights The reward function is a weighted sum of separated sub-functions, each one per aspect to be controlled or optimized. Each one of these sub-functions is going to be called penalty since in general they only have a negative value. This is to have a maximum fixed that an agent can achieve in one episode, which is zero. Although the penalties are all slightly different in computation, all are based on the same idea, which is a Gaussian function. R=w1p1+w2p2+w3p3+w4p4+w5p5+w6p6(25) In this function, each pxrepresents each one of the penalties and the wxare the weights associated with the penalty. Distance Between ASV and AUV This penalty aims to avoid attenuation of the acoustic signal provided by the AUV. Therefore, a range is defined and as the ASV get close to the limit, the penalty starts to grow. The value penalised is the euclidean distance computed with the distance in x and y from the vehicle to the estimated position of the target. This computation could change a bit with the real robots since they obtain the distance from the target directly with the coordination of the acoustic signal, so there would be no need to compute the euclidean distance from the coordinates x and y. p1=−(1 −e −x2 50000 )(26) Figure 14: Distance between ASV and AUV Penalty Function In equation 26, xis the euclidean distance. The value that divides it affects the shape of the curve of the Gaussian function. The values chosen for each one of the penalties relate to the Simultaneous AUV navigation and tracking with satellite ASVs p. 35 range of values that affect the penalty and can be adjusted if necessary. Figure 14 shows how in this case the range is set around 500 m. Distance Between ASVs This one is both to maintain the ASVs at a certain distance and to avoid a collision between the robots. By adding a negative number subtracting the distance between vehicles, it can be decided what is the wanted distance they should maintain from each other. This penalty presents contradictions with others p2=−(1 −e −(x−a)2 500000 )(27) Figure 15: Distance between ASVs Penalty Function As in the previous penalty, xis the euclidean distance, this time between ASVs, and ais the ideal distance at which they should stay. If the ais small, the ASVs have more risk to collide, but if ais too large, it can contradict other penalties such as the distance from the AUV. Figure 15 is shown how the 0 penalty corresponds to 100m and not to 0, since in this case a has been set to 100. The combination of this penalty with p1presents a balance that avoids the ASVs to be too close to the target. This is due to them trying to maintain a certain distance between them and at the same time trying to be as close to the target as possible. That is why there is no penalization for the agents for being too close to the target as in p2. Angle Error Since to reduce the uncertainty of the position estimation the ASVs have to keep a specific geometry of the formation, there is a penalty that addresses this aspect. To simplify the computation, it has been considered that the ASV have to be in a position that is at 45ºwith respect to the heading estimated of the AUV. The error with respect to this angle is the one penalised. This angle error is computed as: x=π 4−arctan(a b) + arctan( c d)(28) Where ais the distance in the coordinate y between the ASV and the AUV, bis the distance in the coordinate x. To add the heading of the target there are cand dwhich are the difference p. 36 MUAR Thesis in distance between the previous and the actual step of the target in both coordinates. By using the arc-tangent, the angles of the ASV respect the AUV and the heading of the AUV are computed. The 45 is added to compute how much error there is from the desired 45º. Once the error is computed, it is introduced in the penalty function. p3=−(1 −e −x2 100 )(29) Figure 16: Angle Error Penalty Function Surge Power The surge power penalty punishes the action of the surge so it does not use too much power at each instant. p4=−(1 −e −x2 50000 )(30) Figure 17: Surge Power Penalty Function The power consumed related to the surge is the xin this equation. Yaw Rate Power Like the surge power, the yaw rate power penalty punishes the abrupt variations of angular velocity and the use of the maximum yaw rate if not necessary. Simultaneous AUV navigation and tracking with satellite ASVs p. 37 In this case, to help control the heading of the ASVs, a little positive reward has been added. If the heading of the ASV is close to the estimated for the AUV, the ASV receives a small amount of positive reinforcement. The value gained is proportional to the weight given to the yaw rate power. Without this small adjustment, the agents could not learn correctly how to control the yaw rate action. Depending on how much error of heading is allowed, the ASVs have more or less freedom afterwards to move. h=(0.5if |ϕ|<10 0otherwise (31) The amount of positive reward is half the weight applied to this penalty. 10 is the range within which it gains rewards. p5=−1 + e−20(x2+ ˙x2)+h(32) Figure 18: Yaw Rate Power Penalty Function This equation is a bit different from the other penalties since it takes into consideration the previous value of the yaw rate and the penalty depends both on the difference from one step to the next and the absolute value of the yaw rate applied at the actual step. Meaning it penalises both having a big change between steps and applying a large yaw rate at the moment. This kind of formulation has not been applied to the surge because it usually needs to maintain a constant velocity, and the yaw rate instead needs to be applied only if a turn is needed. Figure 18 shows how the curve of the penalty function changes depending on the previous value. As there is more difference from the previous value, the maximum reward that can be obtained decreases. Energy Consumed The penalty is computed concerning the percentage of total energy consumed during the trajectory. This one is the only one that accumulates the penalty, since the percentage of energy cannot go down again until it starts again and it has been recharged. This penalty benefits from the performance of the two related to power. Also in this case there is an extra bit of penalty like in the case of the Yaw rate power, but for this case, it is a negative reward. Once the total energy is consumed, a small negative value is added to the penalty and the p. 38 MUAR Thesis ASVs are not able to move more. β=(−0.5if x ≥100 0otherwise (33) p6=−(1 −e −x2 2500 ) + β(34) Figure 19: Energy Consumption Penalty Function Here xis the percentage of energy already used, and if it gets to the maximum, it applies an extra 0.5w6of penalty. Weights The weights are used to distribute the importance of each penalty depending on the necessities of the mission. The total sum of weights is 1, so per step, the maximum negative reward will be -1. In general, some weights are going to be higher than others in all the training, which is the case of w1. The behaviour of the final models after training is heavily affected by this distribution of weights, so it is important to know the priorities for the concrete mission to be done. Each distribution of weights has been done by trial and error, checking how the behaviour of the agents was affected by the changes and what minimum values were needed for each weight for the models to work correctly. The combinations of weights that are going to be applied are: Weight/Priorities Formation Power Energy Tracking Neutral Distance 1 (w1)0.40 0.30 0.30 0.50 0.45 Distance 2 (w2)0.10 0.05 0.05 0.15 0.10 Angle (w3)0.30 0.10 0.10 0.15 0.20 Surge (w4)0.05 0.225 0.125 0.05 0.05 Yaw (w5)0.05 0.225 0.125 0.05 0.05 Energy (w6)0.10 0.10 0.30 0.10 0.15 Table 1: Combinations of weights. The first combination, the Formation combination, is focused on maintaining a good formation of the vehicles with respect to the target. The Power combination prioritized the optimization of the power by giving more weight to w4and w5. The Energy one still gives Simultaneous AUV navigation and tracking with satellite ASVs p. 39 some weight to w4and w5but prioritizes w6to reduce the energy consumption. The Tracking combination is centered only on the tracking of the target with a bit of weight in the formation. Finally the Neutral combination is thought of as a balanced combination for general missions. p. 46 MUAR Thesis Figure 22: Velocity Difference in Test 1 Figure 23: Heading Difference in Test 1 Simultaneous AUV navigation and tracking with satellite ASVs p. 47 Figure 24: Distance ASV to AUV in Test 2 Figure 25: Angle Error in Test 2 p. 48 MUAR Thesis Figure 26: Velocity Difference in Test 2 Figure 27: Heading Difference in Test 2 Simultaneous AUV navigation and tracking with satellite ASVs p. 49 Figure 28: Distance ASV to AUV in Test 3 Figure 29: Angle Error in Test 3 p. 50 MUAR Thesis Figure 30: Velocity Difference in Test 3 Figure 31: Heading Difference in Test 3 Simultaneous AUV navigation and tracking with satellite ASVs p. 51 5.2.2 Disturbances To test the adaptability to disturbances 2 models for each algorithm have been trained, one with low noise in the training and another with higher noise. The tests apply different disturbances simulating constant sea currents and one without currents to compare. The currents are the next: Velocity components/Currents 0 1 2 3 Component x (m/s) 0 0.5 0 -0.5 Component y (m/s) 0 0 -0.4 0.3 Table 7: Velocity components of each disturbance test. The low noise is noise with a standard deviation of 0.2, and the high noise has a standard deviation of 0.4. In this case, the variables used to analyse the effect of the disturbances on the trajectories of the models are: the surge mean and the yaw rate mean to see if the robots have adapted to the current; the angle error mean and the mean of the distance to the target to assess that the behaviour of the models is correct. Tables 8 to 11 show that the behaviour of both robots changes depending on the direction of the current, but not all adapt well to these disturbances. Variables/Tests 0 1 2 3 ASV 1 surge mean (m/s) 1.37 0.88 1.41 1.39 ASV 2 surge mean (m/s) 1.37 0.98 1.36 1.55 ASV 1 yaw rate mean (º/s) -4.59e-3 -1.52e-2 2.86e-2 2.06e-3 ASV 2 yaw rate mean (º/s) 6.89e-3 -7.54e-3 1.78e-2 -0.62 ASV 1 angle error (º)1.65 7.34 4.03 1.46 ASV 2 angle error (º)1.45 8.96 3.01 4.17 ASV 1 distance to target (m) 134 140 106 310 ASV 2 distance to target (m) 105 44 128 214 Table 8: Results of the DDPG model with low noise. The first model, the DDPG with low noise in table 8, seems to adapt well to a favorable current since reduces the linear velocity mean but it still presents a slight increase in the angle error mean. The second current shows a positive mean yaw rate, to counteract the current. Despite the change in the distance to the target, they have kept within the ping range. The third current although it presents a good angle error mean, the mean distance to the target increases a lot, meaning that it could not adapt to the disturbances correctly. The second set of models, the DDPG with high noise in table 9, show a similar response to the currents. In test 1, they both reduce velocity, but ASV 1 stays too close to the target, producing a higher angle error mean. They adapt correctly to the second current. And the problem with the last disturbances is that despite maintaining a good distance and adapting the surge velocity, ASV 2 does not adapt as good and moves to the left side of the target, where ASV 1 is. p. 52 MUAR Thesis Variables/Tests 0 1 2 3 ASV 1 surge mean (m/s) 1.40 1.01 1.49 1.82 ASV 2 surge mean (m/s) 1.39 0.91 1.40 1.83 ASV 1 yaw rate mean (º/s) 2.94e-2 -3.59e-3 2.16e-2 0.10 ASV 2 yaw rate mean (º/s) 1.91e-3 2.86e-3 3.73e-2 -2.21e-2 ASV 1 angle error (º)1.88 15.21 2.62 2.23 ASV 2 angle error (º)2.23 9.68 2.94 9.89 ASV 1 distance to target (m) 62 29 58 103 ASV 2 distance to target (m) 90 91 117 109 Table 9: Results of the DDPG model with high noise. Variables/Tests 0 1 2 3 ASV 1 surge mean (m/s) 1.41 0.93 1.47 1.63 ASV 2 surge mean (m/s) 1.40 1.01 1.36 1.80 ASV 1 yaw rate mean (º/s) -3.95e-3 5.28e-4 2.44e-2 1.60e-2 ASV 2 yaw rate mean (º/s) 1.99e-3 0.13 2.62e-2 -1.71e-2 ASV 1 angle error (º)2.58 7.69 3.41 4.14 ASV 2 angle error (º)1.41 6.82 2.15 6.08 ASV 1 distance to target (m) 75 100 57 189 ASV 2 distance to target (m) 90 60 135 126 Table 10: Results of the MADDPG model with low noise. The third model, the MADDPG with low noise in table 10, seems to behave similarly to the first model, but the high positive yaw rate mean of the ASV 2 in the first current indicates that this vehicle has moved to the left side of the target, where the other ASV is. Apart from that, the third current test does show better results than the first model. Variables/Tests 0 1 2 3 ASV 1 surge mean (m/s) 1.38 0.88 1.50 1.81 ASV 2 surge mean (m/s) 1.41 0.92 1.49 1.90 ASV 1 yaw rate mean (º/s) -2.73e-2 5.47e-3 2.50e-2 -2.63e-2 ASV 2 yaw rate mean (º/s) -4.98e-3 3.90e-3 5.05e-2 -5.95e-3 ASV 1 angle error (º)2.99 1.77 10.00 8.78 ASV 2 angle error (º)4.09 4.52 9.29 8.05 ASV 1 distance to target (m) 101 95 69 117 ASV 2 distance to target (m) 104 92 109 114 Table 11: Results of the MADDPG model with high noise. The last model, with MADDPG and high noise in table 11, shows an increase in the angle error in all tests, but the distance is maintained within the ping range in all cases, with not much variation. The surge and yaw rate means seem to adapt well to the directions of the currents. A thing to take into account from the values in these tables is that the ASVs need a moment to adapt correctly to the disturbances, so that is why some values are a bit higher than expected. Also, from these 4 sets of models, the ones that adapt better to all disturbances applied are Simultaneous AUV navigation and tracking with satellite ASVs p. 53 the last ones. This means that a slight increase in the noise applied during the training could help if the tests are expected to have significant disturbances. p. 54 MUAR Thesis 5.2.3 Trajectories Similarly to the difficulty tests, the data gathered is also the distance between agent and target, the angle error and the differences in velocity and heading. The point is to see how good the agents are able to adapt to various trajectories by only having trained with a straight line. The trajectories used for the tests are a sinusoidal trajectory, a circle and a straight line used for comparison. The figures of the straight trajectory, figures from 32 to 35, show how the agents maintain a good distance from the target, reduce the angle error to nearly 0 and although, with some variance, they have a small difference in velocity and heading. An interesting observation that can be extracted from figure 32, is that the distance between ASVs is approximate of 100 m at the end of the trajectory. This distance is the one established as 0 penalty in the reward function. The sinus trajectory tests, figures from 36 to 39, also show good results. The distance is reduced from the beginning to less than 100 m in most of the trajectory. The angle error seems to be affected by the changes in the heading of the target and gets to 0 error when the target does not have a heading change. The changes in velocity show how the ASVs stop and continue in function of the movement of the target. Heading difference data shows that in general, the heading is followed, so the ASVs move accordingly to the sinus trajectory of the target. Finally, the circle trajectory, figures from 40 to 43, present poor results. Distance is good at the beginning, and although it does not lose the ping range, it starts to increment at the end. The angle error results show that the formation is not maintained and the high difference in heading means that they do some turns on themselves especially in the case of MADDPG. Velocity difference does not provide much more information apart from the clear stop they do nearly at the end of the trajectory. Apart from these tests, an extra test with the models of each algorithm was done, which consisted in placing the AUV in a random position without moving. The idea was to test if given a point, the agents could go from their initial position to the target position, but the results were not good and the ASVs either did not move or moved in a random pattern. Probably this is caused by the inclusion of the difference in velocity information in the state, so if the target is not moving, the difference is 0 and the agents do not move to be closer to the target. The use of the difference of velocity in the state has proven useful if the target changes velocity during the trajectory or if it stops in the middle of it, but if it starts not moving it does not translate well for the actions of the ASVs. With this information, it can be established that the training with only a straight line can be useful for different trajectories, especially if those trajectories follow a similar direction. If the trajectory to be executed in the tests change completely the direction, the training needs to address that. Simultaneous AUV navigation and tracking with satellite ASVs p. 55 Figure 32: Distance ASV to AUV in straight trajectory. Figure 33: Angle Error in straight trajectory. Simultaneous AUV navigation and tracking with satellite ASVs p. 63 6 Discussion In this section, the results obtained are compared to the similar works previously presented. Similarly to [23] and [25], which show that a simple training can produce good results with more difficult scenarios in the tests, the method here presented has shown that in general with only training with a simple straight line, it can adapt to different situations. The main difference between those 2 works is that by training the agents with a moving target, the velocity and energy consumption can be optimized. Moreover, compared to [23], the inclusion of information from the other agents, in this case, the distance between them helps avoid collisions and maintain a security distance both with the DDPG and MADDPG algorithms implemented. When the models are tested with the same trajectory and velocity they have been trained with, they present very good results with fewer training episodes than [22]. One reason could be the use of Gaussian functions for the reward function, as in [24], to help accelerate the learning of the models. The use of an increment of difficulty during the training as in [25] has been applied. However, the randomness element added in the implementation of this project has not proven necessarily a good strategy in all the cases for the models to be able to adapt to more difficult scenarios. As is commented in the conclusions of [11], the use of several surface vehicles for the location of an underwater moving target is helpful to reduce the possibility of losing communication and to improve the accuracy of the position estimation. The addition of a navigation system for the ASVs adapted to the movement of the AUV has demonstrated a reduction of the uncertainty in the position estimation of the target. Furthermore, the use of an intelligent tracking system and the optimization of the energy consumption provides the possibility to work with longer missions and not necessarily be limited to a specific area, as in [26]. As for the disturbances, another way to adapt to currents would be to estimate the direction of these disturbances by comparing where the vehicle is and where it should be if no currents affected the movement and provide this information to the models. In a similar manner in [22] they implement a disturbance observer to add to the close loop control. This method could be a good substitute for the increment of noise in the training, even though has demonstrated to be a useful strategy to deal with the disturbances in the tests, the addition of randomness hinders the learning of the models if it is too high. Simultaneous AUV navigation and tracking with satellite ASVs p. 65 7 Economic study In this section, the economic costs of the project are considered. Due to the software being open-source and the lack of physic material used apart from a computer, the only part to take into account in this economic study is the engineering costs. 7.1 Engineering Costs This project has consisted of various phases of studying the subject, formulating the problem, learning the necessary toolsfortheimplementation, implementingthesolution, testing itand finally writing the report. The approximated hours dedicated to each part are presented and the cost of engineering is computed. Each working week dedicated has been considered of 35 hours. Phase Hours dedicated Cost per hour Cost (€) Research 70 20 1400 Problem Formulation 35 20 700 Implementation Research 70 20 1400 Implementation 280 25 7000 Tests 140 20 2800 Writing 105 20 2100 Total 700 - 15400 Table 12: Engineering costs. Simultaneous AUV navigation and tracking with satellite ASVs p. 67 8 Environmental study For this project, the only part that has an impact on the environment is the energy consumption of the computer during the programming and the training of the models. In order for the processing of the training to be quicker, the computer needed to be plugged in the whole time, meaning that the consumption of energy is higher than using the computer for other things. Depending on the number of episodes, the number of neurons in the Neural Networks or other aspects of the code, a training could last between 30 minutes and 5 hours. The most usual are around 1 hour and a half, with the final configuration of the neural networks and the other hyperparameters, and a duration of 500 episodes. Using this duration as a reference, and the fact that the number of tests and training ascents up to 200, the number of hours of the computer being plugged in is 300 hours. The computer used for this consumes 0.07 kWh, so the total amount consumed is 21 kW. Simultaneous AUV navigation and tracking with satellite ASVs p. 69 9 Conclusions and Future Work First of all, the implementation of RL to move 2 ASVs so they are able to locate and track an AUV has been successful. Moreover, these initial results show that the method presented in this project does not add additional errors in the computation of the position estimation of the target. This fact does not assure zero error when the implementation here presented is deployed in the real robots, since external sources of error can still affect the position estimation, such as the errors of the sensors or the variation of the velocity of the acoustic signals due to changes in the salinity or temperature of the water. It has also been demonstrated that by only training with a simple straight trajectory, the models can adapt to various situations, while still maintaining the preferred geometry of the formation and optimizing the energy consumption. In addition, the use of Gaussian functions for the reward function has reduced the number of episodes needed to obtain good results, and thus the time spend in the training. As for the introduction of randomness in the training to increase the robustness of the models, it has shown some mixed results, so it is not a good approach. Besides, the comparison between the 2 algorithms of RL has shown that, as to how they are implemented in this project, the one that presents better results is DDPG in most cases. Themain contributionoftheprojectismodularoptimizationwiththe combinationsof weights. It has been demonstrated that the optimization of energy consumption and the reduction of uncertainty of the position estimation of the target through the optimization of the formation of the vehicles can be achieved with this method. This also means that the performance of the ASVs can be changed and adapted to the type of mission to be carried out by the AUV. Finally, state that the whole process has presented a lot of difficulties, such as finding the correct hyperparameters, the design of the reward function and the programming of the environment from scratch. These difficulties have led to extending the time scheduled to do this project and to change some aspects of the implementation from the original idea, but also have helped to have a better understanding of the methods applied. Future Work: The work here presented is thought as a start for a more realistic and versatile future project. In order to have a more realistic approach to the control of the vehicles, the control of the linear and angular velocities should change to the control of the force provided to each thruster. This also includes the addition of the dynamic functions, such as the inertia, of surface marine vehicles. To add versatility, the way of computing the angle error and thus the "correct" formation of the vehicles could be changed by not taking into account only the heading of the target and computing the angle from there, but with the position of all 3 vehicles. With this change, the coordination between ASVs would increase in importance, but it also could help in the conservation of energy. There are many aspects that could be studied and implemented in the future using this work as the base, one example could be cross-learning. Cross-learning refers to the training of p. 70 MUAR Thesis several agents with the same conditions and that in the end, any of the models obtained would be able to adapt to any part of the ASV formation. This method would reduce training time, add more robots to a formation if needed and make the models able to adapt better. Besides, this implementation can be adapted to any surface vehicle, since the parameters of the environment referent to the energy profile and other specifications can be changed. This can lead to either creating heterogeneous robotic teams to perform the mission, or be implemented by other researchers and new vessels. Simultaneous AUV navigation and tracking with satellite ASVs p. 71 10 Acknowledgements First of all, I would like to thank my supervisors, Dr. Nuno Cruz and Dr. Gerardo Acosta for their patience, their time and their guidance, as well as for giving me the opportunity to work in the field of marine robotics. I would like to also thank my friends and family for giving me support and for not getting too tired of me talking about how my robots did not work. Finally, I would like to thank Dr. Ramon Costa Castelló for helping me navigate through the administrative procedures of the Master Thesis. "The nice thing about artificial intelligence is that at least it’s better than artificial stupidity." Terry Pratchett, The Long War