*5.1. Experiments of Clustering Algorithm*

To verify the effect of the improved local density clustering algorithm (ILDCA) in this paper, the agaricus bisporus was taken as an example to test, and the test data were all from the site of the planting factory. The data is shown in Figure 12a. The pictures were taken on the spot by the harvesting robot, and the mature fruits recognized by visual are marked with red circles. The mature fruit data obtained from the image identification are processed by the clustering algorithm proposed in this paper, and the obtained clustering result is shown in Figure 12b, in which the fruits belonging to the same cluster are marked with the same color. Comparing a and b of Figure 12, it can be seen that the success rate of clustering is close to 97%, which fully meets the requirement of clustering identification in robotic harvesting.

**Figure 12.** The processing result of clustering algorithm processing. (**a**) visual identity map of ripe fruits; (**b**) The processing result of the improved clustering algorithm.

In order to further verify the effectiveness of the algorithm, this paper selects much more samples with different fruit numbers, cluster numbers, and discrete point numbers to conduct multiple sets of experiments and compares them with the commonly used clustering algorithm K-means algorithm and Gaussian mixture algorithm. The results are shown in Table 3. It shows that the K-means algorithm has the worst effect in processing the clustering of the fruits in this paper, whose average success rate is only 68%. Compared with the K-means algorithm, the Gaussian mixture algorithm is more flexible in the shape of the clustering, but it is more difficult to adapt to the characteristics of this paper with many small clusters and many discrete values, and the average success rate is merely 78%. However, the effect of the improved algorithm is much better than the other algorithm, with its average success rate is up to 97%. Additionally, as the number and complexity of clusters increase, the superiority of the improved clustering algorithm remains stable. So, the improved clustering algorithm is suitable to solve the clustering problem of strawrotting fungus.


**Table 3.** Clustering algorithm comparison of many groups of samples.

*5.2. Experiments of Multiobjective Optimization Algorithm for Multiarm Cooperative Harvesting Trajectory*

Take the three-arm Agaricus bisporus harvesting robot as an example to verify the effect of the proposed approach, as shown in Figure 13.

**Figure 13.** The multiarm intelligent harvesting robot working in the multistory shelf trays in the factory environment.

Three sets of data containing 40, 55, and 70 fruits, respectively, are selected as the first experimental data, which are shown in Figure 14. The detailed harvesting information for the fruits to be harvested in Figure 14 is shown in Appendix A, where (X, Y, Z, C) is used to express the harvesting information for fruits. X, Y, and Z represent the coordinates of the center point of the fruit to be harvested. C indicates the cluster number the fruit should belong to, which can be obtained by the clustering algorithm proposed in this paper.

The proposed IGAACMO algorithm is used to optimize the harvesting trajectory of the real fruit data (Figure 14). Furthermore, the two-chromosome genetic algorithm (DCGA) and the genetic stepwise algorithm (GAGA) are also used to plan the trajectory of the three-arm robot with the experimental data to compare with the processing results of the algorithm proposed in this paper.

**Figure 14.** Pictures of fruit harvesting area from planting factory. (**a**) contain 40 fruits; (**b**) contain 55 fruits; (**c**) contain 70 fruits.

The parameter settings are as follows: (1) the crossover probability is set to 0.15, the population is set to 30, the mutation probability is set to 0.015, and the maximum iteration number is set to 500. (2) In the ant colony algorithm, let 1 be the set of the important factors of pheromone, let 30 be the set of the number of ants, let 5 be the set of the intensity of pheromone, and let 10 be the set of the important factors of heuristic pheromone, let 0.1 be the set of the volatile factors and let 500 be the set of the maximum iteration number; (3) the moving speed of the harvesting arm (V) is given as 100 mm/s and the harvesting execution time (t1) is given as 5 s.

The convergence performance of the algorithm is shown in Figure 15. It indicates that when the picking scale is 40 (i.e., 40 fruits need to be picked), the iteration number of the proposed algorithm is about 50% less than that of DCGA, 67% less than that of GAGA, and the optimal harvesting time of GAAC is 14% better than DCGA and 11% better than GAGA; When the picking scale is 55, the iteration number of GAAC is about 67% less than that of DCGA, and 75% less than that of GAGA, and the optimal harvesting time of GAAC is 22% better than DCGA, and 15% better than GAGA; When the picking scale is 70, the iteration number of the proposed algorithms is about 28% less than that of GAGA, about 22% less than that of GAGA, and the optimal harvesting time of the proposed algorithm is 26% better than DCGA, and 19% better than GAGA. Therefore, compared with the other two methods, the convergence speed and optimization ability of the algorithm proposed in this paper are better.

