Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

OpenSim has a broad range of capabilities for generating and analyzing musculoskeletal models and dynamic simulations. This chapter provides an overview of these capabilities and a list of resources to find more information about each component of the OpenSim workflow. Contents include:

Table of Contents

The OpenSim Model

One of the major goals of the OpenSim project is to provide a common platform for creating and sharing models of the musculoskeletal system. Thus, the first component of any analysis is an OpenSim model. An OpenSim model represents the dynamics of a system of rigid bodies and joints that are acted upon by forces to produce motion. The OpenSim model file is made up of components corresponding to parts of the physical system. These parts include bodies, joints, forces, constraints, and controllers.

...

A model consists of different components. For example, in a model used for the simulation of human walking, the bodies represent the geometry and inertial properties of the body segments. The joints specify the articulations at the pelvis, hip, knee, and ankle joints, while a constraint could be used, for example, to couple the motion of the patella with the model’s knee flexion angle. The forces in the model include both internal forces from muscles and ligaments and external forces from interaction with the ground. Finally, the model’s controller determines the activation of muscles (e.g., computed muscle control).

Simulation Pipelines (Workflows)

Different simulation pipelines have been developed to answer different questions. Our webinar on “Which Simulation Pipeline Should I Use? An Overview of Common Workflows” can help you select a suitable simulation pipeline. Our paper on Best practices for verification and validation of musculoskeletal models and simulations of movement also has valuable information about how to design a study. 

You can also use the questions below to guide you in selecting a suitable simulation pipeline.  The section below on Examples of Choosing a Simulation Pipeline also provides useful tips.

...

     If you answered “yes” to (a) and (b), you may have an Inverse Problem. See the Inverse Problem simulation options below. 

...

     If yes, you may have a Forward Problem. See the Forward Problem simulation options below.

...

     If yes, you may have a Forward Problem. See the Forward Problem simulation options below.

...

  - Enabling stochastic simulations of movement with high throughput computing on the Open Science Grid (webinar + links to publications and sample files)

Common Pre-Processing Steps

For several of the simulation pipelines discussed above, the first steps are to import your experimental data and scale your model. For cases where the simulation pipeline relies on experimental data, you can read about importing various types of data below. For cases where you are simulating and analyzing the movement of a specific subject, you can read more about scaling a model below.

Importing Experimental Data

In many cases, you will use OpenSim to analyze experimental data that you have collected in your laboratory. This data typically includes:

...

Scaling

If you are using a generic model from the existing library of models, the next step is to scale the model to match the experimental data collected for your subject—functionality provided by the Scale Tool in OpenSim. The purpose of scaling a generic musculoskeletal model is to modify the anthropometry, or physical dimensions, of the generic model so that it matches the anthropometry of a particular subject. Scaling is one of the most important steps in solving inverse kinematics and inverse dynamics problems because these solutions are sensitive to the accuracy of the scaling step. In OpenSim, the scaling step adjusts both the mass properties (mass and inertia tensor), as well as the dimensions of the body segments.

See the section on Scaling for more details. Tutorial 3 - Scaling, Inverse Kinematics, and Inverse Dynamics includes an example using the Scale Tool. This tutorial is also accessible from the OpenSim application Help menu.

Anchor
Overview_InverseProblem
Overview_InverseProblem
The Inverse Problem

Inverse methods use data measured from observed moments to estimate joint angles and coordinates, joint moments, joint torques, muscle forces, muscle activity, musculotendon dynamics, and other values that are a function of the model's states. The states of the model generally include its coordinates, coordinate velocities, muscle activations, and muscle fiber lengths.

...

METHODGOALKEY CONSIDERATIONSAVAILABLE INTERFACESRESOURCES
GUICommand Line*C++  & Scripting**Other
Inverse dynamicsCalculate joint torques from a measured motionStraightforward; minimal assumptionsXXX

Overview

User Guide: Inverse Dynamics

Hands-on Example (Beginner): Scaling, Inverse Kinematics, and Inverse Dynamics

Static optimization

Estimate muscle force/activations from a measured motion

Fast estimation; assumes rigid tendons; minimizes activation squared at each time step

XXX

Overview

User Guide: Static Optimization

Hands-on Example (Intermediate): Working with Static Optimization

Hands-on Example (Intermediate): Estimating Leg Muscle Forces in Stance and Swing

Computed muscle control (CMC)

Estimate muscle excitations from a measured motion

Excitation-activation dynamics; accounts for tendon stretch;  minimizes activation squared at each time step

XX

Overview

User Guide: Computed Muscle Control

Hands-on Example (Intermediate): Computed Muscle Control

Hands-on Example (Intermediate): Estimating Leg Muscle Forces in Stance and Swing

