Wiki

Clone wiki

scl-manips-v2 / mocap / mocap_osim

Pipeline to reconstruct motion capture data in OpenSim

Collecting data

  • The opti-trac system only works well with rigid bodies.
  • So you will have to use 3markers for each marker point on the skeleton.
  • Once you collect the marker data, you'll have to rename stuff so that the marker center's name matches what osim wants
  • TODO : Add more details here...

Converting data into Osim's format

  • OpenSim uses "trc" files.
    • These are csv style files with a lot of meta-data about timing and markers etc.
  • OptiTrack, however, exports cvs files that are incompatible with OpenSim (even though they have a similar data format)
  • To obtain an OpenSim compatible file, do the following:
    1. Open csv file in Excel (LibreOffice does not work for this)
    2. Make changes to get the file of motion capture data in this form. More details about this form are available at this link. File Format.png
    3. Save this file as a Text(Tab Delimited) with a different name from your original file
    4. In your filesystem, delete the .txt extension from this file and convert the file's extension to trc
  • This should help you obtain a file that can be used in the remaining tutorial

Scaling an OpenSim Model

  • This is important to be able to use the motion capture data.
  • Open whatever model you want to use in OpenSim.
    • In this tutorial, we're using the Stanford VA Upper Limb Model. 01_UnscaledModel.png We're going to add a marker to it for each marker we used in the motion capture experiment. In our motion capture experiment, we used 4 markers:
      1. shoulder
      2. elbow
      3. wrist
      4. knuckle You can call your markers whatever you want. Set the location of the markers by right-clicking on Markers in the Navigator, and then fine-tuning the location coordinates until each marker is where you want it. You can also manually move the markers. Make sure that the box for "Fixed" is not checked for any marker.
  • Here is what you need to do to scale the model:
    1. Double click on your model's name.
    2. Then go to Tools - Scale Model. ScaleModel.png
    3. Set the mass of your subject, and load in the marker data for measurements. This can come from a file of static movement, or it can come from your experimental data file as long as you set "Average measurements between times" to be a small range from the beginning of the data, like from 1 to 2. Similarly, "Marker data for static pose" can be the same file of experimental data, as long as you set "Average markers between times" to be a small range from the beginning of the data, like from 1 to 1.01. Your settings should look similar to this:02_Settings.png
    4. Click on "Scale Factors", another tab in the Scale Tool in the above picture. Click "Edit Measurement Set". Now, choose pairs of markers that correspond to bones in the model. For example, we can choose the shoulder and elbow to be a pair because the bone connecting the shoulder and elbow is the humerus. This means that the model will scale its humerus to the distance between the markers on the shoulder and elbow in the experimental motion capture data. You can name these measurements anything you want. As an example, this is what our marker pairs looked like: 03_MeasurementSet.png
    5. Now when you press OK, you should choose the bones that your marker placements corresponded to. For each bone, click on its appearance in the column "Body Name". Then click "Use measurements", and select the appropriate measurement defined in your Measurement Set. For example, you can see that we've scaled the humerus bone in the model using the measurement "humerus" that we defined in our Measurement Set to be the distance between the shoulder and elbow. The corresponding "Applied Scale Factor(s)" column should change accordingly. Make sure that your Scale Factors look reasonable (.5 - 2). If they don't, check the units defined in your experimental data file (ie. make sure that you're not in mm when you should be in m and vice versa). 04_ScaleFactors.png
    6. Click on "Static Pose Weights", the last tab in the Scale Tool. Make sure that all of your markers are enabled. Check all your settings again and click "Run". OpenSim will execute the scaling and you should now see a scaled blue model.

Playing back mocap data

Open File and then open Preview Experimental Data. Select the .trc file that we made at the beginning of this tutorial. Double click again on your model name in the Navigator and press the play button at the top of the screen to watch your model move.PlayButton.png

Updated