A Real-Time Collision Avoidance System for Autonomous Surface Vessel Using Fuzzy Logic

Numerous researches have been done to develop ASV (Autonomous Surface Vessel) collision avoidance systems. Most of the systems used static methods but did not apply a knowledge base where solutions can be reused and adapted to solve a new case. In this paper, an algorithm of autonomous collision avoidance is proposed considering steering dynamic for ASV. The process of this learning method is to recall the FCBR (Fuzzy Case Base Reasoning) containing basic expert knowledge in the form of stored cases. The solutions will be retrieved from the knowledge base to find a NH (New Heading) command for collision avoidance. Moreover, to execute the NH, a design of adaptive fuzzy ASV heading control system based on command filter is conducted considering the input saturation constraints and external disturbances. T-S fuzzy logic is employed to approximate nonlinear uncertainties existing in the heading control system adopting the MLP (Minimal Learning Parameter) technique. Finally, simulations prove that the method is effective to retrieve the past similar cases for the new collision avoidance situation and give its solution for ASV to track adjusted heading.


I. INTRODUCTION
In recent decades, for building systems of ASV that help avoid collision situations considering the international regulations for preventing collisions at sea using mathematical models for the simulation of ship's maneuverability, technologies such as fuzzy logic, neural networks, expert system and hybrid artificial intelligence have been employed to form autonomous collision avoidance systems which is the key to realize the development of ASV. In this field, fuzzy logic is a suitable and effective method to deal with linguistic representation and subjective concept. Lee and Kwon [1] proposed fuzzy logic and virtual force field algorithm to avoid static and dynamic obstacles. The fuzzy rules were used to solve the problem that the system adheres to COLREGs (International Regulations for Preventing Collisions at Sea), and the virtual The associate editor coordinating the review of this manuscript and approving it for publication was Bohui Wang . field was used as a method of path search. Then, Park and Benedictos [2] proposed an automatic collision avoidance system using FCBR that can continuously learn and expand the case library to cope with different encounter situations and Benjamin et al. [3] presented multi-objective operation and optimization for autonomous unmanned marine vessels. Further, an understanding about autonomous ship navigation for collision avoidance was provided by Thomas et al. [4]. To solve the automatic collision avoidance problem, Perera's studies [5]- [7] are more systematic and prominent. The main research ideas are based on fuzzy theory, supplemented by expert systems, Bayesian networks and parallel decision-making methods that achieve a series of ingenuity. However, one of the primary weaknesses identified with collision avoidance systems is the inability to deal with complex encounter scenarios which require human-like thinking to select an appropriate course of action, as opposed to a single discrete action [8]. To solve the problem, Wang and Karimi [9], presented successive way points tracking method for under-actuated surface vehicles. Paper [10] conducted dynamic obstacle avoidance and path planning methods for unmanned surface ship combining the algorithms of clustering and ant colony considering complex maritime environment.
Nevertheless, during the real navigation, the ASV motion state can be limited by the maneuvering characteristics which should be considered. The research of adaptive nonlinear control has always received considerable attention. To overcome the drawback of model based methods, some ideas have emerged to compensate for the ship steering problems with uncertain dynamics and the external environment, such as the model reference adaptive fuzzy logic control [11]. Based on small-gain approach, Yang et al. [12] and Ma et al. [13] presented robust adaptive fuzzy algorithms which can be applied to ship course control. Paper [14] focused on straightpath tracking design parametric uncertainties. Moreover, studies using dynamic surface control had been proposed in [15]- [18]. Then, Li et al. [19] and [20] proposed an adaptive design of neural control for nonlinear systems with input saturation and time-varying delays. Besides, considering time delays, Wang et al. [21] addressed the regulation cooperative control of uncertain chaotic systems and Deng et al. [22] developed a novel periodic switching controller to solve the event-triggered consensus problem of linear multiagent systems with time-varying delays. In terms of the filtering designing, Chang and Yang [23] addressed a non-fragile H ∞ filter for continuous-time fuzzy systems and the command filter method was provided avoiding the repeated derivatives of the virtual control laws in papers [24], [25]. In the further researches [26]- [28], the adaptive control methods for uncertain nonlinear systems were considered based on command filter. To combine two aspects of collision avoidance and tracking control algorithms, dynamic collision avoidance control methods were presented by the paper [29].
Though these previous systems have been able to solve collision avoidance situations and provide outputs, their solutions are not adjusted to adapt to each unique environment that every collision avoidance situation has for the design of intelligent decision-making for ASV, it is necessary to learn from the decision-making process of the officers when dealing with complex traffic scenarios, experience and rules based on fuzzy definitions, and implementing ASV heading control for collision avoidance.
In this paper, an adaptive dynamic collision avoidance algorithm for ASV is proposed based on an improved decision making and adaptive steering systems which respectively can recognize multi-objects and execute adjusted heading control. The contributions are made mainly in the following three aspects: 1) To deal with the situations when ASV accounts dynamic objects, the fuzzy system is designed to calculate real-time dynamic collision risk using dynamic information and the most dangerous target ships will be indicated. 2) To make decision for taking collision avoidance actions, the FCBR module retrieves a solution from the constructed dynamic expert knowledge base on account of the dynamic information of target ships and the algorithm of self-adaptive adjustment. 3) To solve dynamic course tracking problems with uncertainties under external interference and input saturation, a fuzzy adaptive heading control system is conducted combining command filter and MLP method. In the control model, the nonlinear uncertainties are approximated by T-S fuzzy logic. In this way, the integration of collision avoidance decision making mechanisms and heading control is realized.
The remainder of this paper is constructed as follows. The basic concepts and problem formulation are provided in section 2. ASV collision avoidance system is designed in section 3. Section 4 shows the simulation results. Finally, the conclusions are given in section 5.

