## 3 DNN Based Grinding Robot Kinematics Solution
### DNN Model  
In this paper, a deep neural network (DNN) method is proposed to solve the kinematic problems of grinding robot, the problem of solving robot kinematics is transformed into a weight coefficient matrix, bias vector, and input vector of training a neural network, and a series of linear operations and activation operations are carried out.  
This paper takes the KUKA KR300 R2500 6-DOF series robot (grinding robot) as an example. The essence of a forward kinematics solution is to solve the position and orientation (\(X\),\(Y\),\(Z\),\(A\),\(B\),\(C\)) of the end-effector of the manipulator under the condition of known joint variables (\(\theta_{1}\),\(\theta_{2}\),\(\theta_{3}\),\(\theta_{4}\),\(\theta_{5}\),\(\theta_{6}\)). Similarly, the inverse kinematic solution is to solve the angle of each joint in the case of known terminal position and orientation. Therefore, the six joint angles of the manipulator are taken as the input of the whole neural network, the input vector is \(J=[\theta_{1},\theta_{2},\theta_{3},\theta_{4},\theta_{5},\theta_{6}]\), the position and orientation of the end-effector are taken as the output of the whole neural network, and the output is \(W=[X,Y,Z,A,B,C]\). On the contrary, the inverse kinematics is solved by taking the terminal position and orientation as input and the joint angle as output.  
For the analysis of grinding robot kinematics, according to the topological structure type of neural network [34,35], a forward propagation neural network structure with six dimensions of input, six dimensions of output, and multiple hidden layers is established (as shown in Figure 6) to realize the desired mapping vector relationship from input space to output space.  
According to the classification of DNN's internal neural network layers, the layers are fully connected, any neuron in layer \(i\) must be connected to any neuron in layer \(i+1\), it is a linear relationship \(z=\sum c_{i}x_{i}+b\) plus an activation function \(\sigma(z)\).  
If the activation function is \(\sigma(z)\) and the output value of the hidden layer and output layer is \(w\), then the output of the second layer is available. The expression is as follows:  
\[\begin{array}{l}w_{1}^{2}=\sigma(z_{1}^{2})=\sigma(c_{11}^{2}x_{1}+c_{12}^{ 2}x_{2}+\cdots+c_{1k}^{2}x_{k}+b_{1}^{2})\\ w_{2}^{2}=\sigma(z_{2}^{2})=\sigma(c_{21}^{2}x_{1}+c_{22}^{2}x_{2}+\cdots+c_{2 k}^{2}x_{k}+b_{2}^{2})\\ \vdots\ \ \vdots\ \ \vdots\\ w_{k}^{2}=\sigma(z_{k}^{2})=\sigma(c_{kl}^{2}x_{1}+c_{k2}^{2}x_{2}+\cdots+c_{ kl}^{2}x_{k}+b_{k}^{2})\end{array} \tag{5}\]  
The output of the third layer is \(w_{1}^{3}\), the expression is as follows:  
\[w_{1}^{3}=\sigma(z_{1}^{3})=\sigma(c_{11}^{3}w_{1}^{2}+c_{12}^{3}w_{2}^{2}+ \cdots+c_{1k}^{3}w_{k}^{2}+b_{1}^{3}) \tag{6}\]Assuming that layer \(i-1\) has a total of \(m\) neurons, then the output of the \(j\) neuron of layer \(i\) is \(w_{j}^{i}\), the algebraic expression is as follows:  
\[w_{j}^{i}=\sigma(z_{j}^{i})=\sigma(\sum_{k=1}^{m}c_{jk}^{i}w_{k}^{i-1}+b_{j}^{i}) \tag{7}\]  
Assuming that the layer \(i-1\) has a total of \(m\) neurons, the layer \(i\) has a total of \(n\) neurons, then the layer \(i\) has coefficient matrix \(C^{i}\) of the order \(n\times m\), the bias vector for layer \(i\) has vector \(b^{i}\) of the order \(n\times 1\), the output of layer \(i-1\) has vector \(w^{i-1}\) of the order \(m\times 1\), the output of the inactive parameter at layer \(i\) has vector \(z^{i}\) of the order \(n\times 1\), the output of layer \(i\) has vector \(w^{i}\) of the order \(n\times 1\), the matrix expression is as follows:  
\[w^{i}=\sigma(z^{i})=\sigma(C^{i}w^{i-1}+b^{i}) \tag{8}\]  
where \(C\) refers to the matrix corresponding to the hidden layer and the output layer, \(b\) is the bias vector, \(z\) refers to the parameters contained in the activation function, \(w\) refers to the matrix corresponding to the output layer.