Abstract
The nervous system predicts and executes complex motion of body segments actuated by the coordinated action of muscles. When a stroke or other traumatic injury disrupts neural processing, the impeded behavior has not only kinematic but also kinetic attributes that require interpretation. Biomechanical models could allow medical specialists to observe these dynamic variables and instantaneously diagnose mobility issues that may otherwise remain unnoticed. However, the real-time and subject-specific dynamic computations necessitate the optimization these simulations. In this study, we explored the effects of intrinsic viscoelasticity, choice of numerical integration method, and decrease in sampling frequency on the accuracy and stability of the simulation. The bipedal model with 17 rotational degrees of freedom (DOF)—describing hip, knee, ankle, and standing foot contact—was instrumented with viscoelastic elements with a resting length in the middle of the DOF range of motion. The accumulation of numerical errors was evaluated in dynamic simulations using swing-phase experimental kinematics. The relationship between viscoelasticity, sampling rates, and the integrator type was evaluated. The optimal selection of these three factors resulted in an accurate reconstruction of joint kinematics (err < 1%) and kinetics (err < 5%) with increased simulation time steps. Notably, joint viscoelasticity reduced the integration errors of explicit methods and had minimal to no additional benefit for implicit methods. Gained insights have the potential to improve diagnostic tools and accurize real-time feedback simulations used in the functional recovery of neuromuscular diseases and intuitive control of modern prosthetic solutions.
Introduction
The central nervous system (CNS) evolved to orchestrate muscular and skeletal actions to produce complex motor behaviors (1). For instance, in locomotion, intrinsic and sensory feedback signals are integrated with descending visuomotor commands to fine-tune limb stepping and foot placement (2,3). To explain this intricate interplay between neural and mechanical systems, previous research has produced a variety of biomechanical models and analyzed their interactions with the environment (4). For example, a biomechanical model of the arm was shown to explain the directional tuning property of the primary motor cortex neurons, describing why some cortical neurons are most active in particular movement directions (5). Similar models of neuromechanical interactions are believed to exist within neural pathways in order to overcome transmission delays and nonlinear limb dynamics (6). The use of embedded dynamical computations for motor control is illustrated in Fig. 1. The desired motion transformed through the inverse dynamics yields control signals to muscles (Fig. 1A). The oversight over the execution of these motor commands can also be monitored with the use of embedded forward simulations (Fig. 1B). Because biomechanical computations can be expressed within neural pathways, models of musculoskeletal transformations are biomimetic and may capture mechanistic cause-effect relationships.
Fig.1.

