Does OpenSim report state equations?

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: Does OpenSim report state equations?

Post by Christopher Dembia » Mon Feb 15, 2016 11:14 am

bradh wrote: Recently I have tried to understand how/if excitation plays a roll in computeStateVariableDerivatives.
Brad
The fiber dynamics is not a function of excitation (thinking about the jacobian); that is, the element of the jacobian relating fiber velocity to excitation is zero. Are you saying OpenSim's API should have a way to tell you such information?

User avatar
Ton van den Bogert
Posts: 166
Joined: Thu Apr 27, 2006 11:37 am

Re: Does OpenSim report state equations?

Post by Ton van den Bogert » Tue Feb 16, 2016 8:24 am

These pieces of information from Ross are very valuable. This is a good place to share these details which usually don't make it into the publications.

I generally use a 1 N/m linear (bidirectional) spring in addition to the ground contact model, and I do the same in the elastic elements of muscle. It seemed like the right thing to do.

I do something similar in the contractile element force-velocity relationship, by adding a small linear damping in parallel. Currently I am using a damping of 1e-5 (that is in units of Fmax per m/s). That removes the horizontal asymptote. In explicit dynamics, this addition makes it harder to solve for the CE shortening velocity. In implicit dynamics, this is a very easy change to make.

For neither of these I know how critical they currently are for successful convergence of a direct collocation problem with IPOPT. These tricks tend to accumulate and never get removed or critically examined again, even when other improvements may make them unnecessary.

I do know that the CE damping is essential for certain implicit ODE solvers. Our fixed-step real time solver would not work without it.

Ton

User avatar
Brad Humphreys
Posts: 79
Joined: Thu Feb 03, 2011 11:32 am

Re: Does OpenSim report state equations?

Post by Brad Humphreys » Sat Feb 20, 2016 9:40 am

Chris,

I wanted to put in one more plug for implicit dynamics formulations. Wouldn't having implicit dynamics also provide a means to better diagnose problems during Static Optimization? It would make it possible to diagnose why static optimization fails to solve due to under-actuated joints.

For example using computerStateVariableDerivatives and equilibriateMuscles, I do a "poor man's static optimization" to get a set of balanced/static initial conditions for models. (I use fmincon to solve muscle lengths, all velocities=0, constrained to achieve 0 joint accelerations, while minimizing an activation cost function; you could of course do this with an OpenSim work flow too). But then I am also able to look at which joint accelerations are having trouble getting to 0 across the optimization. One of the limitations to that troubleshooting is that all muscles lengths can effect all joint accelerations; they are coupled. But as Ton points out in his 2011 IUTAM paper, the implicit formulation produces a Jacobian with non-zero terms only in locations where muscles cross joints - it decouples the joints from each other. So you would be able to diagnose under actuated joints.

Maybe this has been said before, but in case it has not, another +1 for implicit dynamics.

Brad

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: Does OpenSim report state equations?

Post by Christopher Dembia » Sun Feb 21, 2016 10:18 pm

Brad:

That's a good point; I hadn't realized this added benefit. We have talked about creating a tool to diagnose issues with CMC, in particular, to give information about if a model is too weak to generate the necessary forces to track a motion. It seems the implicit dynamics might help here. Here's a related issue on GitHub: https://github.com/opensim-org/opensim-core/issues/337.

-Chris

POST REPLY