1 Introduction

Physical exercise can help to attenuate the incidence of the so-called age-related conditions (Valenzuela et al. 2011). More effective interventions based on personalized exercises and designing physical training programmes can improve the muscle strength and balance (Larsson et al. 2019). Recent studies reported that cycling training has positive effects on muscle strength, bone density, spasticity, cardiopulmonary function and many other physiological and psychological benefits in neurological patients and in the elderly. All the factors are directly related to improvement of functional abilities in postural control and gait (Peng et al. 2011).

Therefore, the need arises to identify new tools that allow to encourage physical activity and to promote adherence to functional activity programmes. Among the emerging technologies applied to this area, immersive technologies stand out. Their potential lies in the ability to generate controlled and personalized immersive environments where the movements made by the user can be captured and objectively quantified. Thus, we want to generate a virtual reality application that stimulates the user’s sense of immersion as a way to promote adherence to a continuous exercise routine. The requirements for this virtual reality application must be: (i) that it can be used with any stationary pedalling system and therefore, (ii) that it does not depend on a specific system, (iii) that it can be used in a generic virtual reality helmet at an affordable price. And above all, that it is easy to install the pedalling system, which implies reducing possible sources of complications such as dependence on external systems and use of cables.

1.1 Immersive environments for indoor cycling training

The latest use of virtual reality technologies is aimed at providing feedback to stroke patients to improve cortical activity, functional performance, muscle control and fatigue (Ferrante et al. 2011; Yang et al. 2014). Among the possible modalities of extrinsic biofeedback adopted for stroke patients, visual input is the most widely used (Ebrahim 2000). Visual feedback during cycling could improve neuromuscular control and the overall training performance (Lin et al. 2012), which is generally based on cadence and load. The generation of cycling training home-based systems requires the integration of user-friendly and low-cost tracking systems, affordable game stations and common static bicycles or monocycles. To facilitate access to immersive environments for cycling, several mobile applications have been developed like Virtual Cycling World (World 2022) or Cycle Go (Software 2021) offer scenic roads and voice guided training to make indoor training more effective and enjoyable. These solutions do not monitor the user’s exercise but seek to improve the user performance through virtualized environments and motivating feedback.

On the other hand, the approaches found in the literature in this field rely on high-cost robotic systems and complex and highly specialised equipment. Cardoso et al. (2019) developed a neurorehabilitation platform using a robotic monocycle instrumented with inertial sensors to measure cadence. They also customized an electronic board to control the virtual monocycle with user’s motor imagery of electroencephalography (EEG) and surface electromyography (sEMG). Ferreira et al. (2019) developed an active-motorized static bicycle which can be gradually adjusted according to the pressure exerted on pedal’s force sensors. This design allows to use different parameters to train each leg individually to compensate impairments. Chen et al. (2017) offered an integral solution that includes an electric wheelchair with lower limb training function, a multivariate control module, a virtual reality training module and a tele-doctor-patient interaction module. Despite specific hardware designed for lower limb rehabilitation combined with virtual or non-immersive scenarios, the most widely used equipment are static pedalling stations such as those marketed under the trademark MOTOMed™. In fact, Grani and Bruun-Pedersen (2017) developed a VR biking system, named Giro prototype, using a pedal-tracking device mounted on a MOTOMed™, which synchronizes the visual virtual feedback to user exercise.

1.2 Motion tracking for cycling

In the spirit of increasing the visual feedback of movement, approaches are emerging that seek to represent the user’s virtual avatar through tracking systems. But representing the positioning and orientation of the user’s body from a tracker data acquisition is still a very challenging issue. When it comes to full body tracking, most common VR approaches are limited by either high latency or insufficient accuracy. Regarding the features of the most advanced non-standalone HMDs, like HTC Vive™, PlayStation VR or Oculus Rift™, can detect the positions and rotations of their headsets and compatible controllers or trackers, since they use their own infrared tracking system (Farahani et al. 2016). These tracking solutions overcome the jittering and inconsistent tracking of fine movements as suffered by Kinect or Nintendo Wii (Friðriksson et al. 2016). But even all these motion-sensing models are limited by the occlusion principle to a greater or lesser extent, since the markers must remain within the space delimited by the tracking systems. Recent studies focus on the design of real-time gait tracking systems detecting for virtual reality rehabilitation training platforms. Nowadays, wearable sensors based on IMUs are widely used to monitor human gait. The list of applications of IMUs on gait analysis present by Ribeiro and Santos (2017) includes several prototypes and commercial solutions. This review identifies solutions that allow the estimation of thigh movements, the measurement of lower limb joint angles and the study of physical activity and postural orientation and the estimation of temporal parameters of gait. In addition to the applications of these sensors for the study of gait, it should be noted that the use of virtual reality in this field of study has promoted the development of solutions that provide interactive and attractive locomotor training (Kim et al. 2019) for the user or the patient. Therefore, some studies have simulated walking in different virtual environments (Fung et al. 2006; Yang et al. 2008) promoting different tasks, such as walking on a slope or walking while avoiding obstacles (Mirelman et al. 2011; Shema et al. 2014). As an example, Guo et al. (2017) analysed gait parameters relations to the plantar pressure and the lower limb joints range of motion (ROM) measured by inertial measurement units (IMU). The aim of this sensing system is to transmit the lower limb motor parameters of patients via bluetooth into the virtual training game, as the motion control signals for character driven in games has proved to be valuable in rehabilitation assessment. With the aim of capturing the user’s movement using hardware-based virtual reality trackers: Caserman et al. (2019) proposed to synchronize avatar’s motions with user’s motions using HTC Vive™ headset and Vive Trackers™. They conclude that the imperceptible delay of \(6.71\pm 0.80\) ms and the reasonable accuracy of the tracking, according with the results of the rating simulation questionnaire based on Likert scale, were contributing factors in the user’s perception of deep immersion. Besides the use of trackers and inertial sensors for capturing pedalling motion, the use of smartphone applications for monitoring outdoor pedalling or running has become widespread. APPs like Strava (2022) track the route by GPS and provide exercise performance information based on the device’s internal accelerometer and gyroscope sensors, and often complement it with biometric data. These applications implement algorithms for real-time motion detection similar to those used in IMU sensors. For indoor cycling, APPs like ICG (Group 2022), OneLapFit (OneLap 2022) or BODY BIKE Indoor Cycling (BIKE 2022), among others, allow monitoring exercise performance, but these APPs are developed to be used for specific hardware, i.e. to be paired with a specific commercial exercise bike.

