ComputationalBiomechanicsLab / opensim-creator

A UI for building OpenSim models
https://opensimcreator.com
Apache License 2.0
154 stars 18 forks source link

Add Modenese muscle parameter scaling tool #568

Open adamkewley opened 1 year ago

adamkewley commented 1 year ago

Suggested by @JuliaVanBeesel.

Warp-based model scaling involves:

This issue covers part of scaling-parameters-step. @modenaxe published one method for scaling muscle parameters, which is available here:

But the plugin only really works in OpenSim 3.3. This is problematic because OpenSim Creator, and the osim files we're developing, are all made in OpenSim 4.x, which is incompatible with 3.3.

This ticket covers:

adamkewley commented 1 year ago

This is going to be non-trivial to do, because the source repo contains a mix of C++ for the algorithm and java for the UI.

The UI code probably can't be upgraded to OpenSim 4.4 trivially, and the C++ code is somewhat designed to be called from the GUI.

I'm working on a fork to essentially rip out everything non-essential and upgrade what's left to OpenSim 4.4 here:

It might be that I can port the command-line client to OpenSim 4.4, but I'll need to review each "broken" (after upgrading to 4.4) line to ensure that the 4.4 equivalent doesn't behave too differently.

modenaxe commented 1 year ago

Hi @adamkewley, it might be helpful to know that for the MATLAB version of the tool, which I have used the most, there are two tests available for the code:

  1. mapping a model on itself: it should return the same musculotendon parameters (just a sanity check, really)
  2. the models from the original publication are used as test The MATLAB implementation on branch https://github.com/modenaxe/MuscleParamOptimizer/tree/updOS4 works on OpenSim 4.x, I haven't merged it yet as test 2) does not give exactly the same results and I haven't investigated if this is only due to OpenSim version changes.