Page 1 of 1

Ground reaction forces (GRF)

Posted: Thu Jun 13, 2024 12:56 pm
by ali_fo
Hi everyone,

I'm working on a project using OpenSim 4.5 and encountered an issue related to applying ground reaction forces (GRF) to a model.

While following the OpenSim tutorial, I observed specific messages in the OpenSim console related to GRF application that are not present in my own setup.

The tutorial shows the following messages:
ExternalLoades: external_loads_model_kinematics_file option is not supported anymore. Results may change.
ExternalLoads 'grf_walk' was renamed and is being reset to 'externalloads'.
ExternalLoads 'Ex2' was renamed and is being reset to 'externalloads'.
Storage: read data file = ../../ExpData/grf_walk.mot (nr=4778 nc=19)
ExternalForce::Right_GRF Data source being set to subject11_noload_free_trial03_ground_reaction
ExternalForce::Left_GRF Data source being set to subject11_noload_free_trial03_ground_reaction
Storage: read data file = /OpenSim/4.5/Models/Rajagopal/RRA/walk/../../ExpData/grf_walk.mot (nr=4778 nc=19)
Storage: read data file = /OpenSim/4.5/Models/Rajagopal/RRA/walk/../../ExpData/grf_walk.mot (nr=4778 nc=19)

However, my example only shows:
ExternalLoades: external_loads_model_kinematics_file option is not supported anymore. Results may change.
ExternalLoads 'grf_walk' was renamed and is being reset to 'externalloads'.
ExternalLoads 'Ex2' was renamed and is being reset to 'externalloads'.
ExternalForce::Right_GRF Data source being set to subject11_noload_free_trial03_ground_reaction
ExternalForce::Left_GRF Data source being set to subject11_noload_free_trial03_ground_reaction
Missing Messages:

The missing lines in my example suggest that the .mot file containing the GRF data is not being read correctly, which might explain the discrepancy in my results compared to the tutorial.
Additionally, I've tried to match the header information in my .mot file to the one used in the OpenSim tutorial, but this hasn't changed the results.

My .mot file header:
subject11_noload_free_trial03_ground_reaction
inDegrees=no
nColumns=19
nRows=2480
DataType=double
version=3
OpenSimVersion=4.5
endheader

Tutorial's .mot file header:
subject11_noload_free_trial03_ground_reaction
version=1
nRows=4778
nColumns=19
inDegrees=no
endheader


Could you please point out any potential issues with my .mot file header or data format that might prevent OpenSim from reading the GRF data correctly?
What are the common troubleshooting steps for ensuring the correct application of GRF in OpenSim?
Is there a way to verify if OpenSim is successfully reading the GRF data from the .mot file?
I appreciate your insights and help in resolving this issue.

Thanks in advance!

Re: Ground reaction forces (GRF)

Posted: Thu Jun 13, 2024 10:54 pm
by tkuchida
Please see the "Motion (.mot) Files" page in the User's Guide (https://opensimconfluence.atlassian.net ... .mot+Files) for details about the requirements of the .mot file format. You can preview the data to ensure the file is being read correctly; please see the "Previewing Motion Capture (Mocap) Data" page (https://opensimconfluence.atlassian.net ... Mocap+Data).

Re: Ground reaction forces (GRF)

Posted: Mon Jun 17, 2024 11:07 pm
by ali_fo
Thank you for the suggestion!

I've encountered an issue with the addTableMetaDataString function when writing MOT files. It seems the function adds metadata strings to the file based on alphabetical order, which prevents me from placing nColumns before nRows. This results in OpenSim being unable to read the MOT file correctly.

Code: Select all

metadata.nRow = num2str(forces_flat.getNumRows());
metadata.nColumns = num2str(forces_flat.getNumColumns() + 1); % +1 for time column

forces_flat.addTableMetaDataString('header', 'Coordinates'); 
% Add metadata in desired order
forces_flat.addTableMetaDataString('nColumns', num2str(forces_flat.getNumColumns() + 1)); 
forces_flat.addTableMetaDataString('nRows', num2str(forces_flat.getNumRows()));
For example, I need to add metadata for nRows and nColumns, but nColumns should come before nRows. However, using addTableMetaDataString, they are added in the wrong order (based on alphabetical order of 'nColumns' and 'nRows').

I've had to manually create the MOT file myself to get the correct metadata order. It works.

ExternalLoades: external_loads_model_kinematics_file option is not supported anymore. Results may change.
ExternalLoads 'grf_walk' was renamed and is being reset to 'externalloads'.
ExternalLoads 'Ex2' was renamed and is being reset to 'externalloads'.
Old version storage/motion file encountered
Storage: read data file = ../../ExpData/grf_walk.mot (nr=2480 nc=19)
.. assuming rotations in Degrees..
ExternalForce::Right_GRF Data source being set to grf_walk.mot
ExternalForce::Left_GRF Data source being set to grf_walk.mot
Old version storage/motion file encountered
Storage: read data file = /Programing/OpenSim/4.5/Models/Rajagopal/RRA/Walk/../../ExpData/grf_walk.mot (nr=2480 nc=19)
.. assuming rotations in Degrees..
Old version storage/motion file encountered
Storage: read data file =/Programing/OpenSim/4.5/Models/Rajagopal/RRA/Walk/../../ExpData/grf_walk.mot (nr=2480 nc=19)
.. assuming rotations in Degrees..

Re: Ground reaction forces (GRF)

Posted: Tue Jun 18, 2024 4:03 pm
by kernalnet
Hi, I'm not sure if such order matters for opensim. I just tested the Gait2354_Simbody data and ran the ID tool with the default GRF file and a new GRF file in which nColumns was before nRows in the headers. The outputs were identical.

Troubleshooting would be much easier if you share your files.

Along with Previewing Motion Capture (Mocap) Data, if everything is shown correctly when associating GRF with motion, then your GRF file is written correctly.

Hope this helps.