It is also worth to mention computer vision (CV) and video-based applications for tracking and visualizing the posture and movement of indoor pedalling. Kaplan et al. (2019) presented a video-based framework for cycling to enable tracking of the knee. This approach allows monitoring the trajectory that describes this joint in real time with the aim to visualize cycling biomechanics and to avoid overuse injuries. Bini et al. (2021) presented a solution for postural analysis during pedalling motion based on video analysis for detection of the body segments. This automated tool allows the analysis of the cyclist’s biomechanics. With a similar approach, in automating real-time motion detection, Karashchuk et al. (2021) created a markerless CV-based tool able to analyse 3D walking kinematics in humans, mice and insects. In case of human gait characterization, this tool extracted knee flexion, hip rotation and hip flexion angles from 3D joint positions tracked. Although the latter solution does not focus on pedalling, it also illustrates the potential for motion tracking in the field of computer vision. Yet, it should be acknowledged that wearable inertial sensors have no disadvantages compared to vision systems, which may have tracking problems due to illumination or occlusion. Of course, inertial systems provide a direct measurement of joint motion rather than an estimation from image or video processing techniques. For these reasons, it becomes more intuitive and reasonable to use inertial systems to address motion tracking in pedalling.

1.3 Approach

While emerging technologies are being used to promote physical activity, many of these new therapies based on video games (Dimbwadyo-Terrer et al. 2016; Bayón and Martínez 2010) focus on two fundamental aspects: inducing as much immersion as possible and accurately tracking the user’s movements. The potential of aiming these aspects is that enabling accurate tracking is necessary to evaluate whether the movements have been performed correctly and achieving greater immersion improves the user’s engagement in a physical task. Current VR devices, by their very nature, are capable of very accurate tracking of the user’s head and hand movements, but they rely on motion tracking systems to manage reliable and accurate data on any other body-segment. Nevertheless, rehabilitation solutions based on immersive environments are more effective than traditional (Viñas-Diz and Sobrido-Prieto 2016) because of these essential qualities: first of all, they have proven to improve individual engagement: Exergames increase user energy expenditure and involve both cognitively and physically rewarding tasks (Maillot et al. 2012). These highly motivating activities are likely to promote adherence to play. Secondly, they provide physical fidelity to a real movement: the user performs movements similar to what he or she would do in an analogous situation during daily life. And lastly, they provide cognitive fidelity to a real situation: The person must perform the activities in an environment designed to be similar to the real world.

With all this in mind, it is still necessary to generate an accurate cycling motion capture system that is universal to any cycling equipment and communicates with a virtual reality application on any standalone device. Therefore, the present work seeks to provide an approach that allows to accurately track the pedalling movement of the individual (i) without limitations of occlusion in the tracking and (ii) without defining the initial orientation of the person’s body, but (iii) ensuring low-latency tracking for real-time applications, and (iv) a virtual reality solution specifically design to be motivating to perform pedalling exercises. Hence, we have developed a low-cost wireless standalone platform for VR-based cycling exercises using an IMU paired with the Oculus Quest 2 headset and a common stationary bicycle, which is expected to promote immersion and improve individual engagement to the PA therapy.

The overall objective of this work is to present a low-cost wireless application in virtual reality (VR) for pedalling exercises. This is addressed in the following points: the first is to describe our technical approach according to the mentioned design features to increase user motivation. The second one is to technically evaluate the validity and reliability of our cycling cadence estimation system for real-time exercise feedback in virtual scenarios. For this technical validation, we have tested with healthy participants our approach by assessing the validity and reliability of the cadence estimation outcomes related to another cycling platform set as reference.

2 Materials and methods

2.1 Description of the cycling platform used as reference

The reference cycling platform was composed of a magnetic encoder (AS5048, AMS AG) attached to the rotation axis of the MOTOMed™Viva2 with an analogue potentiometer (modelled as a linear transducer between 0\(^\circ\) and 360\(^\circ\)) plus a microprocessor (STM32F302K8, STMicroprocessors) that reads each 20 ms the encoder and sends the pedalling angle value via CAN communication protocols to a microcontroller (Arduino Uno) for the real-time reading of the crank angle position loop. To enable the Arduino UNO to receive CAN messages, a CAN shield (SparkFun Electronics, Boulder) was installed on the Arduino, taking advantage of the capability of modular extensions of this microcontroller. When Arduino UNO microcontroller receives the pedalling angle via CAN communication, it sends it simultaneously to the PC interface via USB (see Fig. 1).

