# Real-Time Musculoskeletal Kinematics and Dynamics Analysis Using Marker- and IMU-Based Solutions in Rehabilitation

^{1}

^{2}

^{3}

^{*}

^{†}

## Abstract

**:**

## 1. Introduction

`gait2392`model [8] within the open-source modeling framework

`OpenSim`[9,10]. Statistically significant differences were found in the output variables, which may not influence the conclusions in clinical settings as concluded by the original authors [11]. However, a proprietary solution may limit this system’s use and extent towards a quick adoption of new technologies (e.g., markerless tracking). To this end, we will present an open-source framework for carrying real-time calculations based on the

`OpenSim`tool-chain that is well-adopted by the biomechanics community.

`rtosim`), that relies on

`OpenSim`, capable of performing Inverse Kinematics (IK) and Inverse Dynamics (ID) calculations was presented in [12]. Multi-thread implementation was proposed to increase the throughput of the system. The authors presented a real-time filter for rejecting noise and calculating the kinematics’ first and second derivatives. The influence of the filter’s cutoff frequency was further studied, and a methodology for determining its value was presented. In this study, we examine the role of real-time filtering more closely and how it can negatively affect dynamic calculations at later stages. We propose a filter capable of accurately estimating the kinematics’ first and second derivatives under noisy conditions. This results in real-time calculations of kinematics and dynamics that closely resemble the alternative offline analyses.

## 2. Methods

#### 2.1. Marker- and IMU-Based Inverse Kinematics

`OpenSim`, a transformation ${}^{{G}_{o}}{\mathit{R}}^{{G}_{IMU}}$ is first required. Next, a transformation ${\mathit{R}}_{heading}$ is applied which is computed from the angular difference between the orientation of the base sensor’s anterior axis (typically the IMU placed on the pelvis or torso) measured during the static trial, and the orientation of the anterior axis of the virtual model. This is necessary to compensate for the heading direction of the subject. The estimated transformation ${\mathit{R}}_{heading}{}^{{G}_{o}}{\mathit{R}}^{{G}_{IMU}}$ is considered constant throughout the session and can be applied as an offset transformation during IK. That is, after the static trial, the initial orientations in the IK analysis module are set to the transformation ${\mathit{R}}_{heading}{}^{{G}_{o}}{\mathit{R}}^{{G}_{IMU}}{}^{{G}_{IMU}}{\mathit{R}}^{{S}_{i}}\left({t}_{init}\right)$, while during the dynamic trial, the transformations passed to the IK module are ${\mathit{R}}_{heading}{}^{{G}_{o}}{\mathit{R}}^{{G}_{IMU}}{}^{{G}_{IMU}}{\mathit{R}}^{{S}_{i}}\left(t\right)$.

`NGIMU`from x-io Technologies Limited) to record the upper- or lower-limb movement and test the real-time system. Unfortunately, this introduced many technical challenges related to obtaining accurate orientation from multiple sensors that are out of the current study’s scope. We experienced problems with the accumulation of errors due to bias and drifting in the orientations, which are sensitive to magnetic interference. Synchronization of sensor data (e.g., IMU, pressure insoles) was accommodated through a data structure that stores the arriving frames, which are then resampled (constant sampling frequency) using each sensor’s synchronized timestamp. Timestamp synchronization was performed at the beginning of each session. Despite the technical challenges, we were able to test whether one could successfully use IMU information as an input to our system and verify the Inverse Kinematics (IK) method.

#### 2.2. Real-Time Filtering

#### 2.3. Estimation of Ground Reaction Wrenches

#### 2.4. Real-Time Estimation of Muscle Forces

#### 2.5. Developing a Gait Retraining System

`Unity3D`game engine.

`Unity3D`was selected because it can permit the implementation of solutions that can target typical projection screens and utilize augmented or virtual reality output devices. Our system could support interactive scenarios that could engage the user and make the training process more fun and effective. Exchange of data with the simulation back-end was established through shared memory to improve efficiency, reduce latency, and decouple implementation specifics (e.g., simulation back-end written in

`C++`and front-end in

`C#`).

## 3. Results

`OpenSim`’s API [9,10,34] and all comparisons are made against its offline methods for kinematic and dynamic calculations. The musculoskeletal model used in this study is based on

