## 5 Improve Obstacle Avoidance Path Planning for RRT  
### Based on RRT and APF Algorithms  
The rapidly exploring random tree (RRT) algorithm is a type of random sampling method in which the starting point is used as the root node and the target point is used as the end node, and the intermediate node is added to expand a random tree by randomly selecting the sampling point in sampling space [19]. The algorithm has the advantage of probabilistic completeness, which can search for the picking path without solving all the spatial points, and quickly and effectively plan the picking path in the 3D sampling space. The RRT algorithm has a strong search ability and is suitable for high-dimensional spaces. However, it has some disadvantages, such as high randomness of sampling points, which may result in a large number of offset target points, leading to long operation time and uneven paths planned by the algorithm [20]. Artificial potential field (APF) is a widely used obstacle avoidance path planning algorithm, which assumes that there is repulsion on the obstacle and gravity at the target point, and the combined force of gravity and repulsion is used as the direction of motion of the moving object, and the target point has an attraction to the moving object, inducing the moving object to move towards the target point, and the obstacle has a repulsive force on the object, so as to effectively avoid the collision between the moving object and the obstacle [21]. Its advantage is that it does not need to accurately obtain the spatial location of obstacles and can effectively avoid obstacles in space. However, when the moving object is subjected to the repulsive force and the force of attraction are in the same straight line and in opposite directions, the moving object falls into the local optimal solution and cannot reach the target position, or when the distance between multiple obstacles is close, the robotic arm is prone to unstable states such as wandering and shaking, resulting in vibration and deadlock phenomenon [22]. Therefore, the APF algorithm is not suitable for obstacle avoidance path planning of the robotic arm alone. The artificial potential field contains two types of force fields: the gravitational field formed by the position of the moving target and the repulsive field formed by obstacles. \[U(q)=U_{att}(q)+U_{rep}(q) \tag{11}\]  
Among them, \(U_{att}\) is the gravitational field that guides the robot to move towards the target position; \(U_{rep}\) is a repulsive field that guides robots to avoid obstacles. The gravitational field function is as follows:  
\[U_{att}(q)=\left\{ \begin{array}{ll}\frac{1}{2}\zeta d^{2}(q,q_{goal})&d(q,q_ {goal})\leq d^{*}_{goal}\\ d^{*}_{goal}\zeta d(q,q_{goal})-\frac{1}{2}\zeta(d^{*}_{goal})^{2}&d(q,q_{goal })>d^{*}_{goal}\end{array} \right. \tag{12}\]  
Its gradient is as follows:  
\[\
abla U_{att}(q)=\left\{ \begin{array}{ll}\zeta(q-q_{goal})&d(q,q_{goal}) \leq d^{*}_{goal}\\ \frac{d^{*}_{goal}\zeta(q-q_{goal})}{d(q,q_{goal})}&d(q,q_{goal})>d^{*}_{goal }\end{array} \right. \tag{13}\]  
The gravitational field function is a piecewise function, and when \(d<d^{*}_{goal}\), the magnitude of gravitational potential energy is proportional to the square of the distance from the current position to the target position; when \(d>d^{*}_{goal}\), reduce the value of the gravity calculation function to avoid the problem of excessive gravity when moving away from the target position. The commonly used functions for repulsive fields are as follows:  
\[U_{rep}(q)=\left\{ \begin{array}{ll}\frac{1}{2}\eta\big{(}\frac{1}{D(q)}-\frac{ 1}{Q^{*}}\big{)}^{2},&D(q)\leq Q^{*}\\ 0&,D(q)>Q^{*}\end{array} \right. \tag{14}\]  
Its gradient is as follows:  
\[\
abla U_{rep}(q)=\left\{ \begin{array}{ll}\eta\big{(}\frac{1}{Q^{*}}-\frac{ 1}{D(q)}\big{)}\frac{1}{D^{*}(q)}\
abla D(q),&D(q)\leq Q^{*}\\ 0&,D(q)>Q^{*}\end{array} \right.