Notations:
The following notations will be used in this paper: if y is a scalar, |y| denotes its absolute value. In case, A is a matrix, A denotes the Frobenius matrix norm which is defined as A 2 = i,j a i,j 2 . |·| denotes the usual Euclidean norm of a vector. λ max (A) and λ max (A) represent the largest and smallest eigenvalues of a square matrix A, respectively.

II. BASIC CONCEPTS AND PROBLEM FORMULATION
The concept of DCPA (Distance to Closest Point of Approach) is usually supposed an absolute value, but will be presented as an output with negative or positive sign which is essential for the ASV's FCBR system.   Remark 1: If their relative or apparent motion will be moving to the left towards OS, DCPA is negative while if it will go apparently towards the right, the sign is positive.

B. THE CASE BASE FOR RETRIEVING
The cases stored inside the case base used in this paper can be expressed as MISO (Multiple Inputs and Single Output) fuzzy reasoning rules sets. According to the current encountered situation, these cases serve as the previously acquired knowledge which can be retrieved for a similar case in the same way as an experienced ship officer is recalling his acquired knowledge from past experiences. Figure 2 describes one case stored in the case base of ASV's FCBR system for being retrieved and adapted to the new case. Then, it can be used to obtain the output heading according to the steering rules of the regulation for preventing collisions at sea shown in Figure 3.
The parameters referred in ASV's case base are shown in Table 1.

C. PROBLEM FORMULATION OF HEADING CONTROL
The nonlinear Norrbin mathematical model of the ASV's steering system is selected: where T , r, α, K and δ are following index, angular deflection rate, coefficient, ship turning ability index and rudder angle, respectively. In practice, the ASV steering system cannot be arbitrarily changed because rudder angle is subject to input saturation which is described as |δ| ≤ δmax and in the actual process of ASV handling, the rudder actuator dynamics also affect the performance of the steering control, thus the mathematical steering model will be added and it can be expressed as: where δ E represents the command rudder angle, δ represents the actual rudder angle, T E represents the time delay constant, and K E represents the control gain.
Integrating formulas (1) and (2), the nonlinear uncertain ASV heading control system can be expressed as: the external disturbances 1 = 3 = 0 and 2 which is assumed as an unknown smooth function. f 1 = 0, g 1 = 1 and f 2 (x) is the unknown dynamics of control system, g 2 = K /T , Considering the limitation of the input saturation, an auxiliary design is conducted as follows: where f (·) = f (z 3 , u), u = u − v, k > 0, e is a variable introduced to reduce the input saturation effects and ε is a positive parameter. VOLUME 8, 2020

