aikkala / O2MConverter

OpenSim to MuJoCo XML converter
63 stars 13 forks source link

OpenSim to MuJoCo XML converter

:exclamation: IMPORTANT! This project is deprecated, but the development continues in MyoConverter. Please use MyoConverter for your model conversion needs.

If you use these converted MuJoCo models in your research, please cite "Converting Biomechanical Models from OpenSim to MuJoCo", as well as the original models. The converted models, and the original ones, are available for academic and other non-commercial use (check the references given in table below for licenses of original models).

Disclaimer: I started writing this code when I was still learning MuJoCo and OpenSim, and therefore the code logic is subpar at some places and could use a little update.

Models

Converted file Original file File containing optimized parameters Description of the model Reference
gait10dof18musc MuJoCo gait10dof18musc OpenSim data.pckl A simple leg model consisting of both legs and rotating torso. Derived from the gait2392 model below. Distributed with OpenSim, OpenSim web page (download requires registration) GitHub
MoBL_ARMS MuJoCo MoBL_ARMS OpenSim data.pckl A dynamic shoulder and arm model with fixed torso. Project web page (download requires registration). Benchmarking of Dynamic Simulation Predictions in Two Software Platforms Using an Upper Limb Musculoskeletal Model, K. R. Saul, X. Hu, C. M. Goehler, M. E. Vidt, M. Daly, A. Velisar, W. M. Murray (2014)
gait2392 MuJoCo gait2392 OpenSim data.pckl A leg model consisting of both legs and a rotating/bending torso. Distributed with OpenSim, OpenSim web page (download requires registration) GitHub
leg6dof9musc MuJoCo leg6dof9musc OpenSim - A simple leg model (one leg), derived from gait2392 model. Distributed with OpenSim, OpenSim web page (download requires registration) GitHub
Hamner2010 Not available in this repo, see reference - 3D full-body model with 92 musculotendon actuators in lower extremities Project web page (download requires registration). Muscle contributions to propulsion and support during running, S.R. Hamner, A. Seth, S.L. Delp (2010)
Rajagopal2015 Not available in this repo, see reference - 3D full-body model with a muscle-actuated lower extremity and torque actuated trunk and upper extremity Project web page (download requires registration). Full-Body Musculoskeletal Model for Muscle-Driven Simulation of Human Gait, A. Rajagopal, C. L. Dembia, M. S. DeMers, D. D. Delp, J. L. Hicks, S. L. Delp (2016)
HYOID1.2 HYOID1.2 OpenSim - Neck model Project web page (download requires registration). The Inclusion of Hyoid Muscles Improve Moment Generating Capacity and Dynamic Simulations in Musculoskeletal Models of the Head and Neck, J. D. Mortensen, A. N. Vasavada, A. S. Merryweather (2018)

Limitations and known bugs

How to run the converter

Easiest way to run the converter is to use conda to create the environment from conda_env.yml, activate the environment, and then run O2MConverter.py script

> conda env create --name O2MConverter --file=conda_env.yml
> conda activate O2MConverter
> python O2MConverter.py opensim_model_file.osim /location/where/converted/model/will/be/saved /location/where/geometry/files/are

How to optimize converted model's parameters (for a new model)

How to load converted model's optimized parameters

The optimized parameters are saved in tests/[model_name]/output/data.pckl, or in a file specified by the EnvTemplate object if you created & optimized a new model. Use function load_data(args) from Utils.py to load the optimized parameters, and function set_parameters(args) to set the models into a mujoco_py.PyMjModel model (see function run_mujoco_simulations(args) in tests/process_test_runs.py for an example).

Contributors

Florian Fischer, Miroslav Bachinski (analysis and conversion of musculotendon properties)