Fig. 1
figure 1

Diagram of the cycling platform system set as reference for the comparison study

2.2 Development of virtual reality pedalling platform

The virtual reality pedalling platform consists of two parts: the ENLAZA™ sensor (Werium Assistive Solutions) as the main sensing system which integrates microcontroller unit (MCU), inertial measurement unit (IMU) and a Bluetooth module, and a virtual rehabilitation training scene built for Oculus Quest 2™(Facebook Technologies, LLC), as shown in Fig. 2. In order to meet the portable requirements, the Oculus Quest 2 has been selected as a low-cost, portable, commercial standalone VR device that allows the pairing of peripherals via Bluetooth. The sensing system used was the ENLAZA™ sensor from Werium Assistive Solutions, due to its proven reliability of their ROM measurements in wrist and elbow joints (Costa et al. 2020).

Fig. 2
figure 2

Overall scheme diagram of the developed virtual cycling platform to be validated

The ENLAZA™ sensor module contains an IMU with 9 degrees of freedom; which integrates a 3-axis accelerometer, a 3-axis gyroscope and a 3-axis magnetometer. The sensor module also includes a microcontroller unit (MCU) (8-bit AVR, 8 MHz, 32 KBytes of flash memory) to acquire the raw data of all three sensors via I2C protocol and to compute the angular orientation (yaw, pitch and roll) and the Direction Cosine Matrix (DCM) at 50 Hz before forwarding it via UART at 57,600 Kbps to the Bluetooth module (2.4 GHz, class 2 radio, 20 m range, slave mode and on-chip antenna). Additionally, the transmission settings of the ENLAZA™ sensor were adapted to implement a serial transmission protocol of binary data packages to feed the estimation algorithm. The modification consisted on sending data over a single byte-by-byte communication path from the built-in Bluetooth module of the sensing system to he VR headset. The rotation data are transmitted in binary format in 48-byte buffers to the VR HMD and, once all received on VR application, first 12-bytes are parsed into (single type) \(3\times 1\) Vector, to save the angular velocities, and last 36-bytes are parsed into a (single type) \(3\times 3\) matrix to construct the rotation matrix. From this rotation matrix, the hip flexion-extension angle is calculated, allowing to analyse the pedalling motion in the sagittal plane. The following sections detail how this angle is calculated and how all the input signal is processed for the estimation of the cadence.

2.2.1 Definition of coordinate system

To describe the orientation of a body-fixed coordinate frame many possible sets of generalized coordinates can be used. For our purpose, we based the cadence estimation on the kinematic model of the hip. To describe the orientation of the tight according to the convention recommended by the International Society of Biomechanics (ISB) for the femur, we adopted the standard coordinate system (Wu et al. 2002), where the Y axis is defined along the line joining the hip centre and the midpoint of the medial and lateral femoral epicondyles, pointing proximally. The Z axis is perpendicular to the Y axis, located in the plane defined by the hip centre and both femoral epicondyles, pointing laterally to the right side of the body. The X axis is then perpendicular to both, pointing ventrally (anteriorly). Flexion would therefore be defined around the Pelvic Z axis, axial rotation around the Femoral Y axis, and adduction/abduction around the “floating” axis mutually perpendicular to the Pelvic Z and Femoral Y axes. Relating the ISB coordinate system to the own reference coordinate system of the IMU sensor as shown in Fig. 3, it is obtained that \(Y_{\mathrm{ISB}}=X_{\mathrm{IMU}}\), \(Z_{\mathrm{ISB}}=Y_{\mathrm{IMU}}\) and \(X_{\mathrm{ISB}}=Z_{\mathrm{IMU}}\).

Fig. 3
figure 3

Coordinate system relation between ISB and own reference coordinate system of IMU sensor

2.2.2 Estimation of the hip flexo-extension

The first step of our approach is to calculate the Direction Cosine Matrix (DCM) at the IMU sensor. We obtain the DCM fusing the accelerometer and gyroscope signals following the method proposed by Premerlani and Bizard (2009).

Then, we send the DCM data to de virtual cycling platform (VCP) via WiFi. To estimate the neutral position of the sensor in virtual world coordinates, we first determine a calibration matrix to set this new reference frame. To calculate the transformation matrix for each movement, we multiply the transposed calibration matrix (\(R_{\mathrm{cal}}^\mathrm{T}\)) with the DCM (\(R_{\mathrm{raw}} \in {\mathbb {R}}^{3\times 3}\)), transmitted from the IMU sensor, at time step t to obtain the transformation matrix (\(R_{\mathrm{trans}}\)), which describes in Unity’s local coordinate system the rotations performed by the sensor. This is applied according the following equation: \(R_{\mathrm{trans}}\left[ t \right] = R_{\mathrm{raw}}\left[ t \right] \times R_{\mathrm{cal}}^\mathrm{T}\), where \(R_{\mathrm{cal}}\) is the calibration matrix, \(R_{raw}\) is the DCM matrix obtained by the IMU sensor, and \(R_{\mathrm{trans}}\) is the final matrix after applying the calibration. After calculating \(R_{\mathrm{trans}}\), we normalize it, so that the system is orthonormal. The \(R_{\mathrm{trans}}\) normalized is described as a \(3\times 3\) matrix whose elements represent the angles of the 3 axes for each of the planes of rotation:

