# Neural Network-Enhanced Fault Diagnosis of Robot Joints
## 3 Diagnosis Framework
### BP Neural Network for Classification
Analysing the above study, the following conclusions can be drawn: firstly, the diagnostic correctness is higher when the injected fault size is one degree, and the accuracy decreases but is still acceptable when the fault size is small. Secondly, classifying the positions of the end-effector as features can only achieve fault diagnosis for five joints, and the overall required data set is relatively large, requiring 60,000 sets of data and 1200 epochs to achieve an accuracy of 91% when the fault is 0.2 degrees, which is unrealistic in practical applications. When analysing the reasons for the lack of accuracy of the classifier, it is believed that the data, i.e., the positions of the end-effector, are not good enough to classify the existing trajectories and, even if there are only six segments of trajectories, there is also the problem that each segment of the trajectory has a strong correlation with the others, e.g., if the injected fault is 0.2 degrees, which is shown in Figure 8, the six segments of trajectories overlap more than in Figure 5, which has a 1-degree fault of the joint, and it is difficult to differentiate them even by the naked eye. When analysing the tasks of the individual joints of the robotic arm, Section 2 states that the sixth joint is used to control the rotation of the robot's wrist around its own axis, i.e., the rotation of the robot's end-effector. This means that it is possible to distinguish between faulty and fault-free trajectories of the sixth joint characterised by the orientation of the end-effector with respect to the base. Therefore, the attitude of the end-effector is used as a feature to achieve trajectory classification and fault diagnosis; the attitude is represented by the Pitch, Roll and Yaw in the Euler angles; the three values corresponding to the attitude feature are also extracted from its sub-transformation matrix in the robotic arm DH; the process of the feature extraction has already been given above; the rest of the algorithms are the same; and there are seven neurons in the output layer of the neural network (because the attitude can be put into the sixth joint faults from fault-free trajectories). It was found that the classification accuracy of the seven labelled data were found to be only about 65% when the injected fault was one degree, and the accuracy was independent of the database size for the same number of epochs. The results are shown in Table 6. \begin{table}
\begin{tabular}{l c c c c} \hline
**Sampling Number** & **Number of Epochs** & **Layers** & **Accuracy (\%)** & **Cross-Entropy Loss** \\ \hline
500 & 800 & 3-13-13-7 & 64.00 & 0.8464 \\
1500 & 800 & 3-13-13-7 & 65.48 & 0.7317 \\
5000 & 800 & 3-13-13-7 & 64.53 & 0.7383 \\ \hline \end{tabular}
\end{table} 
Table 4: Network training results of joint diagnosis for robots. Size of joint angle error = 1\({}^{\circ}\) (single feature: attitude). \begin{table}
\begin{tabular}{l c c c c} \hline
**Sampling Number** & **Number of Epochs** & **Layers** & **Accuracy (\%)** & **Cross-Entropy Loss** \\ \hline
500 & 400 & 6-13-13-7 & 97.67 & 0.4082 \\
1000 & 350 & 6-13-13-7 & 99.48 & 0.3265 \\
1500 & 350 & 6-13-13-7 & 99.62 & 0.1708 \\ \hline \end{tabular}
\end{table} 
Table 5: Network training results of joint diagnosis for robots. Size of joint angle error = 1\({}^{\circ}\) (dual features). The reason for this result is that, compared to using actuator positions as features, the actuator attitudes in each segment of the trajectory after injecting faults into each joint are more highly correlated with each other, and are more difficult to be extracted by the neural network. For example, the third and fourth joints have the same attitude of the end actuator after fault injection, the sixth joint has exactly the same Roll value as without fault, etc. This high correlation between differently labelled database at single-feature three data can greatly affect the classification accuracy of the neural network. Therefore, in summary, it was decided to use multi-feature fusion for fault diagnosis.