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!
Forward simulation: basic steps
Re: Forward simulation: basic steps
Hi Maria,
The tug-of-war example uses a control signal in a forward simulation;
http://simtk-confluence.stanford.edu:80 ... ompetition
The tug-of-war example uses a control signal in a forward simulation;
http://simtk-confluence.stanford.edu:80 ... ompetition
Re: Forward simulation: basic steps
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 of ?
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)
Code: Select all
class Controller
Re: Forward simulation: basic steps
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.
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.
Re: Forward simulation: basic steps
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:
and then I use
to set the force I want.
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"));
Code: Select all
muscle1->addInControls(muscleControl, controls);