arXiv:2610.12140cs.ROOct 2026

Manuscript Offprint

arXiv:2610.12140

Leveraging Human-In-The-Loop Demonstrations in Reinforcement Learning for Digital Twin-Driven Robot Flexibility

Yuzhu Sun, Mien Van, Nguyen Minh Nhat, Stephen McIlvanna, Sean McLoone

Yuzhu Sun, Mien Van, Nguyen Minh Nhat, Stephen McIlvanna and Seán McLoone

Abstract—Growing automation makes collaborative robots work in more variable environments, increasing the need for adaptation. We propose a human-in-the-loop online training framework combining a digital twin (DT), reinforcement learning (RL), and human demonstrations. Unlike DTs used mainly to generate synthetic data before task execution, our DT is synchronized with the physical system in real time through camera feeds, allowing the virtual robot to update its observations and policy from real-world feedback. A dual actor framework integrates imitation learning (IL) without adding a direct imitation loss to the RL actor, so demonstrations can guide adaptation instead of manual reprogramming. The proposed framework is demonstrated on the Ufactory Xarm5 collaborative robot, where the robot's end-effector aims to reach the target position while avoiding obstacles. The experiments show that the framework can resume training after a change in the physical workspace and that, with a fixed set of non-optimal demonstrations, the dual actor framework achieves a much higher final success rate than two methods that add an imitation loss to the actor. The same pattern holds with real human demonstrations collected in virtual reality (VR): with demonstrations that never reach the goal, the dual actor framework reached 83–100% mean deterministic evaluation success, against 0–17% for the two imitation-loss methods.

Keywords— digital twin, reinforcement learning, robot manipulator, human-in-the-loop, demonstrations, obstacle avoidance

I. INTRODUCTION

With growing automation in Industry 5.0, sensor-equipped collaborative robots increasingly work alongside people rather than behind safety cages. More complex and unpredictable workspaces therefore require greater adaptability and flexibility [1]. Artificial intelligence (AI), particularly reinforcement learning (RL), can improve robot autonomy by learning through trial and error from environmental feedback [2]. Training RL agents directly on physical robots is costly, potentially hazardous, and often impractical. A digital twin (DT) represents the physical workspace in simulation, allowing an RL agent to train and receive feedback without repeated physical trials. Digital twins have often been used to generate synthetic data or provide simulated environments for training perception and control models before deployment [3]–[6]. Sim-to-real transfer methods seek to bridge the remaining differences between these virtual environments and the physical robot [7], [8]. This separation between training and operation becomes a problem when the workspace changes: the twin may no longer reflect the physical scene, and the model or policy may need to be updated [9]. Such updates can interrupt task execution.

We address this gap with a PyBullet digital twin of the Ufactory Xarm5 [10], linked to the physical robot through the Robot Operating System (ROS). Camera feeds keep the twin synchronized with the workspace in real time. If the twin detects that the current policy fails an obstacle-avoidance task after a workspace change, the RL agent resumes training in simulation.

During this resumed training, an operator can demonstrate the desired behaviour to guide the robot's adaptation. This lets the operator contribute task knowledge without manually reprogramming the robot or needing specialist AI expertise. Previous work has used demonstrations in offline reinforcement learning [11], [12] and in methods combining imitation learning (IL) with RL [13]–[15]. Many studies use datasets generated by pre-trained experts, which help evaluate algorithms but differ from demonstrations collected from operators during deployment. For value learning, demonstrated transitions also need reward labels [12]; raw human motion data do not provide these automatically. This makes it harder to use operator demonstrations during the resumed training described above. To address this, we capture the operator's movements in virtual reality (VR) and transfer them to the DT, where they guide the virtual robot. The DT evaluates each demonstrated step using the task reward and labels the resulting transitions automatically. The same environment therefore supports both resumed RL training and the preparation of human demonstrations.

The DT provides reward labels for human demonstrations, but it cannot make the demonstrated behaviour optimal. In our experiments, methods that combine IL and RL through an imitation loss on the RL actor [14]–[17] performed poorly with noisy, non-optimal demonstrations. The imitation loss encourages the actor to repeat those actions, potentially limiting its exploration of better solutions. To address this limitation, we use two actors with distinct roles: an RL actor learns from interactions with the DT, while an IL actor learns from human demonstrations. Both paths contribute to the critic target, which favours the one with higher estimated value. With non-optimal demonstrations, the proposed framework reached over 80% mean final training success, while two imitation-loss baselines rarely completed the task. Fig. 1

This work was supported by the European Commission through the Horizon Europe project HARMONICA under grant agreement No 101294331. Views and opinions expressed are those of the authors only and do not necessarily reflect those of the European Union or the European Commission.

Yuzhu Sun, Mien Van (corresponding author), Nguyen Minh Nhat, Stephen McIlvanna and Seán McLoone are with the School of Electronics, Electrical Engineering and Computer Science, Queen's University Belfast, Northern Ireland, UK. E-mail: ysun32@qub.ac.uk; m.van@qub.ac.uk; nnhat01@qub.ac.uk; smcilvanna0@qub.ac.uk; s.mcloone@qub.ac.uk

Figure

Fig. 1: The structure of the proposed system.

shows the framework. Our main contributions are:

  1. A hardware-in-the-loop DT that stays synchronized with the physical workspace and resumes RL training when a change causes the current policy to fail. Unlike DTs used mainly for synthetic data or training before deployment [3]–[6], it updates the learned policy during operation until the task can again be completed.

  2. A dual actor framework in which demonstrations train a separate behaviour-cloning actor and guide the RL actor only through the critic target. Without a direct imitation loss, the RL actor can explore beyond poor demonstrations.

  3. An evaluation with real human VR demonstrations that the DT labels with task rewards automatically. We report collection effort and workload; with complete demonstrations, the dual actor framework converged in all six seeds, compared with at most one for the imitation-loss baseline methods. We also test retraining in three additional modified scenes.

The remainder of this paper is organized as follows. Section II reviews related work. Section III describes the DT, and Section IV details the dual actor framework. Section V presents the experiments and discussion; Section VI concludes the paper.

References (50)