Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The frequently asked questions about OpenSim are broken up into several categories:

...

Visualization and Graphics

Q. Why can't I launch the GUI's Visualizer Window?


A: The OpenSim GUI has been unable to launch the visualizer on some 
Windows and Mac machines. The most common reasons are:

...

Q. Does OpenSim support python scripting? (or only MATLAB?)

A. Yes, OpenSim version 3.2 and later supports scripting in Python, Jython (an implementation of Python in Java), and MATLAB. In the OpenSim application, the scripting shell is a Jython shell. All scripting capabilities use a technique (called wrapping) to invoke the OpenSim C++ API from Python, Java, or MATLAB.

Q. Is there full documentation on how the API is exposed to Scripting?

A. You should be able to leverage the extensive Doxygen documentation of the OpenSim API to use it in Scripts. You'll also find the examples included with the distribution as well as the help page on Scripting (Common Scripting Commands) helpful.

Q. Is the MATLAB interface only for 32 bit MATLAB or will it work for 64 bit as well?

Q. Should OpenSim be running when doing scripting from another language like MATLAB/python?

A. No, the OpenSim application and the scripting interface both utilize the same libraries, but are unrelated otherwise. While scripting in the GUI, you have access to all the API and some GUI functionality (e.g. control of view, plotter, loading models, motions, etc.). While in MATLAB you have access to the API and you can use the MATLAB tools for plotting and the API Visualizer. You can also use the scripting interface from a standalone Python or Jython shell but you have access to neither the GUI functionality nor MATLAB's. See Common Scripting Commands for more information.

...

Q. How should I do batch processing for the OpenSim tools (e.g. IK, ID, CMC) with a script?

In general, we strongly discourage doing raw parsing of XML files in a Matlab script. This approach is not robust and does not take advantage of the OpenSim API in Matlab. Instead you should instantiate tools/objects from setup files and let the code do the parsing internally. The XML format changes with different versions of the software and the version number of the documents written by newer versions of the software may even be different from the one you read due to backward compatibility built into the code and assumptions about default values, etc. You'll keep changing your code endlessly rather than rely on a robust API that makes calls to set/get values (rather than parse XML files). In essence the assumptions about the contents of the XML files and the XML file header are all built into the code that is exercised by the API but ignored by any XML parsing code. Violating these assumptions will break the functionality downstream.

An example using parsing (not recommended):

Code Block
% get initial and inal time from first and last entry in time column
initial_time = trcData(1,1);
final_time=trcData(end,1);
    
