In this paper, a localization and navigation guidance algorithm based on the tree row in orchards for agricultural robots was proposed. In this algorithm, the tree rows formed by the trunks of parallel planting grape trees were used as auxiliary information. Together with the relative position provided by IMU, odometer and 3D LiDAR, the proposed algorithm was used to calculate the position and orientation of the moving robot. Firstly, the coordinates of the robot were obtained by the vehicle positioning system, and then the orientation of the tree and the posture of the robot relative to the tree row were determined through the 3D LiDAR point cloud, to ensure that the robot can parallel walk along the tree row and maintain a specific distance. Finally, the odometer, IMU data and LiDAR point cloud image were deeply fused to determine the accurate position and orientation to complete the path planning in the orchards. Experimental results show that the algorithm can effectively improve the positioning accuracy of the robot walking in the orchard and ensure that the robot can walk along the tree row without hitting the trees.