# Development of a Virtual Reality-Based Environment for Telerehabilitation
## 2 Materials and Methods
### The Main User Console
#### 2.2.3 Using the VR Environment for the LegUp Robotic System  
The Unity 3D platform was chosen for the VR environment because it has accessibility and ease of use, support for multiple platforms, and flexibility in programming. The compression and decompression algorithm used in Unity 3D is LZ4, which is efficient and fast. To create a three-dimensional VR experience in Unity 3D, various algorithms and techniques are required, including the following:  
* To handle complex graphics and rendering tasks, Unity uses the Universal Render Pipeline (URP) or High Definition Render Pipeline (HDRP), ensuring high-quality images in VR.
* For realistic physical simulations and collision detection, essential in interactive VR environments, algorithms such as PhysX are used.
* The A* (A-star) algorithm is frequently used for path identification in 3D spaces, facilitating the navigation of characters or objects in the VR environment.
* The implementation of spatial audio algorithms ensures that sound sources are perceived as coming from precise locations in 3D space, thus enhancing immersion.  
The use of robotic systems in physical rehabilitation has gained significant attention due to their ability to address motor deficits and alleviate the increased strain on healthcare systems [42]. The LegUp parallel robotic system is used for telerehabilitation applications, enabling therapists to remotely control the robotic system. In this setup, the patient is at home, and the therapist communicates with the patient from their office to develop personalized patient rehabilitation plans. During these planning sessions, the therapist and patient collaborate to establish a tailored plan that incorporates rehabilitation exercises using the LegUp robotic system. These sessions are designed to help the patient improve lower limb strength, flexibility, and mobility while focusing on reducing pain and discomfort. Once the rehabilitation plan is established, the therapist dors the VR headset (Figure 10(a)) and holds the controllers (Figure 10(b)) in both hands. After putting on the VR headset, the therapist enters an immersive, three-dimensional environment that facilitates deep interaction and active engagement, closely mimicking physical presence within that context. Through the two controllers, the therapist operates the robotic rehabilitation system to demonstrate to the patient the types of exercises that the robotic system can perform.  
For an optimal viewing angle, the robotic structure, along with the patient on the table, is rotated using two buttons located on the controller held in the left hand (Figure 10(b) (4)). While using the two controllers, the user interface displays the type of exercise that is being performed at that moment. The background color, initially blue, changes to yellow to indicate the active exercise (Figure 8 (7)).  
Once the therapist has presented the patient with the types of exercises that the robotic rehabilitation system can perform, they proceed to the next stage. Here, the therapist customizes the types of rehabilitation exercises to suit the patient's specific needs using the user interface (Figure 8). Once tailored, these exercises are sent to the robotic structure to  
Figure 11: Devices used in the control of the robotic system: (**a**) VR headset; (**b**) controllers.  
start the rehabilitation procedure for the patient's lower limb, with the patient positioned on the robotic bed.