*3.2. Algorithm Verification*

In the previous chapter, we introduced the method of fruit tree information perception. Next, the point cloud registration based on the 2D-ICP algorithm and the fruit tree position detection based on the LAPO-DBSCAN algorithm are tested.

#### 3.2.1. Experiment on Fruit Tree Information Acquisition

Firstly, the test platform is controlled to drive slowly from the beginning of the fruit tree to the end of the fruit tree to collect the point cloud data of the fruit trees. Then, all the initial point cloud data of the fruit trees are preprocessed, and the final result only retains the nearest point cloud data of the fruit tree on both sides of the test platform. The original point cloud data, as shown in Figure 5, show that the data in the untreated orchard have many interference points, such as the data collected from non-bilateral fruit trees and the "zero-points" generated by the 2D LiDAR sensor at a certain angle. During the preprocessing, we keep the data in the red box in Figure 5. The preprocessed data are shown in Figure 6.

**Figure 5.** A frame of original data.

**Figure 6.** A frame of preprocessed data.

After preprocessing, registration is performed based on the 2D-ICP algorithm to obtain the completed fruit tree row point cloud data. This paper takes the registration of two frame point cloud data as an example to illustrate the registration process of fruit tree point cloud data. The registration process is shown in Figure 7. In Figure 7a–e, the iterative registration processes of two point clouds are shown. The *R* and *T* from Figure 7a–e are calculated using Equations (6) and (7). The *<sup>R</sup>* and *<sup>T</sup>* are 0.999948 −0.010145 0.010145 0.999948 and 0.027403 0.139726 in Figure 7a. The *<sup>R</sup>* and *<sup>T</sup>* are 0.999992 −0.003975 0.003975 0.999992 and 0.010213 0.062397 in Figure 7b. The *<sup>R</sup>* and *<sup>T</sup>* are 0.999997 −0.002030 0.002030 0.999997 and 0.007544 0.030963 in Figure 7c. The *R* and *<sup>T</sup>* are 0.999999 −0.000753 0.000753 0.9999996 and 0.001915 0.018437 in Figure 7d. The *R* and *T* are 0.999999 −0.000435 0.000435 0.999999 and 0.002288 0.000870 in Figure 7e. Figure 7f is the result

of using a two-frame point cloud registration as the next target point cloud. All the preprocessed point cloud data of fruit trees on both sides of the test platform can be iteratively registered by the 2D-ICP algorithm to obtain complete the point cloud data of fruit trees, including the point cloud information of each fruit tree position, as shown in Figure 8. The fruit trees on both sides of the test platform in Figure 8a show the point cloud data in Figure 8b.

When using the 2D-ICP algorithm to construct point cloud data of fruit trees on both sides of the test platform, we need to consider two problems. The first question is how to obtain as much complete point cloud data as possible. The second problem is how to prevent the oscillation of the collected point cloud data due to the uneven ground of the orchard during movement. Therefore, on the one hand, we move the test platform as slowly as possible, so the vibration amplitude of the vehicle is not large in the process of moving. On the other hand, we choose a 2D LiDAR sensor with a high frequency, as shown in Table 1, to obtain more fruit point cloud data within a short period of time. Through these two measures, the adverse effects caused by the vibration of the test platform can be compensated for to a certain extent, and the obtained fruit tree point cloud information can be enriched, which is conducive to obtaining better point cloud registration results.

**Figure 7.** The 2D-ICP algorithm registration process. (**a**) First point cloud registration; (**b**) second point cloud registration; (**c**) third point cloud registration; (**d**) fourth point cloud registration; (**e**) last point cloud registration; (**f**) results after two-frame point cloud alignment.

**Figure 8.** Complete fruit tree row point cloud data. (**a**) Fruit trees on both sides of the test platform in the actual scene; (**b**) point cloud data corresponding to fruit trees on both sides of the test platform.

#### 3.2.2. Experiment on Fruit Tree Position Acquisition

