You are viewing the documentation for OpenSim 2.4. Are you looking for the latest OpenSim 4.0 Documentation?
Forward Simulation of Stance Phase
Creating a Muscle-Driven Simulation of the Stance Phase of Gait
To present some of the tools and capabilities of OpenSim, we will use a simplified model (leg6dof9muscles.osim) throughout this example. The model consists of the pelvis, thigh, shank, and foot segments along with the psoas major, gluteus maximus, rectus femoris, vastus intermedius, biceps femoris long head, biceps femoris short head, tibialis anterior, medial gastrocnemius, and soleus muscles. This simple model is not intended for research.
Opening the Model and Viewing the Data
- Load the leg6dof9muscles.osim model from the examples directory (e.g., examples \Leg6Dof9Musc)
- Preview the kinematics and ground-reaction forces with the model
- Load the motion file leg69_IK_stance.mot and hit play.
- Under File, choose Preview Motion Data and select leg69_stance_grf.mot
- Leg6Dof9Musc.osim: The model we'll use in this exercise is of a right leg and pelvis with 6 coordinates and 9 muscles. Sync the two motions by selecting both motions: hold the control key, right click to sync motions, and hit play.
Inverse Dynamics
Use Inverse Dynamics to determine the amount of residual force that is required for the model's dynamics to be consistent with applied ground reaction forces:
- Right click the leg69 model and make it the current model.
- Launch the Inverse Dynamics tool.
- Under Input select Motion→Loaded motion→ ik trial.
- Check the box to filter kinematics at 6Hz.
- Specify the time range as 0.5s to 1.5s, the period in which ground reaction forces are defined.
- Specify an output directory (e.g. <YourWorkingDir>\Stance\ID_Results)
- Select the External Loads tab and check the External Loads box.
- Edit the External Loads settings by clicking the pencil icon.
- Select the leg69_stance_grf.mot as the Force data file. This file describes the force applied at the foot's center of pressure.
- Select leg69_IK_stance.mot as the Kinematics for external loads.
- Select Filter kinematics and specify 6Hz.
- Forces listed in the motion file are added as individual forces by hitting the Add button.
- Provide a name (e.g., "Right_GRF")
- Applied to body (e.g., calcn_r)
- Check Applies Force and select Point Force
- Force Columns select "ground_force_vx", y & z selected automatically
- Point Columns select "ground_force_px"
- The GRF free moment is a torque, so check "Applies Torque"
- Torque Columns, scroll down and select "ground_torque_x"
- Both the GRF and CoP are expressed in the ground (lab) frame
- Click OK
- Hit Save and enter a filename for the External Force (e.g., leg69_right_GRF.xml)
- Save settings (e.g. leg69_Setup_ID_stance.xml), then hit Run.
- Plot the forces acting on the pelvis (e.g., pelvis_tilt_moment, pelvis_tx_force, etc.) and the net joint moments for the hip, knee and ankle from inverse_dynamics.sto. Which is the largest residual? What accounts for the large residual forces?
Residual Reduction Algorithm
Use the RRA tool to reduce residuals. In other words, adjust the model to compensate for model inconsistency with the applied GRFs.
- Launch the Reduce Residuals tool.
- Specify Desired Kinematics, which is the IK motion leg69_IK_stance.mot.
- Check the box to filter kinematics at 6Hz.
- Specify the tracking tasks for RRA. Specify the task file provided in Stance/Reference/ leg69_Tracking_Tasks.xml. This file specifies the coordinates to be tracked and the corresponding weights. Use an XML editor (e.g., Notepad++) to view the tasks.
- Specify Actuator control constraints file leg69_muscles_residuals_motors_control_limits.xml. These constraints define the maximum and minimum control limits for all actuators.
- Check "Adjust model". Click on the folder icon, make sure you are in the Stance folder, and specify a new model name (e.g. leg6dof9musc_adjusted_COM_pelvis.osim). Click Save.
- Specify the Body COM to adjust as pelvis. The center-of-mass of this body will be adjusted to reduce residual. Typically we choose the segment incorporating the torso.
- Specify the time range as 0.5s to 1.5s.
- Specify an output directory (e.g. Stance\RRA)
- Select the Actuators and External Loads tab and choose "Replace model's force set" to replace the model's muscles with residual and joint motor actuators since we are creating a torque-driven simulation. Click Edit, then click Add. Then click the folder button next to the red text box. Select leg69_RRA_residuals_motors.xml. Click OK.
- Check the External Loads box and specify the file you created for Inverse Dynamics (e.g. leg69_right_GRF.xml).
- Save your settings to an RRA setup file (e.g., leg69_Setup_RRA_stance.xml).
- Hit Run.
- Why does the model "float" down and up?
- With the original model, preview the model motion with the GRF again.
- Are all of the forces being applied correctly?
- Thinking about this model and motion, what time range of the gait should you restrict your RRA analysis?
- Repeat RRA with the original model over the new time interval (and save the new settings). Close the RRA Tool.
- Does the model still "float" up or down? If so, what else could be causing this?
- Open up the messages window and locate the recommendation from the last run of RRA (e.g., "dmass = 44.037"). Note, the units are in kilograms (kg).
- What is the recommended mass adjustment?Why would the mass adjustment be so large?
- Edit the adjusted model to make the recommended mass adjustments by RRA to the pelvis body.
- To make mass adjustments open the Property Editor (Window→Properties). Navigate to the pelvis Body of the adjusted model. Edit the mass of the pelvis and save the model. Alternatively, use an XML editor to edit the model file.
- Rename the model in the Navigator window (e.g. leg6dof9musc_adjusted) by right clicking on the current model name and selecting Rename.
- Re-run RRA with the adjusted model. Be sure to close and re-open the RRA Tool so you are working on the adjusted model.
- Is the mass adjustment suggested by RRA smaller than before?
- Plot the RRA residual actuator forces (i.e., MZ, FX, FY) from leg6dof9musc_Actuation_Force.sto.
- How do they compare tothe forces acting on the pelvis from your ID results?
- Plot tracking kinematics outputted by RRA from leg6dof9musc_Kinematics_q.sto vs. kinematics from IK. You can also get the tracking error values directly from the file leg6dof9musc_pErr.sto.
- Which coordinates have large tracking errors?
- Increase the tracking task weights for coordinates that show poor tracking (via Edit → File). Decrease the tracking weight for coordinates that are within a degree, since the optimizer can use this to reduce residuals. Note: The plotter will display most angles in radians. 1 degree = 0.017 radians. See Simulation with OpenSim - Best Practices for more information about getting good results from RRA.
- Re-run RRA. Repeat steps 19 and 20 to check the residual forces and tracking errors.
- Are the residual forces and tracking improved?
Computed Muscle Control
Use the Computed Muscle Control (CMC) Tool to determine the muscle excitations, activations and forces that generate a forward dynamics simulation of the stance-phase of gait.
- Load the final adjusted model from RRA
- Consider the residual and motor actuators necessary for CMC (e.g., modify leg69_RRA_residuals_motors.xmlusing Edit→File or an XML editor)
- With muscles present, reduce the optimal force of joint motors to 1 so that they are penalized during CMC and muscles are favored to generate joint moments.
- Save the edited the actuators as a new file (e.g., leg69_CMC_residuals_motors.xml).
- Launch the CMC Tool.
- Specify Desired Kinematics as output from RRA (e.g., leg6dof9musc_Kinematics_q.sto). Note, no filtering is required as the kinematics are smooth since they result from a simulation.
- Apply tracking tasks. Use the same tasks file as for RRA.
- Include limits on muscle actuators by using leg69_muscles_residuals_motor_control_limits.xmlas Actuator constraints. Open the file in an XML editor to compare with the Actuator constraints used for RRA.
- What is the difference between the actuator constraints file used in CMC and the file for RRA?
- Define time range for the stance simulation (use the same range you determined from Step 14 in RRA).
- Specify the output directory (e.g., Stance\CMC).
- Under the Actuators and External Loads tab, select "Append to the model's force set" to include joint motor and residual actuators in addition to existing muscles in the model. Use the Edit button to specify leg69_CMC_residuals_motors.xml to be appended.
- Specify the external loads (same as for RRA).
- Save your settings to a file.
- Run CMC. If CMC does not execute completely, review the tips and tricks in the handout for help with troubleshooting.
- Plot the muscle activation patterns from the states file, leg6dof9musc_added_mass_states.sto. Tip: Using the pattern filter in the plotter selection tool, type "activation" to quickly select the activations.
- Are the simulated activations close to what you expected?
- Check the quality of the simulation by examining the tracking errors, the residual forces, and the motor moments (i.e., reserves). The motor moments are in leg6dof9musc_added_mass_Actuation_force.sto
- How do the kinematics compare to the IK solution for stance?How big are the residuals forces from CMC? How do they compare to residuals from RRA? Are the motor moments (i.e., reserves) at the hip, knee and ankle significant?Are the residuals below 2% of body-weight?
- If time permits, run a forward simulation with the controls from CMC and initial states from CMC. Running Forward Dynamics after CMC is a method of verifying that the controls from CMC generate a forward simulation consistent with the observed kinematics and applied GRFs.
- How do the kinematics from Forward compare to the original IK solution?
OpenSim is supported by the Mobilize Center , an NIH Biomedical Technology Resource Center (grant P41 EB027060); the Restore Center , an NIH-funded Medical Rehabilitation Research Resource Network Center (grant P2C HD101913); and the Wu Tsai Human Performance Alliance through the Joe and Clara Tsai Foundation. See the People page for a list of the many people who have contributed to the OpenSim project over the years. ©2010-2024 OpenSim. All rights reserved.