ControllerExample --> modify induced accelerations

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Anne Schmitz
Posts: 76
Joined: Thu May 31, 2007 7:44 am

ControllerExample --> modify induced accelerations

Post by Anne Schmitz » Thu Aug 29, 2013 5:39 pm

Hello,

In the ControllerExample, the activation of the muscle is just based on the desired force. I would also like to include the force of the other muscle in this since Fdes = mass*desired acceleration - force in the other muscle. However, when I use double FmuscleForce = muscle->getForce(s) in the controller code, I get an error about velocity when I run the exe. I am trying to slowly improve how this controller computes accelerations induced by each muscle (and ultimately emulate CMC). Any advice would be greatly appreciated.

Thanks,

Anne Schmitz

User avatar
Michael Sherman
Posts: 801
Joined: Fri Apr 01, 2005 6:05 pm

Re: ControllerExample --> modify induced accelerations

Post by Michael Sherman » Thu Aug 29, 2013 8:22 pm

Hi, Anne. In OpenSim, forces depend on controllers but not vice versa. That is, first the values of the controls are calculated from the state, then actuators that depend on those controls are calculated. So you can't ask for the computed value of a force from within your controller. You didn't provide the exact error message, but I suspect it is telling you that you asked for a quantity that hasn't been computed yet.

To use a force value in a controller, you may want to refer to an earlier value of the force that has been saved in the state, or if the force actually does not depend on controls you could calculate the force that will be applied. If you actually have controls that depend on forces that depend on controls you have probably set up a complex force model that must be solved iteratively; you would have to write that yourself, perhaps as a custom ModelComponent so that you can incorporate an appropriate solver.

Regards,
Sherm

User avatar
Anne Schmitz
Posts: 76
Joined: Thu May 31, 2007 7:44 am

Re: ControllerExample --> modify induced accelerations

Post by Anne Schmitz » Fri Aug 30, 2013 5:21 am

Hi Sherm,

That makes sense. Is there a way to better calculate the acceleration induced by each muscle then, as is done in CMC? I'm thinking a forward dynamics simulation within the controller. Within the controller, apply 1 N of muscle force to the equations of motion, calculate what the induced motion is over a specified time period, then calculate the induced acceleration. Would this account for other forces in the model (i.e. the other muscle in the ControllerExample)? The current implementation of the ControllerExample does not track the motion well and I suspect it is in how muscle induced accelerations is done.

Thanks,

Anne

User avatar
Michael Sherman
Posts: 801
Joined: Fri Apr 01, 2005 6:05 pm

Re: ControllerExample --> modify induced accelerations

Post by Michael Sherman » Fri Aug 30, 2013 8:52 am

In my (limited) understanding of CMC, I believe what you are describing is how CMC works. It does an internal forward simulation over short time intervals from within the controller in order to characterize muscle capabilities. So you could do that too. The approach seems somewhat ad hoc to me though -- it would be nice if it could be put on a more rigorous footing within control theory.

I think there are others on this forum who have given this issue much more thought than I have -- speak up please!

Sherm

User avatar
Anne Schmitz
Posts: 76
Joined: Thu May 31, 2007 7:44 am

Re: ControllerExample --> modify induced accelerations

Post by Anne Schmitz » Fri Aug 30, 2013 11:57 am

How would I add a forward dynamics simulation into the controller to do this?

If CMC does indeed do a forward dynamic simulation at each time point, then I don't need to modify the current CMC implementation. How can I verify this?

Thanks,

Anne

POST REPLY