D. T-S TYPE FUZZY LOGIC
Generally, the structure of the T-S type fuzzy logic is described using N rules having the following form: After defuzzifying using the method of center average and defining an optimal parameter, the output of the T-S fuzzy logic can be expressed as the following vector form: , ε is the error of approximating.
The fuzzy basis function ξ j (x) and vector A x are given as follows: The command filter is introduced into the designed system as the following form:ẋ where τ i is a positive constant, β 1 (0) = α 1 (0), β 1 , β 1 and ... β 1 are bounded. The control object is designing an adaptive nonlinear controller to guarantee all signals of the closed-loop system uniformly and ultimately bounded. The necessary assumptions are provided for the control design and the command signal x 1d (t) is a sufficiently smooth function of t, and x 1d ,ẋ 1d ,ẍ 1d are bounded.
Lemma 1 [16]: For any scalar variables A and B, the following inequality holds where γ represents a positive coefficient. Lemma 2 [17]: where a 0 and b 0 represent two positive constants. Then,

III. ASV COLLISION AVOIDANCE SYSTEM DESIGN
The structure of this ASV collision avoidance system consists of three modules. These modules have specific components that are essential for decision making and heading execution. Figure 4 illustrates the data flow. Module 1 is conducted for the fuzzification of the inputs and indexing a new case. In Module 2, the new case is used to retrieve a similar case and adjusting solution is done for the adapted solution. Finally,the steering control system is designed in Module 3.

A. INDEXING A NEW CASE
In module 1, the inputs DCPA and TCPA will be used to obtain the values of SI (Safety Index) and CR, then the new case will be indexed. Indexing is essential for the efficient retrieval of similar case from case base. The fuzzy membership functions for DCPA, TCPA and SI are shown in Figure 5 to Figure 7.
where The output variable SI for the fuzzy rule is used in solving for CR = 1-SI.

B. SOLVING FOR THE ADAPTED SOLUTION
In module 2, cases similar to the new situation will be retrieved from case base. When a similar case has been retrieved, the DCPA will be the input to solve for the output    which is the NH to take by OS to avoid collision. The fuzzy membership functions for DCPA and NH are shown in Figure 5 and Figure 8, while the input and output variables for the fuzzy rule in solving for NH are shown below.
where BN is Big Negative, SN is Small Negative, ZE is Zero, SP is Small Positive and BP is Big Positive.
The crisp output is adjusted by the similarity of the attributes. We calculate Sim(Similarity) with equation (11) using TCPA and TRB as the attributes to adjust or adapting the output of the solution of the selected case.
where ω is the importance weighting attribute of i, f is the similarity function, and T and S are the values for individual attribute i in the input and retrieved cases respectively. This solution will be used to produce the output. The input for finding Sim by fuzzy inference used in this paper is the difference between T and S for every attribute i.
The input and output variables for the fuzzy rule in solving for Sim is: It is expressed as a single input single output (SISO) which will have the rule base: The fuzzy membership functions for TCPA, TRB and similarity of attribute i are shown in Figure 9 to Figure 11 while Figure 12 shows the ASV case base structure.
where VBN is Very Big Negative, BN is Big negative, MN is Medium Negative, SN is Small Negative, VSN is Very Small Negative, ZE is Zero, SP is Small Positive, MP is Medium positive, BP is Big Positive and VBP is Very Big Positive,  where VD is Very Different, DF is Different, MD is Medium Different, MS is Medium Similar, SM is Similar, and VS is Very Similar.
The structure of ASV's fuzzy case base is shown in Figure 12 for solving adapted heading output.

