Documents I Downloaded OpenSim: Now What? Introductory OpenSim Tutorial GCMAS Annual Meeting, Portland, OR March 18, 2015 Allison Arnold, Apoorva Rajagopal, James Dunne, Chris Carty Website: opensim.stanford.edu Acknowledgments OpenSim was developed as a part of SimTK and funded by the Simbios National Center for Biomedical Computing through the National Institutes of Health and the NIH Roadmap for Medical Research, Grant U54 GM072970. Information on the National Centers can be found at http://nihroadmap.nih.gov/bioinformatics. OpenSim is additionally funded by the National Center for Simulation in Rehabilitation Research (NCSRR), a National Center for Medical Rehabilitation Research supported by grant R24 HD065690, and by the Mobilize Center, a National Center for Big Data to Knowledge (BD2K) supported by grant U54 EB020405. Funding for OpenSim has also been provided by the DARPA Warrior Web Program and NMS Physiome. Trademarks and Copyright and Permission Notice SimTK and Simbios are trademarks of Stanford University. The documentation for OpenSim is freely available and distributable under the MIT License. Copyright (c) 2015 Stanford University Permission is hereby granted, free of charge, to any person obtaining a copy of this document (the "Document"), to deal in the Document without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Document, and to permit persons to whom the Document is furnished to do so, subject to the following conditions: This copyright and permission notice shall be included in all copies or substantial portions of the Document. THE DOCUMENT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE DOCUMENT OR THE USE OR OTHER DEALINGS IN THE DOCUMENT. 2 Table of Contents 1 Overview ............................................................................................................................................. 4 1.1 Audience ....................................................................................................................................................... 4 1.2 Learning Objectives .................................................................................................................................. 4 1.3 Format ........................................................................................................................................................... 5 2 Generic Model of the Lower Extremity ..................................................................................... 5 2.1 Loading a Model ......................................................................................................................................... 5 2.2 Viewing a Model ......................................................................................................................................... 6 2.3 Identifying Components of a Model .................................................................................................... 7 Bodies ............................................................................................................................................................................. 7 Joints ............................................................................................................................................................................... 8 Muscles........................................................................................................................................................................... 9 2.4 Animating a Model ................................................................................................................................. 10 2.5 Questions ................................................................................................................................................... 11 2.6 Additional Resources ............................................................................................................................ 11 3 Tools for Analyzing Models and Data ...................................................................................... 12 3.1 Plotting Muscle Moment Arms Using the Plot Tool .................................................................... 12 Questions..................................................................................................................................................................... 14 Additional Resources ............................................................................................................................................. 14 3.2 Scaling a Model Using the Scale Tool ............................................................................................... 15 Questions..................................................................................................................................................................... 16 Additional Resources ............................................................................................................................................. 17 3.3 Solving for Joint Angles Using the Inverse Kinematics Tool ................................................... 18 Questions..................................................................................................................................................................... 20 Additional Resources ............................................................................................................................................. 20 4 Tools for Editing Models to Represent Contracture and Surgery ................................. 21 4.1 Characterizing Muscle Force-Generating Capacity .................................................................... 21 Additional Resources ............................................................................................................................................. 23 4.2 Plotting Muscle Moment-Generating Capacity............................................................................. 23 Questions..................................................................................................................................................................... 25 4.3 Representing Plantarflexion Contracture ..................................................................................... 25 Questions..................................................................................................................................................................... 27 4.4 Explaining Consequences of Tendon Lengthening Surgery .................................................... 27 Questions..................................................................................................................................................................... 28 Additional Resources ............................................................................................................................................. 28 5 Answer Key ....................................................................................................................................... 29 3 1 Overview Computer simulation has emerged as a powerful method to investigate the actions of muscles during movement, identify factors that contribute to movement disorders, and evaluate the biomechanical consequences of possible treatments. OpenSim is freelyavailable software for developing, analyzing, and sharing such simulations. In OpenSim, a musculoskeletal model consists of a set of rigid bodies connected by joints. Muscles span these joints and generate forces that accelerate the body, consistent with the laws of physics. OpenSim models allow users, for example, to examine the effects of musculoskeletal geometry and muscle-tendon properties on the forces and moments that individual muscles can produce. When used in combination with experimental data from motion capture, OpenSim allows users to visualize musculoskeletal structures during movement, scale models to individual subjects, run inverse and forward dynamics analyses, estimate internal loads (such as muscle forces, which are difficult to measure), and plot results. This hands-on tutorial introduces users to some of OpenSim’s features, file formats, and documentation using clinically-relevant examples. 1.1 Audience This tutorial is designed for members of the GCMAS Community (scientists, clinicians, and students) who are curious about the capabilities of OpenSim, but who have not previously used the software. 1.2 Learning Objectives By working through this tutorial, you will: • • • • • • • Identify components of an OpenSim model Load a model and animate it using OpenSim’s graphical user interface (GUI) Use the Plot Tool to plot data calculated from a model of the lower extremity Use the Scale Tool to create a subject-specific model from a generic model Use the Inverse Kinematics Tool to solve for a subject’s joint angles during walking from measured motion capture data Analyze a model to explain how force-generating capacity changes after a simulated tendon lengthening surgery Locate OpenSim documentation and resources 4 1.3 Format This handout assumes that you’ve already installed OpenSim v3.2 and that you’ve downloaded a folder of files named GCMAS Tutorial 2015, which was distributed to participants at the GCMAS OpenSim Tutorial. The handout reviews some of the exercises that were presented at the GCMAS Tutorial. In these exercises, you’ll use the OpenSim GUI to visualize and analyze an existing model of the lower extremity. The menus and options that you must select to complete each exercise, as well as any commands that you must type, appear in bold face. Questions are provided at the end of each exercise to help confirm your understanding. An Answer Key is provided at the end of this handout. As you complete each exercise, feel free to explore OpenSim and the model more on your own. 2 Generic Model of the Lower Extremity In this exercise, you’ll load a model of the lower extremity in OpenSim and use the View, Navigator, Coordinates, and Properties windows to identify important components of the model, including bodies, joints and muscles. The model you will use characterizes the musculoskeletal geometry and muscle force-generating capacity of an adult male with a height of 1.8 m and a mass of 75 kg. The model has 11 rigid body segments and specifies the force-generating properties of 86 muscle-tendon units (43 per leg). 2.1 Loading a Model Launch OpenSim and load the model named gait2392_PiG.osim as follows: • • • Click on the File menu and select Open Model. Browse and find the folder: Select and open the model: GCMAS Tutorial 2015 gait2392_PiG.osim Once you’ve loaded this model, it will appear in the View window. The light grey skeleton shows the bodies (i.e., limb segments) of the model, the red lines represent the muscles, and the pink spheres are markers. The model’s name, gait2392_PiG_generic, appears in the Navigator window. The Navigator window provides information about the bodies, joints, forces, and other components of the model. To expand one of these headings in the window, click on the plus icon (+) to its left. 5 2.2 Viewing a Model Click in the View window to make it active. Use the following commands and your mouse to view the model from different directions: ROTATE To rotate the view, click and hold the left mouse button and drag the mouse. ZOOM To zoom, click and hold the right mouse button. To zoom in, drag the mouse down. To zoom out, drag the mouse up. TRANSLATE To translate the view, click and hold the center mouse button and drag the mouse. Also note that there are six orienting icons located along the right side of the View window. To view the model in the –X direction, click the icon. To view the model along other principal directions, click on the other orienting icons. To view the axes of the OpenSim reference frame, click on the axes icon. To take a snapshot of the View window, click on the camera icon. You may save the image to a file. 6 2.3 Identifying Components of a Model To see information about the bodies and muscles that comprise this model, click on the plus icon (+) next to the model’s name, gait2392_PiG_generic, in the Navigator window. NOTE: You can choose to display the Navigator window or the Coordinates window at any time by clicking the window’s title bar or by clicking the Window menu and selecting Navigator or Coordinates. Bodies An OpenSim model starts with a set of bodies (e.g., pelvis, femur, tibia). Each body is assumed to be rigid, and each body has its own associated reference frame. For display purposes, bodies are typically associated with one or more “visual objects” (e.g., bone files) that describe the surface geometry. Bodies may be assigned mass and inertial properties. • • • To view a list of all bodies in gait2392_PiG_generic, click on the (+) next to Bodies in the Navigator window. To get information about a particular body, click on the body’s name. Important attributes of the body, such as its mass, center of mass, and inertial properties, will appear in the Properties window (e.g., the pelvis body in this model has a mass of 11.777 kg). By default, the Properties window reports all quantities in SI units. 7 Joints Bodies in OpenSim are connected by joints. Joints constrain bodies to move within physiological bounds. Each joint specifies how one body is allowed to translate and rotate with respect to its “parent” body, and these translations and rotations are called coordinates. For example, in gait2392_PiG_generic, the femur body is connected to the pelvis body via the hip joint. The hip joint has three rotational degrees of freedom that are described by three coordinates: hip flexion angle, hip adduction angle, and hip rotation angle. Every body must be connected to a parent body via a joint. The only exception is the ground body, which represents the ground reference frame. In gait2392_PiG_generic, the pelvis body is connected to the ground body via a six-degree-of-freedom joint. The six coordinates labelled pelvis_rotation, pelvis_list, pelvis_tilt, pelvis_tx, pelvis_ty, and pelvis_tz, specify the location (3 translational degrees of freedom) and orientation (3 rotational degrees of freedom) of the pelvis with respect to the ground. • • • To view a list of all the coordinates in gait2392_PiG_generic, open the Coordinates window by clicking the window’s title bar. The Coordinates window has sliders that correspond to each coordinate in the model. Move the sliders back and forth and examine how changing a coordinate’s value changes the model’s pose. To return the model to its default pose, click on Poses and select Default. 8 Muscles Muscles in OpenSim are characterized by their geometric paths and by their forcegenerating capacity. The path of each muscle-tendon actuator is specified by a series of points and (sometimes) wrap objects. This geometric path determines the muscle’s originto-insertion length and the muscle’s moment arms about the spanned joint(s), all of which vary with the coordinate values of the joint (e.g., a muscle’s origin-to-insertion length changes as the spanned joint rotates). Each muscle-tendon actuator is also represented by a Hill-type muscle model that determines the muscle’s force-generating capacity as a function of its activation, length, and velocity. Section 4 of this tutorial provides more information about the parameters that characterize muscle force-generating capacity. • • • • To view a list of all the muscles in gait2392_PiG_generic, click on the (+) next to Forces in the Navigator window, and then click on the (+) next to Muscles to expand the list of muscles. You may display a list of all muscles or a functional group of muscles (e.g., R_hip_abd, the right hip abductors). For now, expand the list of all muscles. To see information about a particular muscle, click on the muscle’s name. Parameters that define the muscle’s force-generating capacity appear in the Properties window. You can choose whether to display the paths of one or more muscles in the model by right-clicking either the name of a muscle, the name of a functional group, or all in the Navigator window, selecting Display, then Show, Show Only, or Hide. 9 2.4 Animating a Model To animate the model gait2392_PiG_generic, load the motion file named TD_Walk_ik.mot as follows: • • • • • Click on the File menu and select Load Motion. Browse and find the folder: ExampleMotionFiles within GCMAS Tutorial 2015 Select and open the file: TD_Walk_ik.mot This file contains joint angle data that describe the time-varying gait pattern of a typically developing subject. If necessary, re-center the model in the View window using the View commands (section 2.2). Use the motion slider and the video control buttons to play the animation and make the model “walk.” Try the buttons that loop, pause, and adjust the speed of the animation. In the Coordinates window, observe that as the animation plays, the values of the model’s coordinates change accordingly. 10 2.5 Questions 1. How many bodies (segments) does gait2392_PiG_generic have? 2. How many coordinates (degrees of freedom) does gait2392_PiG_generic have? 3. Which two bodies are connected by the knee_r joint? 4. Which coordinate represents right ankle flexion? In this model, is dorsiflexion described as a positive or negative angle? 5. What is the maximum isometric force that the semimembranosus muscle can produce? (HINT: Find and select semimem_r in the Navigator window, then find the muscle’s max_isometric_force in the Properties window. Forces are given in Newtons.) 6. Some muscles in the model are represented by multiple muscle-tendon actuators. For example, the gluteus medius muscle is split into glut_med1, glut_med2, and glut_med3. Which other muscles in the model are divided into multiple compartments? Why do you think these muscles are represented this way? 2.6 Additional Resources You can find links to a wide range of OpenSim-related resources, including documentation, tutorials, webinars, the user forum, and announcements, at: http://opensim.stanford.edu The OpenSim User’s Guide is available online at: http://simtk-confluence.stanford.edu:8080/display/OpenSim/User%27s+Guide A more detailed discussion of bodies, joints, muscles, markers, and other components of an OpenSim model is available at: http://simtk-confluence.stanford.edu:8080/display/OpenSim/OpenSim+Models Descriptions of the various models that were distributed with your OpenSim installation, together with a list of other existing models, are available at: http://simtk-confluence.stanford.edu:8080/display/OpenSim/Musculoskeletal+Models The following paper provides an overview of OpenSim’s features. Please cite this work in any of your own publications that use OpenSim: Delp, Anderson, Arnold, Loan, Habib, John, Guendelman, and Thelen (2007) OpenSim: Open-source software to create and analyze dynamic simulations of movement. IEEE Transactions on Biomedical Engineering, vol. 54, no. 11, pp. 1940-1950. 11 3 Tools for Analyzing Models and Data This exercise provides a brief introduction to three of OpenSim’s commonly-used tools. From the OpenSim GUI, you will: • • • use the Plot tool to plot the moment arms of muscles about the ankle, as calculated from the model gait2392_PiG_generic use the Scale tool, together measured marker data from a static trial, to scale gait2392_PiG_generic to the dimensions of a subject with equinus gait, characterized by excessive ankle plantarflexion during the stance phase use the Inverse Kinematics (IK) tool, together with the scaled model, to solve for the subject’s joint angles during walking from measured marker trajectories 3.1 Plotting Muscle Moment Arms Using the Plot Tool OpenSim’s Plot tool is relatively straightforward: select a quantity to plot along the X-axis, select a quantity to plot along the Y-axis, and hit the ADD button to generate the plot. Quantities that are often plotted along the X-axis include time, the gait cycle, a relevant joint angle, etc. Quantities that may be plotted along the Y-axis include geometric data that OpenSim calculates from a model (e.g., muscle-tendon lengths and moment arms), data that OpenSim calculates from a muscle model (e.g., muscle forces and fiber lengths) as well as kinematic, kinetic, or other data that you could generate using one of OpenSim’s tools (e.g., joint angles from Inverse Kinematics or joint moments from Inverse Dynamics). To get started, let’s plot the ankle plantarflexion moment arms of the gastrocnemius and soleus muscles (right leg) across a range of ankle angles using the model that you’ve already loaded. • • • • • • Make sure gait2392_PiG_generic is in its default pose by clicking on Poses and selecting Default from the Coordinates window. Open a plotter window by clicking on the Tools menu and selecting Plot. Click on Y-quantity and select moment arm >> ankle_angle_r. Click on Muscles. Find and select lat_gas_r and soleus_r, then close the Select Muscles window. Click on X-quantity and select ankle_angle_r. Click on the Add button to generate the curves. The plotter window will show the ankle plantarflexion moment arm for the selected muscles over a range of ankle angles (from -40° plantarflexion to +30° dorsiflexion) as computed from the current model at its current pose. 12 • • For reference, rename these curves as follows. Right-click on the name of each curve in the Curves List, select Rename, and rename the curves “lat_gas_r, Knee Flexion = 0” and “soleus_r, Knee Flexion = 0”. To give your figure a meaningful title, right-click on the figure, select Properties, and rename the title “Ankle Flexion Moment Arm”. Leave this plot open since you’ll return to it later. A muscle’s moment arm is the perpendicular distance from the muscle’s line of action to the joint axis of rotation. This geometric measure is important! A muscle’s moment arm transforms the muscle’s force into a moment about the joint. To produce the same moment, a muscle with a smaller moment arm will need to generate more force than a muscle with a larger moment arm. A muscle’s moment arm also determines how much the muscle’s origin-to-insertion length changes when the spanned joint rotates. A muscle with a smaller moment arm will change length less than a muscle with a larger moment arm, and thus may be able to generate force over a wider range of joint angles. force moment arm moment 13 Questions 7. Are the ankle flexion moment arms of the gastrocnemius and soleus muscles plotted as positive or negative? Given the muscles’ geometric paths and the sign convention for the ankle_angle_r coordinate as defined in gait2392_PiG_generic, does your answer make sense? 8. Your plot shows the muscles’ moment arms about the ankle with the knee fully extended. Do you think the muscles’ moment arms about the ankle will change if the knee is flexed? One way to answer this question is to re-calculate the muscles’ moment arms with the knee flexed 90°. Let’s try it: • • • • In the Coordinates window, change knee_angle_r to -90°. Note that knee flexion angles are defined as negative in this model. In your same plotter window, verify that: Y-Quantity is still set to ankle_angle_r moment arm X-Quantity is still set to ankle_angle_r Muscles is still set to lat_gas_r and soleus_r Click on the Add button to overlay the new curves onto the existing figure. In the Curves List, right-click on the name of each curve that you just added and select Rename. Rename these curves “lat_gas_r, Knee Flexion = 90” and “soleus_r, Knee Flexion = 90”. 9. Which muscle’s ankle moment arm vs. ankle angle curve changed when the knee was flexed? Why did this curve change? Additional Resources The following papers describe studies in which muscle moment arms were analyzed to answer scientific or clinical questions: Lee and Piazza (2009) Built for speed: musculoskeletal structure and sprinting ability Journal of Experimental Biology, vol. 212, pp. 3700-3707. Delp, Hess, Hungerford, and Jones (1999) Variation of rotation moment arms with hip flexion Journal of Biomechanics, vol. 32, pp. 493-501. Arnold and Delp (2001) Rotational moment arms of the medial hamstrings and adductors vary with femoral geometry and limb position: implications for the treatment of internally rotated gait Journal of Biomechanics, vol. 34, pp. 437-447. 14 3.2 Scaling a Model Using the Scale Tool In this exercise, you will scale gait2392_PiG_generic to match the anthropometric dimensions of a child with cerebral palsy who walks with an equinus gait. The motion capture data that you will use was provided by Chris Carty and Lee Barber at the Queensland Children’s Gait Laboratory. These data were collected as part of larger study examining muscle-tendon properties in subjects who were scheduled to undergo an orthopedic intervention to correct equinus gait. In OpenSim, generating a subject-specific model is typically the first step in either an inverse dynamics or forward dynamics analysis. This step is very important, since the results of subsequent analyses are typically sensitive to the accuracy of the scaling step. The Scale tool: • • • • scales the dimensions of bodies adjusts the mass and inertial properties of bodies scales muscle fiber lengths and tendon lengths, preserving their ratio (but does not change the muscles’ maximum isometric forces) moves markers on the scaled model to match their measured locations, if desired (this facilitates tracking the markers if Inverse Kinematics is to be performed). Scale factors are calculated independently for each body in the model and may be determined using a combination of two methods. In measurement-based scaling, scale factors are determined by comparing measured distances between specified pairs of markers on the model, known as virtual markers, and the corresponding distances between experimental markers placed on the subject. For example, in this exercise, you will scale the bodies that comprise the right foot (talus_r, calcn_r, toes_r) based on measured distances between the right heel and toe markers (RHEE, RTOE) using the scale factor dexperimental/dvirtual (illustrated below). In manual scaling, scale factors are specified by the user based on some predetermined measure. Manual scaling is helpful when suitable marker data are unavailable, or when the scale factors for a body have already been determined using an alternative algorithm. In this exercise, you will scale the pelvis using manual scale factors derived from anthropometric measurements taken on the subject. dvirtual dexperimental 15 If you have information about the pose of the subject during the static trial (e.g., the experimental data were collected with the subject’s knee flexed at a known angle), then you can specify the model’s coordinates, in addition to the marker pairs and/or manual scale factors, during the scaling process. For all other coordinates that are not specified, the Scale tool will solve an optimization problem to determine the values of the coordinates (i.e., the scaled model’s pose) that best fit the virtual markers to the experimental markers. To see how the Scale tool works, let’s use an existing scale settings file to scale our model, gait2392_PiG_generic, to our subject with equinus gait: • • • • Click on the Tools menu and select Scale Model. At the bottom of the Scale Tool dialog, click Load … Browse and find the folder: Select and open the file: Scale within GCMAS Tutorial 2015 Subject_003_Setup_Scale.xml The settings file that you just loaded, Subject_003_Setup_Scale.xml, is an xml file that contains pre-configured settings to scale our model to the dimensions of our subject. The settings file specifies, for example, the name of the file that contains the subject’s experimental marker data. In this case, the subject’s marker data are read from the file Subject_003_static.trc, which is located in the Scale folder within your GCMAS Tutorial 2015 folder. In general, settings for the Scale tool can either be specified within the OpenSim GUI or can be loaded and edited from an existing settings file (which is useful if you need to scale a model to different subjects in a consistent manner). Before proceeding, examine the scale settings for this subject by answering the following questions: Questions 10. Click on the Scale Factors tab to see which bodies are manually scaled and which are scaled based on measured distances between marker pairs. Which bodies in this model are manually scaled? 11. What is the scale factor for the right talus, calcaneus, and toes? 12. Click on the Static Pose Weights tab to see which markers are tracked to best fit the scaled model’s pose to the experimental markers and which coordinates are specified. Which coordinates are specified? To complete the scaling process: • Click on Run in the Scale Tool dialog, then click on Close. 16 Once scaling in completed, a new model named Subject_003 will appear in the View window. Notice the difference in size between the generic model (adult-sized) and the scaled model (child-sized). Also notice the blue spheres on the scaled model, which show the locations of the experimental markers used in the measurement-based scaling. You won’t use the generic model in the next exercise, so you may “hide” it as follows: • In the Navigator window, right-click on the model’s name, gait2392_PiG_generic, and select Display >> Hide. Additional Resources More information about the using the Scale tool in OpenSim is available at: http://simtk-confluence.stanford.edu:8080/display/OpenSim/Scaling More information about the study for which this subject’s gait data were collected is provided in the following paper: Cronin, Carty, Barrett, and Lichtwark (2011) Automatic tracking of medial gastrocnemius fascicle length during human locomotion Journal of Applied Physiology, vol. 111, pp. 1491-1496. 17 3.3 Solving for Joint Angles Using the Inverse Kinematics Tool In this exercise, you will use the scaled model that you just created, together with measured marker trajectories, to solve for the subject’s joint angles during walking. The Inverse Kinematics (IK) tool in OpenSim determines the coordinate values of a model that “best match” a subject’s measured marker trajectories. To do this, the IK tool solves an optimization problem at each time step, or frame, of the measured motion. Specifically, the IK tool solves a weighted least-squares optimization problem with the goal of minimizing marker error. Marker error is defined as the distance between a virtual marker located on the model and the corresponding experimental marker measured on the subject. In the IK settings file, the user specifies the weight associated with each marker, which determines how strongly each marker is tracked. Important markers that are placed with confidence over bony landmarks (e.g., an ankle marker) are typically assigned higher weights than markers that may be susceptible to skin motion artifact or other errors. OpenSim’s IK algorithm differs from the direct kinematics methods used in many motion capture programs, such as Cortex and Plug-in-Gait. Direct kinematics methods rely on marker positions to directly define the joint axes of body segments and then use the axes of adjacent segments to directly calculate joint angles. These methods are susceptible to errors in the marker positions, since noisy marker data (e.g., due to skin motion artifact) leads directly to errors in joint angles. OpenSim’s IK tool, by contrast, solves for the joint angles that best align the model’s virtual markers with the subject’s experimental markers. In this approach, the model’s virtual markers are fixed relative to the joint axes of the associated bodies, which are specified in the model’s osim file independent of the experimental marker trajectories. To see how the IK tool works, let’s use the scaled model, Subject_003, together with an existing IK settings file, to solve for the joint angles of our subject with equinus gait: • • • • Click on the Tools menu and select Inverse Kinematics. At the bottom of the IK Tool dialog, click Load … Browse and find the folder: Select and open the file: InverseKinematics within GCMAS Tutorial 2015 Subject_003_Setup_IK.xml The settings file that you just loaded, Subject_003_Setup_IK.xml, is an xml file that contains pre-configured settings to solve the IK problem for our subject. This file specifies weights for tracking each marker as well as the name of the file that contains the subject’s experimental marker data. In this case, the subject’s marker data are read from the file Subject_003_Walk3_kinematics.trc, which is located in the MarkerData folder within your GCMAS Tutorial 2015 folder. For the IK tool, ground contact forces are not needed, and mass/inertia properties of the model are not used. 18 • • Click on Run in the IK Tool dialog, then click on Close. Find the progress bar in the lower right corner of the OpenSim window. Even though you closed the IK Tool dialog, the tool is still running. Wait until the progress bar disappears before proceeding. In the View window, the model will begin to “walk” as the optimization problem is solved for each time step of the measured motion. If necessary, re-center the model in the View window using the View commands (section 2.2). To compare your IK results to the subject’s experimental marker data: • • • • In the Navigator window, under Motions, right-click on Results – this is the motion that the IK tool generated. From the drop-down menu, choose Associated Motion Data. Browse and find the folder: Select and open the file: MarkerData within GCMAS Tutorial 2015 Subject_003_Walk3.trc The model’s virtual markers are shown in pink and the subject’s experimental markers are shown in blue. Hit Play in the Motion Toolbar. The virtual markers should closely track the experimental markers as the animation proceeds. 19 To examine the accuracy of the inverse kinematics solution: • • Click on the Window menu and select Messages. The Messages window displays details about the all commands you have performed in OpenSim. Take a minute to explore the messages, then scroll to the bottom. The next-to-last line reports the marker errors (root-mean-square errors and maximum marker errors) associated with the last frame of the motion; the preceding lines report the marker errors associated with earlier frames of the motion. This information is often useful when identifying a set of marker weights that yields satisfactory IK results. Note: All marker errors are reported in units of meters, and all coordinate errors are reported in units of radians. To plot the subject’s calculated ankle joint angles vs time: • • • • • Click on the Tools menu and select Plot … In the plotter window, click on Y-quantity and select Results (Deg.). This motion quantity provides your IK results for each of the model’s coordinates. Alternatively, you could select Load file…, then browse to open the file named Subject_003_Walk3_kinematics.mot, located in the InverseKinematics folder within your GCMAS Tutorial 2015 folder. This file also provides your IK results. It was specified in the IK settings file and was created when you ran the IK tool. In the Select Motion Quantity window, select ankle_angle_r, and then click OK. Click on X-Quantity, select time and click OK. Click on the Add button to generate the curve. Questions 13. What is the root-mean-squared (RMS) marker error from the last frame of the motion? Does this seem reasonable? 14. From viewing the animation of the IK solution, and from your plot of ankle angle vs time, how would you describe this subject’s gait? 15. What impairments may be contributing to this subject’s abnormal gait? Additional Resources More information about the using the Inverse Kinematics tool in OpenSim is available at: http://simtk-confluence.stanford.edu:8080/display/OpenSim/Inverse+Kinematics 20 4 Tools for Editing Models to Represent Contracture and Surgery In OpenSim, the force-generating properties of the muscles are characterized by Hill-type muscle models. This exercise reviews properties of Hill-type models in the context of a clinical example. Specifically, you will: • • • • use the Plot tool to plot the passive and active ankle plantarflexion moments generated by the gastrocnemius and soleus muscles, as calculated from the model gait2392_PiG_generic edit muscle fiber lengths of the gastrocnemius to represent contracture edit tendon lengths of the gastrocnemius to simulate surgical lengthening use the Plot tool to analyze the biomechanical consequences of your simulated surgery; specifically, you will determine how much the tendon should be “lengthened” in the model with contracture to restore the muscle’s passive range of motion while preserving its active strength 4.1 Characterizing Muscle Force-Generating Capacity In OpenSim, a muscle’s force is calculated as the sum of its active force, generated by a contractile element (CE), and its passive force, generated by a parallel elastic element. The muscle’s force is transmitted via an elastic tendon to the skeleton, where the fraction of the force transmitted by the tendon depends on the pennation angle, α, between the muscle fibers and the tendon. A schematic of the muscle model is shown below. The active force produced by a muscle depends on its activation, length, and velocity. In the following exercise, you will analyze the isometric forces and moments that the gastrocnemius and soleus muscles can produce, and thus you will ignore the muscles’ force-velocity behavior. 21 Four parameters (per muscle) are used to scale the force-length (F-L) properties of a generic Hill-type model to each muscle: • • • • Optimal fiber length of the muscle, lMo Maximum isometric force of the muscle, FMo Slack length of the tendon, lTs Pennation angle, α A muscle generates its maximum active force (FMo) when the length of the muscle fiber (lM) is at the optimal fiber length (lMo). Though the optimal fiber length differs for different muscles, the isometric force-generating capacity of any muscle can be characterized by the muscle’s current fiber length relative to its optimal length. A muscle’s activation (defined in OpenSim as a number between 0 and 1) determines the percentage of the muscle’s maximum active force (which, remember, is a function of the muscle fiber’s length and velocity) that the muscle generates. For example, when activation=1 (100%), a muscle generates all of its maximum active force, and when activation = 0.5 (50%), a muscle generates half of its maximum active force. When a muscle’s fiber length is longer than its optimal fiber length, the parallel elastic element is stretched, generating passive force. This passive force depends on the muscle’s length, independent of activation. When tendon is stretched beyond its slack length (lTs), it also generates passive force. Because muscle operates in series with tendon, the muscle’s force and the tendon’s force must be in equilibrium, accounting for pennation angle. All muscle models in OpenSim include implementations of the F-L and F-V curves for muscle and the F-L curve for tendon. Values for the muscle-tendon parameters are based on published measurements of the muscle architecture in cadaveric specimens and have been tested and refined based on strength measurements in healthy subjects. 22 Additional Resources More information about Hill-type muscle models in OpenSim is available at: http://simtk-confluence.stanford.edu:8080/display/OpenSim/Thelen+2003+Muscle+Model More information about muscle architecture measurements used to parameterize Hill-type models is available in the following papers: Ward, Eng, Smallwood, and Lieber (2009) Are current measurements of lower extremity muscle architecture accurate? Clinical Orthopedics and Related Research, vol. 467, pp. 1074-1082. Arnold, Ward, Lieber, and Delp (2010) A model of the lower limb for analysis of human movement Annals of Biomedical Engineering, vol. 38, pp. 269-279. 4.2 Plotting Muscle Moment-Generating Capacity When a muscle produces force, it generates moments about the spanned joints. The moment produced at a joint is the product of the muscle’s force (which depends on its activation, length, and velocity, as described in section 4.1) and the muscle’s moment arm about the joint (i.e., the perpendicular distance from the muscle’s line of action to the joint axis of rotation, as described in section 3.1). A muscle’s moment-generating capacity generally varies with joint angle, since the muscle’s length, force, and moment arm also vary with joint angle. In this exercise, you will use the generic model, gait2392_PiG_generic, to plot the ankle moments (both passive and maximum active moment) that can be generated by the three major plantarflexor muscles (medial gastrocnemius, lateral gastrocnemius, and soleus) as a function of ankle angle: If the generic model is still hidden, you may “show” it again as follows: • • • In the Navigator window, right-click on the model’s name, gait2392_PiG_generic, and select Display >> Show. If necessary, re-center the model in the View window using the View commands (section 2.2). Make sure gait2392_PiG_generic is in its default pose by clicking on Poses and selecting Default from the Coordinates window. You won’t use the scaled model in this exercise, so you may close it as follows: • In the Navigator window, right-click on the scaled model’s name, Subject_003, and select Close. 23 To plot the muscles’ passive ankle moments: • • • • • • • • Click on the Tools menu and select Plot … In the plotter window, click on Y-quantity and select Moment >> ankle_angle_r. Click on Muscles. Find and select med_gas_r, lat_gas_r, and soleus_r. Select the “sum only” box, then close the Select Muscles window. Click on X-quantity and select ankle_angle_r. Click on Advanced. Select Activation override and type 0.01 in the Activation field. Click OK. These commands set the muscle activations to 0.01 (1%, which is essentially inactive). Thus, the moment that you will plot represents the muscles’ passive resistance to dorsiflexion at each ankle angle. Click Add to add the curve. The plotter window will show the moment generated by the three muscles (summed) over a range of ankle angles (-40° plantarflexion to +30° dorsiflexion) as computed from the model (in its current pose) with the specified activations. For reference, rename these curves as follows. Right-click on the name of the curve in the Curves List, select Rename, and rename the curve “Generic Model” To give your figure a meaningful title, right-click on the figure, select Properties, and rename the title “Passive Moment”. Leave this plot open since you’ll return to it later. To plot the muscles’ maximum active ankle moments: • • • • • • • • Open a new plotter window by clicking on the Tools menu and selecting Plot … In the plotter window, click on Y-quantity and select Moment >> ankle_angle_r. Click on Muscles. Find and select med_gas_r, lat_gas_r, and soleus_r. Select the “sum only” box, then close the Select Muscles window. Click on X-quantity and select ankle_angle_r. Click on Advanced. Select Activation override and type 1.0 in the Activation field. Click OK. These commands set the muscle activations to 1 (100%, which is maximally active). This time, the moment that you will plot represents the maximum isometric moment that the muscles can produce at each ankle angle. Click Add to add the curve. Right-click on the name of the curve in the Curves List, select Rename, and rename this curve “Generic Model”. Rght-click on the figure, select Properties, and rename the title “Maximum Active Moment”. Leave this plot open since you’ll return to it later. 24 For your reference, the plots are shown below: Questions 16. What is the magnitude and direction (dorsiflexion or plantarflexion) of the ankle moment produced by the plantarflexors when the muscles are inactive (passive)? 17. At what ankle angle does the peak passive moment occur? Does this make sense? 18. What is magnitude of the ankle moment produced by the plantarflexors when the muscles are maximally activated? What is the ratio between the peak passive moment and the peak active moment? 19. In an individual with normal muscle architecture, do passive moments at the ankle, due to muscle-tendon stretch, substantially limit dorsiflexion range of motion? 4.3 Representing Plantarflexion Contracture One of the biomechanical factors that often contributes to equinus gait is contracture, or shortening of the muscle fibers, of the gastrocnemius and/or soleus muscles. If the muscle fibers are shorter than normal, then the muscles will begin to stretch at shorter muscletendon lengths (i.e., smaller dorsiflexion angles), thus reducing ankle range of motion. Suppose you have a patient with a plantarflexion contracture. Based on the physical exam, you deduce that the patient has a tight gastrocnemius, but not a tight soleus. To gain insight into the possible consequences of tendon lengthening surgery, you develop an OpenSim model that represents the relevant characteristics of your patient. In this exercise, you will alter the generic model, gait2392_PiG_generic, to better represent your patient. Specifically, you will shorten the optimal fiber lengths of the medial and lateral gastrocnemius. You’ll then use your new model to re-plot the ankle moments (both passive and maximum active moments) that can be generated by the three major plantarflexors as a function of ankle angle. 25 • • • • • In the Navigator window, click on the (+) next to Forces, then click on the (+) next to Muscles to expand the list of muscles. Expand the list of R_ankle_pf, then click on med_gas_r. In the Properties window, decrease the optimal fiber length of medial gastrocnemius by 45%. To do this, click in the optimal_fiber_length field and change its value from 0.06 to 0.033 m. In the Navigator window, click on lat_gas_r. In the Properties window, decrease the optimal fiber length of lateral gastrocnemius by 45%. To do this, click in the optimal_fiber_length field and change its value from 0.064 to 0.0352 m. To rename your edited model, right-click on the model’s name, gait2392_PiG_generic, in the Navigator window. Select Rename, type gait2392_PiG_gastroc_contracture, and click on OK. To save your edited model, right-click on the model’s new name and select Save As. Save this model in your GCMAS Tutorial 2015 folder. Note: Your GCMAS Tutorial 2015 folder may already contain a sample model called gait2392_PiG_gastroc_contracture.osim. If this is the case, you may overwrite this file or give your own version of the model a new filename. You can use your edited model to analyze the effects of a gastrocnemius contracture by re-plotting the ankle moments (both passive and maximum active moments) that can be generated by the three major plantarflexor muscles as a function of ankle angle. To do this: • Open the plotter window you created previously that shows the Passive Moment. Add a plot of the ankle moment (Y-quantity >> Moment >> ankle_angle_r) versus ankle angle (X-Quantity >> ankle_angle_r), summed for the gastrocnemius and soleus (med_gas_r, lat_gas_r, and soleus_r) with activation = 0.01 as before. Rename this curve “Contracture”. 26 • Open the plotter window created previously that shows the Maximum Active Moment. Add a plot of the ankle moment (Y-quantity >> Moment >> ankle_angle_r) versus ankle angle (X-Quantity >> ankle_angle_r), summed for the gastrocnemius and soleus (med_gas_r, lat_gas_r, and soleus_r) with activation = 1.0 as before. Rename this curve “Contracture”. For your reference, the plots are shown below: Questions 20. How much did shortening the optimal fiber lengths of the gastrocnemius affect the passive ankle moment? 21. How much did shortening the optimal fiber lengths of the gastrocnemius affect the maximum active ankle moment? 22. In a patient with gastrocnemius contracture, do passive moments at the ankle, due to muscle-tendon stretch, substantially limit dorsiflexion range of motion? 4.4 Explaining Consequences of Tendon Lengthening Surgery When plantarflexion contracture limits a patient’s functional range of ankle motion, the tendon is often surgically lengthened, slackening the tight muscles. A relevant question is: How much should the tendon be lengthened to restore a normal range of motion while maintaining strength? If the tendon isn’t lengthened enough, passive forces from the contracted muscles continue to limit ankle dorsiflexion after surgery. But if the tendon is lengthened too much, the active muscle forces can be compromised, resulting in plantarflexion weakness. In this exercise, you will use your OpenSim model to examine this trade-off between restoring range of motion and maintaining plantarflexion strength. First, you will increase the tendon slack lengths of the contracted gastrocnemius muscles in your model to simulate the effects of tendon lengthening surgery. Second, you will re-plot the ankle moments (both passive and maximum active moments) that can be generated by the plantarflexors as a function of ankle angle. Lastly, you will explain the biomechanical consequences of the simulated surgery. 27 • • • • • In the Navigator window, click on the (+) next to Forces, then click on the (+) next to Muscles to expand the list of muscles. Expand the list of R_ankle_pf, then click on med_gas_r. In the Properties window, increase the tendon slack length of medial gastrocnemius. To do this, click in the tendon_slack_length field and change its value. As a start, you might increase the slack length by 5%, from 0.39 to 0.41 m. In the Navigator window, click on lat_gas_r. In the Properties window, increase the tendon slack length of lateral gastrocnemius. As a start, you might increase the slack length by the same amount, from 0.38 to 0.4 m. Open the plotter window you created previously that shows the Passive Moment. Add a plot of the ankle moment (Y-quantity >> Moment >> ankle_angle_r) versus ankle angle (X-Quantity >> ankle_angle_r), summed for the gastrocnemius and soleus (med_gas_r, lat_gas_r, and soleus_r) with activation = 0.01 as before. Rename this curve “Tendon Lengthening”. Open the plotter window created previously that shows the Maximum Active Moment. Add a plot of the ankle moment (Y-quantity >> Moment >> ankle_angle_r) versus ankle angle (X-Quantity >> ankle_angle_r), summed for the gastrocnemius and soleus (med_gas_r, lat_gas_r, and soleus_r) with activation = 1.0 as before. Rename this curve “Tendon Lengthening”. Iteratively edit the tendon slack lengths and examine the consequences. When you are finished exploring, save your edited model and answer the following questions. Questions 23. How much did you need to lengthen the gastrocnemius tendon to substantially reduce the passive moment without compromising the active moment? 24. What do you think would happen if you surgically lengthened the Achilles tendon in your patient who has an isolated contracture of the gastrocnemius? Try it! In your model, increase the tendon slack lengths of the medial gastrocnemius, lateral gastrocnemius, and soleus by the same amount. Can you restore ankle range of motion while also maintaining plantarflexion strength? Additional Resources This exercise was motivated by the following publication: Delp, Statler, and Carroll (1995) Preserving plantar flexion strength after surgical treatment for contracture of the triceps surae: a computer simulation study. Journal of Orthopaedic Research, vol. 1, pp. 96-104 28 5 Answer Key 1. How many bodies (segments) does gait2392_PiG_generic have? This model has 11 bodies in addition to the ground body: the pelvis and the right and left femur, tibia, talus, calcn, and toes. 2. How many coordinates (degrees of freedom) does gait2392_PiG_generic have? This model has 26 coordinates: 6 describe the orientation and position of the pelvis with respect to ground: pelvis_rotation, pelvis_list, pelvis_tilt, pelvis_tx, pelvis_ty, and pelvis_tz 10 describe the joint angles of the right leg: hip_flexion_r, hip_adduction_r, hip_rotation_r, knee_angle_r, knee_adduction_r, knee_rotation_r, ankle_angle_r, subtalar_angle_r, and mtp_angle_r 10 describe the joint angles of the left leg: hip_flexion_l, hip_adduction_l, hip_rotation_l, knee_angle_l, knee_adduction_l, knee_rotation_l, ankle_angle_l, subtalar_angle_l, and mtp_angle_l 3. Which two bodies are connected by the knee_r joint? The knee_r joint specifies motions of the tibia_r relative to the femur_r. 4. Which coordinate represents right ankle flexion? In this model, is dorsiflexion described as a positive or negative angle? The coordinate ankle_angle_r describes right ankle flexion. In this model, dorsiflexion is represented as a positive angle. 5. What is the maximum isometric force that the semimembranosus muscle can produce? 1288 N 6. Some muscles in the model are represented by multiple muscle-tendon actuators. For example, the gluteus medius muscle is split into glut_med1, glut_med2, and glut_med3. Which other muscles in the model are divided into multiple compartments? Why do you think these muscles are represented this way? In addition to the gluteus medius, the gluteus maximus, gluteus minimus, and adductor magnus muscles are divided into multiple compartments. These muscles originate from broad regions on the pelvis and thus aren’t well represented by a single line of action. 7. Are the ankle flexion moment arms of the gastrocnemius and soleus muscles plotted as positive or negative? Given the muscles’ geometric paths and the sign convention for the ankle_angle_r coordinate as defined in gait2392_PiG_generic, does your answer make sense? The gastrocnemius and soleus have moment arms that plantar flex the angle; in this model, plantarflexion moment arms are calculated as negative values. 29 8. Your plot shows the muscles’ moment arms about the ankle with the knee fully extended. Do you think the muscles’ moment arms about the ankle will change if the knee is flexed? The moment arm of the gastrocnemius will change when the knee is flexed since the path of this muscle depends on the knee flexion and ankle flexion angles. The moment arm of the soleus, whose path only depends on the ankle flexion angle, will not change with knee flexion. 9. Which muscle’s ankle moment arm vs. ankle angle curve changed when the knee was flexed? Why did this curve change? The plantarflexion moment arm of the gastrocnemius changes when the knee is flexed because the gastrocnemius crosses the knee as well as the ankle. Flexing the knee changes the muscle’s line of action relative to the ankle axis of rotation. 10. Click on the Scale Factors tab to see which bodies are manually scaled and which are scaled based on measured distances between marker pairs. Which bodies in this model are manually scaled? The pelvis body is manually scaled. 11. What is the scale factor for the right talus, calcaneus, and toes? These bodies are scaled by the factor 0.634792. 12. Click on the Static Pose Weights tab to see which markers are tracked to best fit the scaled model’s pose to the experimental markers and which coordinates are specified. Which coordinates are specified? The following coordinates are specified: hip_rotation_r, knee_angle_r, knee_adduction_r, knee_rotation_r, ankle_angle_r, hip_rotation_l, knee_angle_l, knee_adduction_l, knee_rotation_l, ankle_angle_l, and pelvis_tilt 13. What is the root-mean-squared (RMS) marker error from the last frame of the motion? Does this seem reasonable? The RMS marker error from the last frame of motion (frame 98) is 0.452 cm. This is an excellent result given typical skin motion artifacts and other sources of error. 14. From viewing the animation of the IK solution, and from your plot of ankle angle vs time, how would you describe this subject’s gait? This subject walks with excessive plantarflexion of both ankles throughout the stance phase, also called equinus gait. 15. What impairments may be contributing to this subject’s abnormal gait? You might hypothesize that this subject’s excessive ankle plantarflexion is caused by contracture of the gastrocnemius, soleus, or both. Other plausible explanations include spasticity or abnormal activation of the gastrocnemius. 30 16. What is the magnitude and direction (dorsiflexion or plantarflexion) of the ankle moment produced by the plantarflexors when the muscles are inactive (passive)? When the muscles are inactive, they generate a passive plantarflexion moment that is relatively small in magnitude (increasing from 1 to 8 Nm over a 70 degree range of ankle motion). Plantarflexion moments are calculated as negative in this model. 17. At what ankle angle does the peak passive moment occur? Does this make sense? The muscles’ passive moment peaks near 30 degrees of dorsiflexion in this plot. This makes sense because the muscle-tendon length increases as the ankle dorsiflexes, stretching the muscle and tendon, generating passive force. 18. What is magnitude of the ankle moment produced by the plantarflexors when the muscles are maximally activated? What is the ratio between the peak passive moment and the peak active moment? When the muscles are maximally activated, they generate a plantarflexion moment that ranges from 50 Nm to 216 Nm over a 70 degree range of ankle motion. The ratio between the peak passive and active moments is about 3.7%. 19. In an individual with normal muscle architecture, do passive moments at the ankle, due to muscle-tendon stretch, substantially limit dorsiflexion range of motion? In individuals with normal muscle architecture, the passive plantarflexion moment is relatively small over a functional range of ankle angles. The passive moment limits ankle motion only at dorsiflexion angles greater than about 30 degrees. 20. How much did shortening the optimal fiber lengths of the gastrocnemius affect the passive ankle moment? Shortening the optimal fiber lengths of the gastrocnemius substantially increased the passive moment, which exceeded 75 Nm at dorsiflexion angles above neutral. 21. How much did shortening the optimal fiber lengths of the gastrocnemius affect the maximum active ankle moment? Shortening the optimal fiber lengths of the gastrocnemius slightly increased the plantarflexion moment that the muscles could actively produce. 22. In a patient with gastrocnemius contracture, do passive moments at the ankle, due to muscle-tendon stretch, substantially limit dorsiflexion range of motion? Yes. 23. How much did you need to lengthen the gastrocnemius tendon to substantially reduce the passive moment without compromising the active moment? Lengthening the slack length of the medial and lateral gastrocnemius muscles by 4 cm in this model restored the passive moment to near normal; however, this slightly weakened the plantarflexors, reducing the muscles’ active moment-generating capacity to about 75% of normal. 31 24. What do you think would happen if you surgically lengthened the Achilles tendon in your patient who has an isolated contracture of the gastrocnemius? Try it! In your model, increase the tendon slack lengths of the medial gastrocnemius, lateral gastrocnemius, and soleus by the same amount. Can you restore ankle range of motion while also maintaining plantarflexion strength? When the Achilles tendon is lengthened enough to restore the passive moment, allowing a normal range of ankle motion, the soleus is greatly weakened. This compromises the muscles’ active moment-generating capacity. However, when the Achilles tendon is lengthened by a smaller amount, the passive forces generated by the contracted gastrocnemius remain greater than normal. The soleus has shorter fibers than the gastrocnemius, and thus its active momentgenerating capacity is more sensitive to tendon lengthening surgery. 32
© Copyright 2026 Paperzz