Robot-mediated rehabilitation has the potential to deliver high-intensity, individualized therapy, but existing systems (which have not consistently improved outcomes) typically prescribe kinematic trajectories rather than explicitly targeting the neuromotor activations thought to support recovery. To address this gap, and ultimately enable activation-optimizing rehabilitation robot behavior, we present a personalizable transformer-based model mapping individuals' muscle activations (as measured via surface electromyography) to prescribed contact force trajectories when interacting with an end-effector rehabilitation robot. The model uses a transformer encoder-decoder leveraging rotary positional embeddings (RoPE) to generate a latent representation of trajectory-relevant and user-specific neuromotor factors, and augments trajectory prediction with flow matching to produce a distribution over plausible prescriptions biased toward the training distribution. Using data from 16 healthy participants completing 15 isometric trajectory tracking tasks, we evaluate generalization across held-out tasks and users, as well as the feasibility of user-specific fine-tuning within a therapy-session timescale. The model achieves mean trajectory prediction errors of <8% on held out tasks and users, with effectively instantaneous deterministic inference and sub-second sampling of trajectory distributions. An initial test using the model during live rehabilitation tasks demonstrates that, on average, participants reach the target neuromotor activations with just 15% error accumulated throughout the task. These results provide a proof of concept for data-driven, activation-targeted trajectory prescription in robot-mediated rehabilitation and establish a foundation for future validation in clinical populations. Data and code have been open-sourced as part of the OpenRobotRehab project on SimTK.
Figures & tables
Figure 1: End-effector robot-mediated rehabilitation platform. Users exert forces on a LBR iiwa 14 R820 7-degree-of-freedom cobot (KUKA AG, Augsburg, Germany; a) via a custom handle attached to a SensONE 6-axis force torque sensor (Bota Systems AG, Zürich, Switzerland; b). Users’ forces along each positional axis are mapped to the corresponding x/y/z velocity of an on-screen avatar ball (c), where the z axis into and out of the screen is represented by a decrease and increase in avatar size, respectively. Users are instructed to follow a target ball along a displayed trajectory. Force and game trajectory data (of both avatar and target) are collected at 1000 Hz and 60 Hz, respectively. During this process, two Trigno Quattro 4-channel sensor motes (d), controlled through a Trigno Base Station (Delsys, Inc., Natick, MA, USA) collect surface electromyography (sEMG) data at a rate of 2.22 kHz from 8 upper limb muscles (e). Electrode placements are as follows: anterior deltoid (AD), middle deltoid (MD), posterior deltoid (PD), and biceps brachii (BB), grounded at the acromion (G1); and triceps brachii (long head, TR), brachioradialis (BR), wrist flexors (FL), and wrist extensors (EX), grounded at the olecranon (G2). All data are collected and synchronized via Redis (MongoDB, Inc., New York, NY, USA). Full implementation details are included with code release.
Task No.
Task
Other axes locked?
Force required for unit velocity x/y/z motion (N)
Repe-ti-tions
Dura-tion (s)
Trajectory displayed?
Trai-ning set?
Test set?
T01
x -axis
No
15/15/36
3
60
Yes
✓
T02
y -axis
No
15/15/36
3
60
Yes
✓
T03
z -axis
No
15/15/36
3
60
Yes
✓
T04
x -axis
Yes
15/−/−
3
60
Yes
✓
T05
y -axis
Yes
−/15/−
3
60
Yes
✓
T06
z -axis
Yes
−/−/36
3
60
Yes
✓
Table 1: Trajectory Tracking Tasks
Figure 2: Architecture of trajectory prescription model. Latent representation z of both target-associated information ( zv ) and unknown neuromotor behavior ( zU ) is generated using a RoPE [ 17 ] transformer encoder ( blue flow), then decoded separately to generate prescribed trajectory v^target ( green flow) and estimated activation a^ ( turquoise flow). A flow-matching diffusion model [ 12 ] is also trained to generate a conditional distribution of zv given zU whose samples can be passed through the target trajectory decoder to generate a distribution over v^target ( orange flow).
Metric
Model
Components
Error (mean ± standard deviation)
Traj. Dec.
Act. Dec.
Flow Mat.
Training Set
New Tasks
New Users
New Tasks & Users
MSETD
Naive MLP
✓
0.106±0.273
0.097±0.233
0.238±0.462
0.106±0.204
LSTM
✓
0.155±0.308
0.068±0.143
0.191±0.354
0.063±0.128
Minimal
✓
0.016±0.109
0.108±0.211
0.099±0.256
0.115±0.213
+ Act. Dec.
✓
✓
0.005±0.074
0.117±0.267
0.088±0.252
0.110±0.228
+ Flow Mat.
✓
✓
0.069±0.216
0.115±0.239
0.095±0.255
0.106±0.185
Table 2: Trajectory Prediction Performance of Baselines, Ablated Models, and Full Model
Figure 3: Exemplar trajectory prediction accuracy V^target distributions for unseen tasks and unseen users. Left : Known participant (P09) performing unknown task (T14). For regions within the distribution of tasks observed during training ( 0.3<t<0.6 ), trajectory mean is accurately predicted. For regions outside this distribution ( t<0.3 , t>0.9 ), flow matching tends to pull predicted trajectories toward in-distribution regions, which are more likely to be safe. Some regions ( 0.6<t<0.9 ) exhibit a mix of this behavior across axes. Center : Unseen participant (P11) performing known task (T07). Trajectory predictions are accurate aside from artifacts (e.g., at t≈0.15 ) due to the length of windows that were seen by the transformer at training time. Right : Unseen participant (P16) performing unseen task (T14). Prediction is qualitatively comparable to unseen tasks performed by known users, with slightly higher overall error rates.
Figure 5: Training loss L upper-bounding trajectory prediction error after re-training using an incrementing number of each user’s trials via our greedy re-training algorithm. All users exhibit decreasing error with additional training, characterizing the trade-off between calibration time and prediction accuracy.
Appendix figures & tables15 assets
Supplementary material from the paper’s appendix.
Appendix
ID
Age
Gender
Handedness
P01
21
M
Left
P02
24
M
Right
P03
24
M
Right
P04
19
M
Right
P05
27
M
Left
P06
47
F
Right
Appendix
Table 3: Participant Demographics
Figure 6: Example of user force generation behavior f about target v on unlocked x -axis task T01 ( top ) and its locked counterpart T02 ( bottom ). Due to the challenge of maintaining appropriate values in all axes during unlocked tasks, users frequently correct one axis at a time, resulting in oscillating signals. On locked tasks, users’ signals are smoother, but have bias in unspecified dimensions that varies from user to user.
Figure 7: T01 and T04
Figure 8: T07 and T10
Figure 9: T02 and T05
Figure 10: T08 and T11
Figure 11: T03 and T06
Figure 12: T09 and T12
Figure 13: T14 (exemplar)
Figure 14: T15 (exemplar)
Component
Hyperparameter
Value
Transformer Encoder/Decoder
Model width
128
Attention heads
4
Feedforward width
512
Encoder layers
3
Decoder layers
3
Latent dimension
64
Appendix
Table 4: Hyperparameters
Figure 15: Target ( top ) and user-generated ( bottom ) muscle activations for participant P08.
Figure 16: Target ( top ) and user-generated ( bottom ) muscle activations for participant P13.
Figure 17: Target ( top ) and user-generated ( bottom ) muscle activations for participant P18.
Figure 18: Target ( top ) and user-generated ( bottom ) muscle activations for participant P19.
The authors are with the Departments of Mechanical Engineering, Physical Medicine & Rehabilitation, and Mathematics, the Kahlert School of Computing, and the Robotics Center at the University of Utah, Salt Lake City, UT 84112, USA.
Faculty of Mechanical Engineering, Atlantic Technological University, Galway, Ireland. · Department of Health and Nutritional Science, Atlantic Technological University, Sligo, Ireland.