Remember to update your bookmarks with our new URL.
If you find missing content or broken links, let us know: opensim@stanford.edu

Example - Computed Muscle Control

Using Computed Muscle Control

  1. Load the Upper Extremity Model.  The model (arm26.osim) can be found in the Resources directory (by default, C:/Users/<username>/Resources/Models/Arm26).
  2. Open Computed Muscle Control Tool. To open the tool, select Compute Muscle Control… from the Tools menu.
  3. Specify Filtered Input Motion. Browse to the inverse kinematics directory and select the Desired kinematics file
    (e.g. .../InverseKinematics/arm26_InverseKinematics.mot), check the Filter kinematics option, and enter a cutoff frequency of 6 Hz. Note that if you are starting with the Computed Muscle Control example, you will find the desired kinematics file in the Output Reference folder (e.g. .../OutputReference/InverseKinematics/arm26_InverseKinematics.mot).
  4. Specify Tracking Tasks. Browse to select the tasks file (e.g., arm26_ComputedMuscleControl_Tasks.xml) specifying the joint coordinates for CMC to track and their relative weightings as well as the Kp and Kv gains on the errors.
  5. Specify Actuator Constraints. Browse to select the constraints file (e.g., arm26_ComputedMuscleControl_ControlConstraints.xml) specifying the maximum (or minimum) value used to constrain the allowed values of the actuator controls.
  6. Specify Time Range. The time range for the forward simulation is specified and these should be set from 0 to 1 sec to correspond to the interval upon which the motion was found from inverse kinematics.
  7. Set CMC look-ahead window. A time window of 0.01 is generally sufficient for muscle activations to change enough to produce the desired accelerations.
  8. Specify Output Directory. Set the output Directory (e.g., .../ComputedMuscleControl\Results), so that you are able to compare the results of a CMC simulation with Forward Dynamics simulations using Nonphysiological and Physiological controls generated earlier by Static Optimization.
  9. Specify Additional Model Actuators. Under the Actuators and External Loads tab, set the actuator settings to Append (rather than replace) and edit the Additional force set files field by adding an actuator set file (e.g., arm26_Reserve_Actuators.xml) containing reserve torques.
  10. Save Settings. Use the Settings > button to save your settings to a setup file (e.g., arm26_Setup_ComputedMuscleControl.xml).
  11. Run CMC Tool. You will see the model begin to move as muscles contract and accelerate the model. When the simulation has completed by reaching the end of the specified time range, the specified output directory will be populated by states files (e.g., arm26_states_degrees.mot) and the corresponding motion file (e.g., arm26_states) will be associated with the model in the GUI.

Changing the Tracking Tasks

  1. Change Tracking Weight. Edit the tasks file (e.g., arm26_ComputedMuscleControl_Tasks.xml) or use the Property Editor to reduce the r_shoulder_elev weight from 1.0 to 0.0.
  2. Specify New Tracking Tasks. Browse and select the new tasks file (e.g., arm26_ComputedMuscleControl_Tasks.xml) or save new task from the Property Editor.
  3. Run CMC Tool. You will see the model begin to move while tracking the elbow flexion well but not the shoulder elevation.

Changing the Actuator Constraints

  1. Change Actuator Constraint. Edit the constraints file (e.g., arm26_ControlConstraints.xml) or use the Excitation Editor to limit BIClong control to a maximum of 0.05.
  2. Specify Actuator Constraints. Browse and select the new constraints file (e.g., arm26_ControlConstraints.xml) or save new constraint from the Excitation Editor.
  3. Run CMC Tool. You will see the model begin to move by using other actuators in lieu of BIClong.

Changing the CMC Look-Ahead Window

  1. Change CMC Look-Ahead Window. Set the look-ahead time to 0.5 rather than 0.01.
  2. Run CMC Tool. You will see the model begin to move, but the control will be too coarse to allow for good tracking.

Return to the list of Examples and Tutorials 

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.