*3.1. Cowshed Point Cloud Preprocessing Results*

In order to clarify the influence of the preprocessing method of point cloud data on the pusher robot in different motion states, the pusher robot collected 3D point cloud data in static and moving (forward speed is 0.5 m/s) states. From the collected 3D point cloud data, 200 frames of point clouds were selected for preprocessing. The number of preprocessed point clouds and the processing time of the filtering algorithm are shown in Table 2. It can be seen from the table that the pre-processed average point cloud numbers of the data collected by the robot at rest and in motion were 3257 and 3249, and the total average processing time was 0.338 and 0.319 s. There was no significant change in the number of point clouds and the total average processing time, which indicated that the preprocessing method selected in this study was suitable for machines in different motion states. Comparing the processing time of through filtering, downsampling filtering, and statistical filtering, it was found that statistical filtering took the longest time (0.122 s), accounting for 37.5% of the total preprocessing time, which was not conducive to real-time processing.


**Table 2.** Cowshed point cloud preprocessing results.

The visualization results of the preprocessed 3D point cloud data are shown in Figure 8. The ROI point cloud was extracted by pass-through filtering (Figure 8a), and the number of processed point clouds was 9872, which was reduced by 40%, and significantly reduced the number of point clouds; the number of point clouds after voxel downsampling filtering was 4777, which was reduced by 70%, and still retained the structural features of the original point cloud data (Figure 8b); the number of point clouds after statistical filtering was 8253, and 7% of outliers were removed (Figure 8c); after fitting the ground plane, the number of point clouds was 3257, which reduced the ground point cloud data by 79%, and retained the fence information (Figure 8d).

**Figure 8.** Visualization diagram of point cloud preprocessing: (**a**) Through filtered point cloud, (**b**) Statistical filtered point cloud, (**c**) Down sampling filtered point cloud, (**d**) Point cloud after ground removal.

#### *3.2. Extraction Results of Fence Lines and Paths*

In the experiment, Gaussian noise and artificial noise were added to the cowshed point cloud data, and the LSM and RANSAC were used to extract the fence lines and the initial paths. The visualization results were shown in Figure 8 and Table 3. It could be found from Figure 9 that both methods could process the fence point cloud data, and the processing effect was better. From Table 3, the value of the slope of the right fence line extracted by the LSM was −0.095 after adding artificial noise. Compared with no noise added (the value of the slope was about −0.061), there was a larger error and the extraction effect was reduced. The LSM considers the shortest distance from the overall point cloud to the extraction line and the phenomenon that the extracted fence line deviates when many data are deviating from the fence point cloud. The results of the RANSAC extracting fence lines without adding noise, adding Gaussian noise, and adding artificial noise (take the value of the slope of the right fence line as an example) were about −0.058, 0.058, and −0.061, respectively, and there was no significant change, indicating that RANSAC has certain resistance to both Gaussian noise and man-made noise. It could be seen from Table 2 that after adding artificial noise, the intercept value of the initial path extracted by the LSM was about −0.610, and the group without noise (the intercept was about −0.603) was quite different; The intercepts value extracted by the RANSAC in the three groups were −0.602, −0.603, and −0.601, and the intercept changes were not obvious, indicating that the RANSAC was better for initial path extraction.


**Table 3.** Extraction of bullpen line and initial path analysis by LSM and RANSAC.

From the analysis of the processing time of the two methods, it could be found that there was no significant difference in the processing time of RANSAC in the non-noise group, the Gaussian noise group, and the artificial noise group. The processing time (2.352 × <sup>10</sup>−<sup>3</sup> s) of the LSM without noise group was significantly different from the other two groups, indicating that the processing time of RANSAC was less affected by noise than the LSM method. The running time of RANSAC is significantly lower than that of LSM transform, and RANSAC can obtain better real-time performance by selecting a reasonable number of iterations.

**Figure 9.** Results of extracted ridgeline and initial path by three methods under different noise. (**a**) Least squares method; (**b**) Random sampling consistency.

#### *3.3. Simulation Analysis of Obstacle Avoidance Algorithm*

In response to the problem that the traditional artificial potential field method is prone to the defect of falling into minimal values, a new repulsion field function is proposed, and the selection range of the repulsion field gain coefficient is analyzed. In order to verify the effectiveness of the improved artificial potential field method when there are multiple obstacles, and the influence of parameter selection on the obstacle avoidance effect. This paper conducts simulation experiments in MATLAB BR2020a. Since there are cows and feed belts on both sides of the fence, it is only necessary to place obstacles at the proximal and distal ends of the feed belts. The simulation space adopts a 10 × 10 grid map. It sets the coordinates of the starting position of the robot to be (0, 0) marked with a square, and the coordinates of the end point of the target point to be (10, 10), marked with a triangle, and the obstacle coordinate points marked with circles are set between the two to simulate the actual situation.

As shown in Figure 10, five obstacle coordinate points were set, with the coordinates being (1.1, 1.2), (3, 2.4), (5.5, 5.5), (6, 2), and (8, 8.5). Then, the simulation parameters were set: the improved repulsion potential field parameter gain coefficient value *Ď* = 5, the gravitational potential field gain coefficient value *ξ* = 15, the value of the maximum distance that obstacles affect the mobile robot was 1.5 m, and the iterative step size of the mobile robot was 0.1 m. The simulation results showed that the mobile robot could successfully move from the starting point to the target point and achieve the effect of avoiding obstacles.

