## 2 Potential Fields: Generating the Global Middle Path  
The algorithm presented here is developed by using the information gathered from the global middle path from the robot tip to the goal point through obstacles. In other words, it is not the path that the links of the manipulator follow in the proposed algorithm. It only needs middle path points to place beam lines. The middle path may be generated by means of any global path-planning methods. Despite the alternative methods in the literature, numerical potential fields are a well-developed method without local minima. That is why, the Laplace equation is used to have information on the workspace for navigation purposes in developing the algorithm. Motion planning is carried out on top of that. For this reason, the potential field method is used and briefly explained in this section. A scalar potential driven by Laplace's equation under Dirichlet boundary conditions is expressed by  
\[\
abla^{2}u=0 \tag{1}\]  
Equation (1) is on a domain \(\Omega\) where the boundary of \(\Omega\) consists of the boundaries of all obstacles and the goal point. The goal point is given a very small number while the obstacle points including boundary points excluded in the calculation. The workspace \(\Omega\) is represented by a grid of certain dimensions. The partial equation represents the Laplace equation on equally spaced and connected grid as below. \[u_{(i,j)}=\frac{u_{(i+1,j)}+u_{(i-1,j)}+u_{(i,j+1)}+u_{(i,j-1)}}{4} \tag{2}\]  
where \(i\) and \(j\) are grid positions in the \(x\) and \(y\) directions, respectively. An iteration procedure using Equation (2) is performed on the grid to calculate field values at all points. A handful number of iterations are done to obtain field values at grid points. Following these values results in reaching the goal. Nevertheless, the path obtained is coarse due to path points placed on a discrete grid and is not very useful. For this reason, values within the square grid need to be accessed via the linear interpolation. Then, the direction of the largest descent \(\alpha\) is calculated using Equation (3) as shown in Figure 1. Therefore it can be reached from the point of \(p_{k}\) to the point of \(p_{k+1}\) via vector \(L_{k}\) in a two-dimensional (2D) environment. So, a collision-free path which is comprised of points for a point robot is obtained [44]. \[\alpha=\arctan 2\left(\frac{u_{(i,j-1)}-u_{(i,j+1)}}{u_{(i-1,j)}-u_{(i+1,j)}}\right) \tag{3}\]  
Having obtained the path points, a much smoother path is attained by means of a numerical calculation method called windowing. Calculating potential field in 3D environment is similar to calculating in 2D environment. \(L\) is the length of the cube representing the length of the side of the environment and \(N\) is the number of sections of this length. Grid values of the potential field are given below. \[dx=dy=dz=h=L/N\] \[u_{i,j,k}=u(x_{i},x_{j},x_{k}):i,j,k\in[0,N]\] \[u_{i,j,k}=\frac{u_{i-1,j,k}+u_{i+1,j,k}+u_{i,j-1,k}+u_{i,j+1,k}+ u_{i,j,k-1}+u_{i,j,k+1}}{6} \tag{4}\] \[\frac{\partial^{2}}{\partial x^{2}}u(x_{i},y_{j},z_{k})\approx \frac{u_{i-1,j,k}-2u_{i,j,k}+u_{i+1,j,k}}{h^{2}}\]Using Gauss-Seidel method, Equation (5) is obtained as follows;  
\[u_{i,j,k}^{m+1}=\frac{1}{6}(u_{i-1,j,k}^{m}+u_{i+1,j,k}^{m}+u_{i,j-1,k}^{m}+u_{i, j+1,k}^{m}+u_{i,j,k-1}^{m}+u_{i,j,k+1}^{m}) \tag{5}\]  
where \(i\), \(j\) and \(k\) are grid positions in the \(x\), \(y\) and \(z\) directions, respectively and \(m\) is the iteration number. Calculation of the direction of the largest descent is also similar for 3D environments. In addition to \(\alpha\) value, \(\beta\) value is required from newly obtained line of \(p_{k}d\) and the line of \(p_{k+1}d\) which is the difference of the potential field in the direction of \(z\) as shown in Figure 2. Therefore it can be reached from the point of \(p_{k}\) to the point of \(p_{k+1}\) via vector \(L\) in a 3D environment.