How to extract ground reaction forces from OpenCap trials?

New project for OpenCap, which is a new software package to estimate 3D human movement dynamics from smartphone videos. OpenCap strongly relies on OpenSim.
POST REPLY
User avatar
Camille Frayssinhes
Posts: 13
Joined: Thu Nov 16, 2023 9:42 am

How to extract ground reaction forces from OpenCap trials?

Post by Camille Frayssinhes » Mon Nov 27, 2023 12:58 pm

Hi,

We performed two treadmill walking trials in healthy controls to test the OpenCap software.
It was very easy to extract the joint angles from these trials. However, I want to extract the ground reaction forces, but I really don't understand how to do that. I thought I had to import the OpenCap data into OpenSim. But once in OpenSim, I can load the model and the trial, but I don't see how to find the grf.
Could you help me with that please?

Best,

Camille

User avatar
Antoine Falisse
Posts: 438
Joined: Wed Jan 07, 2015 2:21 am

Re: How to extract ground reaction forces from OpenCap trials?

Post by Antoine Falisse » Tue Nov 28, 2023 11:00 am

Hi Camille,

To estimate ground reaction forces, you need to generate dynamic simulations, this is not automated. We share example code for doing that, see this repository: https://github.com/stanfordnmbl/opencap-processing and this script in particular: https://github.com/stanfordnmbl/opencap ... inetics.py

The example_kinetics.py script contains an example for simulating treadmill walking: https://github.com/stanfordnmbl/opencap ... cs.py#L146

Please take a look at the resources here https://github.com/stanfordnmbl/opencap ... /OpenSimAD to learn more about dynamic simulations.

Best regards,
Antoine

User avatar
Camille Frayssinhes
Posts: 13
Joined: Thu Nov 16, 2023 9:42 am

Re: How to extract ground reaction forces from OpenCap trials?

Post by Camille Frayssinhes » Wed Nov 29, 2023 9:23 am

Thank you for your reply!
There are two things I'm still confused with.
First, what is the difference between the resultant GRF and the GRF .mot files? (see screenshot)
Second, how can I export the .mot files into a csv file, the same way I'm doing it with the joint angles (GRF over time)?

Thank you for your help,

Best,

Camille
Attachments
Screenshot 2023-11-29 at 11.20.58.png
Screenshot 2023-11-29 at 11.20.58.png (50.03 KiB) Viewed 1177 times

User avatar
Antoine Falisse
Posts: 438
Joined: Wed Jan 07, 2015 2:21 am

Re: How to extract ground reaction forces from OpenCap trials?

Post by Antoine Falisse » Wed Nov 29, 2023 12:20 pm

Hi,

1. To estimate GRFs, we attach contact spheres to the feet of the model. We use 6 spheres per foot. Each sphere produces forces. The resultant forces are the forces resulting from all six spheres.

2. You can use the kineticsOpenSimAD class for that. See this example https://github.com/stanfordnmbl/opencap ... AD.py#L243. You can extract the GRFs https://github.com/stanfordnmbl/opencap ... AD.py#L257 and then export the dataframe as a csv file, similar to how it is done here https://github.com/stanfordnmbl/opencap ... ple.py#L67. It would look like:

opt_sol_obj = kineticsOpenSimAD(dataFolder, session_id, trial_name, case)
grfs = opt_sol_obj.get_ground_reaction_forces()
grfs.to_csv(output_path)

Antoine

User avatar
Yuwen Lu
Posts: 8
Joined: Mon Nov 09, 2020 3:05 am

Re: How to extract ground reaction forces from OpenCap trials?

Post by Yuwen Lu » Fri Dec 01, 2023 2:18 am

antoinefalisse wrote:
Wed Nov 29, 2023 12:20 pm
Hi,

1. To estimate GRFs, we attach contact spheres to the feet of the model. We use 6 spheres per foot. Each sphere produces forces. The resultant forces are the forces resulting from all six spheres.

2. You can use the kineticsOpenSimAD class for that. See this example https://github.com/stanfordnmbl/opencap ... AD.py#L243. You can extract the GRFs https://github.com/stanfordnmbl/opencap ... AD.py#L257 and then export the dataframe as a csv file, similar to how it is done here https://github.com/stanfordnmbl/opencap ... ple.py#L67. It would look like:

opt_sol_obj = kineticsOpenSimAD(dataFolder, session_id, trial_name, case)
grfs = opt_sol_obj.get_ground_reaction_forces()
grfs.to_csv(output_path)

Antoine
I used the example provided here and I checked the results of GRFs and joint torques. It is amazing! But I still have several questions:
1. In example_kinetics.py, two sesstion_types are mentioned: 'overground' and 'treadmill'.
For 'overground', is it possible to calculate and analysis walking and running? The current codes only include 'squat', 'STS' and 'jump'.
For 'treadmill', I want to make sure that whether the GRF data of treadmill was used in kinetic calculation.
2. Using OpenSim, we can calculate joint contact forces. So can we get joint contact forces from MoCap or opencap-processing codes?

User avatar
Antoine Falisse
Posts: 438
Joined: Wed Jan 07, 2015 2:21 am

Re: How to extract ground reaction forces from OpenCap trials?

Post by Antoine Falisse » Mon Dec 04, 2023 4:02 pm

Hi,

1. These are just examples from the data we had. You can analyze overground walking as well. Please inspect the examples and corresponding settings.
2. Knee joint contact forces are computed when running simulations, you can proceed similarly for the other joints and use OpenSim with the simulation results: https://github.com/stanfordnmbl/opencap ... D.py#L2398

Best,
Antoine

POST REPLY