$$\begin{aligned} R_{\mathrm{trans}}\left[ t \right] = \left[ \begin{array}{ccc} r_{00} &{} r_{01} &{} r_{02}\\ r_{10} &{} r_{11} &{} r_{12}\\ r_{20} &{} r_{21} &{} r_{22} \end{array}\right] \in {\mathbb {R}}^{3\times 3} \end{aligned}$$
(1)

Reconciling the rotations of the \(R_{\mathrm{trans}}\left[ t\right]\) calibrated rotation matrix with Euler angles, it would correspond as follows: rotation in Y-coordinate axis represents flexion/extension movement, rotation in Z-coordinate axis represents the adduction/abduction movement, and the rotation in X represents the axial rotation movement around the femoral axis, satisfying the relations described in (1):

  • hip adduction/abduction angle: \(\psi = \arcsin (-r_{01})\)

  • hip rotation angle: \(\phi =\arctan 2(r_{21}, r_{11})\)

  • hip flexion/extension angle: \(\theta =\arctan 2(r_{02}, r_{00})\)

2.2.3 Cadence estimation algorithm

Relying on the timed interpretation of rotation, data describes the cycling motion curve, where cycling-phase angle could be known from processing hip flexion-extension angles. Taking the sequence of rotation angles over time as the samples of a motion function, the number of cycles can be counted as number of peaks detected along the signal.

Fig. 4
figure 4

Pseudo code of discrete sample’s method peak detection

Cycling phase analysis is here formulated as a peak detection problem using the mountaineer’s method for peak detection (MMPD) (Argüello-Prada 2019). Our MMPD-based method consists of considering all cycles as mountains, and then the peaks of the mountain will be the crests of the curve. Thus, each detected peak will represent the starting session of a cycle. The pseudo-code of this method is shown in Fig. 4, in which all flexion-extension angles are added to an \(N\times 1\) array (alfa array at Fig. 4) each batch of 3 samples data are analysed. At each batch, samples are classify as maxima or minima, and the maximum local value is set with the highest value among those. Once a local maximum is reached, the cycle-counter is incremented by one and the value of the maximum is reset to the value of the symmetry axis. This way, when the curve starts its positive phase again, the local maximum is searched for again by analysing the values of its segment neighbours. To avoid peak detection failures due to baseline changes, the symmetry axis threshold is adjusted from the average of the amplitude values of the last 1000 ms with a 20 ms refresh rate.

2.2.4 Virtual platform

Virtual rehabilitation training scenes are programmed with Unity3D software platform for Android 25 API Level for Oculus Quest 2 HMD. The user actives the ENLAZA™sensor to provide motion control signals for the game scenarios. Meanwhile, the user acquires the visual feedback information, so as to maintain or adjust the cycling cadence in order to achieve the best training effect. The user is able to be aware of the cycling assessment results promoted by the rehabilitation evaluation module in real time.

In this game, the user is in the steer cab of a vehicle which moves forward at user’s cycling speed. The user has to pedal at a fixed target speed. Therefore, derived from cadence estimation (see Sect. 2.2.3), the following information about cycling performance is displayed on a panel in text format to strength engagement experience:

  • Number of crawl cycles cycle-counter of peak detection (see Fig. 4).

  • Distance travelled the estimation of forward displacement depends on the number of cycles and virtual wheel radius (27 cm) as: \(\hbox {distance}\, (\hbox {km}) = \left[ (2.0f\times \pi \times 0.27\,(\hbox {m})) \times N_{\mathrm{cycles}}\right] /1000\)

  • Pedalling speed Knowing that \(\omega \, (\hbox {rad/s}) = v\,(^{\circ }/\hbox {s}) \times 2\pi /360\); the formula applied to calculate pedalling speed for each time lapse between cycles is: \(\Delta v\,(\hbox {km/h}) = \left[ (2.0f\times \pi \times 0.27)\, (\hbox {m})/\Delta t\,(\hbox {s})\right] \times 3.6\); setting an average wheel radius of 27 cm.

  • pedalling Pace feedback compares each frame whether average pedalling speed is equals to (\(\pm 10\%\)) target speed; higher than (\(+10\%\)) target speed; or lower than (\(-10\%\)) target speed; according to this classification, either one feedback message is displayed to user’s to keep, reduce or increase cycling pace.

  • Also elapsed time and target speed are displayed to remind the game objectives to the user.

In addition, the speed information is mapped to those elements of the virtual environment that are moved to generate a perception of displacement. Also, shader-based procedural terrains have been used to optimise the graphics rendering of the experience. This has made it possible to keep the static virtual camera embedded within the vehicle model and to simulate the displacement of the environments by varying the exposed variables of the texture displacement velocity shaders on the forward axis. Lastly, the whole experience is designed for Hand-Tracking enabling a soft user-interface based on touch panels.

2.2.5 Software strategy design

