## 3 Improved Artificial Potential Field Method Based on Joint Space
### Algorithm Comparison
We performed kinematic simulations in Simscape in Matlab, and these simulations were divided into two cases, namely obstacle avoidance for a sphere and obstacle avoidance for a rectangular beam. To demonstrate the real-time capability of our algorithm in this paper, we compared it with the algorithms discussed in Section 3.5. Additionally, we compared it with the genetic algorithm to showcase the performance of the results obtained by our algorithm. ### The Obstacle Avoidance for a Sphere

Table 2 shows the task information and the parameter details of the spherical obstacle. The motion process of the robotic arm using the APF algorithm is shown in Figure 10, where the red trajectory represents the running trajectory of the middle joint and end-effector. The change in each joint angle using the improved APF algorithm is shown in Figure 11, and the change in each joint angle using the genetic algorithm is shown in Figure 12, and their operation indexes are shown in Table 3. Table 4 compares the running time





### Experimentation in the Real World

The improved APF algorithm has now been tested in the real world for the rectangular beam obstacle in Section 4.2. Figure 16 shows each joint of the real robotic arm and the obstacle. Figure 17 shows the experimental result in the real world, and the robot avoids the obstacle and reaches the target position. \begin{table}
\begin{tabular}{c c} \hline \hline
**Algorithm** & **Run Time** \\ \hline Improved APF & 0.3912 (s) \\ APF in Cartesian space & 9.7521 (s) \\ APF using a sampling method & 286.2102 (s) \\ APF using a numerical method & 6.8694 (s) \\ \hline \hline \end{tabular}
\end{table} 
Table 7: The run time of algorithms. Figure 14: Change of the joint angle using APF. Figure 13: The motion process of the robotic arm using APF. Figure 15: Change of the joint angle using genetic algorithm. Figure 16: The experiment detail of the real robotic arm. Figure 17: The motion process of the real robotic arm. (**a**) depicts the motion of the robotic arm from 0 to 1 s. (**a**) depicts the motion of the robotic arm from 0 to 1 s. (**b**) depicts the motion of the robotic arm from 1 to 2 s. (**c**) depicts the motion of the robotic arm from 2 to 3 s. (**d**) depicts the motion of the robotic arm from 3 to 4 s.

## 5 Discussions

In smart factories, trajectory planning algorithms require high real-time capability to adapt to complex and dynamic industrial tasks. The algorithm proposed in this paper meets this requirement by demonstrating an excellent real-time performance. As evident in Tables 4 and 7, the improved artificial potential field method presented in this paper outperforms other APF methods in terms of real-time performance, as it can complete trajectory planning tasks within a mere 0.4 s.

The algorithm should strive to compute excellent trajectories, as excellent trajectories can save the energy consumed by the robotic arm, reduce the impacts during motion, and enhance the operational efficiency. From Tables 4 and 7, it can be observed that the algorithm presented in this paper exhibits smaller joint angle variations compared with the genetic algorithm. This indicates that using the algorithm proposed in this paper can reduce the energy consumption during the operation of the robotic arm. However, the algorithm proposed in this paper still has some drawbacks. In comparison to the genetic algorithm, this algorithm may cause the robotic arm's end effector to move slightly further, thereby reducing the efficiency of the robotic arm's operation. Additionally, the smoothness of the paths obtained by this algorithm is lower than that of the genetic algorithm, which may result in a greater impact on the robotic arm. Lastly, taking the rectangular beam obstacle in Section 4.2 as a case study, we conducted real-world testing using the algorithm presented in this paper. It can be observed that the robotic arm can effectively avoid obstacles. ## 6 Conclusions

Robotic arms are widely used in factory assembly lines.