## 3 Improved Artificial Potential Field Method Based on Joint Space
### Algorithm Comparison  
The flowchart of the artificial potential field algorithm in joint space is shown in Figure 8, and the pseudocode is shown in Algorithm 1. The values of \(\varepsilon 1\), \(\varepsilon 2\), and \(\varepsilon 3\) can be adjusted appropriately according to the requirements. It can be seen that each iteration only requires the calculation of the potential field function once from the algorithm flowchart. The configuration at the starting position and the target position are obtained by inverse kinematics. In order to obtain a smooth obstacle avoidance trajectory, the values of \(F_{rep}\) and \(F_{rep\_vir}\) are limited to less than \(\varepsilon 3\). Figure 8: The flowchart of the algorithm. Figure 7: Reducing \(F_{rep}\) to prevent the angle of joint \(i\) from exceeding the limit range. ```
1:Set Start position: \(q_{start}\) and Goal position: \(q_{goal}\)
2:\(q_{start}=[\theta_{1},\cdots,\theta_{n}]_{start},q_{goal}=[\theta_{1},\cdots, \theta_{n}]_{goal}\) by inverse kinematics
3:While \(d(q,q_{goal})>\varepsilon\)1 %Determine whether the target point has been reached
4:For \(i=1:n\) %Calculate the attraction and repulsive forces on each joint
5:\(F_{att}(i)=-\mu d\Big{(}q,q_{goal}\Big{)}\); \(d(q,q_{obs})=\sqrt{\left(x(\theta)-a\right)^{2}+\left(y(\theta)-b\right)^{2}+ \left(z(\theta)-c\right)^{2}}-r1-r2\)
6:\(F_{rep}(i)=\left\{k\Big{(}\frac{1}{\left(d(q,q_{obs})\right)}-\frac{1}{\delta_ {0}}\Big{)}\frac{1}{\delta^{2}\left(d(q,q_{obs})\right)}\
abla d(q,q_{obs}),d(q, q_{obs})\leq d_{0}\right.\)
7:\(\left.\begin{array}{l}\text{if }F_{rep}>\varepsilon 3\text{ }F_{rep}= \varepsilon 3\text{ end }\%Ensure\text{ }smooth\text{ trajectory}\\ \text{8: }F_{att}=\text{sum}(F_{att}(i))\text{, }F_{rep}=\text{sum}(F_{rep}(i)) \text{ end}\\ \text{9: }\
abla U(\theta_{1},\cdots,\theta_{n})=F_{att}+F_{rep}\\ \text{10: }\text{if }\
abla U(\theta_{1},\cdots,\theta_{n})<\varepsilon 2\text{ }\%Determine\text{ whether



This type of method needs to calculate the potential field function \(3^{n}\) times in each cycle, while our algorithm only needs to calculate the potential field function once in each cycle. Thus, the algorithm in this paper has a higher real-time performance. #### 3.5.3 Comparison with APF Algorithm Using a Numerical Method

This type of method [23] uses the Euler method to calculate the gradient of the potential field function, as shown in Equations (18) and (19):

\[\
abla U(\theta_{1},\cdots\theta_{n})=(\frac{\partial U}{\partial\theta_{1}}, \cdots,\frac{\partial U}{\partial\theta_{n}}) \tag{18}\]

\[\frac{\partial U}{\partial\theta_{i}}=\frac{U(\theta_{i}+h\cdots,\theta_{n})- U(\theta_{i}-h\cdots,\theta_{n})}{2h} \tag{19}\]

\(h\) is the iteration step size. This method requires calculating the potential field function twice to obtain the gradient direction of a joint angle, and each cycle requires calculating the gradient of six joint angles. Therefore, the method requires 2n calculations of the potential field function per cycle, while our algorithm only needs to calculate the potential field function once in each cycle. Thus, the algorithm in this paper has a higher real-time performance. ## 4 Experiment and Result

In this paper, the ROCR6 is our research object. ROCR6 is a six-axis robotic arm developed by a Chinese company, Si Valley. Figure 9 shows the structure and coordinate system of the robot, and Table 1 shows the modified D-H parameters of the 6-DOF robot. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Joint** & \(\theta_{i}\) & \(\mathbf{a_{i-1}}\) & \(\mathbf{a_{i-1}}\) (mm) & \(\mathbf{d_{i}}\) (mm) \\ \hline
1 & \(\theta_{1}\) & 0 & 0 & 122.3 \\
2 & \(\theta_{2}-\pi/2\) & \(\pi/2\) & 0 & 0 \\
3 & \(\theta_{3}\) & 0 & \(-270\) & 0 \\
4 & \(\theta_{4}-\pi/2\) & 0 & \(-253\) & 123.3 \\
5 & \(\theta_{5}\) & \(\pi/2\) & 0 & 207.1 \\
6 & \(\theta_{6}\) & \(-\pi/2\) & 0 & 99.1 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Modified D-H parameters of the 6-DOF robot. Figure 9: The structure and coordinate system of the robot.