Visual feedback is extremely important to any VR experience, even more so in extrinsic feedback where processing latency and rendering times must be optimized to the maximum in order not to compromise the feeling of immersion. The CPU and GPU performance of the HMD must be considered in the design of the VR experience development to ensure its functionality. The Oculus Quest 2 was launched with the Qualcomm Snapdragon XR2 platform, expanding the overall AI processing power and improving the engine of visual analytics (EVA) to reduce latency and support stronger connectivity. Exploiting these technical improvements, our application design involves the following features: (i) modulate the whole virtual environment based on cycling speed and (ii) enable interaction via hand-tracking. In order not to compromise visual results, the threads-tasks for communication and processing data have to be optimized.

Regarding our cadence estimation algorithm, it has to be executed, at least, every 10 ms to grant accurate feedback in real-time. To meet this requirement, our MMPD-method has been implemented with timer events because it was tested that including the call to the MMPD-method in the ’Update’ function of Unity’s MonoBehaviour classes compromised the rendering frequency of the application. Worse results were obtained with the use of background threads. This strategy does not compromise the performance of the CPU and optimizes the execution of the MMPD every 10 ms without affecting the performance of the VR application with an average rendering rate of 70–75 FPS. The signal analysis optimization strategy has been an important issue, as it must compensate for the sampling rate of the IMU. It should be recalled that the data acquisition times by the IMU sensors and the composition of the DCM for the transmission of information via Bluetooth takes 20 ms. In addition, the latency in the Bluetooth reception and processing of the message for the flexo-extension angle calculation adds 10 ms, resulting in a 30 Hz data capture rate. Due to this limitation in frequency of the setup, it has been necessary to achieve an optimal cadence analysis algorithm that does not saturate the performance of the device so as not to affect the rendering frequency.

On the other hand, a virtual reality environment has been generated in which the aeroplane velocity and flight altitude are directly influenced by the user’s speed and cadence stability. With these interrelations of effects, the user can observe how the conditions of his flight vary depending on his pedalling performance. This approach of using proprioceptive stimulation in VR as a strategy to involve the user in the physical activity has been previously explored by Grani and Bruun-Pedersen (2017) and Guo et al. (2017). All in all, these studies have shown that this strategy achieves a high sense of presence in the user and enhances engagement in the physical activity promoted. Bringing it to this context, our application is not only a 3D digital environment in which user’s pedalling parameters are shown in real time, but it is also an experience that allows the user to modulate how the vehicle behaves within the game. Therefore, the user is expected to be involved in achieving and maintaining the target speed during the session and also to control the behaviour of the vehicle. In the end, relating the participant’s exercise performance to the behaviour of the vehicle and, by placing the user in first-person control of the game, it is expected that the user will perceive all changes in the environment with greater impact than through a screen, which is the most commonly employed system.

2.3 Study design

2.3.1 Participants

The committee of CEU San Pablo University provided ethical approval for this research (Trial reference: 550/21/51). Participants were recruited via email by contacting those people subscribed on the list to participate in studies of the NeuroRehabilitation Group of the Cajal Institue, Spanish National Research Council (CSIC). Thirteen participants (nine men and four women, aged \(25.38\pm 1.14\)) volunteered to participate in this study. They were informed about all the procedures and possible discomforts before giving their informed consent. The following criteria were applied for the selection of participants for the study.

  • Inclusion criteria: (i) Healthy physical condition, (ii) Ability to follow instructions. (iii) Ability to perform pedalling movements.

  • Exclusion criteria of participants: (i) Visual problems that cannot be overcome by the use of contact lenses or glasses compatible with the usage of VR HMD. (ii) Presence of any pathology or joint disorder affecting lower limb movement. (iii) Predisposition to suffer dizziness or loss of balance. (iv) Altitude sickness. (v) Failure to sign the informed consent form.

  • Withdrawal criteria: (i) Decision by the participant to drop out. (ii) Feeling dizzy during the test due to visual incongruities. (iii) Feeling of discomfort or fatigue due to physical exercise.

2.3.2 Data collection system

The system configuration taken during the experimental study is the shown at Fig. 5. We set up the virtual platform with the ENLAZA™ sensor, an Oculus Quest 2™ and a stationary bike provided with a hall effect sensor connect to an Arduino UNO microcontroller that triggers the angle of pedal position each nanosecond. That Arduino is connected to a PC running an specific software to read the Arduino serial port, clean incoming readings and save the amount of cycles performed. In order to synchronize the VCP and the pedalling platform of reference in the pedalling trials, since the VCP is a closed-loop system, both systems had to be initiated simultaneously at each attempt by the user via pressing a keyboard button with one hand and a virtual button with the other hand.

Fig. 5
figure 5

Overview of the components of both systems used in the validation study. The left side of the diagram shows the elements of VCP, and the right side shows the elements of the reference pedalling system

2.3.3 Procedure

Preliminary preparation

Prior to placing the physical elements of the test on the participant, the ENLAZA™ sensor had to be paired via Bluetooth with the Oculus Quest 2™. Then, the sensor was placed on the participant’s thigh by adjusting the elastic-strap and ensuring its correct orientation. Once the subject sat in a chair with the feet secured to the pedals of the ergometer, the Oculus Quest 2 HMD was adjusted to the user’s head by widening or narrowing the elastic bands.

According to this arrangement, the design of the commercial motorized ergometer and the positioning of the subject, maximum knee extension was reached at 90\(^\circ\) crank angle, maximum knee flexion at 270\(^\circ\), maximum hip extension at 140\(^\circ\) crank angle, and maximum hip flexion at 320\(^\circ\) crank angle. As 0\(^\circ\) or 320\(^\circ\) crank angle corresponds to the position when the pedal is in its top position and 180\(^\circ\) to the pedal bottom position. Therefore, it is expected to obtain a minimum hip flexion about 30\(^\circ\) and a maximum hip flexion about 70\(^\circ\) according to normal ranges of hip flexion during city bike cycling movement (De Roeck et al. 2021).