C. ASV HEADING CONTROL
In order to execute adapted output heading in Fig 13, an adaptive nonlinear steering control is built using the command filter technique and MLP algorithm based on backstepping method. It contains 3 steps in this procedure. The virtual controller α i+1 , i = 1, 2 will be designed at each step and finally considering input saturation of the steering system, an overall controller of rudder angle will be conducted at Step 3.
Step 1: Define the heading tracking error variable z 1 = x 1 − x 1d , it obtainsż 1 = x 2 −ẋ 1d (14) where x 1d is the desired signal. Then define the virtual control law α 2 for x 2 . Remark 2: In order to avoid the repeated derivative of virtual control law and reduce the computing burden of 'explosion problem' existing in conventional backstepping methods, the designed command filter (7) will be introduced in the following steps. Let α 2 bypass the filter. In the filter, the variables α 2 andα 2 can be represented by x 2c andẋ 2c , respectively. Now, we define the compensated error The signal dynamic of s 1 is defined aṡ where s 2 is the signal that will be designed in (26). Once substitute (16) into the derivative of the compensated error and geṫ Then, define the second tracking error The transformation of equation (17) is handled bẏ wherez 2 is the second compensated tracking error defined It is time to choose the Lyapunov candidate Then differentiating V 1 , one can obtaiṅ Choose the virtual control α 2 as By substituting the virtual control above into (16), it obtainsV Step 2: Go forward one by one, a similar procedure is given recursively in accordance with the second subsystem (18), one obtainsż In the same way, define the virtual control α 3 for x 3 above. The signal dynamic s 2 is defined aṡ where α 3 , x 3c are the input and output of the filter, respectively. Further, substitute (25,26) into the derivative of the compensated error and geṫ Let α 3 bypass the filter, the outputs α 3 andα 3 of the filter are defined as x 3c andẋ 3c , respectively.
Define the last tracking error Then, one haṡ wherez 3 is the last compensated tracking error. It is defined asz For the unknown dynamic f 2 (x 2 ), the T-S fuzzy logic is utilized as a fuzzy approximator. Then f 2 (x) can be expressed as Substituting (31) into (29), it yieldṡ Let the normalized term A m x equal to A x /c 2 , an unknown constant c 2 = A x is only for analytic purpose, A m x ≤ 1 and ν 2 = A m 1z 1 and a variable ω is introduced for simplicity and can be expressed as where · denotes the Eulidean norm vector.
The equation (32) can be converted as followṡ In the same way, Lyapunov candidate is chosen as where is a design parameter. The time derivative of V 2 (t) iṡ whereθ 2 are the estimates of θ 2 ,θ 2 = θ 2 −θ 2 . Notice the remark 2 and choose a virtual control law for x 3 using variableẋ 2c of the command filter, update control law, tracking error and compensated error as shown below.
The update control lawsθ 2 is designed aṡ The time derivative of V 2 (t) turns intȯ where γ 2 is a designed parameter. It is worth to note that |AB| ≤ A 2 4γ 2 + γ 2 B 2 , thus Use the following inequalitỹ Notice that Then, one haṡ Step 3: The final control law shall be given in this step. Considering the last tracking error variable z 3 and compensated tracking errorz 3 , one haṡ The signal dynamic s 3 is defined aṡ Then, the derivation of z 3 is shown as followṡ One getṡ Choose the final control input in (4) as Then one haṡ Similarly, we choose Lyapunov candidate as Choose the function in the auxiliary design system as f (·) = f (z 3 , u) = |g 3 z 3 · u| + 1 2 u 2 and pay attention to that e ·ė = −ke 2 − |g 3z3 · u| + 1 2 u 2 e 2 · e 2 + u · e, u · e ≤ 1 2 u 2 + 1 2 e 2 (54) Then substitute the inequalities into (53) and obtaiṅ Theorem: Consider the closed-loop system composed of the virtual controllers, the controller and the updated laws, given any positive number p, for all initial conditions satisfying n j=1 z 2 j + n j=1 θ T j −1 jθ j + n j=2 ν 2 j + e 2 ≤ 2p, there exist k i , σ i , c i , γ i and −1 j , such that the solutions of the closed-loop system is uniformly ultimately bounded. Furthermore, given any µ, we can tune all controller parameters such that the output error z 1 (t) = x 1 (t) − x 1d (t) satisfies lim t→∞ |z 1 (t)| ≤ µ.
Now if choose γ ≥ 1, it finally can be converted intȯ where c 1 = 2µ − 1. Notice Lemma2 and then obtain, It can be seen that all the signals in the closed-loop system are bounded. For any µ 1 ≥ (ρ/c 1 ) 1/2 , there exists a constant T ≥ 0 making z 1 (t) ≤ µ i for all t ≥ t 0 + T . By selecting  the appropriate design parameters, (ρ/c 1 ) 1/2 can be arbitrarily small, the tracking error can be as small as possible. Thus the theorem is proved.
Remark 3: By fusion techniques of the command filter and MLP, the section proposed can simultaneously solve both problems of 'explosion of complexity' and explosion of learning parameters. It is easy to be implemented in real applications.

