Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
-
Ana de Sousa
- Posts: 62
- Joined: Thu Apr 07, 2016 4:21 pm
Post
by Ana de Sousa » Tue Mar 26, 2019 5:44 am
Hello, I would like to know how may I change a force through Matlab code.
I know that for torques is:
Code: Select all
osimModel.updActuators().get('gear_load').addInControls(Vector(1, controlActionLoad(controlIteration)), modelControls);
But I would like to apply a force in a specific direction and in a specific point in a body. I would also like to change it at each iteration.
I appreciate any help with this matter.
-
Ana de Sousa
- Posts: 62
- Joined: Thu Apr 07, 2016 4:21 pm
Post
by Ana de Sousa » Tue Apr 09, 2019 1:05 pm
Thank you for the response, Dimitar!
May I ask you how do I use PrescribedForce in Matlab? The example from the link is in cpp, and when I look for the same name in Matlab (PrescribedForce), it does not find it in org.opensim.modeling.*
-
Ana de Sousa
- Posts: 62
- Joined: Thu Apr 07, 2016 4:21 pm
Post
by Ana de Sousa » Tue Apr 09, 2019 1:09 pm
Sorry, actually, I am able to create the force, but I do not know how I change it in Matlab.
Code: Select all
% Create force
pelvis_Force = PrescribedForce(pelvis);
pelvis_Force.setName('pelvis_force');
pelvis_Force.setForceFunctions(Constant(0), Constant(250), Constant(0));
% Add the force to the model
osimModel.addForce(pelvis_Force); % Add the force to the model