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.
Opensim And Matlab
- samane amini
- Posts: 5
- Joined: Wed Apr 22, 2020 11:39 am
- samane amini
- Posts: 5
- Joined: Wed Apr 22, 2020 11:39 am
Re: Opensim And Matlab
I solved it
modelcontrols = Model.getDefaultControls;
Tkr = Vector(1, Tkr);
Model.getActuators.get("knee_motor_r").addInControls(Tkr,modelcontrols)
Model.setDefaultControls(modelcontrols)
modelcontrols = Model.getDefaultControls;
Tkr = Vector(1, Tkr);
Model.getActuators.get("knee_motor_r").addInControls(Tkr,modelcontrols)
Model.setDefaultControls(modelcontrols)
- Dimitar Stanev
- Posts: 1096
- Joined: Fri Jan 31, 2014 5:14 am
Re: Opensim And Matlab
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
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