Inverse model of the human motor control (a) and the model validation pipeline (b). From left to right: (1) signal processing—the joint angles θt are found from kinematic equations given the limb positions xt; (2) body dynamics—the joint torques τt are computed using motion equations, given joint angles and their derivatives; (3) muscle dynamics—the muscle forces and computed muscle activations mt are calculated using joint torques (τt,), limb positions (xt), velocities (vt), and musculoskeletal geometry. The model validation process: (1) torques τt, computed using inverse dynamics model (IDM), are compared to reference torques to validate the solution (error: Δτt); (2) joint angles θt*, simulated with forward dynamics model (FDM), are compared to the experimental angles θt to confirm the cause-and-effect relationship between the τt and θt (error: Δθt).
Gait abnormalities can be diagnosed and treated more effectively using forward dynamic simulations of body motion (7–9). However, subject-specific pathomechanics may be required for effective rehabilitation (10,11). Simple models may capture the dynamics of the limb in real-time, but they may fail to capture the muscle-specific actions that require musculoskeletal morphology (12–18). Conversely, detailed models with a minimum of 6 degrees of freedom (DOF) and 43 major muscles may require more time to execute (19). Thus, the engineering challenge in biomechanical modeling is to balance model complexity and computational efficiency. For this reason, we have previously modified Sartori et al. (20) approximation method to derive an objective approximation of muscle dynamics to accurately describe arm and hand muscles in the context of real-time simulations with reduced computational load (21,22). This development can be potentially extended to model the muscle dynamics of the leg (23). However, the fast and accurate simulations of body dynamics remains a challenge (24,25).
Recently, the use of efficient physical engines (26) has been combined with the musculoskeletal models (19) to develop a new iteration of tools for research, health, and consumer applications (27). Physical engines use various numerical methods (e.g., Runge-Kutta, implicit/semi-implicit Euler) to integrate ordinary differential equations (ODE) describing multi-DOF body dynamics. Accurate solutions are often achieved by selecting the integration time step (Δt) that satisfies a set tolerance error. Namely, the time step is decreased for rapid system dynamics to maintain integration accuracy and increased for the slow dynamics to speed up the simulation. In real-time decoding, for example, in robot-assisted applications (28), the computing power provides just-in-time or even faster than real-time accurate calculations for movement planning. What is especially challenging is the inclusion of object manipulation in these simulations. Erez et al. compared the performance of real-time engines to demonstrate that each engine is currently optimized for its corresponding use (gaming or robotics) through the difference in system formulation (Cartesian vs. generalized coordinates) and body internal/external forces calculation methods (29). However, not surprisingly, all simulations fail with the decrease in the simulation time step, which indicates a challenge for applications with low sampling rates. Yet, the growing virtual reality use in the post-stroke rehabilitation (30,31) further necessitates computing body dynamics accurately and swiftly (32). The use of motion capture systems to acquire body kinematics in these interactive environments is typically performed with fixed sampling frequencies, linked to the low display refresh rate (60 or 120 Hz). Thus, there is a need to improve simulation stability at low sampling rates where numerical inaccuracies result in transient kinematic perturbations.
In this study, we developed a biomechanical framework for testing viscoelastic joint constraints and numerical solver types to reduce simulation errors at low sampling rates. We posited that the transient kinematic perturbations due to the large integration time step could be smoothed by adding viscoelastic joint impedance to increase simulation stability. Furthermore, we hypothesized that the viscoelastic compensation depends on the type of a used numerical solver. We tested these hypotheses in a human bipedal model simulating locomotion. We used three numerical solvers with varied combinations of joint impedance to simulate the inverse and forward dynamics of the swing locomotor phase. We determine optimal viscous and elastic pair that stabilized the kinematic solutions and produced close-to-physiological kinetics. In addition, we evaluated feasibility of our approach for real-time applications.
Materials & Methods
This study aimed to test the stabilization effects of viscoelastic compensation, evaluate the performance of numerical solvers, and identify sampling frequencies that produce accurate and stable simulations of the leg dynamics. This was accomplished with the following four steps to develop: (1) subject-specific morphometry scaling of the inertial properties of the body segments, (2) forward and inverse computations for simulating kinematics and kinetics, (3) search for optimal impedance and simulation rate, and (4) validation pipeline for computing numerical errors.
A. KINEMATIC AND KINETIC DATASETS
Three datasets were used for the development and validation of the inverse and forward dynamics: (1) experimental marker trajectories, (2) joint angles, and (3) joint torques simulated during swing.
1). DATASET 1: MARKER TRAJECTORIES
The representative three-dimensional marker trajectories were recorded for one healthy individual (male, 26 y/o, 72 kg, 1.75 m). The Institutional Review Board of Cruzeiro do Sul University approved all the procedures, and the participant signed a written consent form prior to the experimental session. A computerized gait analysis system (Vicon, Oxford Metrics, Inc.) with eight infrared cameras tracked reflective markers placed bilaterally on the anterior superior iliac spine, posterior superior iliac spine, medial and lateral epicondyles of the femur, tibialis tuberosity, medial and lateral malleoli, inter-malleolus, and first and fifth metatarsals, following the recommendations of the International Society of Biomechanics (33). Prior to data acquisition, a T-pose kinematic calibration trial was performed with all reflective markers to register marker clusters relative to the anatomical landmarks. Subsequently, markers were removed from the medial and lateral epicondyles of the femur, tibialis tuberosity, medial and lateral malleoli, and inter-malleolus. The subject was asked to walk at a self-selected comfortable speed without interruption along a 10-m walkway equipped with two force platforms (Kistler, Model 9286BA). Practice was allowed before the data recording session to familiarize the subject with the laboratory environment and the walking condition. From the five recorded trials, 10 unilateral swing phases were extracted using heel-strike and toe-off events, identified based on experimental ground reaction forces and vertical velocity of the foot (34).
2). DATASET 2: JOINT ANGLES
The hip, knee, and ankle joint angles, as well as the standing foot rotation with respect to the ground, were calculated from the Dataset 1 using the biomechanics analysis package Visual3D (C-Motion, Inc.). The data were low-pass filtered using a 2nd order Butterworth filter with the cutoff frequency of 6 Hz and resampled with cubic splines (35) at f=50, 100, 200, 300, 400, 500, 2000 Hz.
3). DATASET 3: JOINT TORQUES
Joint torques were simulated from the computed joint angles (Dataset 2). Since the numerical solution approaches analytical as the sampling rate increases, torques calculated from angles sampled at 2 kHz were used as a reference () for all torques simulated at lower frequencies with and without viscoelastic impedance. This impedance was modeled as varied combinations of rotational stiffness and damping coefficients.
B. MODEL AND ANATOMICAL SCALING
A bipedal biomechanical model describing the movement of 17 DOFs was assembled to solve inverse and forward dynamics in Simscape Multibody (R2022b, MathWorks). The proximal to distal segments of human leg were represented by solid frustums of right circular cones (wide base placed proximally) using subject-specific inertial properties based on validated mathematical relationships (36). This refinement reduced inertial representation errors to <10% of observed properties. The centers of mass, locations of the hinge points, and inertia were derived for each body segment using Hanavan’s formulations (see Supplementary Information). The segment weight was calculated as a fraction of the total human body weight using Winter’s tables (37). The weight of upper body was assigned to the pelvis segment. The axial length of the lower body parts was expressed as a fraction of the subject’s height. The segment geometry was adjusted according to sex and age. Thigh and shank proximal base diameter (d) were calculated from a circumference equation C=πd, where the circumference C was fetched from the sex- and age-based anthropometric reference tables (38,39). The proximal base diameter for a foot segment was estimated as a malleolus height. The distal base diameter of all segments was found from the regression equations describing the relationship between axial length and base diameters (36). The motion of rotational DOFs between the base and follower bodies was expressed as a sequence of time-varying rotational transformations. The knee joint was modeled with a simple 1 DOF revolute primitive. The ankle and hip joints were modeled as a combination of a revolute and universal 2 DOF primitives to avoid the gimbal lock problem (undesired alignment of two perpendicular axes). The foot was rigidly connected to the ground (no slip condition for the leg in stance) close to metatarsophalangeal (MTP) joint (75% of foot length), and MTP was allowed to rotate in 3 DOFs. This modeled an approximate location of the foot center of pressure during the single stance phase (40). Since the analysis was focused on the leg in swing, the motion of leg in stance was determined by its kinematics in both forward and inverse simulations. This hybrid design prevented kinetic errors from propagating from the standing to the swinging leg. While 17 DOFs were simulated, we focused our analysis on the seven DOFs of the leg in swing.
C. BODY DYNAMICS SIMULATIONS
A built-in recursive algorithm (Simulink R2022b) was used to simulate the inverse dynamics of the modeled body; the explicit 4th-order Runge-Kutta and explicit/implicit Euler methods were used to simulate the forward dynamics. Euler explicit integration is the least accurate and yet the fastest. Euler implicit formulation is better suited to keep the integration error bound to the tolerated error; however, it is slower than the explicit type (41). The accuracy and speed of the Runge-Kutta method are somewhere between those of the two previous methods. For all fixed-step solvers, the integration step is inversely proportional to the sampling rate f. Fig. 1B describes the simulation-validation pipeline, where the joint angles (θt, Dataset 2) are calculated from the experimental marker trajectories (Dataset 1) and then used in the inverse dynamics model (IDM) to simulate joint torques (τt, Dataset 3). These torques propagate through the forward dynamics model (FDM) to simulate joint angles (θt*). Simulated and observed angles were compared to assess the accuracy. The kinetic (Δτt) and kinematic (Δθt) errors were calculated as root-mean-square errors (RMSE) between simulated (τt, θt*) and reference / observed signals . A dynamic translation technique (Accelerator Mode, Simulink R2022b) allowed us to change input signals without terminating the model execution and increased the simulation efficiency. A standard portable computer running macOS was used for all simulations.
D. IMPEDANCE OPTIMIZATION
Passive joint impedance was described with the rotational stiffness and damping (k,b) of the spring-dampers used to stabilize multibody simulations (42). An increase in the impedance decreased angular errors, but also increased torque errors. This, therefore, presented an optimization problem. To find the optimal impedance, we searched for the minimal integrated kinematic and kinetic error. Computed kinetic (Δτt) and kinematic (Δθt) errors for each DOF were normalized to peak-to-peak torque and angle ranges, respectively. We covered the grid of multiple k ∈ [0, 10−4, 10−3, 10−2, 10−1] Nm/deg and b ∈ [0, 10−4, 10−3, 10−2, 10−1] Nm/deg/s for multiple experimental swing phases, simulation rates, and numerical solvers:
- Normalization for each DOF, solver type, and sampling frequency:
- Optimization:
where N is the number of swing phases; K is the number of stiffness coefficients; B is the number of damping coefficients; D is the number of DOFs; S is the number of solvers; F is the number of simulation rates; θpp and τpp are vectors containing joint range of motion and torque peak-to-peak values, respectively; and (k,b) is optimal stiffness and damping matrix.
E. STATISTICAL ANALYSIS
The normality was tested with the Anderson-Darling test for the following variables: model execution time, kinematic and kinetic errors (43). The appropriate statistical significance level (α) initially set to 5% was adjusted with the Holm-Bonferroni correction, and the difference between simulations with and without the viscoelastic contribution was tested with Wilcoxon rank sum test (Fig. 3–4). The linear regression demonstrated the correlations between the execution times and simulation rates (Fig. 5). All analyses were performed using the Statistics and Machine Learning Toolbox (MATLAB, R2022b, MathWorks Inc.)
Fig. 3.

