# Automatic Docking Trajectory Design-Based Time-Varying-Radius Dubins for Unmanned Surface Vessel
## 3 Varying-Radius-Dubins-Based Trajectory Design
Figure 11: Distributed local path planning approach. Figure 10: Main flowchart of ADTA-ACO. The proposed ADTA-TRD algorithm utilizes the Dubins path with one turn segment and one straight segment. The USV is closest to the dockyard when the straight segment of Dubins path is at an angle of 90 degrees to the current dockyard's position. Therefore, the ADTA-TRD algorithm calculates the angle between the straight segment of Dubins path and the current dock position under different turning radii. Then, the algorithm selects the turning radius closest to 90 degrees as the current optimal turning radius \(r_{best}\). When the distance between the dockyard and the USV is less than the distance threshold \(D\), the distributed algorithm calculates the time for the USV to reach the dockyard under different turning radii. Then, the algorithm selects the turning radius with the shortest time as the current optimal turning radius \(r_{best}\). The core idea of the method is to optimize the minimum turning radius to obtain the fastest possible trajectory. In summary, the details of the proposed ADTA-TRD are described as Algorithm 1. ```
0: the USV's position \((x_{t}^{u},y_{t}^{u},\theta_{t}^{u})\), dockyard's position \((x_{t}^{d},y_{t}^{d},\theta_{t}^{d})\), minimal speed of USV \(V_{\min}\), number of different speed selection \(M\);
0: the set of minimal turning radius intervals \(H\);
1: Initialize radius influence factor \(k\), moving position of Dubins path \(Slen=\emptyset\), end position of linear segment of Dubins path, \(\epsilon\), \(ENDPoint_{i}=\emptyset\),...;
2:if Distance(\(x_{t}^{u},y_{t}^{u},x_{t}^{d},y_{t}^{d}\))\(<\)\(\epsilon\)then//Calculate the Euclidean distance between the USV and the dockyard. 3:\(f_{t}=1\);
4:else
5:\(f_{t}=0\);
6:endif
7:while\(\textbf{do}f_{t}==1\)
8:for\(i=1\to h\)do
9:\(R=\textbf{f}(V_{i}k)\);//Calculate the turning radius. 10:\((ENDPoint_{i},Slen_{i},t_{i})=\text{Dubins}(x_{t}^{u},y_{t}^{u},\theta_{t}^{u},x_{t}^{d},y_{t}^{d},\theta_{t}^{d},R,V_{i})\);// Calculate the Dubins path. 11:endfor
12:if Distance(\(x_{t}^{u},y_{t}^{u},x_{t}^{d},y_{t}^{d}\))\(>\)\(D\)then
13:for\(i=1\to M\)do
14:\(Angle_{i}\)=\(\text{Calgangle}(ENDPoint_{i},x_{t}^{u},y_{t}^{u},x_{t}^{d},y_{t}^{d},V_{i})\);// Calculate the angle between the straight segment of Dubins path and the dockyard. 15:endfor
16:\((r_{best},V_{best})\)=\(\text{Finda}(Angle)\);//Find the turning radius and speed of USV corresponding to the closest 90 degree angle. 17:else
18:\((r_{best},V_{best})\)=\(\text{Findt}(t)\);//Find the turning radius and speed of USV corresponding to the shortest time. 19:endif
20:\(H\gets r_{best}\)
21:\((x_{t+1}^{d},y_{t+1}^{d},\theta_{t+1}^{d})\)=\(\text{Updatadockyard}(x_{t}^{d},y_{t}^{d},Slen,V_{best}r_{best})\);// Update dockyard's status. 22:\((x_{t+1}^{u},y_{t+1}^{u},\theta_{t+1}^{u})\)=\(\text{UpdataUSV}(x_{t}^{u},y_{t}^{u},\)\(Slen,V_{best}r_{best})\);// Update USV's status. 23:if Distance(\(x_{t+1}^{u},y_{t+1}^{u},x_{t+1}^{d},y_{t+1}^{d}\))\(<\)\(\epsilon\)then
24:\(f_{t}=1\);
25:else
26:\(f_{t}=0\);
27:endif
28:endwhile
```  
**Algorithm 1** Automatic docking trajectory algorithm-based time-varying-radius Dubins (ADTA-TRD).