**Figure 10.** Simulation results of improved artificial potential field method.

To illustrate the influence of the improved artificial potential field algorithm parameter selection on the obstacle avoidance effect, the obstacle avoidance effect of the mobile robot in the moving process is analyzed from the perspective of reducing the repulsion force and the gain coefficient of the gravitational potential field. Figure 11a showed the simulation results when the repulsive potential field gain coefficient was too small. It could be clearly seen that although there would be some collisions with obstacles during the movement, the robot could still move to the target point in the end. Figure 11b shows the simulation results when the gravitational potential field gain coefficient was too small. It can be clearly seen that the mobile robot would oscillate back and forth at certain positions. In addition, the robot cannot reach the set target point.

Figure 12 shows the situation where the obstacle is located on the extension line between the robot and the target point, and the target point is within the repulsive potential field of the obstacle. At this time, the coordinates of the target point are set to (8, 8), the coordinates of the obstacle are set to (9, 9), and the maximum action radius of the repulsive potential field of the obstacle is 1.5 m. The mobile robot reaches the target point smoothly according to the planned path.

**Figure 11.** Simulation results when the gain coefficient is not selected: (**a**) The repulsion gain coefficient is too small; (**b**) Gravitational gain coefficient is too small.

**Figure 12.** Simulation results when the target point is in the middle.

Figure 13 shows the simulation results when the obstacle is set between the starting point and the target point, and the resultant force is on the connection line between the two, in which the position coordinates of the obstacle in Figure 13a are (5, 5); the position coordinates of the obstacles in Figure 13b are (5, 5), (4.5, 5.5), (4, 6), (3.5, 6.5), and (3, 7). It can be seen that the robot can successfully get rid of the minimum point and avoid obstacles when it falls into a local minimum value during the movement process, and finally can move to the target point.

Take single obstacle and multiple obstacles as examples, the simulation results of the traditional artificial potential field method are shown in Figure 14 below. It can be seen that compared with the improved artificial potential field method, the traditional artificial potential field method will fall into oscillation when the robot is close to the obstacles, and requires more steps when it is away from the obstacles, which is not conducive to the rapid obstacle avoidance of the robot.

**Figure 13.** Simulation results when obstacles are in the middle: (**a**) Single obstacle; (**b**) Multiple obstacles.

**Figure 14.** Simulation results under traditional artificial potential field: (**a**) Single obstacle; (**b**) Multiple obstacles.

The above results show that the improved artificial potential field method has better performance under reasonable parameter selection. The forward path is predicted and judged before the robot moves, and simplifies the restricted obstacles; that is, the robot only affects the repulsive force of the obstacles on the target side within the affected range; then, a reasonable virtual target point is set near the simplified obstacle, and the improved repulsion function guides the robot to quickly generate a smooth, stable, and collision-free path in a complex environment. Moreover, the rationality of the selection of the gravitational potential field gain coefficient and the repulsive potential field gain coefficient directly affects the obstacle avoidance effect. The algorithm can realize the obstacle avoidance function of a mobile robot.

#### *3.4. Experimental Research on Obstacle Avoidance*

A simple obstacle avoidance test is carried out on the designed pusher robot in this section. The static obstacle is set up in the experiment. In the three scenarios, the maximum speed of the inspection robot is set to 0.5 m/s. Due to the low vehicle speed, the influence radius of obstacles is set to 1.5 m; objects detected within 1.5 m in front of the robot are regarded as obstacles. In the obstacle avoidance experiment, after placing the static obstacle objects in the test area, the robot is initialized to collect and model the surrounding environment information. The robot is instructed to move along the extracted path to verify the robot's response to static obstacles. After the robot completes the map construction and bypasses the obstacles, it quickly moves in the direction of the robot.

The pusher robot performs linear work toward the target until the robot moves to the position shown in Figure 15a. At this time, the robot enters the influence range of the obstacle. Under the combined action of attraction and repulsion, it deflects an angle to the right to drive. Figure 15b shows the position where the robot is closest to the obstacle. Under the action of the resultant force, the robot gradually crosses the obstacle until it successfully reaches the end point (Figure 15c). During the entire driving and obstacle avoidance process, the closest distance to the obstacle is 0.41 m. The optimized path increases the shortest distance value of the obstacle point cloud from the navigation path from 0.18 to 0.41 m, where the average time is 0.059 s and the standard deviation is 0.007 s, which shows that the optimization method can optimize the path in real time to avoid obstacles, basically meeting the requirements of security and real-time performance, and effectively avoiding the local minimum problem The entire obstacle avoidance path is relatively smooth, which can successfully avoid obstacles and reach the destination point. The test proves that the pusher robot can efficiently extract the working path, make timely decisions when detecting static obstacles, avoid collisions with obstacles, and has good stability and reliability.

**Figure 15.** *Cont*.

**Figure 15.** Obstacle avoidance scene and process: (**a**) Find the obstacle; (**b**) Get around obstacle; (**c**) Keep working.