Stabilizing impedance affects kinematic errors differently across solvers. Demonstrated are three representative cases when impedance had: (a) no stabilizing effect across solvers, (b) no effect for a specific solver, and (c) effect for all solvers. The error distributions are shown for ten swing phases simulated at the sampling frequency of 200 Hz. The bottom and top edges of the box plots show the 25th and 75th percentiles of the error distributions, horizontal lines demonstrate medians, whiskers extend to maximum errors, and outliers are marked with circles. Empty boxes represent distributions computed without impedance, while shaded boxes correspond to errors obtained with optimal impedance (k,b) specific to DOFs and solvers. The horizontal bars indicate significant differences as tested with the Wilcoxon signed-rank test and corrected with the Holm-Bonferroni method (p<1.3×10−3).
Fig. 4.

Viscoelastic impedance affects inverse (a) and forward (b) dynamic errors across frequencies. The built-in recursive algorithm and three numerical integrators become more accurate with an increasing sampling frequency (empty boxes); viscoelastic impedance increases kinetic and decreases kinematic errors (shaded boxes), as shown for ten swing phases of the knee flexion-extension DOF. For the sampling rates over 200 Hz, kinetic error distributions with and without impedance were significantly different (p<1.83×10−4); the kinematic distributions computed with explicit methods were different across all sampling rates, while the errors obtained with implicit method were the same (p<1.3×10−3). All distributions were compared using the Wilcoxon signed-rank test and corrected with the Holm-Bonferroni procedure. The description of the boxplots is the same as in Fig. 3. Abbreviations in legend: EE—explicit Euler, RK—4th order Runge-Kutta, and IE—implicit Euler methods.
Fig. 5.

Model execution speed scales linearly with simulation frequency for (a) inverse and (b) forward dynamic simulations. Built-in recursive solver (shown in red), explicit Euler (EE), Runge-Kutta (RK), and implicit Euler (IE) methods demonstrate faster than real-time performance across tested simulation frequencies. Circles (o) represent the median execution times registered and normalized to the swing phase duration for each simulation. The thin dashed lines indicate performance multiples relative to the real-time (when simulation and experimental time are equal). Thick lines illustrate linear regressions; all R-squared values are greater than 0.9887. The equations describing an approximate relationship between the two variables are expressed in legends. Abbreviations in legend are the same as in Fig. 4.
Results
In this study, we used viscoelastic joint impedance to reduce numerical inaccuracies in simulations of limb dynamics. The impedance increasing from proximal to distal joints significantly decreased errors of explicit integration. The beneficial impedance stabilization was negligible when used with implicit Euler method, which outperformed explicit Euler and Runge-Kutta methods. The added impedance generated expected increase in torque errors, however, stabilized kinematics at low sampling rates. Overall, the simulation errors were below 1% of peak-to-peak kinematics, and below 5% of peak-to-peak kinetics. All simulations were executed faster than in real-time.
A. OPTIMAL VISCOELASTIC IMPEDANCE
We modified viscoelastic joint impedance to determine the optimal values that minimize both kinetic and kinematic errors in simulations of leg movements. High impedance values increase torque errors (Fig. 2A) and decrease kinematic errors (Fig. 2B); low impedances have the opposite effect. We, therefore, chose the optimal stiffness and damping sets as generating minimal kinetic and kinematic errors at a given sampling rate. These sets were different for different DOFs and increased in value from proximal to distal joints along the limb, i.e., the viscoelastic contribution was the lowest at the hip and the highest at the ankle. These values are shown with the blue outline in Fig. 2. Supplementary tables (S1-S2) contain this information for all DOFs in the model.
Fig. 2.

