## 5 Inverse Kinematics Analysis
### The SQP Algorithm for Inverse Kinematics  
The SQP algorithm is an iterative algorithm, whose principle is that within the allowed inaccuracy the constraint condition is the total amount of rotation radians of the industrial robot's joints are the minimum when the industrial robot reaches the target attitude. With this principle, the SQP algorithm establishes the inverse kinematics model of the robot. The objective function, which is to minimize the sum of the total rotation radians of the joints of the UR10 robot, is built. Equation (15) is the objective function,  
\[f=\sum_{i=1}^{i=6}(\theta_{i}^{r}-\theta_{i})^{2} \tag{15}\]  
where \(\theta_{i}^{r}\) and \(\theta_{i}\) are the actual joint radian and starting point radian of the UR10 robot at the target point. When an iterative algorithm is utilized to resolve the inverse kinematic model of the UR10 robot, due to the existence of \(T_{\text{tool}}\) and \(T_{\text{dis}}\), which causes inaccuracy of the end effector to increase. Therefore, the constraint condition of the SQP algorithm can be set as the inaccuracy of the pose of the laser focus. Since the allowed position inaccuracy and pose inaccuracy of the laser focus differ, the position and axial constraints are described in Equations (16) and (17), respectively. \[\text{st}:\sqrt{\sum_{j=1}^{j=3}(\theta_{1}^{T}\gamma_{4}-\theta_{6}^{T}\gamma _{4})^{2}}-\text{es}\leq 0 \tag{16}\]  
\[n^{\prime}\cdot n\leq\text{cos}\big{(}\text{es}^{\prime}\big{)} \tag{17}\]  
In Equation (16), \(\text{es}^{\prime}\) is the maximal allowable pose inaccuracy, \(\text{T}^{\prime}\) represents the actual pose of the target point, and \(T_{\text{ij}}\) is the element on the \(i\)-th row and \(j\)-th column. In Equation (17), \(\text{n}^{\prime}\), equals \((\theta_{1}^{T}\gamma_{13}^{\prime}\theta_{1}^{T}\gamma_{23}^{\prime}\theta_{ 13}^{T})\), represents the axis of the laser focus and \(n\) represents the actual axial direction of the target points. The SQP algorithm decomposes a problem into QP (quadratic programming) sub-questions. By finding the descending direction \(d\) of the current angle sequence \(\theta_{k}\) in QP sub-questions and updating \(\theta_{k+1}\) via \(d\), the SQP algorithm meets the Karush-Kuhn-Tucker (KKT) conditions or reaches the maximum number of iterations. The precise operation process of the SQP algorithm is described below. In the first step, the current Lagrangian function \(L(\theta_{k},\lambda)\) which is depicted in Equation (18), of the current angle sequence \(\theta_{k}\) is established. \[L(\theta_{k},\lambda)=f(\theta_{k})+\lambda g(\theta_{k}) \tag{18}\]  
In equation (18), \(\lambda\), which is larger than 0, is the Lagrange multiplier. In the second step, the descending direction \(d\) of the current \(\theta_{k}\) is identified. Equation (18) can be transformed into the solution for \(d\), which is shown in Equation (19). The Hessian matrix in \(L(\theta_{k},\lambda)\) is represented by \(H_{\text{k}}\). \[ \begin{split}&\min_{d}\
abla f(\theta_{k})^{T}d+\frac{d^{T}H_{ \text{k}}d}{2}\\ & st:\ g(\theta_{k})+\
abla g(\theta_{k})^{T}d\leq 0\end{split}  \tag{19}\]  
In the third step, the angel sequence is updated and \(\theta_{k+1}\) equals \(\theta_{k}\) plus \(d\). Whether the result meets the KKT conditions or reaches the maximum number of iterations is determined. If the result meets the KKT conditions or reaches the maximum number of iterations, iterations will be terminated. If not, the second step is repeated. Equation (20) shows the KKT conditions. \[ \begin{array}{l}\
abla f(\theta_{k})+\lambda g(\theta_{k})=0;\\ \lambda\geq 0;\\ g(\theta_{k})\leq 0;\\ \lambda g(\theta_{k})=0\end{array}