xmlDoc.getElementsByTagName('IKTool').item(0).getAttributes.item(0).setValue(name);
xmlDoc.getElementsByTagName('marker_file').item(0).getFirstChild.setNodeValue([trialsForIKPath markerFile{1}]);
xmlDoc.getElementsByTagName('output_motion_file').item(0).getFirstChild.setNodeValue([results_folder '\' name '_ik.mot']);
xmlDoc.getElementsByTagName('time_range').item(0).getFirstChild.setNodeValue([num2str(initial_time) ' ' num2str(final_time)]);

An example of calling the API (recommended):

Code Block
% Get trc data to determine time range
markerData = MarkerData(markerDateFileName);
    
% Get initial and intial time 
initial_time = markerData.getStartFrameTime();
final_time = markerData.getLastFrameTime();
    
% Setup the ikTool for this trial
ikTool.setName(name);
ikTool.setMarkerDataFileName(fullpath);
ikTool.setStartTime(initial_time);
ikTool.setEndTime(final_time);

The code snippet above is take from the example "setupAndRunIKBatchExample.m".

OpenSense

Q. Can OpenSense be used for both lower and upper extremity movements?

A. Yes, OpenSense can be used for both lower and upper extremity movements, although for any population, movement, or musculoskeletal model of interest, you should be sure that you or others have validated the pipeline for the measures you are interested in. To use OpenSense for your use case, make sure to use a model that has the bodies and joints relevant for your dataset and research question.

Q. OpenSense gives joint angles as outputs. Can it also be used to estimate other quantities, such as spatiotemporal (distance and time) metrics or kinetics (including ground reaction forces)?

A. Currently, the OpenSense tools provide only joint angles as outputs; however, the results from the IMU Inverse Kinematics tool can be used with other OpenSim tools to estimate other quantities. For instance, the inverse kinematics results can be used with the Body Kinematics and Point Kinematics tools to calculate the position, velocities, and accelerations of bodies or points in the model throughout the motion. Careful validation should be done when doing this since, unlike markers, positions are not directly measured by IMUs.

Estimating kinetics, such as ground reaction forces or joint moments, from IMU data is a very active area of research, and OpenSense does not currently provide tools to estimate kinetics directly. Workflows that use physics-based simulations to estimate kinetics have been developed to address this. OpenSim Moco is our software package that generates simulations using an advanced optimization technique called direct collocation, and a Moco example was developed to generate simulations using accelerometer and gyroscope data. Other approaches being researched include using statistical and machine learning techniques to estimate kinetics, without physics-based simulation.

Q. Can OpenSense be used in real-time?

A. Yes, OpenSense can be used in real-time. We provide one such workflow with OpenSenseRT, which uses open-source software and hardware to compute the motions of body segments based on IMU data using a microcontroller worn on the body. Instructions and other details can be found on the OpenSenseRT documentation page.

Q. What import options are there for OpenSense? Which IMU devices can be used for OpenSense?

A. OpenSense requires IMU orientations expressed as quaternions as input into the tools, so sensor fusion must be performed before importing data. We provide import tools for Xsens and APDM systems through our API (C++, MATLAB, and Python) to create an OpenSim storage file, and we have an OpenSense MATLAB example that shows this step with Xsens data. For other IMUs or if you want to use different sensor fusion algorithms, users can create custom import tools by matching the format in any example files provided with OpenSense. 

If you can obtain IMU quaternions from an API with your system, you can instead populate an OpenSim Table and use the Table with the OpenSense tools directly, without using the import tools discussed above to generate a file.

As user needs evolve, we may add other import options in the future.

Q. How does the IMU Placer work? Does it only consider orientation of the IMU or also the position? When should the Heading Correction option be used?

A. The IMU Placer tool uses the IMU calibration data to find the orientations of the IMU frames relative to an OpenSim model’s body segments. It does not consider the positions of the IMUs. 

The Heading Correction option within the IMU Placer tool allows for the user to indicate a specific axis of an IMU that should be aligned with the model’s forward direction. This is helpful to ensure the IMU orientations on the OpenSim model are correct in cases when the participant was not facing in the same direction as the model’s forward direction (usually the positive X direction in OpenSim). More details can be found on the IMU Placer documentation page.

Q. Can I scale my OpenSim model using OpenSense?

A. OpenSense does not provide any tools to scale OpenSim models. Models can be scaled either by using marker data or using manual scaling factors. Find out more about scaling at the Scaling documentation page. For some applications where you are only studying kinematics, it may not be necessary to scale your musculoskeletal model. If taking this approach, validation for your particular population and simulation pipeline should be conducted.

Q. For the IMU Placer and IMU Inverse Kinematics tools, how do you determine the rotations between IMU space to OpenSim space?

A. Transforming data from IMU to OpenSim space depends on the individual lab setup, and there are a couple of places to start that can be helpful. First, check the documentation for your IMU system as it can have helpful information about the coordinate system it uses. Second, visualization tools in the OpenSim GUI can help as well by visualizing the IMU orientations and comparing them to the OpenSim ground frame. IMU data can be visualized in the GUI by going to File -> “Preview Sensor Data…”. Using this feature with a calibration trial, or any other trial where the IMU orientations in the lab space are straightforward, can help figure out what rotations are needed.

OpenSim vs SIMM

Q. What is the relationship between SIMM and OpenSim

...