`gait2392`[8] with some minor modifications. The DoF have been reduced to 19 and the model is actuated by 92 Hill-type muscles [35]. The generic model is scaled using a static trial to account for the subject’s anthropometry. Experiments were carried out on Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz. Better CPU specs can further reduce the computational delays.

#### 3.1. Performance of Real-Time Filtering and Differentiation

`OpenSim`’s offline kinematics analysis. The

`OpenSim`’s kinematics analysis utilizes the same low-pass filter and spline method, having at its disposal the whole duration of the movement. We observed that for each type of error (coordinates, speeds, accelerations), there exists an optimal value for M. We determined that $M=35$ is the optimal choice for this movement because acceleration errors can significantly impact the consequent analysis. Besides, a small value of M reduces the computational latency of the filter. Similarly, $D=14$ seems to be the optimal solution, which can lead to an artificial lag of 0.14 s for a typical marker sampling frequency of 100 Hz. Notably, one can follow this procedure to determine the optimal parameters for any movement.

`OpenSim`’s offline kinematics analysis (ground truth) against the proposed filter and the “spatial” filter as implemented in

`rtosim`[14]. The only parameter of the spatial filter is the cutoff frequency, which we set to 6 Hz. We can observe that the proposed filter has a lower RMSE and closely resembles

`OpenSim`’s offline time-series. While the spatial filter can approximate the original signal well, it underestimates its first and second derivatives for fast-moving coordinates (comparison of all coordinates presented in the Supplementary Materials). The spatial filter has low computational latency (mean latency less 0.1 ms) than the proposed filter (mean latency of 3 ms) and is very easy to implement. However, acceleration errors can lead to significant differences during dynamic analysis (presented in the next subsection).

#### 3.2. Influence of Online Filtering on Inverse Dynamics Calculations

`OpenSim`’s offline counterpart. The ID module implements a recursive Newton–Euler formulation, which is very efficient, achieving a mean computational latency of less than 0.1 ms. Please note that the

`OpenSim`’s ID offline analysis has at its disposal the full trial in advance and thus can apply non-casual operations to reject the noise and calculate derivatives. In contrast, the real-time system operates on the arriving frames and must process a limited number of instances (filter’s memory buffer) to reduce latency while maintaining accuracy.

`OpenSim`and real-time ID utilizing the two real-time filters presented previously (proposed and spatial) is illustrated. A comparison of all coordinates is also presented in Supplementary Materials. The time lag introduced by the filters was compensated (shifted) in these plots for comparison reasons. We observed that the real-time results closely match the offline ones. Residual vertical forces at the pelvis are low and within the accepted norm [37]. The initial part of the proposed filter’s curve is missing because we need at least M samples to begin the processing. The real-time curves are smoother and present fewer oscillations due to the non-causal implementation related to the D parameter. We also observed that the proposed filter outperforms the spatial filter in terms of RMSE. The spatial filter can underestimate the moments due to the kinematic mismatch at the coordinate velocity and acceleration, as presented in the previous subsection. Therefore, this can have a significant impact on the joint moments.

#### 3.3. Prediction of Ground Reaction Wrenches and Influence on Joint Moments

#### 3.4. Comparison of Muscle Forces Determined in Real-Time

`OpenSim`’s Static Optimization (SO) and proposed real-time muscle optimization method. Results show forces for major muscles (gluteus maximus, semimembranosus, psoas major, rectus femoris, vastus medialis, biceps femoris short head, medial gastrocnemius, soleus, and tibialis anterior) of the lower-limb. A comparison of all 92 muscles is presented in the Supplementary Materials. Good agreement between timing and shape matching is observed even though the two methods use different formalization and implementation specifics.

#### 3.5. A Gait Retraining System for Reducing Knee Loads

Dr. Good has experience with the gait retraining system, and their clinic just received a patient that has been diagnosed with mild knee osteoarthritis in her right leg. He already knows that the patient needs to adopt a gait pattern that alleviates the knee joint’s medial loading to reduce the pain. The primary indicator to assess the loading of the joint is the medial reaction force at the knee. One strategy is to adjust the foot progression angle, defined as the angle between the line of walking progression and the foot’s longitudinal axis. Therefore, he defines the vertical reaction force as an objective to be minimized. The decision variable is the foot progression angle. However, he also decides to experiment with the step length and step width, providing simple and intuitive visual feedback to the patient. The system can adjust the decision variables’ target value (Figure 12) using online gradient descent based on the joint reaction forces’ estimates.