Pedalling trials procedure

Prior to the experimental trials, all the participants performed a 2-min warm-up of pedalling to familiarise with the virtual platform. Then, the experimentation is organized in two identical sessions in which participants performed 3 sets of pedalling at a constant speed of 30 rpm, 60 rpm and 90 rpm with 3 min rest between sets. Also, each set is divided in 3 trials of 1 min cycling, in order to assess the number of cycles 3 times per each target speed. After 30 min of resting, we repeated the whole session, assuming this lapse of resting time to be sufficient to allow this second round of pedalling exercises to be considered as an independent sample. In each trial, the participants were told the target speed to cycle at and to maintain it based on the information displayed on the vehicle’s control panel and the aeroplane’s behaviour.

3 Results

This study aims to evaluate the performance of our development in terms of cadence estimation accuracy. For this purpose, we carried out the analysis of the correlation and reliability of the cadence results between our development and the pedalling system developed previously, as a reference. The statistical analysis was performed using IBM SPSS Statistics, version 27. Due to the low sample size, the Shapiro–Wilk test will be applied to confirm the normal distribution of our data, with a significance level of \(p\le 0.5\). For each subject and session, 3 samples of each speed were taken to generate the descriptive statistics shown in Table 1. Each test consists of 1 min of pedalling. Thus, the mean and standard deviation of each set of speeds for 1 min of pedalling is calculated.

Table 1 Session 1: Sample mean (\({\overline{x}}\)) and standard deviation (\(\sigma\)) of cycles per minute at target Speed 30 rpm, 60 rpm and 90 rpm

3.1 Visualization of cadence estimation algorithm performance

Average hip ROM curves have been generated for a pedalling cycle at 30 rpm, 60 rpm and 90 rpm. Figure 6 shows that the hip flexion values performed during cycling exercises on the virtual platform are in accordance with the normal range of motion(Ericson et al. 1988) as predicted for this activity .

Fig. 6
figure 6

Mean hip joint range of motion (degrees) during ergometer cycling at the three set speeds: 30 rpm, 60 rpm, 90 rpm

Figure 7 illustrates the relationship between the number of samples and the pedalling cadence for different speeds. Each point on the curves in the graph represents a sample taken by the inertial sensor and processed by the VR HMD, and each curve represents the hip flexion angles captured during pedalling at different set speeds. Considering that at all times, and acknowledging that the system has a sampling rate of 30 Hz, it is expected to observe that a 30 rpm cadence cycle has a similar number of samples to 2 cycles of 60 rpm cadence and, in turn, to 3 cycles of 90 rpm cadence. This implies that for high pedalling speeds, each pedalling cycle is described with fewer samples due to the constant data capture rate (30 Hz).

Fig. 7
figure 7

Five second time plot (ms) of hip ROM capture by the VCP during pedalling exercise at the three set speeds. The dots plotted along the curves represent each sample taken by the IMU and processed by the VCP in real-time during exercise

This fact is also observed in the generation of the average hip flexion curve for one pedalling cycle (Fig. 6). For 90 rpm a smoother curve is observed due to the scarcity of samples along the slope, while for 30 rpm an average curve with smaller oscillations is observed, due to a higher amount of samples.

3.2 Validity evaluation of cadence estimation algorithm

The validity of the algorithm can be understood as the proportion of number of cycles that are correctly detected according to the number of cycles measured by the reference cycling platform. Therefore, the higher the correct rate, the more the algorithm accuracy is. The assessment of these proportions can be established by correlating the cycles averages of the VCP against the sample averages of the MOTOMed™ cycles. The formula used to calculate this correlation coefficient is:

$$\begin{aligned} \hbox {Correl}(X,Y) = \frac{\sum (x-{\overline{x}})(y-{\overline{y}})}{\sqrt{\sum (x-{\overline{x}})^2 \sum (y-{\overline{y}})^2 }} \end{aligned}$$
(2)

where \({\overline{x}}\) and \({\overline{y}}\) are the detected cycles averages of the algorithm method and the measured cycles averages of the MOTOMed™. To assess the validity of the cadence estimation system, we applied the correlation coefficient of Spearman for each of the target speeds, taking a confidence interval (CI) of 95%, between the measures taken simultaneously. Also, the normal distribution of the data has been verified for all groups.

Involving all the trials in the two sessions, Spearman correlation value for MOTOMed™-VCP algorithm for target speed of 30 rpm was 0.946 (\(p\le 0.001\) with \(95\%\) CI ranged 0.818 to 0.985) for the first session and 0.858 (\(p\le 0.001\) with \(95\%\) CI ranged 0.571 to 0.958) for the second session. In general, for both sessions, the correlation values indicate a high correlation between the results of both pedalling systems at a cadence of 30 rpm. Spearman correlation value for MOTOMed™-VPC for each session at a target speed of 60 rpm was 0.931 (\(p\le 0.001\) with \(95\%\) CI ranged 0.772 to 0.980) and 0.895 (\(p\le 0.001\) with \(95\%\) CI ranged 0.669 to 0.970), respectively. These values point out a high correlation between the cadence estimation performance of both systems at a cadence of 60 rpm. Finally, the Spearman correlation value for MOTOMed™-VCP for each session at a target speed of 90 rpm was 0.787 (\(p=0.001\) with \(95\%\) CI ranged 0.401 to 0.935) and 0.760 (\(p=0.003\) with \(95\%\) CI ranged 0.344 to 0.927). Since the correlation outcomes are less than 0.8, it is considered a moderate correlation between both pedalling systems at a cadence of 90 rpm. These results illustrate that several cycles are not detected by the VCP at a 90 rpm, as shown in Tables 1 and 2 (Table 3).

