ERK'2022, Portorož, 502-505 502 Evaluation of inertial measurement units for determ i ning knee joint angle during cycling Saša Obradović University of Ljubljana, Faculty of electrical engineering , Tržaška cesta 25 , Ljubljana, Slovenia E -mail : so3997@student.uni -lj.si Abstract. The paper presents a simple method for determining the knee joint angle during cycling using inertial sensors. To a c company the presented method, two sensor fusion methods are used: a simple complementary filter and an error -state Kalman filter. E valuation is achieved using an optical motion tracking system. For all three methods f or a short measurement of up to 5 minutes the root mean square error is below 2 o . Results f rom the Kalman filter proved to be the most stable , with the confidence interval under 1 °. As such there was no measurement drift present in the Kalman filter measurements after the Kalman weights have converged , in contrast to the calibrated and complementary filter measurements where a certain drift was always present. T he presented results indicate that the method is efficient in a laboratory environment and co uld be used for monitorin g a cyclist’s position and in turn improv ing a cyclist’s technique and position and preventing certain injuries . Adopting the method presented , as opposed to optical motion capture systems, cheaper and more efficient solutions could be developed. 1 Introduction Determining the knee joint angle during cycling can be used as crucial information in improving the cyclist’s technique , as it is directly linked to the position of the cyclist on a bicycle, which can cause or prevent certain injuries , such as the patellofemoral syndrome and quadriceps tendonitis. In more recent papers, researchers have used information of the knee joint angle or the cycle of rotation in combination with machine learning algorithms to teach and improve the cyclists technique using the readings from inertial sensors as feedback [1] [2] . In [2] researchers have managed to draw the cycle of rotation to the user in real time using the self -organising feature map algorithm and in turn help them improve their technique by trying to align their own cycle with the cycle of a professional cyclist. Some research h as shown that the position of a cyclist is also dependant on the type of cyclist [3] . Professional cyclists prefer a more aerodynamic position with drop bars, meanwhile regular cyclists prefer a more upright position with regul ar handlebars. Research has also been done in the field of muscle activation using an electromyogram to see if there is a connection between the crank cycle of 360 ° and the activation of certain muscle groups [4] . Certain stu dies have also incorporated the measurements of quadriceps and hamstring muscle activity with respect to the knee joint angle and the crank cycle [5] . In these studies, the knee join angle was determined using an optical system. If the knee joint angle can be determined accurately using inertial measurement units (IMU), cheaper equipment could be developed and used outside of a laboratory environment and in turn help pro fessionals and amateur cyclists with improving their technique. The paper presents a simple method, relying on two IMU devices, placed on the upper and lower leg segment of the body for the tracking of rotation angles of each respective body part and in turn measuring the knee joint angle. Since the iron construction of the bicycle body c ould cause inaccurate measurements from the magnetometer, it was not used during the experiment. Similar experiments in the field of joint angle measurements in various dynamic conditions using IMU sensors were conducted in [6] [7] . In [6] a similar optical motion tracking system was used for evaluating the results, however it included more markers for the tracking. Combining measurements from an accelerometer and a gyroscope require s sensor fusion techniques. One of the most popular and robust solutions is the Kalman filter. In [8] the Kalman filter has been proven as a good solution for sensor fusion in dynamic environments . As such, the most stable results in this paper are expected to be obtained when usi ng the Kalman filter. 2 Methods To determine the knee joint angle and evaluate its accuracy two rigid bodies are designed , one for the upper and one for the lower part of the leg as shown in Figure 1. Each rigid body includ es one IMU device an d three visual markers . The position of the later is tracked with an optical motion capture system and gives the reference knee joint an gle. For both rigid bodies , the IMU sensors are positioned at the centre marker representing the centre of the local coordinate system . The remaining two markers d efine the direction of the x and y ax e s. The knee joint angle is determined considering the geometry presented in Figure 2 and according to: 𝛼 = 𝜋 − 𝛾 − 𝛽 (1) where a denotes the knee joint angle, b the angle of rotation of the lower rigid body , and g the angle of rotation of the upper rigid body . Angles b and g are determined u sing the projections of the vector of the 503 gravitational acceleration from the accelerometer, and rotation matrices determined from both the gyroscope readings . The initial value of the vector of gravitational acceleration is determined in the stationary part of the measurement , conducted at the start and the end of the measurement. The stationary projections of the vector of gravitational acceleration are then rotate d using rotation matrices in the local sensor coordinate system. Since the rotations are happening in the local coordinate system, a pre -multiplication method was used for every iteration, as is shown in equation (2) ,where 𝑔 [ 𝑛 +1] denotes the projections of the vector of gravitational acceleration in the next iteration, 𝑔 [ 𝑛 ] the projections from the current iteration and 𝑅 [ 𝑛 ] the rotation matrix that connects the two. Figure 1. Two rigid bodies for determin ing the knee joint angle; 1. and 2. represent rigid bodies for the upper and lower leg segment s, respectively . 𝑔 [ 𝑛 +1] = 𝑅 [ 𝑛 ] 𝑔 [ 𝑛 ] (2) The rotatio n i n (2) is estimated according to the Simultaneous Orthogonal Rotation Angle [9] using the normalized output of the gyroscope 𝛺 [ 𝑛 ] 000000000⃑ as the unit vector of rotation 𝑣 [ 𝑛 ] 00000000⃑ i . e . ,rotation axis : 𝑣 [ 𝑛 ] 00000000⃑ = 𝛺 [ 𝑛 ] 000000000⃑ | 𝛺 [ 𝑛 ] 000000000⃑ | @ (3) while the angle of rotation 𝜑 [ 𝑛 ] is determined as the product of the negative norm - | 𝛺 [ 𝑛 ] 000000000⃑ | of the current gyroscope output and the time difference ∆ 𝑡 between the next and current iteration : 𝜑 [ 𝑛 ] = - D𝛺 [ 𝑛 ] 000000000⃑ D∆ 𝑡 = - D𝛺 [ 𝑛 ] 000000000⃑ D(𝑡 [ 𝑛 +1] − 𝑡 [ 𝑛 ] ) (4) The rotation matrix is then computed using the following formula (5), where 𝑐𝜑 and 𝑠𝜑 denote the sine and cosine functions of the rotation angle 𝜑 [ 𝑛 ] , meanwhile 𝑣 ! ,𝑣 " and 𝑣 # denote the components of the unit vector of rotation. Once the rotation of the gravitational acceleration vector is complete, we can calculate angles b and g according to: 𝛽 = 𝑎𝑡𝑎𝑛 2(𝑔 $ ! 𝑔 $ " ⁄ ) (6) 𝛾 = 𝑎𝑡𝑎𝑛 2(𝑔 % ! 𝑔 % " ⁄ ) (7) where 𝑔 % " and 𝑔 % ! represent the x and y projections of the gravitational acceleration vector from the upper rigid body, meanwhile 𝑔 $ " and 𝑔 $ ! represent the projections of the gravitational acceleration vector from the lower rigid body. Since gyroscope measurements are known t o creating a drift for long measurements, two more methods were used for determining the rotation matrices , a simple Matlab built in complementary and an error -state Kalman filter. The optimal values for the Kalman filter parameters w ere determined empirically . Details on the parameters and equations of the used filters can be found in [10] and [11] , respectively. The results were compared to the knee joint angle values obtained with the optical motion tracking system . Since the Qualisys optical motion tracking system also gives rotation matrices as an output from its measurements, they were used for determining the knee joint angle the same way as with IMU sensors. The given angle was the n used as the reference point fo r the evaluation of the angle determined from the IMU measurements. Figure 2 . Determining the knee joint angle, where a denotes the sought after angle determined with equation (1). (5) 504 Since the two IMUs and the optical motion capture system are not synchronised, knee joint angles obtained with both systems were mutually aligned by considering the maximum of the correlation function at the beginning of the measurement , which consists of the stationary period and the first few rotation cycles. If a linear trend in the complementary filter and the simp le offset deduction method is detected, it is detrended with a polynomial of the first degree. 3 Results 3.1 Experimental validation For the experiment, MetamotionR IMU sensors from Mbientlab Inc. and Oqus 300 optical motion tracking system from Qualisys AB were used . For processing of the measurements Matlab was used in combination with its Sensor Fusion and Tracking toolbox. All processing was performed offline. Prior to the measurement, the laboratory environment was calibrated for the optical motion tracking system, after which the bicycle was placed on a turbo trainer . Both the IMU sensors and the Qualisys motion tracking system were set up to capture the measurement at a sampling frequency of 100 Hz. Taking into consideration the goal cycling rate of 90 rpm or 1.5 cycles per second, the sampling freque ncy was chosen as a safe choice for capturing all significant higher harmonics and for the case of potential measurements in the outside environment . Since the gyroscop es ha ve an offset reading while still , a stationary period of the measurement was added to the start and end of the measurement for calibration purposes . The mean of th is stationary period was subtracted from all readings. A single measurement of 5 minutes was conducted with the subject’s cadence consistency goal 90 revolutions per minute or 66.67 samples per cycle was forced by a background metronome . To evaluate the accuracy of the IMU measurements the root mean square error (short RMSE) was measured for the entire measurement and for each period of the knee joint angle change. 3.2 Experimental results The subject managed an average of 68.26 ±5.23 samples per cycle . The knee joint angle results are represented in Table 1 and Figure 3 , where the graphs represent the RMSE between IMU sensors and the optical syste m. Table 1. RMSE results of the conducted measurements The two spikes present on Figure 3, are the result of the optical system not detecting the marker correctly. If the optical system did not detect the marker, linear interpolation is used to fill in the data for the missing measurements, resulting in such spikes in the RMSE resul ts. The maximum knee joint angle for all cycling periods averaged out to an angle of 136.33 °±3.93° when the leg is fully extended . The minimums averaged out to an Simple calibration Kalman filter Complementary filter 1.78°±1.21° 1.80°±0.55° 1.66°±0.87° Figure 3. RMSE results of the conducted measurement 505 angle of 71.31 °±5.04° when the leg is in its maximum contraction. All of the presented results have a confidence interval of ± two standard deviations. 4 Discussion and conclusion The results confirm the notion that the Kalman filter would provide for the best results . The Kalman filter is an adaptive solution, and as such should be better for longer periods of time in comparison to the Complementary filter and the simple offset deduction method . Even though the Complementary filter and the simple offset deduction method seem to be doing well on their own, they have a linear trend, which was subtracted from the measurement . This , however , was a short measurement of just 5 minutes and it is expected for longer measurements that the trend would no longer be linear. For this reason, measuring the knee joint angle with the Kalman filter would prove to have better results as it is the only one without a trend. From the results of the measurement, we can safely say , at least for short amounts of time , that measuring the knee joint angle with IMU sensors is accurate enough for a laboratory environment . Given the presented results an estimate of an upper limit duration for the simply calibrated IMU sensors can be given in the interval 5-7 minutes. For the Kalman filter further testing is necessary to provide a similar estimated duration limit for similarly unreliable measurement s . Further testing in real time and an open environment would be very beneficial as it would evaluate the system not just for longer periods of time, but the acceleration given from the accelerometers would not be the same . More noise is expected, as the surfaces would be rougher and there is still the unknown element of turning in a corner. The gyroscop es would also show a more significant drift, as they are prone to give inaccurate readings , which accumulate exponentially over time. Further research relying on the method presented in this paper in combination with muscle activity sensors such as the electromyogram, c ould provide with deeper insight regarding the cyclist ’s technique. Muscle activation patterns and their dependencies on the knee joint angle could be fed to the cyclist s through a screen or an actuator , enabling them to impr ove their technique and avoid potential injury. The cyclist s would so have more information on muscle group activation during a session , allowing them to focus more on a desired muscle group and in turn improve their cycling technique . Acknowledgement I would like to express my gratitude towards my mentor doc.dr. Sara Stančin at the Faculty of Electrical Engineering, University of Ljubljana, for motivating me during my research and for being an all -around excellent guide during the whole process of writing it. The experiences I’ve gained are countless and I’m looking forward to further research with her. Literature [1] J. Y. Xu, X. Nan, V. Ebken, Y. Wang, G. J. Pottie and W. J. Kaiser, "Integrated Inertial Sensors and Mobile Computing for Real -Time Cycling Performance Guidance via Pedaling Profile Classification," in IEEE Journal of Biomedical and Health Informatics , 201 4. [2] H. Yakota, M. Naito, N. Mizuno and S. Ohshima, "Framework for visual -feedback training based on a modified self -organizing map to imitate complex motion," J Sports Engineering and Technology, vol. 234, no. 1, pp. 49 -58, 2020. [3] C. A. Wozniak, “Cycling biomechanics: A literature review,” Journal of Orthopaedic & Sports Physical Therapy, vol. 14, no. 3, pp. 106 -113, 1991. [4] S. D. François Hug, “Electromyographic analysis of pedaling: A review,” Journal of Electromyography and Kinesiology, vol. 19, pp. 182-198, 2009. [5] J. Cézar Lima da Silva, O. Tarassova, M. M. Ekblom, E. Andersson, G. Rönquist and A. Arndt, “Quadriceps and hamstring muscle activity during cycling as measured with intramuscular electromyography,” European Journal of Applied Phys iology, vol. 116, pp. 1807 -1817, 2016. [6] S. Bakhshi, M. H. Mahoor and B. S. Davidson, “ Development of a body joint angle measurement system using IMU sensors,” in 33rd Annual International Conference of the IEEE EMBS , Boston, Massachusetts USA, 2011. [7] J. Keun Lee and T. Hyeong Jeon, “IMU-based but Magnetometer -free Joint Angle Estimation of Constrained Links,” in IEEE Sensors , New Delhi, India, 2018. [8] J. Keun Lee, E. J. Park and S. N. Robinovitch, "Estimation of Attitude and External Acceleration Using Inertial Sensor Measurement During Various Dynamic Conditions," IEEE Transactions on instrumentation and measurement, vol. 61, no. 8, pp. 2262 -2273, 2012 . [9] S. Stančin and S. Tomažič, “Angle Estimation of Simultaneous Orthogonal Rotations from 3D Gyroscope Measurements,” Sensors, no. 11, pp. 8536-8549, 2011. [10 ] The MathWorks, Inc., "Orientation estimation from a complementary filter - MATLAB - MathWorks United Kingdom CSP Hash," The MathWorks, Inc., 2019. [Online]. Available: https://uk.mathworks.com/help/fusion/ref/complementar yfilter -system -object.html. [Accessed 23 July 2022]. [11 ] The MathWorks, Inc., "Orientation from acceleromet er and gyroscope readings - MATLAB - MathWorks United Kingdom," The MathWorks, Inc., 2018. [Online]. Available: https://uk.mathworks.com/help/fusion/ref/imufilter - system -object.html. [Accessed 23 July 2022].