A PhysX-based Framework to Develop Rehabilitation using Haptic and Virtual Reality Antonio D’Andrea * , Monica Reggiani , Andrea Turolla * , Davide Cattin * , and Roberto Oboe *† * Laboratorio di Robotica e Cinematica, I.R.C.C.S. San Camillo Venezia Via Alberoni, 70 - 30126 Lido di Venezia - Italy Email: antonio.dandrea@ospedalesancamillo.net Department of Management and Engineering, University of Padova, Stradella San Nicola 3 - 36100 Vicenza- Italy Abstract—The use of virtual reality with haptic interactions seems quite promising for rehabilitation procedure as it provides several advantages: it is possible to change the experiments in the real world based on the patient disability, to use dif- ferent devices depending on the target of the rehabilitation, and to record quantitative information during the execution of the training session. To cope with the required flexibility and adaptability, we developed a software framework based on the Model/View/Controller pattern that allows to decouple the different modules composing the application. To reduce the cost, the framework is implemented only through the use of freely available libraries. The efficacy of the framework was proved through the implementation of the software for a prototype application based on a five-bar linkage haptic device. I. I NTRODUCTION The recent fast development of mechatronics technologies enabled the introduction of advanced robotics devices for clinical use to assist, enhance, and quantify the rehabilitation therapy. A technology that seems quite promising is the use of virtual reality with the support of haptic devices [1]. A haptic interface is a device that enables a manipulator to move and to interact with virtual objects within a virtual space. Due to this interaction, the user receives a force feedback as a response. This allows the user to virtually interact with various types of objects that may have different properties, depending on the settings of the created virtual worlds. The use of an haptic device for rehabilitation helps both patients, that interact with a virtual world encouraging movements, and physiotherapists, who can focus on the patient leaving to the device the duty of collecting quantitative data about the rehabilitation session. A detailed analysis of haptic devices and virtual reality can be found in [2], where a common architecture for haptic appli- cations is introduced(Figure 1). The architecture is composed of three main parts: (1) a simulation engine that dynamically model the environment to be reproduced in the virtual reality; (2) visual, auditory, and haptic rendering algorithms which take care of interfacing with the user by generating forces, audio and video feedback; (3) a transducers that provides the tactile sensation to the patient based on the data provided by simulation engine. While it is possible to devise such a common architecture, Human operator Video and audio Audio-visual rendering Haptic device Haptic rendering Simulation engine Figure 1: Basic architecture for virtual reality applications with haptic interface. each patient is unique and clinicians require to the reha- bilitation system the possibility to customize the rehabilita- tion therapy and create exercises suitable for the particular disability. Therefore, current research has proposed different haptic devices, tailored to the specific pathology with different hardware and visual interfaces based on physiotherapists’ preferences. Usually, the software for the control of each device is implemented from the scratch with a time and cost efforts that could be largely reduced with a suitable framework. In this paper we propose such a framework for the develop- ment of haptic rehabilitation in virtual reality. The advantage of the proposed framework is to include in a single solu- tion: (1) the separation of the simulation, visualization, and interaction with the user through the use of the Model/View/- Controller (MVC) pattern (Sec. II-A ); (2) the possibility to customize the exercises though XML files without any change in the code (Sec. III); (3) the support of different visualization interfaces and haptic devices (Sec. II-B2); (4) the development using only freely available technologies: C++ as development language, Boost.Thread for multicore support (Sec. IV-A), and PhysX as simulation engine (Sec. II-B1). The final section (Sec. IV) presents a use case for our framework: the development of the software for a hand/finger rehabilitation system based on a five-bar linkage device.