First, he tried to familiarize the patient with the motion analysis lab by explaining the different visualization elements and by presenting the current session’s goal. Since this is her first session, the patient is ordered to walk normally to gather information on her walking habits and calibrate the model. The clinician checks if the system works properly by comparing the reaction loads’ real-time and offline calculations at the knee (Figure 13). Based on the calibration trial, he then sets the initial target values for the decision variables. The patient is instructed to walk by alternating her foot progression angle, step length, and step width based on the system’s indication. After exploring different gait modifications using real-time feedback, an optimal walking strategy is reached, resulting in reduced reaction loads on the knee’s medial compartment and is also comfortable for the patient. Both Dr. Good and the patient feel satisfied by the experience of using the gait retraining system, and the next appointment is scheduled.

## 4. Discussion

`XSENS`instead of our custom-build solution and compare the performance of the system against marker-based solutions.

`OpenSim`. The limitation of the current implementation lies in the optimization routine’s ability to solve the problem efficiently. Nevertheless, we are exploring how to improve on this and possibly include additional constraints that could originate from direct measurements such as surface EMG to personalize the obtained solutions optionally.

## 5. Conclusions

## Supplementary Materials

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Conflicts of Interest

## Abbreviations

IMU | Inertial Measurement Units |

MOCAP | Motion Capture |

IK | Inverse Kinematics |

ID | Inverse Dynamics |

EMG | Electromyography |

DoF | Degrees of Freedom |

GRF&M | Ground Reaction Forces and Moments |

FIR | Finite Impulse Response |

CoP | Center of Pressure |

RMSE | Root Mean Squared Error |

SO | Static Optimization |

## References

