.mot file

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
YU SHI
Posts: 5
Joined: Mon Oct 14, 2019 3:46 pm

.mot file

Post by YU SHI » Fri Dec 13, 2019 7:52 am

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.

Tags:

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: .mot file

Post by jimmy d » Fri Dec 13, 2019 8:15 am

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

User avatar
YU SHI
Posts: 5
Joined: Mon Oct 14, 2019 3:46 pm

Re: .mot file

Post by YU SHI » Fri Dec 13, 2019 3:31 pm

Thank you very much

POST REPLY