Stabilizing impedance affects (a) kinetic and (b) kinematic errors differently across DOFs. The errors are shown for the flexion-extension DOFs of the swinging leg’s hip, knee, and ankle during one representative swing phase simulated with the implicit Euler method at 200 Hz. The kinetic performance decreases at high values, and the kinematic performance decreases at low values. The errors obtained with optimal (k,b), specific to DOF, sampling frequency, and solver, are squared in light blue.
The improvements in kinematic accuracy with additional impedance were not uniform across three types of numerical solvers. For example, Fig. 3A shows no significant difference for kinematic errors in ankle flexion-extension computed with and without impedance across three solvers. However, adding impedance to explicit integration reduced the tendency to numerically “overshoot” exact kinematic solutions in 6 out of 7 analyzed DOFs in the swinging leg. Fig. 3B and 3C demonstrate this beneficial improvement in the solution accuracy for the knee flexion-extension and hip abduction-adduction DOFs. The viscoelastic contribution to the implicit Euler method was unnecessary for 5 out of 7 modeled DOFs, with one of these DOFs (internal-external rotation of the hip) benefiting from stabilization only at low sampling frequencies (50–100 Hz). And yet, reinforcing implicit Euler method with viscoelastic stabilization reduced errors in ankle internal-external rotation and hip adduction-abduction kinematics. Fig. 6 shows that the kinetic profiles of these DOFs have frequent sign-switching slopes. These led to the higher integration errors and the need for the stabilization. Adding impedance to these joints reduced kinematic errors (Fig. 3C) but increased kinetic errors. Fig. 4A shows that with added impedance, the torque errors increase moderately (marked with *). While the kinetic errors with and without impedance were significantly different in 4 out of 7 examined DOFs, they did not differ at low sampling frequencies in some DOFs. These included ankle flexion-extension (50–100 Hz), its eversion-inversion (50 Hz), and knee flexion extension (50–200 Hz) for which relatively high stiffness (up to 10−1 Nm/deg) or/and damping (up to 10−1 Nm/deg/s) were applied to counter integration inaccuracies in forward simulations (see Table S1-S2 for details). The viscoelastic contribution was therefore effective for forward simulations with explicit methods and negligible for inverse simulations with fixed low sampling rates. In general, the use of stabilizing impedance was disadvantageous in inverse simulations with high sampling rates.
Fig. 6.

