Forward simulation: basic steps

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Mary K
Posts: 37
Joined: Mon Feb 24, 2014 9:15 am

Forward simulation: basic steps

Post by Mary K » Mon Oct 27, 2014 12:18 pm

Hello there!
I try to implement a forward simulation, for example knee flexion (it could be something else for now, I just want to practice some things).

Can someone tell me the steps I should follow?

For example, should I know the exact forces the muscle produce to move the knee? If yes, how can I define them?

Also, what is exactly the utility of a controller? Is it necessary for implemeting a simulation or it just helps for something specific?

Thank you!

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Forward simulation: basic steps

Post by jimmy d » Sat Nov 01, 2014 2:57 pm

Hi Maria,

The tug-of-war example uses a control signal in a forward simulation;
http://simtk-confluence.stanford.edu:80 ... ompetition

User avatar
Mary K
Posts: 37
Joined: Mon Feb 24, 2014 9:15 am

Re: Forward simulation: basic steps

Post by Mary K » Sun Nov 02, 2014 5:05 am

Thank you for your reply.

I have seen these examples but there aren't examples with C++ code an that's where I have problems (mostly).
I have seen the tutorials "How to create a Controller" and "How to do simulation" also, but they are too simple and don't help much. :?

For example I have some questions like that:
What exactly is supposed to do function

Code: Select all

computeControls(const State &s, Vector &controls)
of

Code: Select all

class Controller
?

User avatar
Ajay Seth
Posts: 136
Joined: Thu Mar 15, 2007 10:39 am

Re: Forward simulation: basic steps

Post by Ajay Seth » Tue Nov 04, 2014 12:02 pm

Perhaps what you are looking for is in the Doxygen that documents the code base.
Locally you can find it here: <OpenSim32_Install_DIR>\sdk\doc\OpenSimAPI.html
Online: https://simtk.org/api_docs/opensim/api_docs/

Furthermore, a Controller is an OpenSim component whose job it is to generate controls for Actuators. Actuators are force elements (Forces) that generate force on the multibody system based on the state (e.g. time, joint coordinates and speeds, muscle activations and fiber-lengths, ...) and a control input. A Muscle is an Actuator in OpenSim and so is a an ideal motor (CoordinateActuator). You can perform a forward dynamics simulation without a controller. A default control value of zero is assumed for most actuators if no control is provided. You can perform a simulation of passive knee swing this way.

A Controller computes controls for its actuators based on the state of the model. If you are trying to write your own Controller, there is an example in the <OpenSim32_Install_DIR>\sdk\APIExamples\ folder.

User avatar
Mary K
Posts: 37
Joined: Mon Feb 24, 2014 9:15 am

Re: Forward simulation: basic steps

Post by Mary K » Wed Nov 05, 2014 1:31 pm

Thanks for your time.

Maybe I should be more specific. Let's say I want to simulate the movement of squat at the lower limb body.
How can I know exactly which actuators should get a control signal and what's the value of this signals?

And correct me if I am wrong:
next thing to do is to draw the curve control_signal vs. time
and do something like that to take control of the muscle I want:

Code: Select all

const Millard2012EquilibriumMuscle* muscle1 = static_cast<const Millard2012EquilibriumMuscle*>(&getActuatorSet().get("muscle_name"));
and then I use

Code: Select all

muscle1->addInControls(muscleControl, controls);
to set the force I want.

POST REPLY