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. 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);

...

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 For users comfortable with using the OpenSim API, if you can obtain IMU quaternions from an API with your IMU system, you can instead populate an OpenSim TimeSeriesTableQuaternion (TimeSeriesTableQuaterion API entry and TimeSeriesTable API documentation) and use the Table with the OpenSense tools directly, without using the import tools discussed above to generate a file.

...