Abstract:Aiming at the complex road environment in greenhouse and the problem that greenhouse mobile robots cannot use GNSS for localization, research and experiments on greenhouse localization were carried out based on ORB-SLAM2. Firstly, the color image and depth information of greenhouse acquired by the depth camera Realsense D455 were preprocessed, and the scale and rotation invariance of ORB features was achieved by the image pyramid and grayscale center-of-mass method to complete accurate and effective feature point matching. Secondly, coarse localization was done by using tracking thread reference key frame tracking, homogeneous model tracking, and repositioning tracking, and then fine localization was done by using local map tracking to achieve an accurate solution for the camera pose. Thirdly, combining with the local map building thread, applying the common-view method to build up the map points based on the completion of the key frame insertion, the recent map point screening, the new map point screening, the new map point reconstruction, the local BA optimization, and the local key frame screening. Finally, combined with the closed-loop thread, the full map was corrected by loopback correction through the candidate loopback, computation of similarity transformation, loopback fusion, and position map optimization, so as to realize the greenhouse in the real-time localization and map building. Three greenhouses with different crop growth conditions in the early, middle and maturity stages of pepper growth were selected for real-machine testing, and the trajectories generated by the algorithm basically matched the actual trajectories, with the root-mean-square errors on the X-axis of 0.6862 m, 0.355 0 m, 0.4925 m, and the average absolute errors of 0.5883 m, 0.293 7 m, and 0.4554 m, respectively, and on the Z-axis of 0.149 7 m, 0.071 8 m, 0.3686 m, and the average absolute errors of 0.0986 m, 0.0464 m, and 0.2825 m, respectively. The experimental results showed that the method could provide technical support for the localization and navigation of greenhouse mobile robots.