- Carcreff, L.; Gerber, C.N.; Paraschiv-Ionescu, A.; De Coulon, G.; Newman, C.J.; Armand, S.; Aminian, K. What is the Best Configuration of Wearable Sensors to Measure Spatiotemporal Gait Parameters in Children with Cerebral Palsy? Sensors
**2018**, 18, 394. [Google Scholar] [CrossRef] [PubMed][Green Version] - Paraschiv-Ionescu, A.; Newman, C.J.; Carcreff, L.; Gerber, C.N.; Armand, S.; Aminian, K. Locomotion and cadence detection using a single trunk-fixed accelerometer: Validity for children with cerebral palsy in daily life-like conditions. J. Neuroeng. Rehabil.
**2019**, 16, 24. [Google Scholar] [CrossRef] [PubMed][Green Version] - Armand, S.; Decoulon, G.; Bonnefoy-Mazure, A. Gait analysis in children with cerebral palsy. EFORT Open Rev.
**2016**, 1, 448–460. [Google Scholar] [CrossRef] - Schlachetzki, J.C.M.; Barth, J.; Marxreiter, F.; Gossler, J.; Kohl, Z.; Reinfelder, S.; Gassner, H.; Aminian, K.; Eskofier, B.M.; Winkler, J.; et al. Wearable sensors objectively measure gait parameters in Parkinson’s disease. PLoS ONE
**2017**, 12, e0183989. [Google Scholar] [CrossRef] [PubMed] - Pizzolato, C.; Lloyd, D.G.; Barrett, R.S.; Cook, J.L.; Zheng, M.H.; Besier, T.F.; Saxby, D.J. Bioinspired Technologies to Connect Musculoskeletal Mechanobiology to the Person for Training and Rehabilitation. Front. Comput. Neurosci.
**2017**, 11. [Google Scholar] [CrossRef] - Bennour, S.; Ulrich, B.; Legrand, T.; Jolles, B.M.; Favre, J. A gait retraining system using augmented-reality to modify footprint parameters: Effects on lower-limb sagittal-plane kinematics. J. Biomech.
**2018**, 66, 26–35. [Google Scholar] [CrossRef] [PubMed] - Van den Bogert, A.J.; Geijtenbeek, T.; Even-Zohar, O.; Steenbrink, F.; Hardin, E.C. A real-time system for biomechanical analysis of human movement and muscle function. Med. Biol. Eng. Comput.
**2013**, 51, 1069–1077. [Google Scholar] [CrossRef][Green Version] - Delp, S.; Loan, J.; Hoy, M.; Zajac, F.; Topp, E.; Rosen, J. An interactive graphics-based model of the lower extremity to study orthopaedic surgical procedures. IEEE Trans. Biomed. Eng.
**1990**, 37, 757–767. [Google Scholar] [CrossRef] [PubMed] - Delp, S.L.; Anderson, F.C.; Arnold, A.S.; Loan, P.; Habib, A.; John, C.T.; Guendelman, E.; Thelen, D.G. OpenSim: Open-Source Software to Create and Analyze Dynamic Simulations of Movement. IEEE Trans. Biomed. Eng.
**2007**, 54, 1940–1950. [Google Scholar] [CrossRef] [PubMed][Green Version] - Seth, A.; Hicks, J.L.; Uchida, T.K.; Habib, A.; Dembia, C.L.; Dunne, J.J.; Ong, C.F.; DeMers, M.S.; Rajagopal, A.; Millard, M.; et al. OpenSim: Simulating musculoskeletal dynamics and neuromuscular control to study human and animal movement. PLoS Comput. Biol.
**2018**, 14, e1006223. [Google Scholar] [CrossRef] [PubMed] - Falisse, A.; Rossom, S.V.; Gijsbers, J.; Steenbrink, F.; Basten, B.J.H.V.; Jonkers, I.; Bogert, A.J.V.D.; Groote, F.D. OpenSim Versus Human Body Model: A Comparison Study for the Lower Limbs During Gait. J. Appl. Biomech.
**2018**, 34, 496–502. [Google Scholar] [CrossRef][Green Version] - Pizzolato, C.; Reggiani, M.; Modenese, L.; Lloyd, D.G. Real-time inverse kinematics and inverse dynamics for lower limb applications using OpenSim. Comput. Methods Biomech. Biomed. Eng.
**2017**, 20, 436–445. [Google Scholar] [CrossRef] - Pizzolato, C.; Lloyd, D.G.; Sartori, M.; Ceseracciu, E.; Besier, T.F.; Fregly, B.J.; Reggiani, M. CEINMS: A toolbox to investigate the influence of different neural control solutions on the prediction of muscle excitation and joint moments during dynamic motor tasks. J. Biomech.
**2015**, 48, 3929–3936. [Google Scholar] [CrossRef] [PubMed] - Pizzolato, C.; Reggiani, M.; Saxby, D.J.; Ceseracciu, E.; Modenese, L.; Lloyd, D.G. Biofeedback for Gait Retraining Based on Real-Time Estimation of Tibiofemoral Joint Contact Forces. IEEE Trans. Neural Syst. Rehabil. Eng.
**2017**, 25, 1612–1621. [Google Scholar] [CrossRef] [PubMed][Green Version] - Lloyd, D.G.; Besier, T.F. An EMG-driven musculoskeletal model to estimate muscle forces and knee joint moments. J. Biomech.
**2003**, 36, 765–776. [Google Scholar] [CrossRef] - Sartori, M.; Reggiani, M.; Farina, D.; Lloyd, D.G. EMG-Driven Forward-Dynamic Estimation of Muscle Force and Joint Moment about Multiple Degrees of Freedom in the Human Lower Extremity. PLoS ONE
**2012**, 7, e52618. [Google Scholar] [CrossRef][Green Version] - Davico, G.; Pizzolato, C.; Lloyd, D.G.; Obst, S.J.; Walsh, H.P.; Carty, C.P. Increasing level of neuromusculoskeletal model personalisation to investigate joint contact forces in cerebral palsy: A twin case study. Clin. Biomech.
**2020**, 72, 141–149. [Google Scholar] [CrossRef] - Ren, L.; Jones, R.K.; Howard, D. Whole body inverse dynamics over a complete gait cycle based only on measured kinematics. J. Biomech.
**2008**, 41, 2750–2759. [Google Scholar] [CrossRef] [PubMed] - Jung, Y.; Jung, M.; Lee, K.; Koo, S. Ground reaction force estimation using an insole-type pressure mat and joint kinematics during walking. J. Biomech.
**2014**, 47, 2693–2699. [Google Scholar] [CrossRef][Green Version] - Fluit, R.; Andersen, M.; Kolk, S.; Verdonschot, N.; Koopman, H. Prediction of ground reaction forces and moments during various activities of daily living. J. Biomech.
**2014**, 47, 2321–2329. [Google Scholar] [CrossRef] - Skals, S.; Jung, M.K.; Damsgaard, M.; Andersen, M.S. Prediction of ground reaction forces and moments during sports-related movements. Multibody Syst. Dyn.
**2017**, 39, 175–195. [Google Scholar] [CrossRef][Green Version] - Karatsidis, A.; Bellusci, G.; Schepers, H.M.; De Zee, M.; Andersen, M.S.; Veltink, P.H. Estimation of Ground Reaction Forces and Moments During Gait Using Only Inertial Motion Capture. Sensors
**2017**, 17, 75. [Google Scholar] [CrossRef] [PubMed][Green Version] - Ryu, H.X.; Park, S. Estimation of unmeasured ground reaction force data based on the oscillatory characteristics of the center of mass during human walking. J. Biomech.
**2018**, 71, 135–143. [Google Scholar] [CrossRef] - Muller, A.; Pontonnier, C.; Robert-Lachaine, X.; Dumont, G.; Plamondon, A. Motion-based prediction of external forces and moments and back loading during manual material handling tasks. Appl. Ergon.
**2020**, 82, 102935. [Google Scholar] [CrossRef] [PubMed] - Richards, R.; van den Noort, J.C.; van der Esch, M.; Booij, M.J.; Harlaar, J. Gait retraining using real-time feedback in patients with medial knee osteoarthritis: Feasibility and effects of a six-week gait training program. The Knee
**2018**, 25, 814–824. [Google Scholar] [CrossRef] - Aristidou, A.; Cameron, J.; Lasenby, J. Real-Time Estimation of Missing Markers in Human Motion Capture. In Proceedings of the 2008 2nd International Conference on Bioinformatics and Biomedical Engineering, Shanghai, China, 16–18 May 2008; pp. 1343–1346. [Google Scholar] [CrossRef]
- Bottegal, G.; Pillonetto, G. The generalized cross validation filter. Automatica
**2018**, 90, 130–137. [Google Scholar] [CrossRef][Green Version] - Jung, C.K.; Park, S. Compliant bipedal model with the center of pressure excursion associated with oscillatory behavior of the center of mass reproduces the human gait dynamics. J. Biomech.
**2014**, 47, 223–229. [Google Scholar] [CrossRef] [PubMed] - Stanev, D.; Moustakas, K. Modeling musculoskeletal kinematic and dynamic redundancy using null space projection. PLoS ONE
**2019**, 14, e0209171. [Google Scholar] [CrossRef] - Prilutsky, B.I.; Zatsiorsky, V.M. Optimization-Based Models of Muscle Coordination. Exerc. Sport Sci. Rev.
**2002**, 30, 32–38. [Google Scholar] [CrossRef][Green Version] - Anderson, F.C.; Pandy, M.G. Static and dynamic optimization solutions for gait are practically equivalent. J. Biomech.
**2001**, 34, 153–161. [Google Scholar] [CrossRef] - Stanev, D.; Moustakas, K. Stiffness modulation of redundant musculoskeletal systems. J. Biomech.
**2019**, 85, 101–107. [Google Scholar] [CrossRef] - Wächter, A.; Biegler, L.T. On the implementation of an interior-point filter line-search algorithm for large-scale nonlinear programming. Math. Program.
**2006**, 106, 25–57. [Google Scholar] [CrossRef] - Seth, A.; Sherman, M.; Reinbolt, J.A.; Delp, S.L. OpenSim: A musculoskeletal modeling and simulation framework for in silico investigations and exchange. Procedia IUTAM
**2011**, 2, 212–232. [Google Scholar] [CrossRef] [PubMed] - Thelen, D.G. Adjustment of Muscle Mechanics Model Parameters to Simulate Dynamic Contractions in Older Adults. J. Biomech. Eng.
**2003**, 125, 70–77. [Google Scholar] [CrossRef] [PubMed][Green Version] - Yu, B.; Gabriel, D.; Noble, L.; An, K.N. Estimate of the Optimum Cutoff Frequency for the Butterworth Low-Pass Digital Filter. J. Appl. Biomech.
**1999**, 15, 318–329. [Google Scholar] [CrossRef] - Hicks, J.L.; Uchida, T.K.; Seth, A.; Rajagopal, A.; Delp, S.L. Is My Model Good Enough? Best Practices for Verification and Validation of Musculoskeletal Models and Simulations of Movement. J. Biomech. Eng.
**2015**, 137, 020905. [Google Scholar] [CrossRef] [PubMed] - Cheung, R.T.H.; Ho, K.K.W.; Au, I.P.H.; An, W.W.; Zhang, J.H.W.; Chan, Z.Y.S.; Deluzio, K.; Rainbow, M.J. Immediate and short-term effects of gait retraining on the knee joint moments and symptoms in patients with early tibiofemoral joint osteoarthritis: A randomized controlled trial. Osteoarthr. Cartil.
**2018**, 26, 1479–1486. [Google Scholar] [CrossRef][Green Version] - Coviello, G.; Avitabile, G.; Florio, A. A Synchronized Multi-Unit Wireless Platform for Long-Term Activity Monitoring. Electronics
**2020**, 9, 1118. [Google Scholar] [CrossRef] - Martin, J.A.; Brandon, S.C.E.; Keuler, E.M.; Hermus, J.R.; Ehlers, A.C.; Segalman, D.J.; Allen, M.S.; Thelen, D.G. Gauging force by tapping tendons. Nat. Commun.
**2018**, 9, 1–9. [Google Scholar] [CrossRef] [PubMed][Green Version] - Fregly, B. Computational Assessment of Combinations of Gait Modifications for Knee Osteoarthritis Rehabilitation. IEEE Trans. Biomed. Eng.
**2008**, 55, 2104–2106. [Google Scholar] [CrossRef][Green Version] - Barrios, J.A.; Crossley, K.M.; Davis, I.S. Gait retraining to reduce the knee adduction moment through real-time visual feedback of dynamic knee alignment. J. Biomech.
**2010**, 43, 2208–2213. [Google Scholar] [CrossRef] [PubMed][Green Version] - Richards, R.; van den Noort, J.C.; Dekker, J.; Harlaar, J. Gait Retraining With Real-Time Biofeedback to Reduce Knee Adduction Moment: Systematic Review of Effects and Methods Used. Arch. Phys. Med. Rehabil.
**2017**, 98, 137–150. [Google Scholar] [CrossRef] [PubMed]