After obtaining the point cloud data of the fruit trees on both sides of the test platform, we need to obtain the position of the fruit trees. The first task is to set relevant parameters. The number of initial cluster centers are set to four groups with six cluster centers in each group, and the maximum number of iterations is 10. Although the above parameters are set randomly, they should also be designed according to the actual situation. The value of the parameters should not be too large or too small. In the traditional DBSCAN algorithm, *Eps* is set to 0.58 m and *MinPts* is set to 3. *Eps* depends on the average radius of fruit trees on both sides. In the dynamic DBSCAN algorithm, *Dyn*\_*rad* depends on the minimum radius and maximum radius of fruit trees on both sides—namely, *Dyn*\_*rad* ∈ [0.42, 0.80]. *Dyn*\_*pts* depends on the quotient of the number of point clouds per frame of the 2D LiDAR sensor and the number of cluster centers in each group, namely, *Dyn*\_*pts* ∈ [3, 333]. The radius of fruit trees depends on their contours, as shown in Table 3. We regard the outline of the fruit tree as a circle and use the formula of the circumference of a circle to calculate the radius of the fruit tree.

The implementation process based on the LAPO-DBSCAN algorithm is as follows. According to the LAPO-DBSCAN algorithm, a set of clustering centers are obtained from step (3) to step (8). In three situations of the missing detection of some fruit trees, two clustering centers appear on one fruit tree and the clustering center obviously deviates from the fruit tree data. Here, we take two clustering centers together as examples, as shown in Figure 9a. Then, we obtain the complete cluster center through step (9) to step (13). Finally, the test results of fruit trees are obtained through step (14), as shown in Figure 9b, where the blue point is the data point and the red "×" is the clustering center. The corresponding cluster center coordinates are shown in Table 4. According to Figure 8b and Table 4, this algorithm can accurately detect the position of fruit trees.

**Table 4.** Two-dimensional LiDAR sensor parameters.


**Figure 9.** Algorithm detection results: (**a**) two cluster centers on a fruit tree; (**b**) results processed using this algorithm.

In Figure 8, the point cloud information of fruit trees on both sides was stored by the 2D-ICP algorithm. Therefore, the point cloud data were directly tested 100 times by the LAPO-DBSCAN algorithm, as shown in Table 5. One hundred iterations of the LAPO-DBSCAN algorithm are shown in Figure 10.

**Table 5.** Actual scene test results.


**Figure 10.** Actual scene, 100 iterations.

In Table 5, the positive detection rate of the algorithm is 96.69%, the false detection rate is 3.31%, the accuracy is maintained at more than 95%, and the average processing time is 1.14 s, which meets the accuracy requirements for the actual scene. Therefore, this algorithm can be used for the detection of fruit trees in orchards. This has certain practical significance for future navigation in orchards.

#### **4. Discussion**

In this research, the contour information of surrounding fruit trees was collected by a 2D LiDAR sensor mounted on an experimental platform, and the point cloud registration of fruit trees on both sides of the transportation robot was completed by the 2D-ICP algorithm. Then, the point cloud data were analyzed using the LAPO-DBSCAN clustering method to obtain the coordinate position points of each fruit tree. The most important thing is to propose a fruit tree position detection algorithm based on LAPO-DBSCAN. This algorithm has obvious advantages over those proposed in previous studies. Compared with K-means clustering, this algorithm does not need to set the number of clustering centers to be detected in advance, which makes it more convenient. Compared with the DBSCAN, this algorithm is more adaptable and can classify fruit trees more accurately. Compared with LAPO, this algorithm takes less time and is more accurate. Comparing the results of the simulation data (Table 2) with the results of the actual scene (Table 5), it can be seen that with the increase in environmental characteristics (from the detection of fruit tree trunks to the detection of fruit tree crowns), although the accuracy of the algorithm is reduced and the processing time is prolonged, the accuracy remains above 95% and the average processing time is 1.14 s, which generally meets the accuracy requirements of actual scenes. Therefore, this method can be used for the detection of fruit trees in orchards.
