# Comparison Study of the PSO and SBPSO on Universal Robot Trajectory Planning
## 2 Materials and Methods  
### Artificial Potential Field  
The elements and resultant of potential energy, contained from an attractive potential field and repulsive potential field. Equations (1) and (2) represent the attractive potential field and attraction force, respectively, by setting the position of end effector \(\mathrm{x}=\left(x,y\right)^{T}\) and the point of goal coordinate \(x_{G}=\left(x_{g},y_{g}\right)\). The UR5 robot has been attracted to the goal object before reaching it. The goal object has the bigger attraction force. \[\mathrm{U_{att}(x)}=\frac{1}{2}\mathrm{K_{att}.d^{2}}\big{(}\mathrm{x},x_{ \mathrm{g}}\big{)} \tag{1}\]  
\(K_{att}\): Attraction potential field constant. \(\mathrm{d}\left(\mathrm{x},\mathrm{x}_{\mathrm{g}}\right)=\left\|\mathrm{x}_{ \mathrm{g}}-\mathrm{x}\right\|\): Distant between the first coordinate of manipulator and last coordinate of it (i.e., pick and place operation of the end-effector). The attraction force of the UR5 robot is the negative gradient of attraction potential field  
\[\mathrm{F}_{\mathrm{att}}(\mathrm{x})=-\
abla\mathrm{U}_{\mathrm{att}}( \mathrm{x})=\mathrm{k}_{\mathrm{att}}.\mathrm{d}\left(\mathrm{x},\mathrm{x}_{ \mathrm{g}}\right) \tag{2}\]  
The direction of attraction force is a line between first coordinate of the end-effector and the goal object coordinate. In Equations (3) and (4), repulsive potential field and repulsive force respectively [22; 23]. The repulsive potential field is dependent on distant. When the UR5 manipulator reaches the obstacle's effect region, it is subjected to repulsion force. The repulsion is greater for the closest (closer) obstacle. The coordinate of obstacle is \(\mathrm{x}_{o}=(x_{o},y_{o})\); the \(\mathrm{U}_{\mathrm{rep}}(\mathrm{x})\) is generated between the manipulator and obstacle based on the distance. \[\mathrm{U}_{\mathrm{rep}}(\mathrm{X})=\frac{1}{2}\mathrm{K}_{\mathrm{rep}} \left(\frac{1}{\mathrm{d}\left(\mathrm{x},\mathrm{x}_{\mathrm{o}}\right)}- \frac{1}{\mathrm{d}_{\mathrm{o}}}\right)^{2} \tag{3}\]  
where \(\mathrm{d}\left(\mathrm{x},\mathrm{x}_{\mathrm{o}}\right)\leq\mathrm{d}_{ \mathrm{o}}\). The \(\mathrm{U}_{\mathrm{rep}}(\mathrm{X})=0\) when \(\mathrm{d}\left(\mathrm{x},\mathrm{x}_{\mathrm{o}}\right)>\mathrm{d}_{\mathrm{ o}}\). \(\mathrm{K}_{\mathrm{rep}}\): The repulsive potential field constant. \(\mathrm{d}\left(\mathrm{x},\mathrm{x}_{\mathrm{o}}\right)=\left|\mathrm{x}_{ \mathrm{o}}-\mathrm{x}\right|\): Distant between the first coordinate of manipulator and obstacle of it (i.e., in the pick and place operation of the end-effector). \(\mathrm{d}_{\mathrm{o}}\): Influence range of \(\mathrm{U}_{\mathrm{rep}}(\mathrm{x})\). The repulsive force of the UR5 robot is the negative gradient of repulsion potential field \(\mathrm{U}_{\mathrm{rep}}(\mathrm{X})\). \[\mathrm{F}_{\mathrm{Rep}}(\mathrm{x})=-\
abla\mathrm{U}_{\mathrm{Rep}}(x) =\frac{1}{2}\mathrm{K}_{\mathrm{Rep}}\left(\frac{1}{\mathrm{d}(\mathrm{x}, \mathrm{x}_{\mathrm{o}})}-\frac{1}{\mathrm{d}_{\mathrm{o}}}\right)\frac{ \
abla\mathrm{d}(\mathrm{x},\mathrm{x}_{\mathrm{o}})}{\mathrm{d}^{2}(\mathrm{ x},\mathrm{x}_{\mathrm{o}})} \tag{4}\]  
when \(\mathrm{d}\left(\mathrm{x},\mathrm{x}_{\mathrm{o}}\right)\leq\mathrm{d}_{ \mathrm{o}}\) and zero other where. The direction of repulsive force is the line between manipulator and obstacle object. In Equations (5) and (6) the resultant potential field and resultant force respectively effecting on the UR5 manipulator. \[\mathrm{U}(\mathrm{x})=\mathrm{U}_{\mathrm{att}}(\mathrm{x})+\mathrm{U}_{ \mathrm{Rep}}(\mathrm{x}) \tag{5}\]  
The resultant force \(\mathrm{F}(\mathrm{x})\) is  
\[\mathrm{F}(\mathrm{x})=-\
abla\mathrm{U}(\mathrm{x})=-\
abla\mathrm{U}_{ \mathrm{att}}(\mathrm{x})-\
abla\mathrm{U}_{\mathrm{Rep}}(\mathrm{x})=\mathrm{ F}_{\mathrm{att}}(\mathrm{x})+\mathrm{F}_{\mathrm{Rep}}(\mathrm{x}) \tag{6}\]  
\(\mathrm{F}_{\mathrm{Rep}}(\mathrm{x})\) is the repulsive force from more than one obstacle and the \(\mathrm{F}_{\mathrm{att}}(\mathrm{x})\) is the attractive force of goal.