1. Introduction
Nowadays, robotic manipulators have effectively replaced skilled technicians in various industrial applications, such as welding, sorting, and assembly. However, in agricultural scenarios, automation still faces formidable challenges, particularly in the development of robotic harvesters.
For harvesting robots, a primary challenge lies in recognizing targets and obstacles within complex environments to obtain their precise spatial coordinates. While computer vision is typically employed for this task, conventional methods often struggle to distinguish targets from obstacles due to the unstructured nature of agricultural scenes and severe occlusions caused by dense branches and leaves [
1]. Recent advancements in deep learning, particularly Convolutional Neural Networks (CNNs), have significantly enhanced the performance of fruit and branch detection [
2]. However, these techniques require large-scale labeled datasets that are labor-intensive and expensive to collect. Furthermore, different harvesting targets necessitate specialized datasets. Regarding tomato harvesting, no comprehensive publicly available dataset currently exists for the simultaneous detection of tomatoes and branches, leaving the reliable recognition of these elements a persistent challenge.
Path planning presents another critical bottleneck for robotic harvesters, especially for dual-arm systems. Two major difficulties arise in this context. The first is the complex obstacle avoidance problem. In agricultural environments, robots must not only reach the target fruits but also navigate around unpredictable obstacles. Since fruits and branches are physically interconnected, any collision with a branch may shift the fruit’s position, thereby reducing the success rate of traditional open-loop planning. To mitigate this, we employ a dual-arm system to mimic the human harvesting process, where one arm stabilizes the branch while the other picks the fruit. This approach necessitates a collision-free path planning method that accounts for both environmental obstacles and self-collision between the two arms—a classic and complex motion planning problem. The second difficulty involves orientation constraints on the end-effector. The harvesting process often requires the end-effector to maintain a specific pose—such as remaining horizontal or holding a precise angle—to prevent pushing the fruit away before it can be captured. Currently, sampling-based algorithms like Rapidly-exploring Random Trees (RRT) [
3] are widely used due to their probabilistic completeness and extensibility to high-dimensional problems. However, while RRT can ensure that the robot reaches a target pose, it struggles to enforce strict orientation constraints throughout the entire path [
4]. Moreover, sampling-based methods suffer from high computational complexity as the state-space dimensionality increases; for a dual-arm system like ours, the sampling dimension reaches 12 degrees of freedom (DOF), which is exceptionally high.
The success of Artificial Intelligence has prompted researchers to explore deep reinforcement learning (DRL) for robot control. DRL provides a robust alternative for handling complex tasks that are difficult for conventional methods, as it maps environmental observations directly to control actions with superior adaptability [
5]. Despite these advantages, DRL often suffers from poor sample efficiency, leading to long and difficult training processes. Consequently, high-fidelity simulation environments are typically utilized for model training. In this paper, we develop a custom dataset for tomato and branch detection and utilize a semantic segmentation network to identify these components. By integrating segmentation results with point clouds from anRGB-D camera, we accurately determine the spatial coordinates of the targets. To enhance harvesting success, a dual-arm strategy is implemented to mimic human-like coordination. We employ DRL to achieve collision-free path planning under orientation constraints, carefully defining the state-action space and reward functions. Furthermore, a novel policy network architecture is designed to improve learning performance by decoupling the task. We established a simulation environment based on real harvesting scenarios; the results from both simulation and real-world experiments demonstrate that our method generates effective, collision-free paths that strictly satisfy the orientation constraints for dual-arm manipulators. The remainder of this paper is structured as follows:
Section 2 reviews the related works.
Section 3 describes the materials and methods.
Section 4 presents the experimental results and analysis.
Section 5 discusses the findings, followed by our conclusions in
Section 6.
2. Related Works
The perception technologies of robotic harvesters based on computer vision can be divided into two kinds: deep learning and conventional image processing technologies. Wang et al. [
6] used the HSV color space to detect mature apples and utilized the highlight spots generated by camera flashes to distinguish green apples from leaves. Similarly, Lv et al. [
7] and Liu et al. [
8] successfully recognized tomatoes in RGB or HIS color spaces using the OSTU automatic threshold segmentation method. Qiang et al. [
9] further extended this by employing Multi-class Support Vector Machines (SVMs) combined with morphological operations to simultaneously segment mature citrus fruits and branches, achieving a fruit recognition rate of 92.4% under various lighting conditions. However, in practice, methods based on color segmentation and traditional machine learning are highly sensitive to ambient light. Even with automatic thresholding, the relative simplicity of these models limits their adaptability to changing harvesting environments and their ability to handle occlusions caused by foliage. The development of deep learning has significantly enhanced the robustness of agricultural perception. Rahnemoonfar et al. [
10] utilized CNNs for apple detection, achieving 91% accuracy on real-world images, while Fu et al. [
11] applied similar techniques to kiwifruit. For tomato harvesting, Liu et al. [
12] implemented an improved YOLOv3 model with an image pyramid structure for multi-scale feature fusion, achieving a 92.39% mAP for detecting small-scale pests and diseases in complex backgrounds. Beyond simple detection, the integrated perception of fruits and branches has become a research focus to support complex harvesting tasks. Kang et al. [
1] proposed DaSNet-v2, a multi-functional network for real-time detection, instance segmentation of apples, and semantic segmentation of branches. Similarly, Majeed et al. [
13] utilized SegNet to achieve semantic segmentation of apple trees by leveraging both RGB and depth information to filter background noise. To obtain the precise spatial coordinates required for collision-free planning, Lin et al. [
14] proposed a pose estimation method using a low-cost RGB-D sensor, where an FCN segments fruits/branches and Euclidean clustering is applied to point clouds for 3D reconstruction. Furthermore, Gené-Mola et al. [
15] introduced a mobile terrestrial laser scanning approach, reaching a recognition success rate of 82.4% in real orchards. However, deep learning-based techniques require large amounts of labeled images, which are expensive to collect. As for tomato harvesting, there is still a lack of comprehensive datasets that include both fruit and branch labels, meaning the simultaneous recognition of tomatoes and their supporting structures remains challenging.
Obstacle avoidance and end-effector orientation constraints are two major challenges to be addressed in path planning algorithms for robotic harvesters. Baur et al. [
16] simplified environmental obstacles into geometric primitives, such as cylinders and spheres, and planned collision-free trajectories based on the artificial potential field method. Hemming et al. [
17] adopted an RRT-based planning algorithm to achieve autonomous picking of peppers. However, these methods often overlook the orientation constraints of the end-effector during the harvesting process. Consequently, picking failures may occur when the robot approaches the target from an improper angle, inadvertently pushing the fruit away rather than capturing it. To address these constraints, several approaches have been proposed, including trajectory optimization-based methods [
18] and workspace sampling-based methods [
19]. Nevertheless, sampling-based algorithms suffer from high computational complexity as the state-space dimensionality increases. For dual-arm systems like the one used in this study, the sampling dimension reaches 12 degrees of freedom (DOFs), which poses a significant challenge for conventional sampling-based methods.
With the rapid development of deep learning, deep reinforcement learning (DRL) has emerged as a prominent research topic in the field of robot motion and path planning. Liu et al. [
20] successfully trained a dual-arm system to perform cooperative tasks—such as reaching, pushing, and picking—in a simulated environment using the DADDPG algorithm. Similarly, Bojan et al. [
21] combined reinforcement learning with intelligent control frameworks to enable an articulated robot to perform complex door-opening maneuvers, validating their approach through both simulation and real-world experiments. In [
22], the authors employed PPO [
23] and DDPG [
24] to train a manipulator in a dynamic environment containing three randomly moving cubic obstacles. Their agent achieved an 85% safety success rate, effectively reaching target positions without collisions.
The advantage of DRL lies in its ability to learn complex control policies directly from high-dimensional sensory inputs, potentially overcoming the limitations of traditional planning methods in unstructured environments. This capability has led to its widespread adoption in agricultural applications in recent years. Ref. [
25] formulated agricultural picking sequence planning as a three-dimensional traveling salesman problem (TSP) and solved it using a pointer network-based actor–critic DRL framework. Li et al. [
26] developed a DRL-based harvesting strategy for clustered kiwifruits, in which fruit recognition and localization, as well as picking order planning, are first performed, followed by DRL-based optimization to generate an efficient harvesting strategy. Yi et al. [
27] proposed a self-supervised DRL-based view planning method that employs a Self-Supervised Convolutional Network to evaluate the effectiveness of actions during training and dynamically adjust rewards to guide policy learning. Liu et al. [
28] proposed an expert experience-based guided reinforcement learning strategy for high-DOF robotic arms in apple picking, outperforming RRT in planning time and path quality. Feng et al. [
29] introduced an enhanced HER-SAC algorithm that incorporates a heuristic action fusion strategy during training to optimize cherry tomato picking. Despite the promising potential of deep reinforcement learning (DRL), its application to agricultural harvesting tasks remains constrained by factors such as reinforcement environment design, network architecture, and deployment methodologies, which often result in relatively low success rates when DRL is directly applied to train harvesting robots.
3. Materials and Methods
In this section, we first formulate robot path planning in tomato harvesting as an RL problem. The state, action, reward function, and network architecture designed by us will be introduced. Then the framework of our dual-arm path planning method for tomato harvesting is illustrated, including the tomato and branch detection method.
3.1. RL Problem Formulation
We model the interaction between our dual arms and harvesting environment as a Markov Decision Process (MDP), defined by the tuple . The state for the MDP is . is the state of the left arm, which contains the robot’s current joint angles , robot’s current end-effector position , and robot’s current end-effector orientation , where are Euler angles. Similarly, the state of the right arm is . is the position of the target tomato and is the position of the branch.
In each episode, the dual arms begin at a fixed initial joint state. At each time step t, the two arms take an action according to the policy . The action space in this paper is defined as a twelve-dimensional vector, corresponding to the delta joint positions at each time step. At each time step, each joint position will only change degrees at most. The step is small so that every action can be executed smoothly on our JAKA manipulator under servo control mode. The control frequency is about 30 FPS to make sure that the manipulator will not move too fast or too slow.
3.2. Reward Function
The agent receives a reward
and transits to the next state
after action
is taken. The goal of the agent is to maximize the expected return from each state. Consequently, by editing the reward function, we can guide the agent to perform our expected actions. The reward function is defined as
To motivate the agent to discover the collision-free path, we design a reward function
to guide the agent to avoid collisions. When a collision happens, i.e., [Collision = 1], a large value of the reward will be deducted, as shown in Equation (
2).
On the other side, we also want the arms to move to the target at an appropriate orientation, as shown in
Figure 1. Hence, we design a reward function
to control the orientations of the dual arms.
is the angle between the target and the approaching vector of the end-effector, as shown in
Figure 1a.
is added to the reward function to make the robot move right towards the target. A similar orientation constraint is also required for the arm that is to grasp the branch.
d is the distance between the branch and the approaching vector of the end-effector, as shown in
Figure 2.
denotes the reward designed to guide the dual arms of the system toward their respective target positions, as defined in Equation (
4). Specifically, the assignment of the manipulator for grasping the tomato and the branch is first determined based on the arms’ relative positions. From the robot’s egocentric view, if the tomato is located on the left side of the branch, the left arm is designated to grasp the tomato; otherwise, the right arm is selected. Here,
represents the end-effector position of the arm assigned to grasp the tomato, while
denotes the end-effector position of the arm assigned to grasp the branch. The variables
and
correspond to the target grasping positions of the tomato and the branch, respectively, and d(·) measures the Euclidean distance between an end-effector and its corresponding target position. A smaller distance yields a higher reward value. When the distances of both arms to their respective targets are less than
, the task is considered completed, and a larger terminal reward is granted.
3.3. Network Architecture
The whole tomato harvesting task is very complex, as we can see in the last part, including reaching the target, collision avoidance, and orientation constraints for both arms. The input of the network is also very complex, including different kinds of information about two arms and targets. Conventional MLP policy networks prove inadequate in effectively analyzing input state and integrating coupled information to fulfill the three tasks of grasping, obstacle avoidance, and end orientation control. Consequently, we propose a novel network architecture to decouple the task, as shown in
Figure 3.
The tomato grasping state includes the position of the tomato and the state of the robot that is to grasp the tomato , which contains the joint angles, position, and orientation of the end-effector. Similarly, the branch grasping state includes the position of the branch and the state of the robot that is to grasp the tomato . Collision avoidance state includes the state of both arms. For the Q network, the action will also be added to each state. The three decoupling networks each take one part of the state as input and generate features about a specific relatively simple task, respectively.
The network is optimized for our harvesting task by reducing the complexity of feature extraction. Specifically, we use a decoupling network to extract features and an integration network to combine them and generate the output. To further enhance the network’s performance, we design an actor network that separates the calculation process of the action for each arm, thereby preventing distraction by irrelevant features.
Soft Actor–Critic (SAC) [
30], a model-free policy gradient algorithm, is adopted for policy and Q function learning. It has better exploration capabilities and stronger robustness. The hyperparameters we use in the training are a discount factor
, a decoupling network size of 512, and an integration network size of 1024 for the actor network and 1536 for the Q network.
3.4. Framework of Dual-Arm Robotic Tomato Harvesting
The framework of our dual-arm path planning method for tomato harvesting is shown in
Figure 4.
The task-decoupling policy network is trained in a simulation environment using the SAC algorithm. Since the network does not require image input, the sim2real problem is not a concern in this case. When deployed on a real robot, the network obtains the robot status information from the JAKA API, while the positions of fruits and branches are estimated by our semantic segmentation network.
For RGB image segmentation, there have been many depth learning models with excellent performance, such as U-Net, Mask RCNN, etc. In previous work [
31], we proposed a U-Net-like network for rice root image segmentation shown in
Figure 5. In this study, we used this network for tomato fruit and branch segmentation. To this end, we took 1000 photos of tomatoes and branches and created a semantic segmentation dataset through manual annotation; some of the annotated pictures are shown in
Figure 6. In the experiments, an individual tomato fruit can be approximately modeled as a sphere with a diameter of around 100 mm, while the branch can be approximated as a cylindrical structure with a diameter ranging from 10 to 15 mm and a length of approximately 300–400 mm. After training, the mIoU of the model is 80.6%, the accuracy rate is 96.3%, and the Kappa coefficient is 0.8545. The model performance meets the requirements.
5. Discussion
The experimental results validate that the proposed subtask-decoupling framework significantly enhances the performance of dual-arm tomato harvesting. The marked difference in success rates between our method and the conventional MLP network (96% vs. 52%) indicates that directly mapping high-dimensional inputs to actions in a 12-DOF space often leads to local optima, where the agent prioritizes safety over task completion. By decoupling the state space into specific modules for grasping, stabilizing, and obstacle avoidance, our architecture reduces the complexity of feature extraction, allowing for more precise coordination.
While RRT achieved low position error, its failure to maintain continuous orientation constraints and its high computational cost in high-dimensional spaces make it less suitable for real-time agricultural tasks compared to our DRL-based approach. The “pushing” effect observed in RRT-planned paths (
Figure 10) underscores the necessity of the orientation-aware reward function used in our model. Furthermore, the successful sim-to-real transfer demonstrates that a state-based policy can effectively bypass visual noise, though future work should address the flexibility of real tomato branches to further enhance robustness in dense orchard environments. Overall, this “stabilize-and-pick” strategy provides a reliable foundation for complex, multi-arm agricultural manipulation.