Table 2 Session 2: Sample mean (\({\overline{x}}\)) and standard deviation (\(\sigma\)) of cycles per minute at target speed 30 rpm, 60 rpm and 90 rpm
Table 3 Spearman correlations, 95% confidence interval and significance between MOTOMed™-VCP organized for target speed (30 rpm, 60 rpm, 90 rpm) and sessions (session 1–session 2)

3.3 Reliability evaluation of the systems

To evaluate the reliability of the measures collected by both systems, we calculated the standard error of measurement (SEM) and repeatability of the measurements using intraclass correlation coefficients (ICC), interpreted as a test-retest analysis. The ICC model (3,1) or Two-Way Mixed Effect model (Absolute Agreement Definition) described by Shrout and Fleiss (1979) was chosen because it considers random effects on the measurements over time (between session 1 and session 2). SEM can be estimated from ICC (Weir 2005):

$$\begin{aligned} \hbox {SEM} = \hbox {SD}\sqrt{1-\hbox {ICC}}, \end{aligned}$$
(3)

were SD is the standard deviation of the measures. Reliability data are provided in Table 4.

Table 4 ICC (with 95%) and SEM for cycles measurements between sessions taken by the MOTOMed and the VR cycling platform (VCP) organized by target speed

The ICC values ranged between 0.416 and 0.913 involving all the speeds. At a target speed of 30 rpm the ICC values for the MOTOmed and the VCP are 0.743 to 0.746, respectively, and SEM values are 1.02 and 1.16 cycles, respectively. Something similar happens at a target speed 60, which ICC values for each system (MOTOmed and VCP) 0.416 and 0.445, and SEM values are 0.96 and 1.26, respectively. According to these results, at speeds between 30 and 60 rpm, the SEM outcome indicates a measurement error of about 1 cycle for each system. This is consistent with previous correlation results, which reflected the high correspondence in measurements of both systems at these speeds. However, in terms of repeatability, we observe that the ICC values are relatively low for both systems. The fact that both systems show consistency in repeatability indicates that both are affected by the same factors. We attribute these results to the human factor because, given that the tests have been performed with humans, despite their attention to maintaining the cadence, they do not achieve the same number of cycles in all sets, affecting the repeatability results. In contrast, at a target speed of 90 rpm, the ICC values are 0.913 and 0.851 for each system and SEM values are 0.799 cycles for the MOTOmed and 3.24 cycles for the VCP. In this case, the repeatability results show that for both sessions the systems have shown similar measurements, suggesting that both systems have been consistent with their measurements and that participants have been consistent with their cadences. However, it is evident for the VCP system that a target speed of 90 rpm its measurement error is 3 times higher than that of the MOTOmed.

4 Discussion

The objective of the present study was to test the validity and reliability of using a novel virtual reality HMD (Oculus Quest 2) in combination with a wearable IMU sensor placed on subject’s tight to assess cycling cadence. To study the validity of this system, it is confronted against a reference pedalling platform previously developed and validated as a reliable cycling platform (Piazza et al. 2018). In this way, the cycle detection measurements performed by both systems during trials of 3 repetitions of 1 min of pedalling at 3 different set-point speeds (30 rpm, 60 rpm, 90 rpm) are captured simultaneously.

We highlighted the high concordance between the measurements taken by the cycling platform of reference (referred to as MOTOmed) and Virtual Cycling Platform (referred as VCP) for slow (30rpm) and medium (60rpm) speed in both sessions (Spearman Correlation Session 1: 0.946 and 0.931; Spearman Correlation in Session 2: 0.858 and 0.895). It has also been shown that the correlation is lower between the results of the reference platform and the system developed for 90 rpm (Spearman correlation session 1 = 0.787 and Spearman correlation session 2 = 0.760). This correlation result is attributed to the fact that at higher pedalling speeds more cycles are lost by the MMPD algorithm. While these results influence the accuracy of the pedalling cadence estimation, the algorithm is still quite successful overall as shown in the average results of Tables 1 and 2. As can be seen in the Fig. 7, at 90 rpm the movement is more shaky than at 60 or 30 rpm, simply because of the speed factor. High-speed pedalling exercises can result in a more unstable motion, which is reflected in the 90 rpm curve itself with a more staggered and less fluid shape. Small oscillations around the peak cause the algorithm to fail in cycle counting, as it is sensitive to the detection of local minima and maxima. This explains why the pedalling speed influences the cycle detection accuracy of the cadence estimation algorithm as shown in the outcome Tables 1 and 2.

