# Research on a PSO-H-SVM-Based Intrusion Detection Method for Industrial Robotic Arms
## 4 Experiments and Evaluation of Results
### Data Collection and Processing  
In the experiments, we collected the joint state data during the real-time closure operation of the robotic arm, which was used as the training data set for the machine learning model mentioned in Section 3.2. In the whole process of data collection, the robot arm completes the closure operation process in real time, that is, it starts to run from the initial position, grabs and places the target object in the designated position, and finally, the robot arm resets and returns to its initial position; the control terminal subscribes to the joint status data in real time to ensure the authenticity and availability of the collected data. In the experiment, we chose a sampling frequency of 200 Hz, that is, a sampling period of 5 ms, to acquire a set of joint state data on the robotic arm. The method of data collection was to subscribe to the/joint_state_publisher message topic by writing a topic  
Figure 5: Physics experiment platform. subscription program through the ROS control terminal. This topic publishes the joint state data structure under sensor_msgs.msg, which contains information such as the joint position, joint speed, motor current value and time stamp of each joint of the robotic arm. In order to show the data of the subscription terminals more visually, we created a table as shown in Table 1, and due to space limitation, only two sets of data are shown. After subscribing to the message data of this topic, we chose to store the joint position, joint speed and current value of the motor in the data structure as JSON format files for later data processing. In the experiment, a total of 10 paths of the complete closure operation process were collected, and the 5 states were stored as 5 data files in the whole closure workflow. Then the tags of the corresponding state data files were marked out, and finally, all the joint state data and the corresponding tags were integrated to complete the production of the training data set. In order to verify the authenticity and usability of the data, the collected joint data were played back in the experiment, the robotic arm executed some of the collected joint data, and the experiment proved that it can complete the task of grasping and placing the target object. In order to have a better training effect, we processed the collected data. The units for joint position and joint speed as collected through the ROS terminal are radians (rad) and rad/s. The data are generally small, and in order to have a better model training effect, the unit was converted from the radian system to the angle system. The joint acceleration value is used in the feature vector; however, at the control terminal, we only collected the joint velocity value, and the joint acceleration value needs to be calculated when performing data processing. However, the process of velocity data acquisition will be affected by noise, and if the data are not processed, that will affect the accuracy of the acceleration calculation. So, in this paper, the zero-phase low-pass Butterworth filter was used to filter the noise of the velocity data, and this filter uses a 10 Hz cut-off low-pass frequency. The acceleration value was calculated after noise filtering of the velocity data, and the formula is as follows:  
\[\text{Ac}= \frac{\text{v}_{\text{t2}}-\text{v}_{\text{t1}}}{\text{t2}-\text{t1}},\text{t2}-\text{t1}>0 \tag{8}\]  
where, Ac is the joint acceleration value; v\({}_{\text{t2}}\) and v\({}_{\text{t1}}\) are the velocity values at the moment of t2 and t1, respectively; and the sampling period is 5 ms in the experiment, so t2 - t1 = 0.005. The above process completes the data acquisition and data processing work, which are fully prepared for the subsequent model training and intrusion detection experiments.