**Figure 1.**Overview of the real-time analysis pipeline. The acquisition thread collects raw data from sensor inputs and performs IK to obtain the kinematics from marker- and IMU-based sources. Data are shared using thread-safe data structures. Depending on the application, the processing thread can arrange the operations required to extract meaningful information from the musculoskeletal model in real-time. Model calibration refers to the process of adjusting the musculoskeletal model to account for the subject’s anthropometric parameters using static trials and functional tasks.

**Figure 2.**An overview of the filtering and differentiation module. The generalized coordinates from IK are placed into a circular buffer of memory M. The M samples of each signal are filtered using a low pass FIR filter. A generalized cross-validation spline of order ${N}_{s}$ is then constructed to evaluate the coordinate and derivatives’ value at time instance ${t}_{d}$.

**Figure 3.**State diagram denoting the conditions required to determine the current gait state. Transitions between swing and stance phases occur by comparing the selected measure $u\left(t\right)$ with a threshold value ${u}_{th}$.

**Figure 4.**Visualization front-end composed of a musculoskeletal visualizer, real-time plotting, and footprint visualization.

**Figure 5.**Gamification approach based on session awarded points. Users can monitor their performance on the dashboard, examine key statistics and major milestones that reflect their progress.

**Figure 6.**RMSE between

