## 2 Materials and Methods
### Training Sessions
\(FE_{old}\) is the error from the previous 3 laps, preceding the laps performed with \(modulation_{old}\) just finished. \(a\) and \(b\) are experimental parameters (\(a=5\) rad\({}^{-1}\) and \(b=-0.1\)) that managed the changes of _modulation_ in its range of variability. Since _modulation_ changes linearly with the changes in FE, \(a\) and \(b\) represented the slope and the intercept of the line, respectively. Because of empirically tested safety conditions, positive values of \(modulation_{new}\) reached saturation when greater than 1, negative values when lower than \(-0.2\). These values were chosen to avoid resulting torques too high in both the resistive and the assistive mode. In the first case, we wanted to avoid severe fatigue during the training, for these reasons we choose to saturate \(\tau_{DoF}\) values based on previously performed experiments, in which presence of fatigue at similar levels of forces (i.e., less than \(\tau_{max}\)) was checked using EMG techniques [16]. Instead, during the assistive modality, when \(modulation_{new}\) was close to 1, movements were not completely passive and small muscle forces were still required to move the end-effector, in order to avoid the slacking effect [25] and to still promote active voluntary contribution. The computed assistance/resistance level (_modulation_) was a pure number and was used to implement the assistive/resistive torque for the following three tracking laps, modifying the initial stiffness of the spring (\(k\)). Specifically, the instantaneous amount of exerted torque on each DoF was determined by both the spring stiffness (_modulation\(*k\)_) and the real-time distance between the target and end-effector (\(\Delta\theta\)). When _modulation_ was positive the actual modality was assistive, while the robot switched to resistive mode when _modulation_ resulted to be negative. Equation (5) presents the formula used for torques (\(\tau_{DoF}\)) computation in both modalities:  
\[\left\{ \begin{array}{ll}\tau_{DoF}=modulation*k*\Delta\theta-d\ \dot{\theta}&;modulation \geq 0\\ \tau_{DoF}=-sign\ (\Delta\theta)*[\tau_{max}-|(0.2+modulation)*k*\Delta\theta|]-d\ \dot{\theta}&;modulation <0\end{array} \right. \tag{5}\]  
where \(\tau_{DoF}\) is the exerted torque (assistive or resistive) modelled as a spring, \(k=0.5\) Nm/rad initial stiffness of the spring, and \(\Delta\theta\) represents the instantaneous distance between the target and end-effector on that specific DoF. Because of the high back-drivability of the robot, a small viscous field (\(-d\dot{\theta},d=0.02\) Nms/rad, \(\dot{\theta}\) the velocity of the end-effector) was added to provide a minimal damping to the inertia of the hand, without affecting the torque direction and thus producing unsafe conditions. \(\tau_{max}\) was a fixed value (\(\tau_{max}=0.5\) Nm) evaluated to allow participants to move even with the highest resistance. Once the assistance/resistance _modulation_ transitioned from positive to negative, the exerted torques moved from pulling the participant towards the target (assistance) to pushing the participant away from the target (resistance).