Simulated dynamics of the leg in the swing. (a) Kinetic trajectories, simulated at 200 Hz with implicit Euler method and no viscoelastic contribution are shown for ten swing phases. The thick lines correspond to the averages; the shaded areas show ± standard deviation; the thin lines correspond to single trials. (b) Kinematic trajectories; the description is the same as in a. Abbreviations: f-e—flexion-extension; ab-ad—abduction-adduction; int-ext—internal-external rotation; ever-inv—eversion-inversion.
B. NUMERICAL SOLVERS
The choice of implicit or explicit numerical integration largely determined the accuracy of the forward simulations. Implicit Euler method outperforms explicit methods as demonstrated by low kinematic errors in Fig. 3 and 4B. Fig. S2 provides further details of the comparative performance for all joints. The best simulation accuracy even at low sampling rates was achieved by implicit Euler method.
C. MODEL EXECUTION TIME
The forward and inverse dynamic models were executed faster than real-time across all tested sampling frequencies. Model execution times were normalized to the respective swing phase duration. Fig. 5 shows the relationship between simulation frequency and execution speed. The real-time speed metric was expressed as the ratio of median values of simulation time (N=10) to swing durations, i.e., values below 1 are faster than real-time. The regression indicates the expected linear increase in execution time with the increase in the sampling rate. The gray dashed lines indicate the performance multiples relative to the real-time. For example, the execution of the inverse model is about 150x and 35x faster than real-time at 50 Hz and 500 Hz, respectively. Due to the difference in algorithmic complexity of integration and differentiation methods, forward simulations are slower than inverse ones across all sampling frequencies. Yet, the forward simulations of leg model were faster than real-time. At 500 Hz, explicit Euler method (~9x) was faster than Runge-Kutta (~7x) and implicit Euler (~3.5x) methods.
D. KINETIC AND KINEMATIC TRAJECTORIES
Lower limb dynamics was simulated with forward and inverse models. Fig. 6 shows joint torques computed with the built-in recursive solver (A) and respective joint angles calculated with the implicit Euler method at 200 Hz (B). The variability of swing dynamics is depicted with standard deviation from the mean (see shaded areas for ±s.d. in Fig. 6). The computed variability is similar to other studies (44–46). The form and absolute values of the computed average signals are also similar to those demonstrated in previous studies (47–50). We selected 200 Hz simulation frequency to keep kinematic and kinetic errors within 1% and 5% tolerance, respectively (Fig. S2). Generally, the implicit methods do not improve accuracy with the additional impedance. Only the explicit methods benefit from it.
Discussion
In this study, we developed a real-time biomechanical framework for testing viscoelastic parameters that reduce the dynamic simulation errors in a human dynamic model of locomotion. The development involved (1) subject-specific body inertia scaling, (2) forward and inverse dynamic computations for simulating kinematics and kinetics, (3) a search for optimal impedance and simulation frequency, and (4) numerical validation and error assessment. Height, weight, age, and sex parameters were used for scaling segment inertia. The simulation errors were small in forward (< 1%) and inverse (< 5%) simulations as computed with implicit Euler and built-in recursive methods, respectively (see also Fig. S2). In general, viscoelastic joint impedance decreased the physiological plausibility of the forces computed in inverse simulations. However, small errors can be tolerated to increase integration accuracy with the explicit methods especially when simulation frequency is low (Fig. 5). The implicit integration method outperformed all explicit methods and required no additional compensation from the impedance. Since explicit methods are standard in physics engines, the use of joint impedance could improve their numerical stability; however, implicit methods deliver the best results. This is supported by the comparative demonstration of handling object interactions with standard physics engines and MuJoCo engine, which utilizes the implicit integration of velocity (26).
A. INTEGRATION METHOD
Accurate dynamic simulations of human limbs in real time require an efficient integration method. Analytical solutions provide the best computational efficiency; however, they may not exist for complex mechanical systems requiring fixed- or varied-step numerical methods to simulate body movement (51). Fixed-step methods are typically used to avoid a sample mismatch between input data acquisition and simulation rates; however, they suffer from the accumulating truncation error. Variable-step methods are challenging to implement in real time because they require a predictive extrapolation of real-time inputs and outputs in simulation. The integration methods of approximating ODE can be explicit or implicit. Explicit schemes compute the future state of the system (t+Δt) from its current state. However, they are often unstable when simulating ‘stiff’ dynamical systems with slow and fast changing dynamical variables (52). For example, the knee swiftly extends during the mid-swing and flexes slowly at the end of the swing of a human gait cycle; the time of ground contact also introduces a sharp transition between swing and stance. Implicit (“backward”) schemes compute approximations using both the current and future states (41). This requires solving for unknowns using a root-finding algorithm (for example, Newton’s method). The additional computational complexity within implicit methods is relatively less taxing than the advantage of accuracy, as shown in Fig. 5.
We selected the simplest implicit integrator—the implicit Euler method—to solve the forward dynamics of the human leg in swing. Other integrators often used for physical simulations include explicit/semi-implicit Euler and (explicit) 4-th order Runge-Kutta (RK) (53,54). The semi-implicit Euler employs a hybrid integration scheme to solve dynamical systems and is an improvement over the least accurate, explicit Euler method. Used in the context of biomechanical simulations, the semi-implicit method can (i) compute joint angles with the fast explicit scheme and (ii) calculate angular velocities with the implicit scheme to stabilize abrupt amplitude changes. Although beneficial for model execution speed, the semi-implicit algorithm may be sensitive to the numerical noise (55). RK is a typical explicit method and another commonly used integrator. The specific feature of this method is that it solves ODE using a weighted average between four slopes—one at the beginning, two in the middle, and one at the end of the time interval Δt,—improving the overall slope estimate (56). Although decreasing the integration error, RK requires additional computations per iteration, slowing down the simulation. In addition, as all explicit integration schemes, this method performs poorly for stiff ODEs solved with large integration time steps. Our results support the use of the implicit Euler over the explicit Euler and RK methods (Fig. 3–4). A modern state-of-the-art physical engine MuJoCo uses RK, implicit Euler, and semi-implicit Euler modified to be fully implicit in the velocity integration (26). While this method was not directly analyzed, our results provide insight into its performance advantages.
As we demonstrate in Fig. 3–6, the solver selection is essential for optimizing a solution to a specific forward dynamic problem. To model human movement, we recommend considering implicit formulations or enforcing the explicit methods with viscoelastic impedance to balance simulation speed, stability, and accuracy (Fig. 5–6, Fig. S2).
B. SIMULATION FREQUENCY
Choosing an optimal simulation frequency is a speed-accuracy tradeoff problem. We solved it by computing inverse-forward dynamics for a range of simulation frequencies and assessing accuracy and execution times. The inverse and forward simulation were performed sequentially, and the numerical errors from both simulations accumulated, as in a similar study (57). The simulation frequency needs to be minimized with acceptable level of errors for closed-loop control applications. We chose the error thresholds (<1% kinematic and <5% kinetic) based on our previous evaluation of errors in the approximation of musculoskeletal dynamics (21,22). We found forward and inverse computations to be real-time accurate at frequencies as low as 200 Hz (Fig. 3 and 5, also see Fig. S2). In simulation of object manipulation, the physics engine MuJoCo could maintain stability even at lower simulation frequencies (62.5 Hz) due to many elegant methodological choices (29). This suggests further benefits of using hybrid solvers; however, the confounding implementation overhead maybe difficult to evaluate in software packages.
C. VISCOELASTIC IMPEDANCE
Passive mechanical impedance can stabilize physical simulation. Modeled using joint spring-dampers, they generate viscoelastic forces to oppose abrupt changes in position and velocity (58). However, in inverse simulations, additional impedance may lead to an overestimation of joint forces. We used this tradeoff to constraint our optimization and find the joint impedance that both reduced kinematic errors and minimized force distortion. Our analyses showed that mechanical stabilization did not improve the accuracy of implicitly computed kinematics, but, in general, improved the results of explicit method. As a result, the hypothesized increase in simulation stability and the reduction in transient kinematic perturbations were true for the explicit but not for the implicit integrators. It is important to note, however, that the impedance-mediated stabilization is similar to kinematic filtering with the correction to the middle of range of motion set by spring rest length. Here, we applied the standard recommendation for filtering kinematics (37) and observed benefits of this approach. It is likely that in simulations that include abrupt mechanical interactions the impedance-mediated stabilization may augment both implicit and explicit methods.
The concept of impedance-mediated stabilization in our study is applied to reducing numerical errors, but it is also theoretically similar to the physiological mechanism. Muscle intrinsic properties and co-contraction generate joint impedance to resist external perturbations. Moreover, the impedance was hypothesized to be the controlled variable for movement and posture control (59–61). In our previous work, adding expected joint impedance to the musculoskeletal dynamic transformations from joint angles to computed muscle excitations generated activation profiles matching electromyography (62). While the impedance control has been a controversial theory of motor control in its pure form, the mechanical impedance is an essential feature of muscle coordination. The future studies could extend our implementation to improve simulations of body movement with realistic muscle-driven impedance. Furthermore, this approach may provide an opportunity for improving the state-of-the-art techniques for controlling active myoelectric prosthetics and orthotics used for rehabilitation of movement (63).
Limitations
This study was limited to the analysis of swing phase. The full step analysis including stance is computationally costly typically resolving equations for viscoelastic ground contact with impulse-based velocity-stepping methods, briefly summarized in (29). Instead, we simulated the standing leg kinematically by attaching it to the ground with a 3-DOF primitive driven by foot segment angles. This simplification introduced kinematic inaccuracies due to the foot roll over the point of contact. The model can be improved in the future by adding translation degrees of freedom and segmenting the foot. Also, ankle joint was modeled with only rotational DOFs, and the translations could also improve accuracy (64). Another limitation was the assumption of constant viscoelastic parameters. The time-varying impedance could improve simulation stability beyond the constant values. The magnitude of viscoelastic coefficients could potentially increase to consider muscle co-contraction and further improve stability even at low simulation frequencies. Lastly, we did not simulate forward dynamics with the semi-implicit Euler method because it was not available in Simulink Multibody software. Including this method in the optimal solver search may further improve the speed-accuracy tradeoff for specialized biomechanical models.
Conclusions
We developed a high-dimensional biomechanical model and an optimization to test viscoelastic stabilization with multiple numerical solver methods and a range of simulation frequencies. We concluded that for the real-time applications, the implicit Euler method with 5 ms time step (200 Hz sampling frequency) and no viscoelastic contribution was optimal. The simulation was kinematically (error <1%) and kinetically (error <5% peak-to-peak) accurate in real-time. However, the viscoelastic impedance was essential to achieve accurate forward dynamic solutions with explicit solvers.
Acknowledgements
This work was funded by the NIH Award (1 R03 HD099426-01A1) and FAPESP Grant (2018/04964-8). We thank Trevor Moon for his insightful critique on model implementation and Matthew Yough for proofreading the article.
References
- 1.Wolpert DM. Computational approaches to motor control. Trends Cogn Sci. 1997. Sep 1;1(6):209–16. [DOI] [PubMed] [Google Scholar]
- 2.Wolpert DM, Miall RC, Kawato M. Internal models in the cerebellum. Trends Cogn Sci. 1998. Sep 1;2(9):338–47. [DOI] [PubMed] [Google Scholar]
- 3.Drew T, Andujar JE, Lajoie K, Yakovenko S. Cortical mechanisms involved in visuomotor coordination during precision walking. Brain Res Rev. 2008. Jan;57(1):199–211. [DOI] [PubMed] [Google Scholar]
- 4.Prochazka A, Yakovenko S. The neuromechanical tuning hypothesis. Prog Brain Res. 2007;165:255–65. [DOI] [PubMed] [Google Scholar]
- 5.Lillicrap TP, Scott SH. Preference Distributions of Primary Motor Cortex Neurons Reflect Control Solutions Optimized for Limb Biomechanics. Neuron. 2013. Jan;77(1):168–79. [DOI] [PubMed] [Google Scholar]
- 6.Franklin DW, Wolpert DM. Computational Mechanisms of Sensorimotor Control. Neuron. 2011. Nov;72(3):425–42. [DOI] [PubMed] [Google Scholar]
- 7.De Groote F, Pipeleers G, Jonkers I, Demeulenaere B, Patten C, Swevers J, et al. A physiology based inverse dynamic analysis of human gait: potential and perspectives. Comput Methods Biomech Biomed Engin. 2009. Oct 1;12(5):563–74. [DOI] [PubMed] [Google Scholar]
- 8.Piazza SJ. Muscle-driven forward dynamic simulations for the study of normal and pathological gait. J NeuroEngineering Rehabil. 2006. Dec;3(1):5. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 9.Hidler J, Neckel N. Inverse-Dynamics Based Assessment of Gait using a Robotic Orthosis. In: 2006 International Conference of the IEEE Engineering in Medicine and Biology Society [Internet]. New York, NY: ; 2006. [cited 2022 Aug 24]. p. 185–8. Available from: http://ieeexplore.ieee.org/document/4461716/ [DOI] [PubMed] [Google Scholar]
- 10.Akhundov R, Saxby DJ, Diamond LE, Edwards S, Clausen P, Dooley K, et al. Is subject-specific musculoskeletal modelling worth the extra effort or is generic modelling worth the shortcut? Carlier A, editor. PLOS ONE. 2022. Jan 25;17(1):e0262936. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 11.Song K, Anderson AE, Weiss JA, Harris MD. Musculoskeletal models with generic and subject-specific geometry estimate different joint biomechanics in dysplastic hips. Comput Methods Biomech Biomed Engin. 2019. Feb;22(3):259–70. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 12.Mochon S, McMahon TA. Ballistic walking. J Biomech. 1980. Jan;13(1):49–57. [DOI] [PubMed] [Google Scholar]
- 13.Onyshko S, Winter DA. A mathematical model for the dynamics of human locomotion. J Biomech. 1980. Jan;13(4):361–8. [DOI] [PubMed] [Google Scholar]
- 14.Mena D, Mansour JM, Simon SR. Analysis and synthesis of human swing leg motion during gait and its clinical applications. J Biomech. 1981;14(12):823–32. [DOI] [PubMed] [Google Scholar]
- 15.Pandy MG, Berme N. Synthesis of human walking: a planar model for single support. J Biomech. 1988;21(12):1053–60. [DOI] [PubMed] [Google Scholar]
- 16.Taga G. A model of the neuro-musculo-skeletal system for human locomotion. Biol Cybern. 1995;73(2):97–111. [DOI] [PubMed] [Google Scholar]
- 17.Gilchrist LA, Winter DA. A multisegment computer simulation of normal human gait. IEEE Trans Rehabil Eng. 1997. Dec;5(4):290–9. [DOI] [PubMed] [Google Scholar]
- 18.Full RJ, Koditschek DE. Templates and anchors: neuromechanical hypotheses of legged locomotion on land. J Exp Biol. 1999;202(23):3325–32. [DOI] [PubMed] [Google Scholar]
- 19.Delp SL, Anderson FC, Arnold AS, Loan P, Habib A, John CT, et al. OpenSim: open-source software to create and analyze dynamic simulations of movement. IEEE Trans Biomed Eng. 2007;54(11):1940–50. [DOI] [PubMed] [Google Scholar]
- 20.Sartori M, Reggiani M, van den Bogert AJ, Lloyd DG. Estimation of musculotendon kinematics in large musculoskeletal models using multidimensional B-splines. J Biomech. 2012. Feb 2;45(3):595–601. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 21.Sobinov A, Boots MT, Gritsenko V, Fisher LE, Gaunt RA, Yakovenko S. Approximating complex musculoskeletal biomechanics using multidimensional autogenerating polynomials. Vanderelst D, editor. PLOS Comput Biol. 2020. Dec 16;16(12):e1008350. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 22.Smirnov Y, Smirnov D, Popov A, Yakovenko S. Solving musculoskeletal biomechanics with machine learning. PeerJ Comput Sci. 2021. Aug 26;7:e663. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 23.Modenese L, Kohout J. Automated Generation of Three-Dimensional Complex Muscle Geometries for Use in Personalised Musculoskeletal Models. Ann Biomed Eng. 2020. Jun;48(6):1793–804. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 24.Boots MT. A Biomimetic Approach to Controlling Restorative Robotics [Internet] [PhD]. West Virginia University Libraries; 2019. [cited 2021 Mar 9]. Available from: https://researchrepository.wvu.edu/etd/7384 [Google Scholar]
- 25.Manukian M. Real-time simulation of arm and hand dynamics using ANN. 2021;53. [Google Scholar]
- 26.Todorov E, Erez T, Tassa Y. MuJoCo: A physics engine for model-based control. In: 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems [Internet]. Vilamoura-Algarve, Portugal: IEEE; 2012. [cited 2020 Dec 23]. p. 5026–33. Available from: http://ieeexplore.ieee.org/document/6386109/ [Google Scholar]
- 27.Caggiano V, Wang H, Durandau G, Sartori M, Kumar V. MyoSuite -- A contact-rich simulation suite for musculoskeletal motor control. 2022. [cited 2022 Jun 27]; Available from: https://arxiv.org/abs/2205.13600 [Google Scholar]
- 28.Abdullah HA, Tarry C, Datta R, Mittal GS, Abderrahim M. Dynamic biomechanical model for assessing and monitoring robot-assisted upper-limb therapy. J Rehabil Res Dev. 2007. Jan;44(1):43–61. [DOI] [PubMed] [Google Scholar]
- 29.Erez T, Tassa Y, Todorov E. Simulation tools for model-based robotics: Comparison of Bullet, Havok, MuJoCo, ODE and PhysX. In: 2015 IEEE International Conference on Robotics and Automation (ICRA). 2015. p. 4397–404. [Google Scholar]
- 30.Darekar A, McFadyen BJ, Lamontagne A, Fung J. Efficacy of virtual reality-based intervention on balance and mobility disorders post-stroke: a scoping review. J Neuroengineering Rehabil. 2015;12(1):46. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 31.Laver KE, Lange B, George S, Deutsch JE, Saposnik G, Crotty M. Virtual reality for stroke rehabilitation. Cochrane Stroke Group, editor. Cochrane Database Syst Rev [Internet]. 2017. Nov 20 [cited 2022 Sep 30];2018(1). Available from: 10.1002/14651858.CD008349.pub4 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 32.Torrisi M, Maggio MG, De Cola MC, Zichittella C, Carmela C, Porcari B, et al. Beyond motor recovery after stroke: The role of hand robotic rehabilitation plus virtual reality in improving cognitive function. J Clin Neurosci. 2021. Oct;92:11–6. [DOI] [PubMed] [Google Scholar]
- 33.Wu G, Siegler S, Allard P, Kirtley C, Leardini A, Rosenbaum D, et al. ISB recommendation on definitions of joint coordinate system of various joints for the reporting of human joint motion—part I: ankle, hip, and spine. J Biomech. 2002. Apr;35(4):543–8. [DOI] [PubMed] [Google Scholar]
- 34.O’Connor CM, Thorpe SK, O’Malley MJ, Vaughan CL. Automatic detection of gait events using kinematic data. Gait Posture. 2007. Mar;25(3):469–74. [DOI] [PubMed] [Google Scholar]
- 35.Ga W. Data smoothing and differentiation procedures in biomechanics. Exerc Sport Sci Rev [Internet]. 1982. [cited 2022 Sep 15];10. Available from: https://pubmed.ncbi.nlm.nih.gov/6749517/ [PubMed] [Google Scholar]
- 36.Hanavan EP Jr. A mathematical model of the human body. Air Force Aerospace Medical Research Lab Wright-patterson AFB OH; 1964. [PubMed] [Google Scholar]
- 37.Winter DA. Biomechanics and motor control of human movement. John Wiley & Sons; 2009. [Google Scholar]
- 38.Fryar CD, Carroll MD, Gu Q, Afful J, Ogden CL. Anthropometric reference data for children and adults: United States, 2015–2018. 2021; [PubMed] [Google Scholar]
- 39.McDowell MA, Fryar CD, Hirsch R, Ogden CL. Anthropometric reference data for children and adults: U.S. population, 1999–2002. Adv Data. 2005. Jul 7;(361):1–5. [PubMed] [Google Scholar]
- 40.Fuchioka S, Iwata A, Higuchi Y, Miyake M, Kanda S, Nishiyama T. The Forward Velocity of the Center of Pressure in the Midfoot is a Major Predictor of Gait Speed in Older Adults. Int J Gerontol. 2015. Jun;9(2):119–22. [Google Scholar]
- 41.Kreiss H, Ortiz OE. Introduction to numerical methods for time dependent differential equations. Hoboken, New Jersey: Wiley; 2014. 176 p. [Google Scholar]
- 42.Andrews S, Teichmann M, Kry PG. Geometric Stiffness for Real-time Constrained Multibody Dynamics. Comput Graph Forum. 2017;36(2):235–46. [Google Scholar]
- 43.Stephens MA. EDF Statistics for Goodness of Fit and Some Comparisons. J Am Stat Assoc. 1974. Sep 1;69(347):730–7. [Google Scholar]
- 44.Roos PE, Dingwell JB. Influence of simulated neuromuscular noise on movement variability and fall risk in a 3D dynamic walking model. J Biomech. 2010. Nov 16;43(15):2929–35. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 45.Winter DA. Kinematic and kinetic patterns in human gait: Variability and compensating effects. Hum Mov Sci. 1984. Mar 1;3(1):51–76. [Google Scholar]
- 46.Mitchell A, Martin AE. Quantifying the effect of sagittal plane joint angle variability on bipedal fall risk. Federolf PA, editor. PLOS ONE. 2022. Jan 26;17(1):e0262749. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 47.Grimmer M, Eslamy M, Seyfarth A. Energetic and Peak Power Advantages of Series Elastic Actuators in an Actuated Prosthetic Leg for Walking and Running. Actuators. 2014. Feb 27;3:1–19. [Google Scholar]
- 48.Millard M, Kubica E, McPhee J. Forward dynamic human gait simulation using a SLIP target model. Procedia IUTAM. 2011. Dec 31;2:142–57. [Google Scholar]
- 49.Font-Llagunes J, Pàmies-Vilà R, Alonso J, Lugrís U. Simulation and design of an active orthosis for an incomplete spinal cord injured subject. Procedia IUTAM. 2011. Jul 1;2:68–81. [Google Scholar]
- 50.Robertson DGE, Caldwell GE, Hamill J, Kamen G, Whittlesey SN. Research methods in biomechanics. Second edition. Champaign, Illinois: Human Kinetics; 2014. 428 p. [Google Scholar]
- 51.Davis PJ, Rabinowitz P. Methods of Numerical Integration. Courier Corporation; 2007. 626 p. [Google Scholar]
- 52.Hairer E, Wanner G. Solving Ordinary Differential Equations II: Stiff and Differential-Algebraic Problems. Berlin, Heidelberg: Springer Berlin Heidelberg; 1991. [Google Scholar]
- 53.Gavrea BI, Anitescu M, Potra FA. Convergence of a Class of Semi-Implicit Time-Stepping Schemes for Nonsmooth Rigid Multibody Dynamics. SIAM J Optim. 2008. Jan;19(2):969–1001. [Google Scholar]
- 54.Potra FA. Runge-Kutta Integrators for Multibody Dynamics. Mech Struct Mach. 1995. Jan;23(2):181–97. [Google Scholar]
- 55.Chen YJ (Edwin), Sheen SH, Ascher UM, Pai DK. SIERE: A Hybrid Semi-Implicit Exponential Integrator for Efficiently Simulating Stiff Deformable Objects. ACM Trans Graph. 2021. Feb 28;40(1):1–12. [Google Scholar]
- 56.Hairer E, Roche M, Lubich C. Runge-Kutta methods for differential-algebraic equations. In: Hairer, Roche M, Lubich C, editors. The Numerical Solution of Differential-Algebraic Systems by Runge-Kutta Methods [Internet]. Berlin, Heidelberg: Springer; 1989. [cited 2022 Sep 16]. p. 14–22. (Lecture Notes in Mathematics). Available from: 10.1007/BFb0093949 [DOI] [Google Scholar]
- 57.Pàmies-Vilà R, Font-Llagunes J. Validation of the Inverse Dynamic Analysis of Human Gait Using a Forward Dynamics Approach. In 2013. [Google Scholar]
- 58.Jang SJ, Choi YJ. SYSTEM AND METHOD FOR EXECUTING A SIMULATION OF ACONSTRAINED MULTI-BODY SYSTEM. 2017;28. [Google Scholar]
- 59.Feldman A. Change in muscle length as a result of equilibrium changes in the muscle-load system. Biofizika. 1974. Jun;19(3):534–8. [PubMed] [Google Scholar]
- 60.Bizzi E . Central and Peripheral Mechanisms in Motor Control. In: Advances in Psychology [Internet]. Elsevier; 1980. [cited 2022 Aug 18]. p. 131–43. Available from: https://linkinghub.elsevier.com/retrieve/pii/S0166411508619421 [Google Scholar]
- 61.Hogan N. Impedance Control: An Approach to Manipulation. In: 1984 American Control Conference [Internet]. San Diego, CA, USA: IEEE; 1984. [cited 2022 Jun 28]. p. 304–13. Available from: https://ieeexplore.ieee.org/document/4788393/ [Google Scholar]
- 62.Sobinov A. Description of motor control using inverse models [Internet] [PhD]. West Virginia University Libraries; 2019. [cited 2022 Aug 19]. Available from: https://researchrepository.wvu.edu/etd/4073 [Google Scholar]
- 63.Tucker MR, Olivier J, Pagel A, Bleuler H, Bouri M, Lambercy O, et al. Control strategies for active lower extremity prosthetics and orthotics: a review. J NeuroEngineering Rehabil. 2015. Jan 5;12(1):1. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 64.Buczek FL, Kepple TM, Siegel KL, Stanhope SJ. Translational and rotational joint power terms in a six degree-of-freedom model of the normal ankle complex. J Biomech. 1994. Dec;27(12):1447–57. [DOI] [PubMed] [Google Scholar]