`OpenSim`’s offline kinematics analysis and proposed filter as a function of the decision variables (M and D). We selected the smallest values that resulted in the lowest error in the acceleration.

**Figure 7.**Comparison between

`OpenSim`’s offline kinematics analysis, the proposed, and spatial filters. Left RMSE compares

`OpenSim`’s and proposed filter’s kinematics. Right RMSE compares

`OpenSim`’s and spatial filter’s kinematics. For comparison reasons, we shifted the curves to compensate for the time lag introduced by the filters.

**Figure 8.**Comparison among offline ID from

`OpenSim`and real-time ID using the two real-time filters. Left RMSE compares

`OpenSim`’s ID and real-time’s ID that uses the proposed filter. Right RMSE compares

`OpenSim`’s ID and real-time’s ID that uses the spatial filter. For comparison reasons, the curves were shifted to compensate for the time lag introduced by the filters.

**Figure 9.**Real-time estimated ground reaction forces, moments, and CoP during gait. Good agreement of the predicted forces, especially on the forward (x) and vertical (y) directions. In contrast, only the x component of the CoP was accurately predicted. Less confluence is observed in the moments.

**Figure 10.**The influence of estimated GRF&M on the generalized forces computed through ID. Predicted GRF&M greatly affect the calculated joint moments. A good estimate of CoP improves the predictions of ankle and knee moments. Hip flexion requires accurate estimation of both CoP and forces, while hip rotation CoP and moments.