**Figure 15.** Comparison of convergence performance of three algorithms. (**a**) contain 40 fruits; (**b**) contain 55 fruits; (**c**) contain 70 fruits.

The other results obtained by the three algorithms and the important parameters are shown in Table 4. By comparing these parameters, the following can be seen: (1) The algorithm proposed in this paper has the best multiarm task distribution uniformity and the highest utilization of multiarm cooperation. The greater the number of fruits to be harvested, the more obvious the advantages compared with the other two algorithms; (2) The harvesting success rate after using the improved algorithm in this paper can always be guaranteed to be above 95%.


**Table 4.** Comparison of experimental results of the three algorithms.

The harvesting trajectory optimized by the IGAACMO algorithm is presented in Figure 16. The harvesting assignment task of each harvesting arm is relative balance, and there is basically no redundancy in the trajectories.

**Figure 16.** Trajectory diagram optimized by IGAACMO algorithm. (**a**) contain 40 fruits; (**b**) contain 55 fruits; (**c**) contain 70 fruits.

Because the larger the ratio of the number of clusters to the total number of fruits is, the more it will affect the performance of the algorithm. Another 10 more experiments are added to verify the stability of the proposed algorithm further. The number of ripe fruits ranges from 40 to 70, with the proportion of clusters ranging from 20% to 60% as well.

The results of the ten group experiments are shown in Table 5. The average harvesting efficiency optimized by the proposed algorithm is 1183 pcs/h, which is about 21% higher than that of the DCGA algorithm and about 15% higher than that of the GAGA algorithm. In the meantime, the average harvesting success rate is 97%, much better than the other two algorithms as well. All of the group results are basically consistent with Table 4. This indicates that the algorithm designed in this paper can achieve a better harvesting trajectory for the multiarm intelligent harvesting robot for fruits with different distributions.


**Table 5.** Comparison of the three algorithms with 10 groups data.

#### **6. Discussion**

The harvesting trajectory planning of a multiarm straw-rotting fungus harvesting robot is a typical NP-hard problem. It can be better optimized by the IGAACMO algorithm, which is proposed in this paper.

In terms of running speed, the IGAACMO is obviously superior to the other two methods (DCGA and GAGA). Moreover, the larger the processing scale (the more fruits to be picked), the greater the convergence advantage.

In terms of the optimization results, the amount and distribution of ripe fruits have an impact on the results. The algorithm is sensitive to the distribution density of the fruit to be picked. With the increase in fruit density, the picking efficiency will decrease. This shows that the closer the fruit distribution is, the more difficult it is to avoid a collision, which makes some picking arms have to wait and reduces the picking efficiency. However, compared with the other two algorithms, the optimization effect of the proposed algorithm is better under the same conditions, especially in the case of the fruit distribution with high density.

In particular, there is another important issue with the fruit cluster that needs to be harvested in a specific order. There are two ways to deal with this issue. One is to regard the fruits in the same cluster as a whole and assign them to the same arm to harvest them in a specific order, which is mostly adopted at present. The other is to allocate them to multiple different arms on the premise of ensuring the required harvesting order, which is an improved method proposed in this paper. The latter method is superior to the former one, especially when the distribution of fruits in each accessible area is seriously uneven, with large fruit clusters stretching across two different accessible areas as well, as shown in Figure 17. The red circle represents the fruit to be picked, and the black circle represents the immature fruit. The picking robot has three arms, and the working area is divided into five accessible areas, where S1 (1,1) represents the exclusive area for Arm1, and the fruits in this area can only be harvested by arm1, S2 (1,2) is the partial shared area that can only be harvested by Arm 1 and Arm 2, S3(1,3) is the fully shared area that can be harvested by all three arms, S4 (2,3) is the partial shared area that can be harvested by Arm 2 and Arm 3, and S5(3,3) is the exclusive area that can only be harvested by arm 3. Most of the fruits to be picked are distributed in the exclusive area S1 (1,1) and the partial shared area S2 (1,2), and there is a large fruit cluster C1 over the two areas, meanwhile. The comparison of the results of the above two methods is shown in Table 6. All of the fruits in the fruit cluster C1 are allocated to Arm2 and the number of fruits allocated to Arm1 is very few by using the GAAC algorithm, which greatly increases the cycle time. However, by comparison, C1 is split and assigned to Arm1 and Arm2 respectively, resulting in a more uniform harvesting task among each arm, thereby improving the harvesting efficiency further.

