Opensim And Matlab

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
samane amini
Posts: 5
Joined: Wed Apr 22, 2020 11:39 am

Opensim And Matlab

Post by samane amini » Fri Aug 21, 2020 11:35 pm

Hi guys
I would try to use addincontrol in Matlab code. I want to define control signal for one actuator. thus I write this code. but it isn't work. why?

modelcontrols = walkerModel.getDefaultControls

model.updActuators().get("knee_motor_r").addInControls(0,modelcontrols)

please guide me.

Tags:

User avatar
samane amini
Posts: 5
Joined: Wed Apr 22, 2020 11:39 am

Re: Opensim And Matlab

Post by samane amini » Sun Aug 23, 2020 11:25 pm

I solved it
modelcontrols = Model.getDefaultControls;
Tkr = Vector(1, Tkr);
Model.getActuators.get("knee_motor_r").addInControls(Tkr,modelcontrols)
Model.setDefaultControls(modelcontrols)

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Opensim And Matlab

Post by Dimitar Stanev » Mon Aug 24, 2020 1:00 am

Hi,

I am glad that you made it work. However, you are not supposed to set the controls directly, but through a controller. You can use a prescribed controller. Please, study the following code:

https://github.com/stanfordnmbl/osim-rl ... sim.py#L19

and in particular:

https://github.com/stanfordnmbl/osim-rl ... sim.py#L59

and

https://github.com/stanfordnmbl/osim-rl ... sim.py#L92

POST REPLY