ClutchedPathSpring in gait simulation using Moco

OpenSim Moco is a software toolkit to solve optimal control problems with musculoskeletal models defined in OpenSim using the direct collocation method.
User avatar
Nicholas Bianco
Posts: 1025
Joined: Thu Oct 04, 2012 8:09 pm

Re: ClutchedPathSpring in gait simulation using Moco

Post by Nicholas Bianco » Mon Jun 27, 2022 12:30 pm

Oh right, it raises the exception when initialize() is called -- my bad. But I have a better way to fix this issue (which I forgot about until just now, sorry Nathan!).

For the ClutchedPathSpring actuator, provide an Output with name "statebounds_<state_name>" that returns a Vec2 containing default bounds for this state variable (use DeGrooteFregly2016Muscle as a guide for this). "<state_name>" needs to be "stretch" or whatever you decide for the state name. In Moco, we automatically detect Outputs starting with "statebounds" to set default values for state info (this happens here, if you're curious).

ActivationCoordinateActuator works too because we automatically specify state info for actuators with activation dynamics based on the control info of those actuators. Any other actuators with states that don't end with "/activation" or don't implement the default bounds via Outputs above will not have state info set automatically.

Hopefully this resolves the issue. Sorry for not realizing this fix sooner!
-Nick

User avatar
Ross Miller
Posts: 373
Joined: Tue Sep 22, 2009 2:02 pm

Re: ClutchedPathSpring in gait simulation using Moco

Post by Ross Miller » Wed Jun 29, 2022 5:56 am

Thanks Nick. To do this it looks like I would need to edit the cpp code for ClutchedPathSpring, is that correct? Would I then need to rebuild OpenSim from source? Nathan and I was discussing that earlier and I wasn't sure (my instinct was "yes").

Ross

User avatar
Nicholas Bianco
Posts: 1025
Joined: Thu Oct 04, 2012 8:09 pm

Re: ClutchedPathSpring in gait simulation using Moco

Post by Nicholas Bianco » Wed Jun 29, 2022 10:46 am

Hi Ross,

Yes, that should be added to the source code, and you would need to rebuild to get the changes.

We should make changes like this for all components with state variables not named "activation".

User avatar
Nicholas Bianco
Posts: 1025
Joined: Thu Oct 04, 2012 8:09 pm

Re: ClutchedPathSpring in gait simulation using Moco

Post by Nicholas Bianco » Wed Jun 29, 2022 10:54 am

FYI, I've just captured this problem in a GitHub issue: https://github.com/opensim-org/opensim-core/issues/3246.

POST REPLY