IV. APPLICAITON
With the cases stored inside the data base, the ASV's FCBR system will retrieve and adapt solutions to new navigational situation with two dangerous ships involved. The most dangerous ships will be identified and solutions from the cases stored inside the database will be adapted to take a safe way away from the danger of collision with the other ships in the area below. Figure 13 shows six TSs in the vicinity of ASV. The OS (ASV) will execute a NH to avoid collision from the most dangerous ships using the details in Table 2.

A. SOLVING FOR CR AND INDEXING
CR is determined by the DCPA and TCPA as inputs while using fuzzy reasoning to indicate the degree of the dangerous targets. After inferring the ships are categorized according to their CR values in Table 3. CR value of 1 means it is the most dangerous while 0 means it is very safe. In cases where collision risk values are the same, DCPA is compared then TCPA. When values CR, DCPA and TCPA of more than two ships remain the same, the index of the number of ships involved are increased.
Based on Table 3, ships F and A are the most dangerous targets. The details of the two ships will be used for indexing as well as input of a new case in the ASV case base shown in Table 4.

B. RETRIEVAL OF SIMILAR CASE AND ADAPTATION OF SOLUTION
The similar case stored inside the case base are listed in Table 5.   The similarity of TCPA from the vessels with the most dangerous CR and the similarity of the widest TRB among the dangerous targets will be used for adapting the NH.
Take the Sim of the similarities multiplied by the weights from Inputs A or B. TCPA is assigned with the weight 0.4 while TRB has the weight 0.6. Totally, The rules for DCPA as input to similar cases will be applied in fuzzy inferring. Take the union of the rules affected by the DCPAs of Input A and Input B, we obtained 58.24 degrees.
Simulation results are shown as follows: In the simulation figures, Fig(a) is the curve of the ship's heading-keeping process. It can be seen that the tracking error is almost zero ; Fig(b) is the heading rate, Fig(c) is command and actual rudder angles of the ship. In fact, the heading rate is restrained by a maximum of ψ (t) max = 3 • /s and the autopilot is restrained by the maximum rudder angle. We can see from the figure that the controller has fast response speed; Fig(e) is update law. Obviously, all signals are reasonable for keeping a desired heading achieved.
Applying the NH to OS, we have the change of DCPA of Ship A and Ship F. Figure 17 shows the first action taken by own ship. The output which is the NH for the steering system of ASV, after adaptation of case base solutions, has been executed.
Remark 4: The resulting DCPA, TCPA and TRB are again used as input to the ASV case base until a safe CR result was obtained. Figure 18 displays the tracking results of adopting successive collision avoidance actions.
An algorithm of the ASV collision avoidance system has been adapted using solutions from cases stored in the case  base. Testing the system with six TS involved, it yielded good results from the ASV case base.

V. CONCLUSION
The scheme of autonomous collision avoidance considering the ASV steering system was proposed for ASV. The FCBR (Fuzzy Case Base Reasoning) with basic expert knowledge provided collision avoidance solution using stored cases to find a NH. An adaptive fuzzy ASV steering system based on command filter was designed for manoeuvring NH considering the input saturation constraints and external disturbances. T-S fuzzy logic was employed to approximate nonlinear uncertainties in the heading control system using MLP technique. Finally, in the simulations, the validity was shown that the solution from a similar case retrieved from the case base was adapted to solve for the NH and applied in the navigational collision avoidance example. The steering system using the NH obtained from the ASV case base can follow a safe track. It proved that past similar cases can be retrieved to solve the new collision avoidance situation for ASV. However, to make the system be a reliable support system, the accuracy of the result needs to be improved in the future.