CMC Theory and Publications

EMG-informed methods

Estimate musculotendon parameters given a measured motion and muscle activity

Normalizing muscle activity is necessary




X

Overview

Calibrated EMG-Informed Neuromusculoskeletal Modeling (CEINMS) Toolbox

...

**"Scripting" refers to calling commands from other languages, specifically MATLAB and Python.

Inverse Kinematics

The Inverse Kinematics (IK) Tool in OpenSim finds values for the generalized coordinates (joint angles and positions) in the model that best match the experimental kinematics recorded for a particular subject (see figure below). The experimental kinematics targeted by IK can include experimental marker positions, as well as experimental generalized coordinate values (joint angles). The IK Tool goes through each time step of motion and computes generalized coordinate values which position the model in a pose that "best matches" experimental marker and coordinate values for that time step. Mathematically, the "best match" is expressed as a weighted least-squares problem, whose solution aims to minimize both marker and coordinate errors.



Experimental markers are matched by model markers throughout the motion by varying the generalized coordinates (e.g., joint angles) through time. See Inverse Kinematics for full documentation on running IK in OpenSim. Tutorial 3 - Scaling, Inverse Kinematics, and Inverse Dynamics walks through an example of using Inverse Kinematics for human walking.

Anchor
Overview_InverseDynamics
Overview_InverseDynamics
Inverse Dynamics

OpenSim enables researchers to solve the Inverse Dynamics problem, using experimental measured subject motion and forces to generate the kinematics and kinetics of a musculoskeletal model (see figure below). Dynamics is the study of motion and the forces and moments that produce that motion. The Inverse Dynamics (ID) Tool determines the generalized forces (e.g., net forces and torques) that cause a particular motion, and its results can be used to infer how muscles are actuated to generate that motion. To determine these internal forces and moments, the equations of motion for the system are solved with external forces (e.g., ground reaction forces) and accelerations given (estimated by differentiating angles and positions twice). The equations of motion are automatically formulated using the kinematic description and mass properties of a musculoskeletal model in Simbody™. 

...

See Inverse Dynamics for full documentation on running ID in OpenSim. Tutorial 3 - Scaling, Inverse Kinematics, and Inverse Dynamics walks through an example of using ID for human walking.

Anchor
Overview_StaticOptimization
Overview_StaticOptimization
Static Optimization

Static optimization is an extension of inverse dynamics that further resolves the net joint moments into individual muscle forces at each instant in time based on some performance criteria, like minimizing the sum of squared muscle forces. See Static Optimization for more details.

Anchor
Overview_CMC
Overview_CMC
Computed Muscle Control

The Computed Muscle Control (CMC) Tool estimates muscle excitations from a measured motion. It does so by dividing a motion into 10ms windows. Within each window, the algorithm performs an optimization to compute the muscle excitations needed to match the motion at the end of the 10ms window. 

...

Full documentation of the Residual Reduction Algorithm and Computed Muscle Control is available in the respective sections.

Anchor
Overview_EMGInverse
Overview_EMGInverse
EMG-Informed Methods

It is possible to include experimental electromyography (EMG) data as an additional input to your inverse problem to estimate musculotendon parameters. We refer to such approaches as "EMG-informed methods." There are two ways to incorporate EMG data:

...

EMG-informed methods provide better estimates of muscle and tendon parameters than CMC because of the additional input data. One key point, however, is to carefully normalize muscle activity data to get good results.

Anchor
_Toc174680178
_Toc174680178
The Forward Problem

OpenSim is also capable of generating muscle-driven forward simulations of gait and other movements (see figure below).

...

METHODGOALSPEEDKEY CONSIDERATIONSAVAILABLE INTERFACESRESOURCES
GUICommand Line*C++  & Scripting**Other

Forward dynamics with known controls

Generate a motion based on specified muscle excitations, joint torques, and/or other applied forces 

Fast (seconds to minutes)Easy to set up and can quickly get results; difficult to use for more complex motions (e.g., walking) without adding a controllerXXX

Overview

User Guide: Forward Dynamics

Shooting methods

Generate a motion based on high-level tasks quantified by an objective function

Slow (hours to days)

Model and controller simplifications are common; controllers are usually motion-specific; can support controllers based on realistic feedback loops (e.g., force)



XX

Overview

SCONE software

Webinar: Predictive Simulation of Biological Motion Using SCONE

Reinforcement learning (RL)

Generate a motion based on high-level tasks quantified by an objective function

Very slow (days to weeks)

Model simplifications are common;  may require very large amount of computing power; minimal input needed from user so workflow can be extended to many motions




X

Overview

osim-rl tool

Webinar: Robust Control Strategies for Musculoskeletal Models Using Deep Reinforcement Learning

