Part II: Leg Muscle Force Estimation in Stance
Before you begin working on stance, be sure to unlock the three pelvis coordinates (pelvis_tilt, pelvis_tx, pelvis_ty) that were locked for the swing analysis.
A. Find a set of generalized forces that produce the stance motion using Inverse Dynamics
Objective: Use the Inverse Dynamics Tool in the OpenSim GUI to find a set of applied forces that make the model dynamics consistent with the applied ground reaction forces.
Associate the ground reaction force (GRF) data with the inverse kinematics trial and visualize the results.
Visualize and associate the stance motion with the model file as follows:
- Use the File menu to load the motion file leg69_IK_stance.mot.
- In the Navigator pane, find the motion called "ik trial".
- Right-click "ik trial" and select "Associate Motion Data...".
- Associate the file Stance\leg69_stance_grf.mot with the loaded motion.
- Play the animation to ensure the ground reaction forces have been loaded correctly.
Use the Inverse Dynamics Tool to find a set of generalized forces.
Read the page on How Inverse Dynamics Works to understand how the forces are calculated.
Open the Inverse Dynamics (ID) Tool and configure it as follows:
- In the Input pane, select "Loaded motion" and use the "ik trial" motion from the previous step.
- Check the box to filter the coordinates and set the cutoff frequency to 6 Hz.
- Set the time range to between 0.5 and 1.5 seconds.
- Specify an output directory (e.g., <YourWorkingDir>\Stance\ID).
- Select the External Loads tab and check the External Loads box.
- Edit the External Loads settings by clicking the pencil icon to the right of the textbox.
- Select leg69_stance_grf.mot as the "Force data file". This file describes the force applied at the foot's center of pressure (CoP).
- Add the forces listed in the motion file by clicking the "Add..." button.
- Provide a name (e.g., "Right_GRF").
- Apply the force to the calcn_r body.
- Check "Applies Force" and select "Point Force".
- Force Columns: select "ground_force_vx" from the first drop-down box; "ground_force_vy" and "ground_force_vz" will be selected automatically.
- Point Columns: select "ground_force_px" from the first drop-down box; the corresponding "y" and "z" entries will again be populated automatically.
- The GRF free moment is a torque, so check "Applies Torque".
- Torque Columns: select "ground_torque_x", "ground_torque_y", and "ground_torque_z".
- The GRF and CoP are both expressed in the ground (laboratory) frame, so click OK.
- Click "Save..." and enter a filename for the External Force input (e.g., leg69_right_GRF.xml).
- Click "Save..." and enter a filename for the ID settings (e.g., leg69_Setup_ID_stance.xml).
- Run the tool, then close the Inverse Dynamics Tool window.
B. Model refinement through residual reduction
Objective: Use the Residual Reduction Algorithm (RRA) Tool to find a new set of model parameters that reduces the residual forces.
Read the pages describing the Residual Reduction Algorithm.
Use the RRA Tool to calculate the size of the residuals.
Open the RRA Tool and configure it as follows:
- In the input pane, set the desired kinematics as the IK motion file (e.g., leg69_IK_stance.mot).
- Check the box to filter kinematics at 6 Hz.
- In the input pane, specify the tracking tasks for RRA (use Stance\leg69_Tracking_Tasks.xml). This file specifies the coordinates to be tracked and the corresponding weights. Use the GUI File Editor or an XML editor (e.g., Notepad++) to view the tasks.
Check "Adjust model". Click on the folder icon, make sure you are in the Stance folder, specify a new model name (e.g., leg6dof9musc_RRA_adjusted.osim), and click Save.
- Make the pelvis the "Body COM to adjust". The center of mass of this body will be adjusted to reduce residuals. Typically, the segment that includes the torso is chosen.
- Specify the time range using your analysis from part A (see Questions: Leg Muscle Force Estimation, Part II, Question A.5).
- Specify an output directory (e.g., <YourWorkingDirectory>\Stance\RRA).
- Go to 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 the "Edit..." button next to the "Additional force set files" textbox, then click "Add". Click the folder button next to the red textbox and 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) and click Run.
After each run of the RRA tool, a new model file will be loaded into the navigator (and also printed) where the COM of the pelvis has been automatically adjusted. In the Messages window, the RRA tool also provides a set of estimated changes to the mass and the COM for all of the segments which would further reduce the residuals needed to match the experimental kinematic and force data.
C. Finalize the model through iteration of RRA
Objective: Create a new model using the output of the RRA Tool. Iteratively run RRA on each new model, adjusting only the pelvis mass and COM location.
Use the Navigator to edit the mass properties of the pelvis as recommended by the RRA Tool.
When RRA is complete, a new model with an adjusted pelvis COM will be loaded into the navigator. However, the mass of the pelvis is not adjusted by the Tool and you will need to manually adjust the mass of the body.
- In the Navigator pane, expand the Bodies tree and select pelvis.
- In the Properties Editor, adjust the mass as recommended by the RRA Tool.
- Rename the model in the Navigator pane (e.g., leg6dof9musc_adj) by right-clicking on the current model name and selecting "Rename...".
- Click "Save As..." and save the model with a new name (e.g., leg6dof9musc_RRA_adjustment.osim).
Perform several iterations of running RRA and adjusting the model until the residual forces and tracking errors have stabilized.
- Re-run RRA with the adjusted model making sure to close and re-open the RRA Tool to ensure the most recent adjusted model is always used.
- Adjust the pelvis COM and mass in accordance with the RRA Tool output messages.
- Plot your tracking errors from the RRA/leg6dof9musc_pErr.sto file. Verify whether the errors are reported in radians or degrees by opening the file in a text editor and reading the header.
- Increase the tracking task weights for coordinates that show poor tracking in the leg69_Tracking_Tasks.xml file.
- Decrease the tracking weight for coordinates that are within 1 degree (0.017 radians), since the optimizer can use these coordinates to reduce residuals.
- Iterate until the requested change in pelvis mass is less than 1 kg and the residual forces and coordinate errors follow the suggested thresholds in the table at the bottom of the Getting Started with RRA page. (Hint: try a pelvis mass of 56kg)
D. Forward simulation of stance with CMC
Objective: Use the CMC Tool to determine a set of muscle excitations, activations, and forces that generate a forward dynamic simulation of the stance phase of gait.
Configure the actuators used in the CMC Tool.
Create a new actuator file that penalizes the use of residual motors:
- Ensure you have loaded your final model from the previous section on RRA.
- From the Edit menu, select "File (.xml)..." and open the leg69_RRA_residuals_motors.xml file, which contains information on the residual and motor actuators necessary for CMC.
- Reduce the optimal force of the Coordinate Actuators that actuate the ankle, hip, and knee to 1 so that they are penalized during CMC and muscles are favored to generate joint moments.
- Save the edited actuators as a new file (e.g., leg69_CMC_residuals_motors.xml).
Use the CMC Tool to calculate the muscle excitations, activations, and forces of the stance phase.
Open the CMC Tool and configure it as follows:
- In the Input panel, specify the desired kinematics as the output from RRA (e.g., leg6dof9musc_Kinematics_q.sto).
- Note that no filtering is required: the kinematics are smooth since they resulted from a simulation.
- Ensure you are using the adjusted RRA model and the corresponding kinematics.
- Apply tracking tasks. Use the same tasks file as you used for RRA.
- Include actuator control constraints that define the control limits for each muscle (e.g., leg69_muscles_residuals_motor_control_limits.xml).
- Specify the same time range as before.
- Specify the output directory (e.g., <YourWorkingDirectory>\Stance\CMC).
- Under the Actuators and External Loads tab, select "Append to 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 that leg69_CMC_residuals_motors.xml is to be appended.
- Specify the external loads (same as for RRA).
- Save your CMC settings to a file.
- Run the tool.
Tips and tricks for CMC
- One common way for CMC to fail is when the tool is unable to find a set of muscle forces that can accurately reproduce the joint dynamics. Consider reducing the tracking weights until your run successfully completes. Make sure to re-run RRA and use the adjusted model output from the RRA Tool in CMC when you adjust the tasks.
- Check the troubleshooting tips at the bottom of the Getting Started with CMC page.
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.