KULeuvenNeuromechanics / PredSim

Generate predictive simulations of human locomotion
MIT License
23 stars 22 forks source link

Use the table of contensts to easily navigate this README. Click on the three lines next to README.md just above this sentence.

Predictive Simulations of Human Movement

This repository contains code and data to generate three-dimensional muscle-driven predictive simulations of human gait. The simulation framework is developed by Falisse et al.. The implementation in this repo is aimed at letting you run simulations with your customized musculoskeletal models*. If you want to reproduce specific published results, you are adviced to visit the repo corresponding to the paper.

This repository is a work in progress

Citations

Please cite the original authors if you use this simulation framework.

  1. Falisse A, Serrancoli G, Dembia C, Gillis J, Jonkers J, De Groote F. 2019 Rapid predictive simulations with complex musculoskeletal models suggest that diverse healthy and pathological human gaits can emerge from similar control strategies. Journal of the Royal Society Interface 16: 20190402. http://dx.doi.org/10.1098/rsif.2019.0402. You can find the original repository here: https://github.com/antoinefalisse/3dpredictsim (MATLAB)

  2. Falisse, A., Serrancolí, G., Dembia, C. L., Gillis, J., & De Groote, F. 2019 Algorithmic differentiation improves the computational efficiency of OpenSim-based trajectory optimization of human movement. PLOS ONE, 14(10), e0217730. https://doi.org/10.1371/journal.pone.0217730

  3. Falisse A, Afschrift M, De Groote F. 2022 Modeling toes contributes to realistic stance knee mechanics in three-dimensional predictive simulations of walking. PLoS ONE 17(1): e0256311. https://doi.org/10.1371/journal.pone.0256311. You can find the original repository here: https://github.com/antoinefalisse/3dpredictsim_mtp (python)

  4. D’Hondt, L., De Groote, F., & Afschrift, M. 2024 A dynamic foot model for predictive simulations of human gait reveals causal relations between foot structure and whole-body mechanics. PLOS Computational Biology, 20(6), e1012219. https://doi.org/10.1371/journal.pcbi.1012219. You can find the original repository here: https://github.com/Lars-DHondt-KUL/3dpredictsim/tree/four-segment_foot_model (MATLAB)

If you are familiar with a previous version of this simulation framework, here is a rundown of the changes

In general, hard coded variables were removed as much as possible and put in a settings structure the user can adapt. This results in:

Besides that, the code was also adapted in accordance with recent (October 2020) adjustments in the original repository of Falisse et al.

Lastly, seperate pieces of code were put together to streamline performing predictive simulations:

Required software

To run this code you need to have the following softwares on your machine:

How to setup the code

  1. Fork this repository to your github account. If you want the fork to be private, follow these steps instead.
  2. Clone the fork to your machine. If you have a computer with restricted permissions, make sure you have permission to run executables from the selected folder (For computers with KU Leuven BioMed Group policies, this is C:\GBW_MyPrograms\ ). Do not download the code as zip.
  3. Get the OpenSim API running on MATLAB. See Setting up your Matlab Scripting Environment.
  4. In main.m, change S.solver.CasADi_path to reflect the location where you installed CasADi.
  5. Make sure the opensimAD submodule is installed. If PredSim\opensimAD\ is empty, open git command prompt, go to ...\PredSim\ , and run git submodule update --init.

After perfoming these steps, run the main script. (Expected run time is 40 minutes, depending on hardware.) If you don't receive any errors, your results should be the same as https://github.com/KULeuvenNeuromechanics/PredSim/tree/master/Tests/Falisse_et_al_2022_Results. If that is the case, you have succesfully intalled and set up the code. You are ready to do your own simulations.

How to use the code

The code is written such that as a user you only have to interact with main.m.

All user-defined settings are stored in structure S. In main.m you have to specify the required settings and are free to change/add the optional settings.

Before running a simulations

This code can automatically convert an OpenSim model to the external function used in the simulations. This greatly simplifies the process of going from a subject-specific model to a predictive simulation. Nevertheless, you should take care of the model you use since not all OpenSim models are suported:

Required Settings

OptionalSettings

S.bounds

S.metabolicE - metabolic energy

S.misc - miscellanious

S.post_process

S.solver

S.subject

S.weights

S.OpenSimADOptions

These settings are passed to OpenSimAD.