Hello,
I am trying to add path actuator between the arm and the forearm part. This path actuator is actually an approximation of the bowden cable and pulley system. I have implemented the path actuator as shown in the visualizer based on what I understood from Doxygen. Following is the code which I used:
%% Path actuator
act = PathActuator();
act.addNewPathPoint('p1',arm_exo1,Vec3(0.035,0,0));
act.addNewPathPoint('p2',arm_exo2,Vec3(0.035,0,0));
act.setOptimalForce(10);
model.addForce(act);
%%
Can you please give me an example or something from where I can understand how to give control signal to this actuator. I have searched everywhere but I didn't find anything. Ofcourse I am a newbie here. I tried PrescribedControl but that is not working for this. Also, how will I set the slack length in this?
Thanks..
Method for giving control signal to path actuator
- Ratna Sambhav
- Posts: 42
- Joined: Sat Jan 12, 2019 10:16 am
Method for giving control signal to path actuator
- Attachments
-
- o.jpg (116.83 KiB) Viewed 760 times
Tags:
- Thomas Uchida
- Posts: 1792
- Joined: Wed May 16, 2012 11:40 am
Re: Method for giving control signal to path actuator
The example on the main GitHub page uses a controller (https://github.com/opensim-org/opensim-core; scroll down to the "Simple example" section). Below the C++ code, there are equivalent scripts for Python and Matlab.
- Ratna Sambhav
- Posts: 42
- Joined: Sat Jan 12, 2019 10:16 am
Re: Method for giving control signal to path actuator
Hello Thomas Uchida,
Thanks for your kind attention and reply. In the simple example code, muscle has been controlled but what I want to control here is the PathActuator, which basically creates tension based on the value of it's OptimalForce and the control signal applied to it.
I tried giving control signal to it, using PrescibedController as is used for controlling muscles, but its showing that the PathActuator is not in the list of muscles under PrescribedController. Here is my code and the error file has been attached as jpg.
%% Path actuator
act = PathActuator();
act.addNewPathPoint('p1',arm_exo1,Vec3(0.035,0,0));
act.addNewPathPoint('p2',arm_exo2,Vec3(0.035,0,0));
act.setOptimalForce(10);
model.addForce(act);
%%
%% Prescribed controller
brain = PrescribedController();
brain.addActuator(act);
brain.prescribeControlForActuator('act', StepFunction(0.5, 3.0, 0.3, 1.0));
model.addController(brain);
Can you suggest me which controller has to be used for PathActuator and the basic command for that.
My aim is to implement a control loop of actuator and muscles, so that for every iteration based on value of elbow angle and muscle force, a control signal will be given to the PathActuator which will create a tension in itself and thus apply a torque on elbow.
Thanks
Thanks for your kind attention and reply. In the simple example code, muscle has been controlled but what I want to control here is the PathActuator, which basically creates tension based on the value of it's OptimalForce and the control signal applied to it.
I tried giving control signal to it, using PrescibedController as is used for controlling muscles, but its showing that the PathActuator is not in the list of muscles under PrescribedController. Here is my code and the error file has been attached as jpg.
%% Path actuator
act = PathActuator();
act.addNewPathPoint('p1',arm_exo1,Vec3(0.035,0,0));
act.addNewPathPoint('p2',arm_exo2,Vec3(0.035,0,0));
act.setOptimalForce(10);
model.addForce(act);
%%
%% Prescribed controller
brain = PrescribedController();
brain.addActuator(act);
brain.prescribeControlForActuator('act', StepFunction(0.5, 3.0, 0.3, 1.0));
model.addController(brain);
Can you suggest me which controller has to be used for PathActuator and the basic command for that.
My aim is to implement a control loop of actuator and muscles, so that for every iteration based on value of elbow angle and muscle force, a control signal will be given to the PathActuator which will create a tension in itself and thus apply a torque on elbow.
Thanks
- Attachments
-
- Capture.JPG (25.11 KiB) Viewed 722 times
- Thomas Uchida
- Posts: 1792
- Joined: Wed May 16, 2012 11:40 am
Re: Method for giving control signal to path actuator
Please see the documentation for the prescribeControlForActuator() method: https://simtk.org/api_docs/opensim/api_ ... cba89bea0c. The first argument is a string, which I believe should be the name of the actuator (i.e., the name assigned to the actuator, not the Matlab variable). You are passing 'act' but you have not assigned a name to your PathActuator. Try adding
after you create the PathActuator.
Code: Select all
act.setName('act');
- Ratna Sambhav
- Posts: 42
- Joined: Sat Jan 12, 2019 10:16 am
Re: Method for giving control signal to path actuator
Thanks, that worked. I understood what I was doing wrong.
- Evan Dooley
- Posts: 33
- Joined: Sun Nov 24, 2019 11:17 am
Re: Method for giving control signal to path actuator
I had this same issue. Thanks for following up. This thread is really helpful.
In the example from the webinar, the Matlab variable and the name assigned to the actuator were the same, so it was not clear it needed the name of the actuator. Is it good practice for these two things to have the same name?
Thanks again,
EAD
In the example from the webinar, the Matlab variable and the name assigned to the actuator were the same, so it was not clear it needed the name of the actuator. Is it good practice for these two things to have the same name?
Thanks again,
EAD