1. Introduction
Intelligent water-spraying robots have attracted increasing attention due to their potential applications in real-world scenarios such as firefighting, agricultural irrigation, and building façade cleaning. In firefighting tasks, robots are required to accurately direct water jets toward flames in complex and cluttered environments while maintaining a safe distance from hazardous areas [
1]. In agricultural irrigation, crops are typically distributed irregularly in three-dimensional space, requiring precise control of water jet positions to ensure efficient watering while minimizing water waste [
2]. Similarly, in building cleaning and industrial washing tasks, water jets must be directed toward specific surface locations at varying heights and orientations [
3]. Achieving accurate water jet targeting in these scenarios is challenging because the landing position of the jet depends on multiple factors, including the nozzle position, orientation, jet velocity, and environmental disturbances such as air resistance. These factors introduce complex nonlinear dynamics that are difficult to model precisely using traditional analytical approaches.
Furthermore, studying robotic fluid manipulation is also important from the perspective of embodied intelligence. As robots are expected to operate in increasingly diverse environments, they must interact with objects with different physical properties, such as rigid bodies, deformable objects, and fluids. Compared with rigid object manipulation, fluid interaction introduces additional challenges due to its complex and dynamic behavior. Therefore, investigating robotic water jet control not only addresses specific application needs but also contributes to improving the general manipulation capabilities of robots in complex environments.
Water jet control therefore represents a complex robotic manipulation problem. Existing robotic fluid manipulation studies have largely focused on liquid pouring tasks [
4,
5], where fluids mainly flow downward under gravity. However, practical applications such as plant watering, firefighting, and high-altitude cleaning involve more complex spatial target distributions. To simplify the problem, many existing methods restrict certain control variables. For example, some approaches fix the spray angle while adjusting only the nozzle position [
6]. In firefighting robotics, this strategy forces the robot to rely on base mobility for coarse positioning, which severely restricts its ability to reach targets in vertically cluttered environments such as multi-story buildings. Similarly, other studies keep the nozzle position fixed and vary only the spray angle to control the landing point [
7]. While effective for planar targets, this approach cannot accommodate irregular three-dimensional crop distributions in agricultural settings, where plants vary in both height and horizontal offset. These simplified strategies fundamentally limit the controllable workspace and make it difficult to reach arbitrary target positions in three-dimensional space. Moreover, such control strategies often require significant manual tuning.
The choice of a robotic manipulator for water jet control is motivated by its inherent advantages in dexterity and flexibility. Unlike fixed spraying systems or those with limited mobility, a robotic arm provides multiple degrees of freedom (DOF), enabling simultaneous and continuous adjustment of both the nozzle’s position (X, Y, Z) and orientation (pitch, yaw). This capability is essential for directing a water jet to arbitrary points in three-dimensional space, a fundamental requirement in applications such as firefighting, where the robot must maintain a safe distance from hazardous areas while accurately targeting flames, or in agricultural irrigation, where crops are distributed irregularly across varying heights and angles. By leveraging the full pose control of a manipulator, the system can overcome the constrained workspace limitations of prior approaches [
6,
7] and achieve precise targeting under complex environmental conditions. Furthermore, studying robotic fluid manipulation with high-DOF arms contributes to the broader goal of embodied intelligence: as robots are expected to operate in increasingly diverse real-world scenarios, they must acquire the ability to interact with objects of varying physical properties, including rigid bodies, deformable materials, and fluids. Mastering water jet control thus serves not only a practical application need but also as a foundational step toward enhancing the generalization and adaptability of robotic systems in unstructured environments.
Reinforcement learning (RL) offers a novel research paradigm for water jet control tasks. Unlike traditional control methods that rely on accurate modeling, RL enables adaptive learning and optimization of control policies through interaction with simulation environments, without requiring explicit and complex fluid dynamic models. In contrast, conventional water control methods struggle with high-dimensional control problems due to their inherent limitations in control dimensionality. These methods often operate under constrained conditions, for instance, with fixed spray angles, which leads to limited adaptability and generalization capability. Despite the demonstrated flexibility and adaptability of RL in handling complex control tasks, existing replay mechanisms exhibit significant limitations in environments characterized by sparse rewards and complex goal spaces.
Hindsight Experience Replay (HER) mitigates the sparse reward problem by relabeling failed trajectories as successful experiences relative to achieved states, thereby improving learning efficiency. However, its uniform goal sampling neglects the varying importance of experiences for policy improvement, resulting in suboptimal sample utilization. In contrast, Prioritized Experience Replay (PER) assigns sampling weights based on Temporal Difference (TD) errors [
8], enabling faster convergence but still suffering from inefficiency in sparse-reward scenarios due to the lack of valuable feedback samples. Integrating HER and PER has been explored to combine goal diversity with prioritized learning, yet the pseudo-success samples generated by HER distort the TD error distribution. Because these relabeled goals cluster in simpler regions of the task space, PER’s prioritization mechanism is weakened, ultimately reducing training effectiveness.
To overcome these limitations, this paper proposes Goal-Priority Hindsight Experience Replay (GPHER), a joint sampling framework that incorporates both goal-space distance and TD error. Adaptive weighting is applied to balance their influence across different training stages. Integrated with the Truncated Quantile Critics (TQC) algorithm, GPHER is evaluated in a simulated water jet control environment with air resistance modeling. Experimental results show that GPHER significantly accelerates convergence and enhances policy stability, achieving higher success rates, especially for high-difficulty targets, thereby improving both learning efficiency and generalization in complex robotic fluid control tasks.
Figure 1 illustrates the overall framework of the proposed robotic water jet control system. The framework includes three main stages: simulation environment construction for modeling the robotic manipulator and fluid dynamics, reinforcement learning–based policy training using the TQC algorithm combined with the proposed GPHER mechanism, and finally sim-to-real deployment with physical validation on a robotic platform. This pipeline illustrates how the water jet control task is formulated, how the learning agent is trained in simulation, and how the learned policy is transferred to the real system for evaluation.
4. Methodology
4.1. State and Action Space of the Simulation Environment
The simulation environment for the robotic water jet control task was developed using the PyBullet physics engine, incorporating a particle-based fluid model to simulate the behavior of water droplets. All simulation experiments were conducted using Python 3.11 and PyBullet (version 3.2.7) on Ubuntu 22.04. The kinematic analysis of the water jet trajectory is formulated as follows:
As shown in
Figure 4, let the world coordinate system be denoted as
, and the end-effector coordinate system of the robotic arm as
. Its pose is represented by a rotation matrix
and a translation vector
. The rotation matrix
satisfies the definition of the Special Orthogonal Group:
where
represents the coordinates of the origin of the end-effector frame
expressed in the world frame
. The column vectors of the rotation matrix R correspond to the projections of the basis vectors of
onto
, given by:
here,
,
,
represent the unit basis vectors of
projected in
. The Z-axis of the end effector coordinate system corresponds to the direction of the water jet. The jet direction vector can be obtained from the third column of
:
which satisfies the normalization condition:
where the pitch angle
and yaw angle
are used to describe the orientation of the nozzle relative to the world coordinate:
For a desired target location (
), all simulated particles are sorted by their vertical distance from the target plane, and the first
k particles with the smallest distances are selected to form a cluster. The centroid of this cluster
defines the landing position of the water jet:
In the proposed robotic water jet control environment, the state space consists of three components:
- (1)
The Cartesian position of the end-effector ;
- (2)
The nozzle orientation described by pitch and yaw angles ;
- (3)
The distribution of the landing points of the water droplets on the target plane .
The action space corresponds to the continuous joint position commands for the seven joints of the robotic manipulator. Each action represents the target position increment applied to the corresponding joint at each control step. This formulation enables smooth motion control while maintaining compatibility with the physics simulation and facilitating sim-to-real transfer.
In summary, this section defines the state and action representations used in the robotic water jet control environment. The formulation captures the essential geometric relationship between the manipulator pose, jet direction, and landing position of the water particles.
For simplicity, several assumptions are adopted in the simulation environment, including a simplified particle-based representation of the water stream. While these simplifications improve computational efficiency during reinforcement learning training, they may not fully capture all complex fluid dynamics in real-world spraying scenarios. Nevertheless, the adopted model is sufficient for learning stable control policies and provides a reliable platform for evaluating the effectiveness of the proposed reinforcement learning framework.
4.2. Reward Function Design
Given the geometric nature of the water jet control task, the primary objective of the agent is to minimize the distance between the actual water jet landing point and the target location. Thus, a sparse reward function is defined as:
where
is the centroid of the selected water particle cluster,
is the target position, and
represents a small tolerance threshold. In this work, a sparse reward scheme is adopted. The use of sparse rewards reduces the risk of bias introduced by artificially designed dense reward functions [
12].
The sparse reward formulation encourages the agent to focus on achieving accurate target reaching without introducing additional heuristic biases. However, this reward design simplifies the task objective by considering only the final landing position of the water jet. Other practical factors, such as water distribution efficiency, obstacle interference, or energy consumption, are not explicitly modeled in this study and may be considered in future work.
4.3. Goal-Priority Hindsight Experience Replay
Although HER has certain advantages in expanding the number of samples, the data it generates are not fully utilized by PER. The core idea of HER is to convert failed experiences into successful ones through goal relabeling, which can significantly increase the number of positive samples. Nevertheless, these ‘hindsight goals’ are essentially virtual successes computed based on substitute goals. Since trajectories rarely reach high-difficulty positions during training, simpler goals are more likely to be resampled by HER. When these samples are incorporated into PER’s priority calculation, the TD error may not accurately reflect their value for policy improvement, and they may even be assigned excessively high priorities, leading the agent to over-rely on pseudo-success samples during training and weakening the exploration of true goals. This phenomenon is particularly prominent in complex water jet control tasks, where the task goal space is large, samples of distant or high-difficulty goals are scarce, and the substitute samples generated by HER dilute the weight of these key experiences in PER, ultimately affecting the overall training effectiveness and policy reliability. Meanwhile, in water jet control task, the system has higher requirements for reaching remote or boundary target positions, and relying solely on HER and PER makes it difficult to balance efficiency and success rate. To address this limitation, this paper introduces an enhanced experience replay sampling strategy named GPHER. This method introduces a goal relevance measure on the basis of traditional PER and thereby optimizes the sample selection strategy to more effectively highlight experiences closely related to the task goals during sampling. As shown in
Figure 5, the GPHER framework designed in this paper further demonstrates its improved mechanism and workflow when combining HER and PER.
Within the framework of traditional PER that allocates sampling priorities based on TD error, it further adds the goal-space center distance as a weighting factor, thereby increasing the sampling probability of samples far from the goal center and forcing the agent to focus more on learning in high-difficulty goal regions. Meanwhile, the priority calculation not only depends on the desired goal itself but also incorporates the spatial relationship between the achieved goal and the goal center. Under the same goal conditions, it prioritizes sampling trajectory samples that are closer to difficult goals. The revised priority formula is:
where
is the goal of the current state transition tuple,
is the center of the goal space, m is the dimensionality of the goal space,
is the farthest distance in the goal space.
is the achieved position, The change in
is as follows:
where
represents the parameter value at training step
n, the maximum number of steps is
N, the initial value is
, and the final value is
. This dynamic adjustment mechanism is similar to the idea of Curriculum Learning, but the difference is that it acts on the experience replay mechanism rather than directly changing the task goals. Compared to achieving curriculum-like training by modifying goals, this method can gradually increase the sampling difficulty without introducing environmental mutations, thereby focusing more on learning difficult goals in the later stages of training.
Since the sampling probability of samples is proportional to the priority measure, the experience distribution deviates from the uniform sampling assumption, thereby introducing estimation bias. To eliminate this bias, PER introduces importance sampling weights:
where
N represents the size of the experience pool,
is the sampling probability of sample
i. The parameter
controls the correction strength. The weights are typically normalized:
the pseudocode of the Algorithm 1 is presented as follows:
| Algorithm 1 TQC-GPHER |
| Initialize the policy network TQC parameters, total training steps N, current step n, minibatch size k, replay period K, buffer D and |
| for episode = 1, X do |
| Sample a goal g and an initial state |
| for t = 0, T do |
| Select an action using the policy from Algorithm: |
| Execute action, interact with the environment and observe |
| end for |
| for t = 0, T do |
| Compute reward |
| Store transition into buffer D with priority: |
| Sample a set of goals G from the current episode states |
| for do |
| Compute relabeled reward |
| Store relabeled transition into replay buffer D |
| end for |
| end for |
| for t = 1 mod K then |
| for j = 1 to k do |
| Sample transition i from the buffer with probability |
| Compute importance-sampling weight as defined in Equation (23) |
| Compute TD error according to Equation (5) |
| Update transition priority according to Equation (20) |
| end for |
| Update network parameters |
| end for |
| end for |
In the subsequent experimental setup, this paper selects the currently well-performing Truncated Quantile Critics (TQC) algorithm as the basic reinforcement learning framework. On this basis, the proposed GPHER mechanism (Algorithm 1) is compared with various mainstream experience replay methods to systematically evaluate its performance improvement in water jet control task. The overall algorithm flow of TQC-GPHER is shown in
Figure 6. The robotic manipulator interacts with the simulation environment to generate trajectories, which are stored in the replay buffer and processed by the proposed GPHER sampling strategy before being used to update the policy network.
Overall, the proposed GPHER mechanism improves experience replay efficiency by integrating TD-error prioritization with goal-space difficulty information. This design enables the agent to focus more effectively on challenging goal regions during training. Nevertheless, the current formulation assumes that goal difficulty can be reasonably approximated by the distance from the goal-space center. Although effective in the considered water jet control task, more complex environments may require alternative difficulty metrics or adaptive goal representations, which remain an interesting direction for future research.
5. Simulations and Experiments
5.1. Simulation Environment Setup for the Robotic Water Jet Control Task
Direct training in real-world environments often faces issues such as low sample efficiency, high safety risks, and prohibitive experimental costs [
14]. Therefore, this paper chooses to train the robotic arm in a simulation environment to accomplish the water jet control task and validate the performance of the proposed TQC-GPHER algorithm. The experimental platform is built based on the PyBullet physics engine combined with the Gymnasium library to construct the reinforcement learning environment, as shown in
Figure 7. The figure shows the training process of an episode.
In this environment, the agent adjusts the water outlet position and jet angle by controlling the pose of the robotic arm. To ensure the quantifiability and observability of the experiments while maintaining applicability to real-world scenarios, this paper adopts a design scheme where “the robotic arm gripper holds a water pipe for spraying.” It should be noted that the water flow is modeled and generated by the PyBullet particle system. As this model does not explicitly consider aerodynamic effects, this study further incorporates the modeling of air resistance on fluid particles, adding air resistance to the motion state of each fluid particle at each simulation time step to improve the physical plausibility of the simulation and the credibility of the experimental results. This provides a more reliable foundation for subsequently applying the trained policies to real-world water jet control tasks (such as firefighting, agricultural irrigation, or high-altitude cleaning). The details of the simulation setup are presented in
Table 1.
First, the range of the water jet control task needs to be analyzed to determine a suitable target scope. The diameter d of natural raindrops is constrained to approximately 1–7 mm. In each simulation time step, fluid particles with a radius r = 3 mm are selected for jetting. The reachable space of the fluid is determined through Monte Carlo sampling to establish the set of reachable targets. According to
Figure 8, the target range can be taken as
. The initial velocity for particle jetting is set to 4 m/s. Data from the reachable target dataset where
are used for training:
5.2. Comparison with Baseline
To comprehensively evaluate the proposed method in the water jet control task, comparative experiments were conducted in the simulation environment using TQC as the base RL framework against various baseline experience replay mechanisms. All experiments used the same hyperparameters, listed in
Table 2.
For fair comparison, all methods were trained for the same total of 750,000 environment steps, and the success rate curves report the average performance over five independent training runs. Since the episode lengths vary across different runs, the success rate data were interpolated to a unified episode interval. A moving average was further applied to smooth the curves and reduce the influence of stochastic fluctuations.
Figure 9 shows the learning curves of each method. The results indicate that when HER and PER are simply combined, as PER relies solely on TD error for importance sampling, the virtual goal samples introduced by HER relabeling are not fully utilized, instead weakening the prioritized sampling effect of PER, leading to overall performance even worse than using HER alone. After approximately episode 1500, the success rate of this method shows a significant decline, indicating a lack of policy stability. In contrast, the proposed GPHER exhibits faster convergence speed in the early stages of training and reaches a success rate of about 95% around episode 1500. Subsequently, its success rate remains stable at around 98%, significantly outperforming HER and Prioritized Hindsight Experience Replay (PHER) (85% with large fluctuations).
For the water jet control task, stable reaching performance across the entire reachable space is essential. To evaluate performance in challenging goal regions, comparative tests were conducted between PHER and GPHER, both outperforming HER. Each method was tested over 100 episodes on two representative planes: the horizontal plane (X = 1) and the vertical plane (Z = 0), where the fluid particle landing density is highest. For consistency, all target regions were defined as square areas and discretized into 16 configurations. On the X = 1 plane, regions I–IV and A–D corresponded to evenly spaced segments along the Z-axes and Y-axes, respectively, while on Z = 0, they represented divisions along the X- and Y-axes. As shown in
Figure 10, GPHER achieves an average success rate of 96.8% in the edge and high-difficulty regions across the two evaluated scenarios, which is substantially higher than the 91.46% achieved by PHER. These results indicate that GPHER exhibits markedly improved performance in challenging boundary regions, demonstrating superior exploration efficiency, policy generalization, and robustness compared with PHER.
5.3. Ablation Experiment
To evaluate the contribution of each component in GPHER, ablation experiments were conducted in the same simulation environment, comparing TQC alone, HER, PER, and GPHER. As shown in
Figure 11, HER accelerates early-stage learning, reaching 80% success around episode 1100, but its relabeling mechanism favors simpler goals, limiting exposure to difficult targets and yielding a final success rate of 82%. In contrast, GPHER maintains higher sample efficiency throughout training and achieves a stable final success rate of 98%, significantly outperforming HER. This confirms that the joint prioritization of goal difficulty and TD error in GPHER effectively mitigates HER’s bias toward simple samples, enhancing both policy learning efficiency and generalization.
5.4. Extending PGHER to Other Reaching Tasks
To further verify the general applicability of the proposed GPHER method, this section selects the relatively simple robotic arm Reach task as a supplementary experimental scenario. In the experimental setup, adjustments were made to the previous training details: During the same 250,000 training steps, the minibatch size was reduced from 512 to 256, and the PyTorch-based DDPG algorithm was used as the base learning framework.
In the Reach task, the robot end-effector was required to reach randomly sampled target positions within a predefined three-dimensional workspace. Specifically, the goal positions were uniformly sampled from a cubic region defined in the world coordinate frame, with ranges of [−1, 1] m along the x-axis, [0, 2] m along the y-axis, and [0.1, 0.3] m along the z-axis.
A reaching attempt was considered successful if the Euclidean distance between the end-effector position and the target goal was below a predefined threshold of 0.05 m. The success rate was computed as the ratio of successful episodes over the total number of episodes and was averaged across multiple independent training runs.
The experimental results are shown in
Figure 12. As shown in the figure, GPHER achieves a success rate of approximately 0.95 within the first 500 training episodes, significantly outperforming the baseline methods during the early training stage. This indicates substantially higher sample efficiency compared with HER, PER, and their direct combination. Moreover, GPHER maintains a higher and more stable success rate throughout the remainder of the training process, with reduced performance fluctuations relative to the comparison algorithms.
5.5. Real-World Experiments
This paper further validates the effectiveness of the proposed method on a physical platform. The experiment adopts a two-stage deep reinforcement learning training framework, which separately models visual perception and the control policy. As shown in
Figure 13, the visual perception module performs target detection and localization of the watering area and landing points, providing this as structured input to the control policy module for subsequent path planning and action decision training. This design effectively avoids the reliance of end-to-end methods on large-scale fine-grained modeling and high-quality annotated data while enhancing the transferability and generalization of the algorithm.
The real-world experiments were conducted using a Franka Emika Panda robotic manipulator, a widely used 7-degree-of-freedom (7-DOF) collaborative robot designed for research applications. The robot has a maximum reach of approximately 0.85 m and a payload capacity of 3 kg. A water nozzle connected to a pressurized water source was mounted at the end-effector of the robotic arm, allowing the jet direction to be controlled through the end-effector pose.
During the experiments, the robotic arm was used to adjust the position and orientation of the nozzle to direct the water jet toward specified target locations. The distance between the robotic arm base and the target surface was approximately 0–2 m, which lies within the reachable workspace considered in the simulation environment. The water jet velocity was maintained at approximately 4 m/s, consistent with the parameter settings used in the simulation environment.
The control commands were generated by the trained reinforcement learning policy and executed through the robot’s position control interface. The control framework was implemented on a workstation running Ubuntu, where the trained neural network model was deployed using PyTorch (version 2.5.1) for real-time inference.
All experiments were conducted in an indoor laboratory environment with relatively stable lighting conditions and minimal airflow to reduce disturbances to the water jet. Although the experimental setup simplifies certain environmental factors such as wind disturbances and water pressure variations, it is sufficient to validate the effectiveness and robustness of the proposed control framework.
For the sim-to-real validation, models trained with three different replay mechanisms (HER, PHER, and the proposed GPHER) were evaluated on a physical robotic platform under identical experimental conditions. Two representative difficult target regions were considered: the boundary regions of the horizontal plane (Z = 0) and the boundary regions of the vertical plane (X = 1). For each scenario, 100 target positions were randomly sampled and tested.
As summarized in
Table 3, the proposed GPHER method consistently achieves the highest success rates across all evaluation settings. In the difficult target regions on the vertical plane (X = 1), GPHER attains a success rate of 0.93, outperforming PHER and HER by 10 percentage points (0.83 for both). Similarly, on the horizontal plane (Z = 0), GPHER reaches a success rate of 0.95, compared with 0.84 for PHER and 0.82 for HER, corresponding to a relative improvement of approximately 13.1% and 15.9%, respectively.
When evaluated over randomly sampled target positions across the entire goal space, GPHER maintains a high success rate of 0.96, exceeding PHER (0.85) and HER (0.81) by 11 and 15 percentage points, respectively. These results indicate that GPHER not only improves overall task success but also demonstrates superior robustness and generalization capability in real-world conditions.
Notably, the performance gap between GPHER and the baseline methods is most pronounced in the difficult target regions, which correspond to the boundary areas of the workspace where control precision and trajectory stability are hardest to achieve. This observation aligns with the design motivation of GPHER, which explicitly increases the sampling priority of high-difficulty goals during training, enabling the learned policy to better handle edge cases that are underrepresented in standard replay strategies.
6. Conclusions and Future Works
Addressing the lack of techniques in the field of intelligent water jet control that enables directly hitting targets without imposing pose constraints, this paper proposes, for the first time, the use of reinforcement learning to control the robotic arm for this task. To address the issue where data generated by HER often concentrates within simple goal ranges, which results in an uneven goal distribution in the replay buffer, suboptimal learning efficiency, and low post-training policy success rates, particularly for critical edge targets in water jet control tasks, this paper proposes GPHER, an improved method that integrates HER and PER. Model validation shows that the proposed algorithm achieves a success rate of up to 99% in the simulated water control environment. Experiments conducted on a real robotic arm yield a success rate of 96% in the physical setup. Furthermore, validation performed on a Reach task demonstrates the method’s potential for generalization. Nevertheless, several limitations remain in the current study. The experimental setup does not explicitly model environmental disturbances such as wind or water pressure variations, which may influence the water jet trajectory in real-world applications.
Future work will focus on extending the proposed framework to more complex and realistic scenarios. In particular, we plan to incorporate fluid properties such as varying flow velocities and fluid viscosity into the state representation to better capture the physical characteristics of different fluids. Furthermore, the system will be integrated with a mobile robotic platform to expand the operational workspace and improve task flexibility. Finally, future studies will investigate the robustness of the proposed approach in outdoor environments with dynamic airflow and other environmental disturbances.