**Figure 17.** Diagram with serious uneven distribution of fruits.

**Table 6.** Comparison results of different allocation methods for fruit clusters.


It can be shown that when the distribution of mature fruits is seriously ununiformly, with some fruit clusters across multiple accessible areas as well, it is easy to cause the uneven task assigned to each arm by assigning the total fruits in a cluster merely to the same arm, which results in some arms waiting for no picking tasks meanwhile other arms have too many picking tasks. This will greatly increase the cycle time of harvesting, thereby seriously reducing the picking efficiency. The algorithm proposed in this paper, combined with the auction mechanism, can allocate the fruits in a cluster to different arms on the premise of ensuring the required harvesting order instead of allocating them to a single arm, which can resolve this issue appropriately. Therefore, it can be concluded from all the above discussions that the algorithm proposed in this paper has strong optimization ability and good stability. For fruits with different densities, the picking tasks for each arm can be evenly distributed even though the fruits are not uniformly distributed on the culture medium or soil, with some fruit clusters across multiple accessible areas as well; thereby, it can not only achieve higher harvesting efficiency but also a higher success rate. The algorithm can better adapt to the issues of dense and uneven distribution of fruits caused by the natural growth of straw-rotting fungus.

#### **7. Conclusions**

This paper takes a straw-rotting fungus multiarm harvesting robot as the research object. Aiming at the problem of uniform task allocation and sequential harvesting for clustered mature fruits in multiarm cooperative harvesting trajectory optimization, an improved multiobjective optimization algorithm, IGAACMO, is proposed. The multiarm cooperative harvesting trajectory planning is abstracted to an MTSP problem. We use an improved local density bi-directional clustering algorithm to identify the clustered fruits to provide preparation for harvesting the clustered mature fruits in the specified order; Then, GA is adopted to decompose the MTSP into m independent TSP problems, where a new DNA coding method is designed to make the harvesting task of each harvesting arm evenly distributed under the constraining of the SSIS area. Subsequently, we use the ant colony algorithm to plan the trajectory of the above M-independent TSP, respectively; Here, by combining with the auction mechanism, the clustered fruits can be planned to be harvested in their specified order.

From all the above experiments and discussion, it can be shown that the optimization ability of the proposed algorithm, IGAACMO, is significantly stronger than the other two methods. The average harvesting efficiency optimized by the proposed algorithm is up to 1183 pcs/h, and the average harvesting success rate is 97%.

In addition, since the hourly harvesting efficiency of the multiarm robot has reached the manual efficiency, the daily harvesting efficiency of the robot will be significantly higher than the manual, even if it can be up to at least twice that of the manual. Because the robot can work for at least 16 h per day (considering battery replacement, layer change, and other auxiliary work), while people generally work for 8 h per day. This efficiency greatly increases the feasibility of the robot applied to the actual harvesting of straw-rotting fungus instead of manual.

However, the operation time of the algorithm is not faster enough. In future research, the algorithm needs to be improved to increase its efficiency of the algorithm to improve its real-time control further.

**Author Contributions:** S.Y.: Writing—original draft, writing—review and editing, conceptualization, methodology, investigation, data curation, formal analysis, software, validation, production of related equipment, funding acquisition. B.J.: writing—original draft, writing—review and editing, data curation, validation, software, production of related equipment. T.Y.: investigation, conceptualization, project administration. J.Y.: investigation, writing-review and editing, conceptualization. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research was funded by the Shanghai Science and Technology Innovation Action Plan-Agriculture, Grant No. 21N21900600; Shanghai Agriculture Applied Technology Development Program, Grant No. 2019-02-08-00-10-F01123; Major Scientific and Technological Innovation Project of Shandong Province, Grant No. 2022CXGC010609-7; Mechanical Engineering (Intelligent Manufacturing) Plateau Discipline of Shanghai Polytechnic University.

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** Anyone can access our data by sending an email to szyang@sspu.edu.cn.

**Acknowledgments:** We acknowledge the Shanghai Lianzhong edible fungus professional cooperative for the use of their mushrooms and facilities.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **Appendix A**

**Table A1.** The detail data with the information of the fruits to be harvested in Figure 14.


#### **Table A1.** *Cont.*