**Figure 11.**Comparison between

`OpenSim`’s SO and proposed real-time muscle optimization method. The force of major right leg muscles: gluteus maximus, semimembranosus, psoas major, rectus femoris, vastus medialis, biceps femoris short head, medial gastrocnemius, soleus, and tibialis anterior was presented.

**Figure 12.**The gait retraining session aims to reduce knee reaction loads by adjusting the foot progression angle, step length, and step width (decision variables). The green regions of the decision variables are adjusted online according to the reaction forces’ estimation on the diseased knee. The user is awarded points if the instructions are followed.

**Figure 13.**Comparison between

`OpenSim`’s (offline) and real-time’s joint reaction loads (forces and moments) on the knee using the muscle forces obtained by the proposed optimization. For comparison reasons, the curves were shifted to compensate for the time lag introduced by the filter.

**Table 1.**According to the gait phase, classification of calculations for determining the forces and moments applied on the leading and trailing legs. During the single support phase, the GRF&M of the limb in contact with the ground are equal to the total external force ${\mathit{f}}_{total}^{w}$ and moment ${\mathit{\tau}}_{total}^{w}$. Whereas, during the double support phase, the results are distributed between the two legs using the transition functions ${\mathit{f}}_{t}\left(t\right)$ described by [18]. The ⊙ operator is used to denote element-wise multiplication.

Reaction Component | Double Support | Single Support |
---|---|---|

${\mathit{f}}_{trailing}^{w}\left(t\right)$ | ${\mathit{f}}_{total}^{w}\left({t}_{hs}^{leading}\right)\odot {\mathit{f}}_{t}\left(t\right)$ | $\mathbf{0}$ |

${\mathit{m}}_{trailing}^{w}\left(t\right)$ | ${\mathit{\tau}}_{total}^{w}\left({t}_{hs}^{leading}\right)\odot {\mathit{f}}_{t}\left(t\right)$ | $\mathbf{0}$ |

${\mathit{f}}_{leading}^{w}\left(t\right)$ | ${\mathit{f}}_{total}^{w}\left(t\right)-{\mathit{f}}_{trailing}^{w}\left(t\right)$ | ${\mathit{f}}_{total}^{w}\left(t\right)$ |

${\mathit{m}}_{leading}^{w}\left(t\right)$ | ${\mathit{\tau}}_{total}^{w}\left(t\right)-{\mathit{m}}_{trailing}^{w}\left(t\right)$ | ${\mathit{\tau}}_{total}^{w}\left(t\right)$ |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Stanev, D.; Filip, K.; Bitzas, D.; Zouras, S.; Giarmatzis, G.; Tsaopoulos, D.; Moustakas, K.
Real-Time Musculoskeletal Kinematics and Dynamics Analysis Using Marker- and IMU-Based Solutions in Rehabilitation. *Sensors* **2021**, *21*, 1804.
https://doi.org/10.3390/s21051804

**AMA Style**

Stanev D, Filip K, Bitzas D, Zouras S, Giarmatzis G, Tsaopoulos D, Moustakas K.
Real-Time Musculoskeletal Kinematics and Dynamics Analysis Using Marker- and IMU-Based Solutions in Rehabilitation. *Sensors*. 2021; 21(5):1804.
https://doi.org/10.3390/s21051804

**Chicago/Turabian Style**

Stanev, Dimitar, Konstantinos Filip, Dimitrios Bitzas, Sokratis Zouras, Georgios Giarmatzis, Dimitrios Tsaopoulos, and Konstantinos Moustakas.
2021. "Real-Time Musculoskeletal Kinematics and Dynamics Analysis Using Marker- and IMU-Based Solutions in Rehabilitation" *Sensors* 21, no. 5: 1804.
https://doi.org/10.3390/s21051804