**2.6 Multiplayers capability**

*Assistive and Rehabilitation Engineering*

of the patient. The new position *<sup>p</sup>*

terrain defined by a parametric surface *t*

instead of arbitrary resistance values.

resistance by 5%.

*p*

where *<sup>p</sup>* →

in accordance to the avatar representing the patient.

(*c*(*t*)∆*t* ∙ *dv*(*t*)) + *p*

→

To integrate the MedBike data (resistance, cadence, and steering) into the Unity 3D environment, we created new classes of objects that control the virtual camera

Virtual Camera Update: By using bike speed and steering sensor measurements, one can change the new virtual camera position and direction to reflect the motion

<sup>→</sup>(*u*(*<sup>t</sup> <sup>+</sup>*∆*t*), *<sup>v</sup>*( *<sup>t</sup> <sup>+</sup>*∆*t*))= *<sup>t</sup>* <sup>→</sup>(*u*(*t*)+(*c*(*t*)∆*<sup>t</sup>* <sup>∙</sup> *du*(*t*)), *<sup>v</sup>*(*t*) <sup>+</sup>

(*u*(*t*),*v*(*t*)) is the current position of the virtual camera relative to the digital

dinates of the surface. The variables *c*(*t*) is the bike speed as measured by the sensor and (*du*(*t*),*dv*(*t*)) is the change in direction as measured by the rotary encoder. The rotary encoder has a resolution 1440 data points per revolution, which allows for an accuracy of 0.25 degrees. The rotary encoder is connected to a high-speed Phidgets encoder interface board connects directly to the PC via USB. A Phidgets API is used to read data from the encoder. The encoder is coupled to the steering column to detect

Computing resistance: To compute the resistance that the KICKR must apply to the bicycle back wheel, a complex haptic rendering algorithm must be used (see **Figure 10**). The algorithm is initialized with a target power specified by the clinician, the minimum allowable resistance, the speed as measured by the KICKR, the current power produced by the patient, and the back wheel circumference. The resistance applied to the bicycle back wheel is continually adjusted to help the rider achieve a target power output. This allows workloads to be specified in Watts

The resistance applied is calculated as follows. If linear speed is ≤0.025 m/s the resistance is held at the minimum allowed resistance. Otherwise, the target resistance value (*R* target) is updated to the resistance value delayed by 1 second (*R* delayed) plus or minus a small increment depending on the different between the power reported by the trainer and the target power output. The current resistance value applied by the bike trainer is then linearly interpolated toward the target

rotation. One can see in **Figure 9** a close look at the rotary encoder setup.

(*u*(*<sup>t</sup>* <sup>+</sup> <sup>∆</sup>*t*), *<sup>v</sup>*(*<sup>t</sup>* <sup>+</sup> <sup>∆</sup>*<sup>t</sup>*)) of the virtual camera is defined by:

<sup>→</sup>(*u*,*v*) where (*u*, *v*) are the parametric coor-

<sup>→</sup> (*u*(*t*), *<sup>v</sup>*(*t*)) (1)

**104**

**Figure 9.**

*Rotary encoder setup.*

In addition to the audio-visual connection (using WebRTC) between the clinician and each patient, each patient can see the avatars of the other patients using the

**Figure 10.** *MedBike resistance controller algorithm.*

**Figure 11.** *Remote patient represented as an articulated avatar.*

multiplayer capabilities of Unity 3D. At each patient's location, the avatars are fully animated and allow each patient to cycle and communicate with the other patients as a group. One can see at **Figure 11** a typical avatar representation. Each patient is personalized by changing the avatar's bike and cycling garment colors.
