The topics covered in this section include:
The .mot (motion) file format was created by the developers of SIMM (Software for Interactive Musculoskeletal Modeling). The .mot file format is compatible with both SIMM and OpenSim. A .mot file consists of two parts: the motion header and the data. The motion header can come in two forms: (1) SIMM header only or (2) OpenSim and SIMM header.
Form (1) of a motion header looks like this:
The first line must start with name followed by a space and the name of the .mot file. The next line should contain datacolumns, a space, and then the total number of columns of data in the .mot file (including the time column). The next line should contain datarows, a space, and then the total number of rows of data in the .mot file. A later line should contain range, a space, the first time value in the time column, a space, and then the last time value in the time column. Optionally, other comments could be included in subsequent lines. The final line endheader indicates the end of the header.
Form (2) of a motion header looks like this:
The first line is the name, which is Coordinates in this case, to be used to represent this .mot file when it is loaded into OpenSim. This does not have to be the name of the .mot file. The second line contains nRows= followed by the number of rows of data in the .mot file. The third line contains nColumns= followed by the number of columns of data (including the time column) in the .mot file. The fourth line is empty.
Note that extra lines containing newline characters or comments can be included before the endheader line in the SIMM header section of both forms (1) and (2) of the .mot motion header.
Immediately after the endheader line, the data section of the .mot file begins. The first line after the endheader line should contain tab-delimited labels for each column of (tab-delimited) data in the .mot file. The first column is usually time, followed by values that vary with time such as generalized coordinates, marker coordinates, ground reaction forces and moments, centers of pressure, muscle activations, or muscle lengths. In old SIMM .mot files, there is no time column, in which case OpenSim uses the range specified in the SIMM header and assumes a fixed time step to specify the time interval for the motion. The names of the column labels should match the names used in the model with which the .mot file is intended to be used. The rows below this line of column labels must be the corresponding values of each of these quantities at the time represented by the first number in each row.
The time values in the time column of a .mot file must be uniformly spaced. An example .mot file (subject01_walk1_grf.mot) is provided in the examples/Gait2354_Simbody directory, which is part of the OpenSim distribution.
Representing Joint Angles in a .mot File
Optionally, if joint angles have been computed previously using other software, they may be imported into OpenSim in addition to marker data. The joint angles must be provided in a .sto or .mot file. The .mot file must contain a header. Below the header, there must be a row of column labels, and the corresponding columns of data below that. Time must be the first column and the generalized coordinates of the model must be the subsequent columns. Angles in .mot files are assumed to be in degrees.
Representing Ground Reaction Data in a .mot File
You need to represent your ground reaction data in a .mot file for input into OpenSim. An example file (subject01_walk1_grf.mot) is given in the examples/Gait2354_Simbody directory, which is part of the OpenSim distribution.
The first row below the header in the .mot file may contain the following column headings. As of OpenSim version 2.3.2 the column headers need to be unique (the program will ask you to save the file in this format first if using a file that doesn't conform to this format). Also each group of three force, point or torque columns should have a common prefix.:
time, ground_force_vx, ground_force_vy, ground_force_vz,
ground_force_px, ground_force_py, ground_force_pz,
l_ground_force_vx, l_ground_force_vy, l_ground_force_vz,
l_ground_force_px, l_ground_force_py, l_ground_force_pz,
ground_torque_x, ground_torque_y, ground_torque_z,
l_ground_torque_x, l_ground_torque_y, l_ground_torque_z
All rows below this line contain the corresponding data in each column. Columns 2-4 (ground_force_vx, ground_force_vy, ground_force_vz) represent the x, y, and z components of the right foot's ground reaction force vector in a specific body coordinate system (ground for the model coordinate system). Columns 5-7 represent the x, y, and z components of the right foot's center of pressure (i.e., the point at which the ground reaction force is applied to the right foot). Similarly, columns 8-13 represent the ground reaction force vector and center of pressure for the left foot. Columns 14-16 represent the x, y, and z components of the right foot's ground reaction moment vector (typically in the model coordinate system). The last three columns represent the analogous quantities for the left foot.
NaNs in your force file
NaNs are not compatible with any dynamics analysis and must be removed from mot files. Force data is splined during computation and occurrences of NaNs cause the entire force, moment, or COP column to become NaN. NaNs often occur when computing COP; more details can be found in the C3D files documentation.