Hello, guys. I want to design a motion file to simulate stair climbing.
I find that some .mot files consist of bone coordinate, joint angle and fiber length; So if I want to create a .mot file, the only solution is measuring these by doing a lab and then transfer the c3d file to mot file, is that right?
Is there any other solutions? Please give me some advices.
.mot file
Re: .mot file
You can leverage the Matlab Structs() and a conversion function to build your own motion files. Below is a simple example of defining a motion for a single time for three model coordinates. You can update easily by defining an array of coordinate values for each of the coordinates in your model. Goodluck.
Code: Select all
% Import the OpenSim libraries.
import org.opensim.modeling.*
% Define an empty struct
coords = struct();
% Set values for 3 model coordinates. Values could be arrays, but MUST
% be all the same length
coords.knee_r_flexion = 10;
coords.hip_r_flexion = 2;
coords.ankle_r_flexion = 10;
% Add a time value to the struct. You MUST have 'time', it must be defined
% last, and it must be the same length as the coordinates.
coords.time = 0.1;
% Use the OpenSim utility osimTableFromStruct.m to convert into an OpenSim
% type table. This function is in your OpenSim 4.0 resources directory.
osimTable = osimTableFromStruct(coords);
% Add Meta data to the table.
osimTable.addTableMetaDataString('DataRate','250');
% Write table to .mot file
STOFileAdapter.write(osimTable,'test.mot');