# Bi-Objective Function Optimization for Welding Robot Parameters to Improve Manipulability
## 3 Design of Robot Simulator
### Closed-Loop Inverse Kinematics Algorithm with PID Controll and WLN Solution  
The CLIK algorithm with PID controller has the advantage of simulating robot motion similar to the actual control environment [29]. However, since there is no separate restriction on the robot joint angle, we applied the WLN solution for joint angle restriction [14; 16]. The robot's Jacobian matrix is a differential kinematic matrix that defines the relationship between the task space and the joint space as shown in Equation (5). Where \(\dot{x}\) is a vector of 6-degree-of-freedom linear velocity and angular velocities in the task space and \(\dot{q}\) is a vector of angular velocities of the robot joints in the joint space. \[\dot{x}=\dot{J}\dot{q} \tag{5}\]  
The Jacobian matrix consists of an \(m\times n\) matrix, where \(m\) is the number of degrees-of-freedom in the task space and \(n\) is determined by the number of joint axes of the robot. Since the joints of the robot in this paper are all rotary joints, the composition of the rotary joint vectors in Equations (6) and (7) defines the Jacobian as shown in Equation (8). \(z_{i}\) is the axis vector of the rotary joint, \(o_{n}\) is the position vector from the origin to the end-effect, and \(o_{i}\) is the position vector from the origin to the \(i\)-th joint. The pseudo-inverse matrix Jacobian is equal to Equation (9). The joint angle can be calculated by multiplying the pseudo-inverse matrix Jacobian by \(\dot{x}\) and integrating it [30]. \[J_{yi}= \begin{cases}z_{i-1}\times(o_{n}-o_{i-1})&for\ revolute\ joint\ i\\ z_{i-1}&for\ prismatic\ joint\ i\end{cases}  \tag{6}\] \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Robot** & \(\mathbf{a}_{i-1}\) & \(\mathbf{\alpha}_{i-1}\) & \(\mathbf{\theta}_{i}\) & \(\mathbf{d}_{i}\) \\ \hline Joint1 & 0 & \(0^{\circ}\) & \(\theta_{1}\) & \(\mathrm{d}_{1}\) \\ Joint2 & 0 & \(-90^{\circ}\) & \(\theta_{2}-90^{\circ}\) & 0 \\ Joint3 & \(\mathrm{a}_{3}\) & \(0^{\circ}\) & \(\theta_{3}\) & 0 \\ Joint4 & 0 & \(-90^{\circ}\) & \(\theta_{4}\) & \(\mathrm{d}_{4}\) \\ Joint5 & 0 & \(90^{\circ}\) & \(\theta_{5}\) & 0 \\ Joint6 & 0 & \(-90^{\circ}\) & \(\theta_{6}\) & 0 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Modified D-H parameters. Figure 8: Coordinate systems: D-H modified. \[J_{wi}=\left\{ \begin{matrix}z_{i-1}&for\ revolute\ joint\ i\\ 0&for\ prismatic\ joint\ i\end{matrix} \right. \tag{7}\]  
\[J=\left[ \begin{matrix}z_{i-1}\times(o_{n}-o_{i-1})\\ z_{i-1}\end{matrix} \right]_{m\times n}=\left[ \begin{matrix}J_{v1}&J_{v2}&J_{v3}& \ldots&J_{m}\\ J_{w1}&J_{w2}&J_{w3}&\ldots&J_{m}\\ J_{w}\end{matrix} \right]_{m\times n}=\left[ \begin{matrix}J_{v}\\ J_{w}\end{matrix} \right]_{m\times n} \tag{8}\]  
\[J^{\dagger}=J^{T}(JJ^{T})^{-1} \tag{9}\]  
The pseudo-inverse matrix Jacobian with WLN is applied with two weight matrices, the gradient matrix denoted as \(W_{1}\) and the Damped Matrix denoted as \(W_{2}\) in Equation (10). \[J^{\dagger}={W_{1}}^{-1}J^{T}\left(J{W_{1}}^{-1}J^{T}+W_{2}\right)^{-1} \tag{10}\]  
The gradient matrix \(W_{1}\) is a diagonal matrix, as shown in Equation (11), that forces the joint angle of each joint in the joint space to be in the middle of the constrained range. \(w_{i}\) is the weight of each joint that makes up the diagonal of the gradient matrix. In Equation (12), \(\mathrm{H}/\partial q_{i}\) is zero within the constrained range of each joint and increases to infinity as it approaches the joint constraint angle. Therefore, \(w_{i}\) has a value close to infinity as the joint angle approaches the joint constraint angle, and a value of 1 as it approaches the middle of the joint constraint angle to reduce joint motion. The damped matrix, denoted \(W_{2}\), is also a diagonal matrix. The value of \(\lambda^{2}\), which makes up the diagonal, is added to the diagonal of the Jacobian matrix, so it always creates a full rank and prevents singular solutions from occurring.