# A Multi-Objective Modified PSO for Inverse Kinematics of a 5-DOF Robotic Arm
## 3 Multi-Objective Inverse Kinematics Problem Statement
### Inverse Kinematics as a Multi-Objective Problem  
Assuming that the joints coordinate is \(Q()\), which may be rotations or translations but also angular or linear velocities; that the target position is \(X_{t}\); and that the forward kinematics model of the system is in Equation (9), the inverse multi-objective inverse kinematics model considering orientation may be formulated as in Equation (15). \[\text{Find }Q()\text{ satisfying }\left\{ \begin{aligned} & minf_{1}(Q)=min\sqrt{(p_{x}-x_{t})^{2}+(p_{y}-y_{t})^{2}+(p_{z} -z_{t})^{2}}\\ & minf_{2}(Q)=min\frac{|\gamma-\gamma_{t}|+|\alpha-\alpha_{t}|+| \beta-\beta_{t}|}{3}\\ &\text{Subject to: }Q\in Q_{DS}\end{aligned} \right. \tag{15}\]  
where \(f_{1}(Q)\) stands for the Euclidean distance of the end-effector position to the target position, which is subject to minimization. \(f_{2}(Q)\) is the Euclidean distance of the end-effector orientation to the target orientation which is also subject to minimization. \((x_{t},y_{t},z_{t})\) are the coordinates of the target position \(X_{t}\). \(P=(p_{x},p_{y},p_{z})\) is the end-effector position for a given joints position \((Q)\). The target orientation \((\alpha_{t},\beta_{t},\gamma_{t})\) represents the desired orientation of the end-effector. The first objective is related to \(f_{1}\) and aims to minimize the distance between the target position and the end-effectors' position. The second objective is related to the function \(f_{2}\), and tends to satisfy a given orientation constraint of the effector. Orientation optimization attempts to minimize the mean of the total angular errors to obtain the closest orientation possible to what is desired. The multi-objective inverse kinematics solving may be resumed within the key steps presented in Algorithm 2  
```
1:Input: \(X_{t}\), \(Y_{t}\), \(Z_{t
```
Begin Fix target position \(X_{t}\) Fix orientation target \(O_{t}\) Initialize a MO-m-PSO Swarm Q0 \(\leftarrow\) random(Q1, Q2,..., Qn) \(F_{K}(Q_{i})\leftarrow\) (forward kinematics model) while (not stop) for each particle Compute \((p_{x},\ p_{y},\ p_{z})=F_{K}(Q_{i})\)\(\triangleright\) System forward kinematics Compute \(O_{t}=Euler(Q_{i})\)\(\triangleright\) Euler angles transformation Execute \(m-PSO()\) / subject to \(\min\ f_{1}()\) as a mono-objective Execute \(m-PSO()\) / subject to \(\min\ f_{2}()\) as a mono-objective find Pareto Utopia point of \((f_{1}(),f_{2}())\) Select \(Best_{q}\) / satisfying \([\min(f_{1}(),f_{2}())]\) end for end while Return ( \(Best_{q}()\)) end
```

**Algorithm 2** Simplified pseudocode of Mo-m-PSO for inverse kinematics. ## 4 Simulation and Results

The modified PSO, m-PSO, and its multi-objective version MO-m-PSO for inverse kinematics were applied to solve the inverse kinematics of an educational robotic arm using four scenarios:

The first test stands for the mono-objective version evaluations; it includes the single target point performances analysis and comparison with related methods. The second scenario is the classical one-target test, where one target and one orientation is given and MO-m-PSO aims to determine the appropriate angles that assure achieving that orientation and position with as minor an error as possible. The third scenario consists of generating 100 different random points covering the majority of the workspace space of the robot, then for each point an inverse kinematics solution is returned by MO-m-PSO. To assess the solver quality, the mean and standard deviations of the results are analyzed. The path tracking test is where a circular trajectory is generated in the workspace of the 5-DOF robot. The circular path is made of 50 points. The role of the inverse kinematics solvers based on MO-m-PSO is to find the best possible solution for each point taking into consideration the desired orientation. Such a scenario may be used in soldering or in the industrial robotized components placement process.