Reviewing the repeatability results, it is observed that in the case of the MOTOmed, for all speeds the error in the measurement is around 1 cycle, while in the case of the VCP it coincides with the previous one at speeds 30 and 60, but the error in the measurement amounts to 3.24 cycles at 90 rpm. It is also concluded that at speeds 30 and 60 the repeatability of the systems is slightly less consistent, although we attribute this to the human factor. Indeed, during the experimental trials, it was observed that at low to medium speeds, the participants are comfortable with the physical exercise and, due to the involving nature of virtual reality, they were often distracted by the virtual environment. However, at high speed, they focused all their attention on the pedalling due to the concentration required to maintain this speed. Therefore, the results of the ICC show that at high speed the VCP consistently exhibits cycle detection errors. But it also reflects the irregularity of the participants in the affordable speed tests, that we attribute to the engaging effect of virtual reality.

To summarize from the ideas drawn from the statistical analysis, the application of this tool should be limited to low or moderate speed exercise environments, excluding high speed applications from the scope of this system. Hence, these validation results have a clinical implication. In first place, our approach can be considered suitable as an engaging tool to practise cycling exercise, as it is assumed low-moderate pedalling speed for this group of users. It should also be considered the remarkable accomplishment of the VCP in the estimation of cycling cadence only based on hip ROM by only one inertial sensor. As a result, we developed a virtual cycling platform independent from the cycling ergometer or stationary bike used, which only requires the use of one inertial sensor and Oculus Quest 2 HMD.

The present study has been performed with young healthy subjects, whose hip range of motion (ROM) is wide. The joint motions obtained (Figs. 6, 7) during standardized ergometer cycling conform to the hip normal range of motion investigated by different authors (Ericson et al. 1988; De Roeck et al. 2021). According to their studies, in the case of healthy young people the hip flexion moves between 32° and 70° of hip flexion (Ericson et al. 1988), which implies a range of movement of approximately 40\(^\circ\). From the characterization of hip flexion motion performed in this study, slight differences in the maximum and minimum hip flexion angles as a function of speed can be observed. And yet, our solution is suitable for hip flexion-extension work in these normal ranges. However, it would be worth analysing the validity of the tool with elderly subjects or participants with motor disabilities to know if it also correctly detects cadence cycles with tight hip ROM. Futhermore, most studies analyse joint kinematics at a cadence of 60 rpm (Johnston 2007). In our study, we have analysed the cadences of 30 rpm, 60 rpm and 90 rpm, in order to analyse which range of cadence our application shows good accuracy in cadence estimation with respect to the system of reference. It is important to consider that our development is focused on the rehabilitation and improvement of lower limb mobility for adults, so they are not expected to work at high cadence. In this sense, our approach would be valid for the purpose for which it has been designed.

We highlight from our approach that it does not depend on specific cycling ergometers or hardware (Chen et al. 2017) since it estimates the cadence based on user’s hip kinematics instead of crank angle of the ergometer likewise (Cardoso et al. 2019; Ferreira et al. 2019; Grani and Bruun-Pedersen 2017). The easiness and accessibility of the setup sets the universality of the system, yet being useful as virtual rehabilitation solution in day-care centres, rehabilitation clinics or even for home-based therapies. Also, in the near future, we plan to improve the design of the virtual scenarios to allow different uses of the tracking sensor, for example, to capture circular movements for the upper limb. Another positive aspect is that our approach is perfectly portable and simple to assemble, unlike the systems proposed by Cardoso et al. (2019), Ferreira et al. (2019) and Grani and Bruun-Pedersen (2017), which are based on the mechanical adaptation of commercial ergometers crank/pedals or custom hardware developments.

In terms of the sense of presence and immersion of our system, no formal survey has been conducted in this technical validation to capture these user ratings. However, in future usability testing and assessment of the potential effect of this platform, it will be essential to collect users’ subjective assessments of their perception of immersion and presence. However, based on what was observed in the experimental tests, it should be mentioned that the participants were truly involved in the virtual reality as they showed their captivation during the exercises and even allowed themselves to be drawn into the environment, sometimes even causing slight variations in the maintenance of the cadence. We believe that this feedback strategy may not only be beneficial in increasing exercise adherence but also justifies the use of these technologies for this purpose. It differs from the strategies implemented in the exergames previously presented (Cardoso et al. 2019; Ferreira et al. 2019), which displayed the sensing data to the user with the purpose of enhancing their performance, but it does not necessarily have an effect on user’s engagement nor motivation. For this reason, we endorse the philosophy of proprioceptive stimulation in VR as a strategy to involve the user in the physical activity followed in some studies (Grani and Bruun-Pedersen 2017; Guo et al. 2017; Caserman et al. 2019). All in all, we have designed a virtual reality system that maps the user’s physical actions into virtual reality feedback and/or behaviour to provide consistency and verisimilitude to the virtual environment. We think this system could be potentially beneficial for increasing user engagement and motivation to use intrinsic biofeedback to influence the sense of presence within the virtual environment.

5 Conclusion

In this paper, a novel low-cost wireless standalone platform for VR-based cycling exercises is developed. This system is based on a wearable IMU sensor paired with the Oculus Quest 2 headset and a common stationary bicycle. The present development has focused on defining an optimal hip flexion motion detection algorithm for pedalling in the sagittal plane for a virtual reality environment. Further research is required to analyse more planes of movement, as the literature suggests performing a three-dimensional (3D) movement analysis instead of a two-dimensional analysis of an isolated plane. This would require to analyse the technical feasibility of increasing the computational load and how it affects the performance of the application, as the current processing of our system is fully done on an Oculus Quest 2 HMD.