## 3 Guided Artificial Potential Field
### Guidance  
The issue of target unreachability is addressed during the computation of the repulsive force. The pre-established Action Model is employed to resolve the local minima problem and direct the movement of the robotic arm.  
The target values for the first two joints, simplified points for joint space obstacles, and the current joint values of the robotic arm are fed into the Action Model to arrive at the subsequent position \(Q_{mod}\) for the two joints. This \(Q_{mod}\) is then utilized as the target values for the initial two joints to ascertain a temporary target position \(Q_{target}\), which guides the robotic arm by generating an attractive force at the joints.  
Since Action Model does not incorporate precise obstacle avoidance and only provides directional guidance, fewer training steps are necessary. The guidance can take place at short intervals. However, the proximity to the temporary target position may result in slower guidance. Thus, to expedite the process, the maximum attractive force is implemented when the arm is quite distant from the final target.  
\[M_{att_{1}}=C_{mattm}\frac{M_{att_{1}}}{|M_{att_{1}}|} \tag{18}\]  
\[M_{att_{2}}=C_{mattm}\frac{M_{att_{2}}}{|M_{att_{2}}|} \tag{19}\]  
where \(M_{att_{1}}\) represents the attractive moment value of the first joint, \(M_{att_{2}}\) represents the attractive moment value of the second joint, and \(C_{mattm}\) represents the attractive moment maximum.  
The rapid alteration of the temporary target position during the guidance process may precipitate a sudden change in the attractive moment, potentially resulting in a shock.  
To circumvent such a situation, a limit is imposed on the rate of change of the attractive moment, as follows:  
\[M_{att_{1}}=M_{attold_{1}}+C_{alr}\frac{C_{alr}(M_{att_{1}}-M_{attold_{1}})}{ 1+C_{alr}|M_{att_{1}}-M_{attold_{1}}|} \tag{20}\]  
\[M_{att_{2}}=M_{attold_{2}}+C_{alr}\frac{C_{alr}(M_{att_{2}}-M_{attold_{2}})}{ 1+C_{alr}|M_{att_{2}}-M_{attold_{2}}|} \tag{21}\]where \(M_{attold_{1}}\), \(M_{attold_{2}}\) symbolize the attractive moment value at the previous point in time, and \(C_{ali}\) and \(C_{alr}\) are constants used to adjust the function.  
At the end of Algorithm 2, \(L_{step}\) is utilized as a step factor. It multiplies the combined force (or moment) \(M\) to ascertain the joint action quantity designated as \(\Delta Q\).  
```
1:whileRundo
2:if\(T_{goal}\) changed then
3: Calculate the joint angle \(Q_{goal}\).
4:\(Q_{target}\gets Q_{goal}\)
5:endif
6: Get the position of the obstacle points \(OP\).
7: Get the current joint value \(Q_{cur}\).
8:if\(\text{abs}(Q_{goal}-Q_{cur})>Thr\)then
9: Generate \(s_{t}\) as input to Action Moleed, and take a step to get \(Q_{mod}\).
10:\(Q_{target_{1}}\gets Q_{\text{mod }}\), \(Q_{target_{2}}\gets Q_{\text{mod }2}\)
11: Use \(Q_{target}\) to calculate \(M_{att}\).
12: Amplify \(M_{att_{1}}\) and \(M_{att_{2}}\) to maximum.
13:else
14: Use \(Q_{goal}\) to calculate \(M_{att}\).
15:endif
16: Attractive limits are imposed on \(M_{att_{1}}\) and \(M_{att_{1}}\).
17: Calculate the coordinates of the control points \(CP\).
18:for\(n\in CP\)do
19:for\(m\in OP\)do
20:if\(|nm|<R_{field}\)then
21: Calculate the repulsive moment at these two points \(M_{rep\_imp}\).
22:\(M_{rep}\gets M_{rep}+M_{rep\_imp}\)
23:endif
24:endfor
25:endfor
26:\(M\gets M_{att}+M_{rep}\)
27:\(\Delta Q\gets M\odot L_{step}\)
28:endwhile
```  
**Algorithm 2** Guided APF