You are viewing the documentation for OpenSim 3.x. Are you looking for the latest OpenSim 4.0 Documentation?

Overview

In this exercise you will use the OpenSim software to simulate and design a dynamic walker.  As a starting point, you will be given a five-segment dynamic walker model and an arena with obstacles.  The goal of the exercise is to maximize the distance the walker can travel on an increasingly challenging terrain by adjusting the model's parameters and adding new model components.  You will learn to use the OpenSim graphical user interface (GUI) and Matlab scripting commands to add model components, adjust component properties, and visualize dynamic simulations, and make plots of your simulation results.

 

Table of Contents

Acknowledgements

The original exercise was created by Daniel A. Jacobs.  Ajay Seth, Chris Dembia, Jen Hicks, Ajay Seth, Tom Uchida contributed to the scripts library used in this example. 

I. Getting Started

  1. Download and install the latest version of OpenSim (version 3.1) from the OpenSim downloads page

  2. Download the archive of starter files (top of page) and unzip them to your working directory.

  3. Follow the setup instructions on Scripting with Matlab to get your Matlab environment ready for scripting. Both 32-bit and 64-bit are supported, but the set-up for 64-bit requires a few extra steps.

II. Explore the OpenSim GUI and Model

In this section, you will familiarize yourself with the OpenSim GUI and explore the editable properties of the walker and environment.  You will use the GUI to examine the bodies, joints, and contact geometry that make up the model.  The starting model is simple; it includes two legs with knees and spherical feet.  In the following sections, you will learn how to add bodies and joints and adjust the model properties to create your own robust walker.  The model of of the walker and the environment includes the following elements:

  • A long platform, declined at 10 degrees with obstacles welded to it.

  • A pelvis segment, connected to the platform by two slider joints.

  • Two thigh segments, offset from the pelvis laterally and connected to the pelvis by pin joints.

  • Two shank segments connected to the thighs by pin joints.

  • A contact geometry set, consisting of contact spheres and a contact half space (plane), which are used to generate contact forces.

  • Contact forces, which compute the applied body forces due to the interaction of contact geometries.

  • Coordinate limit forces, which enforce the desired range of motion of the joints.


A. Launch the OpenSim Program

You can launch OpenSim 3.1 from the Windows Start menu. If you used default installation settings, simply select Windows>All Programs>OpenSim 3.1>OpenSim. You will see multiple information panels and an empty main View.  The can learn more about the Graphical User Interface in the OpenSim User's Guide.

B. Explore the model components

  1. In the OpenSim GUI, select File>Open Model... to open the file DynamicWalkerStarter/DW2013_WalkerModelTerrain.osim. Alternatively, you can drag the model file onto the view window in the GUI.

  2. The View panel is used to control the model's visual display.  By dragging the mouse, the view can be rotated (with the left mouse button), translated (with the middle mouse button), and zoomed (with the right mouse button).

  3. In the Navigator panel on the left side of the screen, use the + icon to expand the list of model components.  Explore the individual components in the model by clicking on them in the Navigator Panel

  4. As you click on each component, scroll through the component's properties in the Property Editor panel underneath the Navigator panel.

  5. The Coordinates panel lists the current values of the model's generalized coordinates. 

    1. The values of the coordinates (in meters or degrees) can be changed with the sliders or by entering a value in the left text box.

    2. The initial coordinate speeds (in meters/second or radians/second) are used as the initial conditions forward simulations. These can be set in the speed text box on the right hand side of each row.

    3. The value of a coordinate can be locked by toggling the lock icon. 

    4. To reset the model to the default pose, select Poses>Default.  You can also uses the Poses menu to change the default pose and add custom poses.

Questions

  1. How many degrees of freedom does the model have?

  2. What are the lengths of the long axes of the thigh and shank segments? (Hint: The length is set by successive joints e.g., thigh-to-pelvis and shank-to-thigh pin joint locations as measured in the thigh).

  3. What is the ratio of the thigh mass to shank mass in the model?

III. Simulate and Visualize the Walker

In this section, you will run a dynamic simulation of the model, visualize the resulting motion, plot the output, and save a movie of the motion using the OpenSim GUI. 

A. Run the Forward Tool

  1. Before you run the forward tool, go to the Coordinates tab in the left panel and choose a set of initial coordinate values and coordinate velocities for your simulation.

  2. Select Tools>Forward Dynamics from the top menu in the GUI

  3. In the Time Pane, set the Time Range to Process from 0 to 2 seconds

  4. In the Output Pane, append a directory called FWD to the currently listed directory (e.g. C:\OpenSimProject\DynamicWalker\FWD).  You can leave all the other settings at their default value.

  5. To quickly set up future runs of the forward tool, save your settings to a file (e.g., Setup_Forward.xml) by clicking the Save... button

  6. Click the Run button to begin the simulation.

  7. Close the tool.

B. Visualize the motion

After running the forward tool, three storage files (.sto) are written to the output directory specified with the time history of the control signals and the model states.  The model state histories, which for this model contain the coordinate values and velocities, are automatically loaded into the program (Results) and can be accessed in the Navigator panel under Motions.

  1. If you wish to run several motions with different starting conditions, make sure to Rename the motion from the default name Results by right clicking on the item in the Navigator (e.g. Default_Results).

At the top middle section of the GUI, the blue movie controls can be used to playback and visualize the results.  On the left hand side, the playback speed can be adjusted with the arrow icons or by entering a value in the textbox.  In the center, you can use the control icons to play a movie forward or backwards, either continuously, or frame-by-frame.

  1. Hit the blue play button to visualize the results from your forward simulation.

C. Create a movie in the GUI

  1. In the Navigator panel under Motions, double click a motion to make it the current motion (bold name).

  2. On the right side of the view window, click the video camera icon (third from the bottom). This will turn the camera icon orange and a dialog will appear.

  3. Type in your desired name for your movie file and hit the Open button.

  4. Set the time and speed of your motion using the view controls

  5. Play the resulting motion (Note: you can pause the movie before completion if you want a specific interval). You can pause and rotate the model and play again to get a movie with two views of the walker.

  6. Click the video camera icon again.  This will end the capture and turn the camera icon blue again.

Note: The size of the movie is based on the current size of the view screen.  At each time interval, as selected by the movie playback speed, a frame is saved to the movie file.  For smaller files, adjust the main window and increase the play speed accordingly.

D. Plot in GUI

The GUI has a Plotter tool for plotting results. We'll plot the coordinate velocities for the right leg of the model.

  1. Select Tools>Plot from the top menu in the GUI

  2. In the bottom panel, select Y-Quantity... and select the Results(deg.) file which was created by the forward tool.

  3. In the Select Motion Quantity window, select the generalized coordinate velocities for the right hip (RHip_rz_u) and the right knee (RKnee_rz_u) and hit OK.

  4. In the bottom panel, select X-Quantity... and select time.

  5. In the bottom right hit Add to plot the data.

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.