AutoTuning Environment for Static Obstacle Avoidance Methods Applied to USVs

: This work is focused on reactive Static Obstacle Avoidance (SOA) methods used to increase the autonomy of Unmanned Surface Vehicles (USVs). Currently, there are multiple approaches to avoid obstacles, which can be applied to different types of USV. In order to assist in the choice of the SOA method for a particular vessel and to accelerate the pretuning process necessary for its implementation, this paper proposes a new AutoTuning Environment for Static Obstacle Avoidance (ATESOA) methods applied to USVs. In this environment, a new simpliﬁed modelling of a LIDAR (Laser Imaging Detection and Ranging) sensor is proposed based on numerical simulations. This sensor model provides a realistic environment for the tuning of SOA methods that, due to its low load computation, is used by evolutionary algorithms for the autotuning. In order to analyze the proposed ATESOA, three SOA methods were adapted and implemented to consider the measurements given by the LIDAR model. Furthermore, a mathematical model is proposed and evaluated for using as USV in the simulation enviroment. The results obtained in numerical simulations show how the new ATESOA is able to adjust the SOA methods in scenarios with different obstacle distributions.


Introduction
Nowadays, the development of the USV is an active and growing field of research. The reason is that the applications of a USV are very broad, covering from environmental control, as well as many scientific and commercial applications, to national security and surveillance issues [1]. The competencies required a vessel in order to be considered autonomous can be grouped into three fields: Navigation, Guidance and Control, [1][2][3]. In more detail, these three fields can be decomposed into the subsystems shown in Figure 1. Where, firstly, the state vector of the vessel dynamics must be estimated from state observers and wave filters [4,5]. Once the state of the vehicle is known, the detection system processes the information received by the surrounding sensors in order to generate a model of the environment in which the USV is located [6][7][8][9][10]. Using this model of the environment, the guidance system (composed by algorithms of: obstacle avoidance [8,[11][12][13][14][15][16], path following [4,5,17,18] and path planning [3,7,17,19,20]) demands the course and speed setpoints which guide the vessel safely to its goal. With the aim of ensuring that the vehicle reaches these setpoints, the control system commands the vessel's actuators (propulsion system and steering machine) [4,5]. In this way, the degree of autonomy of the USV is determined by the level of development of each subsystem, as well as by the integration of the set [1][2][3]. From the subsystems shown in Figure 1, this work is focused on the obstacle avoidance systems applied to USVs [8,10,[12][13][14][15][16][21][22][23][24][25][26][27][28][29][30][31]. Most of this work is focussed on the avoidance of dynamic obstacles in open sea situations [8,[12][13][14][15][21][22][23][24][25][26][27][28]. And, although some of them also consider a specific All these obstacle avoidance methods have a common requirement, they need a simulation environment for their design, development and evaluation. In this aspect, there are very complete approaches [32][33][34][35], where the authors are focused on the development of simulation environments for the validation of USVs under realistic sea conditions (wind, current and waves), considering also the models of inertial and LIDARs sensors available in the GAZEBO framework [36]. On the other hand, most of the works focused on obstacle avoidance methods do not take into account the ambient disturbances that affect the USV and, moreover, they assume known: position, dimension and speed of the obstacles. As exceptions, in [12,15] the error present in the estimates of the environment model is taken into account. In addition, in [15,22] the external disturbances that affect the USV are also considered by modelling them as constant forces and moments referred to the earth axes. As an alternative to these extremely simplified simulation environments [10,13,21,[23][24][25][26][27][28][29][30][31], or the highly complete environments proposed in [32][33][34][35][36], in this work a new simulation environment based on the simplified modelling of a LIDAR sensor is proposed. As a result, the time of numerical simulations is reduced and the methods of obstacle avoidance are exposed to a higher level of uncertainty present in the environment surrounding the vessel. This facilitates that the simulation environment proposed in this work can be used by iterative optimization algorithms, such as the evolutionary algorithms [37], with the advantage that it requires less computer load. In this way, the main contribution of this work is achieved, a new autotuning environment for SOA methods applied to USVs. Currently, there are different approaches for the autotuning of unmanned vehicles [38][39][40][41][42][43][44]. In [38] the authors use machine learning for autotuning the guidance system on a physical ground vehicle. As autotuning methods applied in the marine environment, in [39] a genetic algorithm is used to autotune the parameters of a sliding mode controller, which is applied to the mathematical model of an oil tanker vessel. On the other hand, the work carried out in [40] is focused on the autotuning of a dynamic positioning system in response to changes in the sea state. This is evaluated in numerical simulations with the dynamic model of an offshore supply vessel. With regard to underwater vehicles, in [41] the authors propose a autotuning method for heading control on an underwater vehicle and validate their approach with the micro-ROV vehicle. In relation to these works, the objective of the ATESOA approach proposed in this paper is to facilitate and accelerate the pretuning process necessary to implement SOA methods in USVs. In addition, in order to evaluate this autotuning environment, three methods of static obstacle avoidance have been adapted and implemented in this work [10,23,29,30], which have already been used in USVs. As a secondary contribution of this work, through the application of the generalized potential fields [45,46], the performance of potential fields method for USVs proposed in [23,30] has been improved. Finally, a USV model must be used to evaluate the new autotuning environment. In the current state of the art different mathematical models of USVs have been proposed [22,26,28,[47][48][49], most of them for vessels of small length. This is mainly because one of the advantages of this kind of vehicles is that, as these do not need a crew, the size of the vehicle can be reduced, increasing its manoeuvrability and reducing costs [1,2]. Many of these models [22,26,28,47,48] simplify the dynamics of the vessel since they do not take into account the modelling of the actuators and the effect of the ocean current. In order to make realistic the simulation environment proposed in this work, a mathematical model is proposed for an USV of 9.2 m of length. This model has been synthesized from previous work in the field of marine surface vehicle control [4,5,28,[49][50][51][52], whose parameters have been calculated through numerical simulations in order to obtain a characteristic behavior of marine surface vehicles [5,[53][54][55][56][57]. Concretely, the USV model is composed of: model of the vessel and the actuators, current effect and course/speed controllers.

Major Contribution
This work is focused on the reactive obstacle avoidance methods, which form part of USV guidance systems. The main contribution of this work is a autotuning environment for SOA methods applied to USVs, the ATESOA environment. ATESOA can be applied to different SOA methods and vessels. In particular, it is based on the simplified modelling of a LIDAR sensor. This model takes into account the uncertainty present in the environment by considering the perspective effect of the sensor. In addition, a variation of the error present in the measurements delivered is also modelled as a function of the distance to the obstacle. Given its low computational load, this sensor model is used to perform a realistic autotuning of SOA methods using an evolutionary algorithm. In order to analyze the proposed ATESOA, the SOA methods: LROABRA (Local Reactive Obstacle Avoidance Based on Region Analysis), Vector Field Histogram+ and Potential Fields, have been implemented and adapted to the measures delivered by the sensor model. The results obtained have been analysed in detail in terms of performance and robustness.
The organization of this paper is as follows: Section 2 contains the mathematical models that form the new autotuning environment. The Section 3 presents the SOA methods adapted and implemented in this work to evaluate the autotuning environment. In Section 4, the setting of the genetic algorithm used for autotuning is presented, as well as the indicators that have been defined to evaluate the performance of each avoidance method. Section 5 contains the results obtained in numerical simulations. Lastly, in Section 6 the Conclusions are presented.

Autotuning Environment Based on Numerical Simulations
This section describes the mathematical models that form the simulation environment proposed in this work for the autotuning of SOA methods applied to USVs.

USV Model
The USV model is based on the development proposed in [4,5] for the modelling of three degrees of freedom applied to vessels. Specifically, the non-linear modelling proposed by Norrbin [5,49] is taken into account for the damping and the effect of the ocean currents is incorporated into the model in terms of relative velocities, considering that the current variation is significantly slower than the ship dynamics, [5]. Thus, the dynamic model of the vessel is defined as: where η represents the position vector of the vessel referenced to earth axes, ν and ν r are the vectors of velocity and relative velocity referenced to body axes, R(ψ) is the rotational matrix from Body-axes reference system to Earth-axes reference system (see Figure 2), τ act = [τ x τ y τ z ] T represents the forces and moment applied by the actuators and the viscous non-linear term N uv replaces (Xu − Yv), which causes the destabilizing moment or Munk moment [5]. The relative velocity vector of the Model (1) is defined according to Equation (2), where V c is the module of the current velocity and β c its direction.
Earth and body axis reference systems adopted in this work.
On the other hand, the actuators are the elements that allow the steering of the vessel [4,5,[49][50][51]. For the USV model proposed in this work, an outboard motor is considered as the actuator, which generates the propulsion force and the steering torque. This actuator is modelled as the set formed by propeller and rudder [49][50][51]. In this way, the force vector produced by the outboard located on the vessel's centreline is defined according to Equation (3).
where l x is the distance of the actuator to the vessel's center of gravity, n represents the revolutions per minute (RPM) of the propeller, δ is the rudder angle relative to the vessel's centerline, T act represents the thrust generated by the propeller and, finally, D act and L act are the drag and transversal forces generated by the rudder, respectively. In addition, the dynamics of the outboard motor is taken into account as: where δ c and n c represent the setpoints for the rudder angle and the propeller RPM, respectively. The time constants τ δ and τ n define the dynamics of the outboard motor. Once the mathematical model has been defined, in order to adjust its parameters, the turning radius K r = √ Iz/m and the Nomoto model identified in [28] for the vessel Viknes 830, as well as its maximum speed, have been taken as references to synthesize the proposed mathematical model and its parameter values. The main features of Viknes 830 are listed in Table 1.
The parameters of the USV model proposed in this paper are collected in Table 2. Assuming a homogeneous mass distribution and taking as a reference the Viknes 830, the mass of the new model and its moment of inertia are obtained according to the Equation (5). In addition, the added masses that affect the vessel are estimated according to [52], see Equation (6).
where L, B y D represent the length, the beam and the draft of the vessel, respectively.
where ρ defines the density of seawater. The other parameters are adjusted to obtain stationary values for forward speed and angular rate close to those shown in Table 1. In order to verify this setting, a zero current velocity is assumed (V c = 0) and, once the operating range of the actuators (n c and δ c ) has been discretised, the points of equilibrium of the system are obtained (stationary values of the velocity vector ν). As can be seen in Figure 3, the forward speed increases with propoller revolution (where u max = 10.5 m/s) and falls when the rudder is engaged. Furthermore, the relation of the stationary value of r with the rudder angle is consistent with the behaviour of surface marine vehicles exposed in [5,[53][54][55][56].  On the other hand, the parameters listed in Table 2 must ensure a stable behavior of the Model (1) at all its operating points. In order to check its dynamic behavior, Model (1) is linearized at each operating point shown in Figure 3. As a result, the effective time constants obtained for the velocity vector ν are shown in Figure 4. As can be seen, the system is stable over its entire operating range and its dynamics becomes faster in function of the vessel's speed [5,[53][54][55][56]. Moreover, with a zero rudder angle, the effective time constant τ r varies, depending of the speed, around the 4 s obtained by [28] in the Nomoto model identified for the Viknes 830. To conclude with the analysis of the Model (1), it is evaluated through numerical simulations by carrying out different sea tests [57]. The Runge-Kutta numerical integration method of fourth order is used with an integration step of 0.01 s, holding n c = 2430 RPM and V c = 0 m/s. The Turning Circle Tests can be seen in Figure 5a. On the other hand, in Figure 5b,c the spiral (or Dioudonne) manoeuvre and zig-zag manoeuvres are shown.

Course and Speed Controllers
Most obstacle avoidance systems for USVs [10,12,13,15,[21][22][23][24][25][26][27][29][30][31] require that the vessel be equipped with course and speed controllers. These controllers guarantee, within a range of defined sea states, that the vessel reaches the course and speed requested by the avoidance system in a finite time. To this end, there are currently a multitude of control methods [4,5,52,53,58]. As the objective of this work is not focused on the design of the controllers, and in order to limit the problem, two PID structures are used to control the course and speed, see Equation (7). Moreover, due to the strong non-linearity of the Model (1), the adaptive control technique Gain Scheduling is used [53,58]. For this purpose, the controller parameters are set experimentally for three operating points: low (u low = 3 m/s), medium (u medium = 6 m/s) and high (u high = 9 m/s) speed, see Table 3. For intermediate speeds, linear interpolations are carried out between the PIDs. Finally, these controllers have been discretised using the Euler backwards method with a sampling period T m = 0.05 s.
where i ∈ {u, ψ}, c f = τ f /T m and the time constants have been fixed as τ f = 0.1(K D /K P ). Table 3. Parameters of the course and speed controllers. 45 2 18 Due to the effect of external disturbances, a compensation is carried out on the error signals of the controllers (7) [5,52]. In this way, the course angle (χ = ψ + β, see Figure 2) is controlled instead of the heading angle (ψ), as well as the module of the velocity vector (U) of the USV.

Simplified Modelling of a LIDAR Sensor
As a novel contribution made in this work, and with the aim of increasing the realism of the numerical simulations carried out, a LIDAR sensor has been modelled. As a reference, the characteristics of the LIDAR Ultra Puck of the company Velodyne have been used [59]. In addition, as in [10,12,13,15,[21][22][23][24][25][26][27][28][29][30][31], a 2D Cartesian space (x E , y E ) is used to evaluate the obstacle avoidance systems applied to USVs. Therefore, only one of the vertical channels of the LIDAR sensor is taken into account. Thus, the computation of the sensor model is decreased, reducing simulation times and allowing its use in iterative optimization algorithms, as evolutionary algorithms. In particular, from the information provided by the manufacturer in [59], the following data are taken: Range Accuracy up to ±3 cm. The minimum value for the standard deviation of the WGN (White Gaussian Noise) that affects the measurement is taken as σ L min = 0.03 m.
Before proceeding with the modelling of the LIDAR sensor, it is necessary to define the obstacle scenarios in which the USV is located. In this work, each obstacle Obst E is defined as a polygon formed by four concatenated segments, which are referenced to Earth-axes. Consequently, a scenario (S E ) is the result of the union of a finite number of obstacles (n O ), see Equation (9).
where seg i O 1E···4E represents the concatenated segments that form each obstacle and x i O 1E···4E are the coordinates of its four points.
It is important to highlight that we have chosen to model each obstacle as a rectangle due to the facility for generating scenarios from these polygons. However, this LIDAR sensor model can also be used in the presence of irregular polygons such as the ones that define the marine environments [16,17,19]. For this purpose, two approaches can be taken. Firstly, Delaunay Triangulation [60] can be applied to polygons that form the coastlines [61]. This triangulation decomposes the polygon into a finite number of triangles (n O ). Thus, each triangle is defined as a polygon formed by three concatenated segments. Secondly, the scenario can be defined as the set of segments collected in .shp files such as the ones collected in [61].
Defined the LIDAR parameters, as well as the obstacle scenario (S E ), the measurement of this sensor can be modelled as the set of segments L B (10), which is referenced to Body-axes.
where x i L 1B,2B and y i L 1B,2B represent the coordinates of the two points that form a segment and n L is the number of segments (LIDAR beams) that compose the set L B (n L = h range /h res = 900).
In order to model the distances measured by the LIDAR in its horizontal field of view (h range ), the points of intersection between the two sets of segments S E and L B are taken. For this purpose, both sets of segments must refer to the same reference system. Therefore, once the set L B has been expressed in matrix form, it is rotated and translated to Earth-axes at each simulation instant (k): The set of segments that form the scenario is also expressed in matrix form S E : As the problem of the intersection of segments can be solved from the field of computational geometry [60], in this work the matrices (11) and (12) are used as inputs for the function proposed in [62]. This function calculates the intersections between two sets of segments, considering coincident and parallel segments. Between other outputs, it returns the matrices F Inter and N D L E , both of dimension n L × n O . Where F Inter defines which segments of the sets (11) and (12) are intersected (F Inter (i L , i O ) = 1) and N D L E returns the normalized distances between the intersection points and the starting points of the segments of the set L E . From the matrix F Inter , in the Equation (13) the vector f L Inter is obtained, which indicates that beams of the LIDAR sensor have detected an obstacle.
Once the beams that have detected obstacles are known, the measured distance vector D L m is defined by the Equation (14). This LIDAR modelling considers the perspective effects that affect to this kind of sensors [1,21,26,32], since from each beam only the closest distance (d i L min ) is taken, while the later points of intersection with other segments (obstacles) are ignored.
where η i L is the WGN that affects to each distance measurement, whose standard deviation (σ i L ) depends of d i L min accoding to the Equation (15). Thus, the accuracy of each measure of the sensor is modelled with continuous limits and depends on the distance to the obstacle.
where the parameter σ L max must be set according to the sea states. Thereby, the performance of the sensor depends on the distance of the obstacles as well as of the environmental conditions. As maximum noise level, in this work σ L max = 5 m has been set. Together with the measured distance matrix (D L m ) and intersection flags ( f L Inter ), the sensor model also provides the matrix of detected points (16). Figure 6 shows the measurements delivered by the modelling proposed in this work for a LIDAR sensor.
where the reference system of the LIDAR sensor coincides with the Body-axes reference system. This modelling, with respect to other works [10,12,13,15,[21][22][23][24][25][26][27][28][29][30][31] that also evaluate avoidance systems for USVs through numerical simulations, is a novel contribution. Because it exposes the avoidance systems to a higher level of the uncertainty present in the environment surrounding the vessel, without reaching the complexity required when a complete modelling of the environment is realized [32][33][34][35][36]. This facilitates its application in autotuning environments based on evolutionary algorithms, due to the large number of simulations that these algorithms must carry out. As a visual demonstration, the video [63] shows the LROABRA algorithm adapted to the approach for the LIDAR sensor model proposed in this work. As can be seen in this video, this modelling adds measurement error to the detected points in function of their distance to the vehicle. In addition, this model also takes into account the uncertainty present in the environment, since it does not detect hidden obstacles due to the effects of perspective.

Scenarios for Static Obstacle Avoidance Methods Testing
Before the description of the obstacle scenarios, it is necessary to emphasize that the SOA algorithms studied in this work are reactive methods [11]. These methods are characterized by the use of environmental information processed in real time from the measurements delivered by different sensors. Therefore, these methods do not ensure that the vehicle reaches the target if there are local minima. For this reason, in order to provide a complete solution to the problem of autonomous navigation [1][2][3], it is necessary to combine obstacle avoidance methods or reactive methods [8,10,[12][13][14][15][21][22][23][24][25][26][27][28][29][30][31] with global or path planning algorithms [3,7,17,19,20]. In this sense, the obstacle scenarios studied in this work are focused only on the reactive part, unknown scenarios that the autonomous vehicle discovers while navigating. Without considering scenarios with local minimums such as those that can be found in marine environments (in which it would be necessary to have a guidance system that also incorporates a global algorithm). Specifically, the scenarios used to carry out the autotuning and to evaluate the SOA methods studied in this work are shown in Figure 7. A scenario is defined by the obstacles (9), the goal point P goal and the initial position and speed vectors (η, ν r ) of the USV. In this work, five scenarios are proposed. With scenario 1 the implementation of the SOA methods is verified. The second scenario, mainly, is used to evaluate the stability of the avoidance algorithm in situations where there are close obstacles without risk of collision. As well as the subsequent response of these methods when a collision risk is presented. Scenario 3 places the USV in a zig-zag scenario where all directions, at greater or lesser distances, lead to collision. Thus, the behaviour of SOA methods in closed environments is evaluated. Finally, scenarios 4 and 5 are densely occupied and allow a wide range of alternative routes. These scenarios are used to study the robustness of SOA methods that, while these have been adjusted for a different scenario, must solve new geometric situations not contemplated in their initial adjustment. In all scenarios the vehicle starts moving at the goal speed u goal = u = 7 m/s and, looking for the most unfavourable case in which the current leads the USV towards the obstacles, V c = 0.5 m/s and β C = 0 • has been set.

Static Obstacle Avoidance Methods
In order to evaluate the new autotuning environment proposed in this work, three obstacle avoidance methods have been adapted and implemented to the LIDAR sensor Model (10).

LROABRA Method
The LROABRA method is proposed in [29] as a static obstacle avoidance system that allows USVs to navigate at high speeds. In this approach, the obstacles are represented in a system of polar coordinates referenced to Body-axes, where each obstacle is modelled as a circle of radius r i and position O i (ρ i , θ i ). From these circles, the non-permitted directions are defined: where σ is a safety angle used to expand the angular space occupied by obstacles, d near is the threshold distance from which the obstacles are considered and φ i = asin(r i /ρ i ).
Based on [64], the guidance directions (θ) and speed commands (sp u ) that can be reached by the USV are limited to the following dynamic window: whereu max andṙ max represent the maximum linear and angular acceleration of the vessel, respectively, and T a m is the sample time of the algorithm.
Once the sets of forbidden (B obs ) and reachable (V Head ) orientations have been defined, the Heuristics (19) is maximized in order to obtain the angle θ optimal .
where is the heuristic adjustment parameter and θ goal represents the goal direction.
Due to the fact that the angle θ optimal defines a safe and reachable direction for the USV, it is used to insert a temporary guidance waypoint P insert (x insert , y insert ) at a distance D insert .
where P insert is updated when the USV reaches it or if the guidance angle is far from the optimal angle: where d gate and θ gate represent the linear and angular distance thresholds that set the P insert update. On the other hand, the speed setpoint sp u is calculated according to the Equation (22), which is limited to the dynamic window V T (18).
where the variable η L depends of the minimum distance to obstacles which lie within the impact zone of the USV, see Equation (23).
where r max is the maximum angular rate of the vessel, d i obs is the distance to the center of each obstacle and θ v defines the angular impact zone of the USV.
In order to expose the LROABRA algorithm to a higher level of uncertainty in the environment, in this work the set of non-permitted directions is modified. Thus, B osb is generated from the measurements delivered by the LIDAR sensor model, considering each beam from the Model (10) as an obstacle, see Equation (24). Furthermore, with the purpose that the algorithm considers the direction of the velocity vector, in the Equations (18), (19) and (22), ψ(k) is replaced by χ(k). One of the executions of the LROABRA algorithm implemented in this work is shown in Figure 8.
where the term θ i ± φ i of the Equation (17) has been replaced by i L h res .

Potential Fields Methods
The potential field (PF) method, due to its simplicity, has been widely used in different problems of mobile robotics [7,11,16,19,23,26,30,45,65]. A disadvantage of the classical potential fields used as a reactive obstacle avoidance method is that it can produce oscillatory trajectories [46]. In order to improve their performance in USVs, the classical potential fields [65] are modified by different authors in [23,30]. In their work, the forces of attraction and repulsion are modelled according to Equation (25).
where P USV (k) = [x E (k) y E (k)], P goal is the position of the goal waypoint, α att and m att are positive parameters used to tune the magnitude of the attraction potential, p o is the distance that limits the range of influence of the obstacles, p i s is the distance to each obstacle, and, finally, the magnitude of the repulsion potential is tuned with the positive parameters η rep and n rep .
The repulsive forces of Equation (25), as shown in [23], are generated from the vertices of the obstacles which form the coastline. In addition, the distances considered in [23] are in the range of kilometres. In order to expose the algorithm to a higher level of uncertainty in the environment and evaluate it in proximity situations (d range = 200 m), which increases the difficulty of avoidance scenarios, in this work a repulsive force is generated by each of the beams of the LIDAR sensor (10). In this way, the total repulsive force, the attraction force and the resulting force, all of them referenced to Body-axes, are defined according to Equation (26).
where ζ(k) = ψ(k) − χ(k), θ goal (k) = atan2 y goal − y E (k), x goal − x E (k) and the module of each repulsive force ( f i L rep ) corresponds to term f i rep of Equation (25), in which p i s has been replaced by the measured distance d i L m , which is defined in Equation (14). The course setpoint sp ψ is obtained from the resulting force (F R ) according to the Equation (27), [46]. As can be seen, a low-pass filter is applied to reduce the oscillations [66].
where c F = τ F /T a m , τ F is the effective time constant of the filter applied to the resulting force and T a m is the sample time of the obstacle avoidance method.
On the other hand, in [23,30] the authors do not consider changes in the speed of the vessel. In order to ensure that the potential fields have the same manoeuvrability over the vessel as the other SOA methods studied in this paper, the approach proposed in [66] is adopted to calculate sp u . Thus, the speed setpoint depends on the resulting force and the speed of the vessel, see Equation (28).
where U B (u, v) represents the vessel's velocity vector referenced to Body-axes. As will be shown in the results section, despite the favourable results obtained in [23,30] when applying the modified potential fields (PFs) (for distances of several kilometres), if the detection range is limited (d range = 200 m [59]) the PFs [23,30] do not provide acceptable results. As a secondary contribution of this work, and based on the concept of generalized potential fields (GPFs) proposed in [45] and studied in [46], we propose to use potential fields that consider the relative direction between the obstacle and the vessel's velocity vector, see Equation (29). For this purpose, the module of repulsive forces f i L rep calculated in (26) is replaced by: where β gp f is a positive tuning parameter that decreases the effect of obstacles towards which the USV does not go. The attraction force in the GPFs method is calculated as in the PFs proposed in [23].Therefore, any change in the guidance direction of one method with respect to another depends only on the repulsive forces. A comparative between the repulsive forces generated when applying the PFs proposed in [23,30] and those obtained when applying the GPFs proposed in this paper is shown in Figure 9. As can be seen in the bottom left graph, in the case of GPFs, only the obstacles towards which the USV is moving produce a repulsive force (blue circles in Figure 9). While, in the case of PFs, all obstacles under the range of influence (p o ) produce repulsive forces (brown circles in Figure 9). As a consequence, at the simulation instant shown, the resultant force obtained when applying GPFs (Ft GPF ) guides the USV towards the goal, while if the resultant force obtained by the PFs (Ft PF ) were applied, this would drive the USV away from the obstacle zone (although these do not represent a real danger) and, consequently, away from the goal (see bottom right graph). In the simulation shown, the GPFs method is the one that guides the USV, which has been manually adjusted in an iterative procedure.  Figure 9. Implementation of the potential fields, as obstacle avoidance algorithms, adapted to the simulation environment for USVs proposed in this work.

VFH+ Method
The VFH+ method is proposed in [67] as an improved version of the VFH (Vector Field Histogram) [68]. Later, it has been used as an obstacle avoidance system for an USV in [10]. In this work, the block of this algorithm available in Simulink is used [69]. As model of the environment, the VFH+ method uses The Primary Polar Histogram (H P ), [67]. To generate it, the version of the method available in [69] is fully compatible with the model of the LIDAR sensor proposed in this work. As inputs, this block uses the distance measurements (14) and their angular positions (30). Furthermore, as in the other SOA methods, and in order to consider the effect of environmental disturbances [5,52], in this work the angular positions of the measured distances are referenced to the course angle χ(k).
In the same way that the LROABRA method increases the angular occupation of obstacles with the parameter σ, and in contrast to the potential fields which do not consider the size of the USV, the VFH+ method approximates the shape of the vehicle to a circle of radius r width . Thus, the angular occupation of each detected point is extended according to γ i L r , see Equation (31). In this way, each bar of H P is defined according to the Equation (32). (32) where f d i L m defines the occupation density as a function of distance, see [67,69]. Obtained H P , this is converted into a Binary Polar Histogram (H B ) that classifies the directions between occupied or safe. To ensure that the state of the directions does not change several times, which generates an oscillatory behavior that can drive the system to dangerous situations [67], the hysteresis thresholds τ high and τ low are applied: (33) In addition, in order to take into account the dynamic and kinematic of the vehicle, the VFH+ method simplifies its trajectory to circular arcs of radius r ship , [67]. where φ l and φ r are the safe angles to port and starboard, respectively. The definition of these angles is recorded in [67].
Defined H M , the course setpoint (sp ψ ) is chosen between the safe or collision-free directions obtained (h i L M = 0). For this purpose, the following cost function is minimized: where the parameters µ 1 , µ 2 and µ 3 are weighing factors that take into account: alignment with the goal direction, cost associated with the change of direction and alignment with the previous course setpoint (memory effect), respectively. The operator δ(c1, c2) calculates the angular distance between the directions c1 and c2. Finally, the speed setpoint sp u is calculated according to the Equation (36), [68]. Figure 10 shows one execution of the VFH+ method implemented in this work.
where r max is a tuning parameter which represents the maximum angular rate of the USV.  Figure 10. Adaptation of the VFH+ algorithm available in [69] to the simulation environment for USVs proposed in this paper.

Simple Autotuning Approach for Obstacle Avoidance Methods
Currently there are a great variety of obstacle avoidance methods for USVs [8,10,[12][13][14][15][21][22][23][24][25][26][27][28][29][30][31], as well as a wide range of surface marine vehicles [4,5,8,10,12,21,22,26,28,29,[47][48][49]52] in which these can be applied. For this reason, and as main novelty contribution of this work, an AutoTuning Environment for Static Obstacle Avoidance (ATESOA) methods applied to USVs is proposed. This environment is flexible to any type of marine surface vehicle (that is equipped with course and speed controllers) and can be applied to different SOA methods. It should be noted that, starting from the limitations of each avoidance method, its performance to avoid obstacles and to reach the goal are determined by the tuning of its parameters (Θ tuning ). In addition, this tuning must be carried out on a specific obstacle scenario. However, in the problems of obstacle avoidance there can be an infinite number of geometric combinations that define the scenario. Therefore, even if the optimum value of Θ tuning is obtained for a defined function, this parameter vector would only be optimal for that particular scenario. For this reason, the study carried out in this work does not pretend to find the optimal parameter vector for each avoidance method applied to a specific vessel. Instead, its purpose is to facilitate the pretuning process necessary to implement SOA methods in USVs, as well as to assist in their choice for a particular vessel, through the use of the new ATESOA proposed in this paper.
In this work, a Genetic Algorithm is used as optimization technique to perform autotuning. This election is due to its established use in vehicle autotuning [37,39,42,44] and to the fact that the methods of obstacle avoidance [8,10,[12][13][14][15][21][22][23][24][25][26][27][28][29][30][31] usually include decision factors based on thresholds (that convert them into non-smooth functions, complicating the application of conventional least-squares optimization methods [43,53]). Thus, each tuning parameter of an avoidance method is considered as a gene and, consequently, its tuning parameter vector Θ tuning represents an individual of the population. In addition, to quantify the performance achieved by an avoidance method, with a particular tuning vector Θ tuning , the following indicators are proposed: where ∆sp ψ and ∆sp u are used to quantify the control effort solicited by the avoidance system, dist D is the distance traveled by the USV, time is the travel time and dist G is the distance up to P goal . Once the indicators (37) have been defined, the fitness function that quantifies the performance of an avoidance method for each individual Θ tuning is defined according to: where time lim , dist lim D , ∆sp lim ψ and ∆sp lim u set the maximum allowed values for the indicators (37) in a particular scenario and dist G (0) represents the initial distance between the USV and P goal . On the other hand, f stop defines two situations: the USV has reached its target or not, where d wp and d collision represent the distance thresholds, which define whether the USV has reached P goal or has collided, respectively. In this way, if the parameter vector Θ tuning drives the USV to the goal, within the established limits (39), the index J s is used to minimize: time, distance and control effort in the travel, see Equation (38). On the other hand, if the safety distance (d collision ) or any of the established limits is exceeded, the numerical simulation is stopped and the index used is J f . The value of J f will always be higher than that of J s and, furthermore, it depends on the final distance between the USV and P goal . This last facilitates that, if in the initial populations a parameter vector that successfully guides the USV to P goal is not obtained, the GA prioritizes those vectors Θ tuning that drive the USV closest to the goal. Once the fitness function (38) has been described, the tuning parameter vectors of the four SOA methods studied in this work are defined in the Equation (40).
For the implementation of the AG, the Toolbox available in Matlab [70] has been used. In order to take into account the physical or adjustment limits established for the vectors Θ tuning , these have been limited considering the guidelines exposed in [23,29,30,[66][67][68][69], see Equation (41). Consequently, the option mutationadaptfeasible has been established as a mutation function [70] and the initial population has been limited to x low and x hihg , see Equation (41). On the other hand, in order to limit the simulation times, we have established: a population of 200 individuals, a maximum of 20 generations, and the parameter MaxStallGenerations as 25% of the maximum generations. Finally, with the purpose of avoiding early convergence [37,70], elite individuals have been limited to 1.5% of the population and the crossover factor has been decreased (thus increasing the mutation factor) to 0.7. The other parameters are the ones established by default in [70].
where the respective magnitudes are expressed in the international system of units.

Results
This section shows the results obtained by the new ATESOA applied to the USV model proposed in this work. For numerical simulations, Runge-Kutta numerical integration method of fourth order is used with an integration step of 0.01 s and the SOA methods have a sampling period of T a m = 1 s. Specifically, four SOA methods (LROABRA, PF, GPF and VFH+) have been automatically adjusted for the USV formed by the vessel Model (1), which is governed by the Controllers (7). In addition, in order to expose the algorithms to a higher level of uncertainty in the environment, these have been adapted to the measurements provided by the LIDAR sensor Model (10) proposed in this work, see Section 3. On the other hand, the scenarios 1, 2 and 3, which are defined in Section 2.4, have been used to carry out the autotuning of the SOA methods. As a result, the parameter vectors of each obstacle avoidance method (automatically adjusted for a scenario following the procedure given in Section 4) are shown in the Table 4. Where, for example, PF S1 represents the PF method autotuning for the first scenario.
In order to validate the proposed autotuning environment and to compare the performance of each obstacle avoidance method studied in this work, Figure 11 and Table 5 are presented. On the one hand, Figure 11 shows the different trajectories described by the USV, on the three scenarios of autotuning, when each avoidance method is applied. In addition, Table 5 presents the Indicators (37) that define the performance achieved by each avoidance method when guiding the USV. As can be seen, with the exception of the potential fields applied to scenario 2, the new ATESOA achieves parameter vectors that guide the USV safely to P goal . A situation like scenario 2 is not evaluated by the authors in [23,30]. Since, in the most similar scenario, the authors in [23] guide the model of the Mariner class vessel (171.8-meter vessel) proposed in [52] by a scenario where the space between obstacles is about 10 km, compared with the Model (1) of 9.2 m length and the 50 m of distance between obstacles defined in this paper. Furthermore, in [23], the goal point is contained between the obstacles, which does not cause the F att force to drive the USV into these obstacles (situation posed in Scenario 2). Additionally, with manual tuning, the PFs and GPFs methods have also failed in this scenario. This situation corresponds to the problem described in [19,71], in which the restriction of potential fields when passing through small passages is exposed. To solve it, it would be necessary to apply more advanced potential fields as the one proposed in [71]. On the other hand, the contribution made in this work through the application of the concept of generalized potential fields [45,46] to the improved PFs for USV proposed in [23,30], notably improves the guidance of the USV in the studied scenarios. This can be seen in scenarios 1 and 3, where travel times have been reduced to 54.13% and 58.85% and distances driven to 51.33% and 59.31%, respectively. Nevertheless, the performance obtained, for the measurement range d range = 200 m and the USV Model (1,7), by the methods based on potential fields is significantly lower than that obtained by the LROABRA and VFH+ methods, see Table 5. With respect to these, both present very similar indicators in the three scenarios. The performance obtained by the VFH+ is better in scenarios 1 and 2, while in scenario 3 the LROABRA method is superior. On the other hand, in the problems of obstacle avoidance there are infinite geometric combinations that define the possible scenarios that the autonomous vehicle may encounter. Therefore, once the tuning of an avoidance method for a specific scenario has been made, its robustness for other scenarios with different obstacle distributions must be evaluated. In this aspect, a robust behaviour in the guidance of the USV, which is realized by an avoidance method, that keeps its performance (based on the Indicators (37) or similar) is not the objective. Instead, the capability of the avoidance method to safely guide the USV to P goal in significantly different scenarios than those used for its tuning is analyzed. In this context, each avoidance method has been evaluated, with the parameter vectors collected in Table 4, in scenarios with different obstacle distributions than those used for their autotuning. As a result, Figure 12 shows the paths described by the USV when applying each avoidance method over the scenarios defined in this work for which it has not been adjusted. In addition, as support to the previous figure, Table 6 shows the Indicators (37) achieved by each avoidance method in the guidance of the USV. In this robustness study, the indicator that presents the greatest interest is f stop , which defines success or failure in the vehicle's guidance. As can be seen, in the scenarios defined in this work, the PFs and GPFs methods do not present good results in the guidance of the USV over scenarios for which these have not been adjusted. Since only a favourable result is obtained by the GPFs method adjusted in Scenario 3 when it guides the USV over Scenario 1 (GPF S3 -S1). In the other scenarios, the methods based on potential fields lead the USV to a collision or generate trajectories that are proper of a limit cycle (PF S1 in Scenarios 3 and 5). On the other hand, the LROABRA method successfully solves the majority of scenarios for which it has not been adjusted. With two exceptions: Scenario 2 with the autotuning performed for scenario 1 and scenario 4 with any parameter vector. The first case is due to the value d near = 141.72 m obtained in the autotuning, which constrains the passage between the two parallel obstacles. As a consequence, the avoidance method, without taking into account the USV's dynamics, requires that the vessel turn completely to starboard, which causes a collision. In the second case, the numerical simulations carried out show that, in scenario 4, the collisions occur because the LROABRA method makes multiple switches in the guidance waypoint P insert . These commutations, as established in [67], cause undecided behaviour that leads the USV to a collision. To correct this, in a similar way to the VFH+ method, a possible solution would consist in adding to the heuristics (19) a weighting factor that takes into account the alignment of the candidate directions V Head with the previous course setpoint sp ψ (k − 1). With respect to the VFH+ method, it successfully resolves all of the scenarios defined in this paper for which it has not been adjusted. Moreover, it presents a robust behaviour to the variations in its parameter vector, since the Indicators (37) obtained in the same scenario for different values of Θ tuning are very close, see Table 6. Therefore, for the defined scenarios, of the four methods of static obstacle avoidance applied to USVs that have been adapted and implemented in this work, the VFH+ method achieves the best results in terms of performance (see Table 5) and robustness (see Figure 12).  Figure 12. Trajectories of the USV ((1), (7)) when applying the LROABRA, PF, GPF and VFH+ methods in different scenarios than those used for its autotuning.
As shown in the results obtained in Figure 12 and in Table 6, the new ATESOA proposed in this work is flexible, such that it can be applied to different SOA methods used in USVs. Where, the robustness of the autotuning obtained depends on the scenario used, but mainly of the features specific of each obstacle avoidance method. Since, as shown below, the new ATESOA achieves a successful adjustment of the SOA methods that did not overcome the obstacle scenarios 4 and 5. In particular, the autotuning of the LROABRA method for scenario 4 and of the methods based on potentials fields for scenarios 4 and 5 is carried out. The parameter vectors obtained are collected in Table 7. As a result, Figure 13 shows the trajectories described by the USV when applying the LROABRA, PFs and GPFs methods autotuning in the new ATESOA. In addition, Table 8 presents the Indicators (37) obtained by each method in each scenario. As can be seen, all methods successfully solve the two scenarios. In scenario 4, the LROABRA method again improves performance with respect to potential fields. Regarding the potential fields [23,30], of the methods studied in this work, the results obtained indicate that these would be the worst option as an avoidance system for USVs in situations where the measurement range of the sensors is limited (d range ≤ 200 m). Although in both scenarios, the GPFs method proposed in this work again produces a less oscillatory trajectory in the guidance than the PFs proposed in [23,30], which means shorter travel distances.

Conclusions
Due to the scientific and industrial interest, in the last years many works have been developed in order to provide a higher level of autonomy to the vessels. This has led to a diversity of methods for static obstacle avoidance applied to USVs. In order to design, development and validation of these methods, it is necesary an environment for computer simulation that allows the evaluation of the proposed algorithms. With this aim, the main contribution of this work is the new ATESOA, an autotuning environment for the design parameters associated with each static obstacle avoidance algorithm. This environment is adaptable to diverse SOA methods, which can be applied in different types of USVs. Due to the simplified model of the LIDAR sensor proposed in this paper, the simulation environment is more realistic than those used by most authors for the design of obstacle avoidance methods. With the advantage, over works focused on more sophisticated and complex simulation environments to validate USVs, that this model of the LIDAR sensor facilitates the application of evolutionary algorithms for autotuning (due to its lower computation load). To evaluate the new ATESOA, four SOA methods (LROABRA, PFs, GPFs and VFH+) have been adapted and implemented for using this sensor model. The results show how this new autotuning environment achieves a successful and, depending on the obstacle avoidance method, robust tuning of the parameters of the SOA methods for a range of measurement limited by the LIDAR [59] to 200 m. In addition, the parameters for the mathematical model of a USV of 9.2 m of length, whose modelling is based on previous work in the field of surface marine vehicle control, are proposed and evaluated. This model includes: non-linear modelling of the vessel and actuators dynamics, modelling of the effect of ocean currents and course/velocity controllers. In addition, as method of avoiding reactive obstacles, the performance of potential fields [23,30], applied to this USV model (length of 9.2 m) has been improved, through the adaptation of the generalized potential fields [45,46]. As future work, the new autotuning environment will be adapted for dynamic obstacle avoidance methods.
Author Contributions: R.G. was responsible for studying, adapting and implementing the obstacle avoidance methods, the LIDAR sensor model and the new autotuning environment. In addition, R.G. wrote most of the work. M.J.L. proposed and tested the new mathematical modelling of USV proposed in this work. M.J.L. has also participated in the analysis of proposals, methods and discussion of results. In addition, M.J.L. wrote part of the paper and reviewed in depth all its contents. J.S., due to his experience with the USVs in the Navantia company, reviewed all the work and, more in detail, the vessel's model, the course/speed controllers and the obstacle avoidance methods. Finally, A.C. reviewed the entire article and contributed to its translation. All authors have read and agreed to the published version of the manuscript.
Funding: This research has been carried out within the collaborative framework of industrial doctoral thesis, which is financed by the Universidad de Cádiz and the company Navantia.