# AUV Trajectory Planning for Optimized Sensor Data Collection in Internet of Underwater Things
## 2 Materials and Methods
### Proposed Solution
#### 2.3.2 Path Design
Rotation is necessary only if the current heading \(\psi_{\gamma}\) is misaligned with the direction to \(p_{\gamma+1}\); otherwise, \(r_{\gamma}\) is set to zero without rotation. Throughout this phase, \(r_{\gamma}\) is the only variable control input, which only employed when rotation is necessary. The surge speed is maintained constant at \(u_{\gamma}=u_{\text{max}}\) throughout the entire horizontal movement, while the heave speed \(\omega_{\gamma}\) is set to zero, as there is no vertical movement. The selection between \(r_{\text{max}}\) or \(-r_{\text{max}}\) is determined by computing the angle \(\eta_{\gamma}\in[0,2\pi)\), measured counterclockwise from the \(x\)-axis to the vector \(p_{\gamma}\overrightarrow{p}_{\gamma+1}\). The direction of rotation is then decided by evaluating the angular difference \(\eta_{\gamma}-\psi_{\gamma}\in(-2\pi,2\pi)\), representing the counterclockwise angle between the AUV's current heading and the vector \(p_{\gamma}\overrightarrow{p}_{\gamma+1}\). Based on the evaluated angular difference, the appropriate rotation direction is selected as follows [24]:  
\[\left\{ \begin{array}{c}no\ turn,\ if\ \ \eta_{\gamma}-\psi_{\gamma}=0\\ turn\ right,\ if\ \ \eta_{\gamma}-\psi_{\gamma}\in[-\pi,0)\cup[\pi,2\pi)\\ turn\ left,\ if\ \ \eta_{\gamma}-\psi_{\gamma}\in(-2\pi,-\pi)\cup(0,\pi) \end{array} \right.. \tag{23}\]  
To find the position of the tangent point \(\xi_{\gamma}\) where the AUV stops rotating, a unit vector \(\mu_{\gamma}\) perpendicular to the current heading \(\psi_{\gamma}\) is first defined. This vector is used to determine the center \(\xi_{\gamma}\) of the AUV's circular path, such that \(\xi_{\gamma}\) lies at a distance \(\kappa_{\gamma}\) from the current position \(p_{\gamma}\) along the direction of \(\mu_{\gamma}\)[24]. Two vectors, \(\xi_{\gamma}\overrightarrow{p}_{\gamma}\) and \(\xi_{\gamma}\overrightarrow{\xi}_{\gamma}\), represent the directions from \(\xi_{\gamma}\) to \(p_{\gamma}\) and \(\xi_{\gamma}\), respectively. The center \(\xi_{\gamma}\) is computed as [24]:  
\[\xi_{\gamma}=p_{\gamma}+\frac{u_{\gamma}}{r_{\text{max}}}\mu_{\gamma}. \tag{24}\]  
Since the tangent vector \(\xi_{\gamma}\overrightarrow{p}_{\gamma+1}\) is orthogonal to \(\xi_{\gamma}\overrightarrow{\xi}_{\gamma}\), their dot product is zero [24]. Moreover, given that \(\xi_{\gamma}\overrightarrow{\xi}_{\gamma}\) has magnitude \(\kappa_{\gamma}\), where \(\kappa_{\gamma}=\frac{u_{\gamma}}{r_{\text{max}}}\), and that the tangent vector can be expressed as \(\xi_{\gamma}\overrightarrow{p}_{\gamma+1}=\xi_{\gamma}\overrightarrow{p}_{ \gamma+1}-\xi_{\gamma}\overrightarrow{\xi}_{\gamma}\), the orthogonality condition leads to [24]:  
\[\xi_{\gamma}\overrightarrow{\xi}_{\gamma}\cdot\left(\xi_{\gamma}\overrightarrow {p}_{\gamma+1}-\xi_{\gamma}\overrightarrow{\xi}_{\gamma}\right)=0. \tag{25}\]  
Now, using (25) the angle between \(\xi_{\gamma}\overrightarrow{\xi}_{\gamma}\) and \(\xi_{\gamma}\overrightarrow{p}_{\gamma+1}\) is computed as:  
\[\vartheta_{\gamma}=\arccos\left(\frac{\frac{u_{\gamma}}{r_{\text{max}}}}{|p _{\gamma+1}-\xi_{\gamma}|}\right). \tag{26}\]  
Figure 3: The AUV trajectory design. Using \(\hat{\theta}_{\gamma}\) from (26), the unit vector \(\xi_{\gamma}\overset{\rightarrow}{\xi}_{\gamma}\) can be derived by rotating the unit vector \(\xi_{\gamma}\overset{\rightarrow}{p_{\gamma+1}^{\prime}}\) counterclockwise by \(\hat{\theta}_{\gamma}\), as follows [24]:  
\[\frac{\xi_{\gamma}\overset{\rightarrow}{\xi}_{\gamma}}{\left|\overset{ \rightarrow}{\xi}_{\gamma}\xi_{\gamma}\right|}= \begin{bmatrix}\cos\theta_{ \gamma}&-\sin\theta_{\gamma}\\ \sin\theta_{\gamma}&\cos\theta_{\gamma}\end{bmatrix} \frac{\xi_{\gamma} \overset{\rightarrow}{p_{\gamma+1}^{\prime}}}{\left|\xi_{\gamma}\overset{ \rightarrow}{p_{\gamma+1}}\right|}.