Direct collocation

Quickly generate a motion based on high-level tasks quantified by an objective function; intermediate solutions do not necessarily satisfy physical constraints

Middling (minutes to hours)

Capacity to scale to more complicated models; difficult to implement (e.g., constraints, providing derivatives); difficult to add feedback loops (i.e., for reflexes)



XX

Overview

OpenSim Moco

Webinar: OpenSIm Moco: Software to Optimize the Motion and Control of OpenSim Models

...

**"Scripting" refers to calling commands from other languages, specifically MATLAB and Python.

Anchor
Overview_ForwardDynamics
Overview_ForwardDynamics
Forward Dynamics with Known Controls

In a forward dynamic simulation of motion, muscle excitations, joint torques, and/or other applied forces are used to drive the motion of a model. Or in some cases, the model may have its own controller (e.g., that models reflexes).

...

Refer to the Forward Dynamics section of the User Guide for additional information.

Anchor
Overview_ShootingMethods
Overview_ShootingMethods
Shooting Methods

Developing controllers to generate a forward dynamics simulation can be challenging. As such, methods have been developed that can generate controls in an automated manner to achieve the desired behavior or movement in forward dynamics. Shooting methods are one such method. In shooting methods, a simulated trajectory is “shot” forward in time (e.g., a forward simulation is run).  At the end of each simulation, the results are evaluated by an objective function, a mathematical representation of the criteria you want your simulation to meet.  Example objective functions include minimizing metabolic cost or minimizing joint contact. An optimizer then updates the controller parameters for the next iteration of the forward simulation. This process is repeated until the objective function is met within the specified tolerance. The SCONE software, built on top of OpenSim, enables researchers to use shooting methods for their studies.  

Anchor
Overview_RL
Overview_RL
Reinforcement Learning (RL)  

Reinforcement learning (RL) is another method to generate controls for forward dynamics simulations in an automated manner. Like shooting methods, RL generates a motion based on objective functions, the mathematical representation of the criteria you want your simulation to meet, but it takes a different approach to developing the controller. The RL method consists of three components: 

...

Based on a given action, the objective function (reward) is computed, along with the controller values needed to change the state.  Then, just as with shooting methods, RL iterates over this process. Over more iterations, the policy or controller is updated to get better and better rewards. Thus, the policy is being trained to create a controller without input from the user. osim-rl, built on top of OpenSim, incorporates musculoskeletal modeling into a reinforcement learning environment.

Anchor
Overview_DirectCollocation
Overview_DirectCollocation
Direct Collocation

Forward methods, particularly shooting methods and reinforcement learning, can be slow. Direct collocation aims to generate a forward simulation with the speed of inverse methods. It does so by concurrently optimizing the whole motion trajectory and muscle excitations (or other control values). This can speed up the process quite a bit with physical constraints satisfied at the end of the optimization. While direct collocation problems have traditionally been challenging to set up and solve, the OpenSim Moco project provides an open-source toolkit to facilitate the use of direct collocation methods in human and animal movement studies.

Anchor
Overview_SimulationPipelineExamples
Overview_SimulationPipelineExamples
Frequently Asked Questions About Choosing a Simulation Pipeline

  • Which method is better: forward or inverse dynamics?  Forward and inverse methods are both valuable methods with different goals, and neither method is always better than the other. It is important to choose the method that is needed to answer your research question, and the webinar provided examples of many studies to help guide this process. In general, we suggest choosing the easiest and quickest methods that are sufficient for your problem.
  • Are forward and inverse dynamics simulation more suitable for upper and lower limb modelling, respectively? Neither method is always better than the other, as mentioned in the response to the previous question. We suggest choosing the easiest and quickest methods that are sufficient for your program. For example, forward dynamic simulations of the upper extremity can be easier to generate compared with simulations of the lower extremity, as upper extremity motions don't generally require simulating complicated foot-floor contact.

...

  • If I have a problem that is best addressed by reinforcement learning or direct collocation, would it be a good idea to use a CMC solution as the initial guess? One way to improve the speed of more complicated algorithms such as reinforcement learning or direct collocation is to give it a good initial guess. Using a quicker method, such as CMC, to give a good guess is a great way to do just this. We have seen users leverage this strategy for both reinforcement learning and direct collocation.

Analyzing Simulations

Answering your research questions often requires delving deeper into the details of a simulation. Thus, OpenSim includes an Analyze Tool that allows you to estimate, for example, muscle fiber or tendon lengths during a motion, or the loads on the knee joint. The Analyze Tool enables you to analyze a model or simulation based on a number of inputs that can include time histories of model states, controls, and external loads applied to the model. The following analyses are available in OpenSim:

...