Thanks alot for your time,
I have something working now, but I want to be sure about thing i did:
Since it's not necessary to create a force set, instead just adding the coordinate actuator(through model->addForce) to the model will be sufficient;
I am questioning the following: I added the input control of that coordinate actuator( a torque N.m should be) to the controlSet created to hold the control input ( excitations 0->1) of the 6 muscles. would it be considered a torque/force inside the controlSet if i didnt created a forceSet to hold it alone ?
Thanks,
Adding a Coordinate Actuator to the muscles of the arm
- sariah Mghames
- Posts: 23
- Joined: Thu Jun 30, 2016 5:56 am
- Dimitar Stanev
- Posts: 1096
- Joined: Fri Jan 31, 2014 5:14 am
Re: Adding a Coordinate Actuator to the muscles of the arm
OpenSim does not care what you put in the control set. It just read it and supplies the value to the actuator regarded of the type. It is the actuator who chooses how to handle the control.
- shayan moradkhani
- Posts: 41
- Joined: Fri May 05, 2017 5:12 pm
Re: Adding a Coordinate Actuator to the muscles of the arm
dear all,
i`m a bit too confused. i`m trying to edit an existing API example, by adding an actuator between two bodies. i wan the actuator to create torque for forward simulation. i want to know the difference between CoordinateActuator and TorqueActuator.
assuming i already know which one to pick, CoordinateActuator as an example, by studying the CoordinateActuator() structure in Doxygen, i get
OpenSim::CoordinateActuator::CoordinateActuator ( const std::string & coordinateName = " ").
the thing is it only asks for the name and does not really say how i need to define this actuator: how to put that between bodies, does it need to have initial force, how to connect it to a controller,...
i don`t really figure out if this is just c++ knowledge or something else.
i would really appreciate your help
regards
Shayan
i`m a bit too confused. i`m trying to edit an existing API example, by adding an actuator between two bodies. i wan the actuator to create torque for forward simulation. i want to know the difference between CoordinateActuator and TorqueActuator.
assuming i already know which one to pick, CoordinateActuator as an example, by studying the CoordinateActuator() structure in Doxygen, i get
OpenSim::CoordinateActuator::CoordinateActuator ( const std::string & coordinateName = " ").
the thing is it only asks for the name and does not really say how i need to define this actuator: how to put that between bodies, does it need to have initial force, how to connect it to a controller,...
i don`t really figure out if this is just c++ knowledge or something else.
i would really appreciate your help
regards
Shayan
- Thomas Uchida
- Posts: 1795
- Joined: Wed May 16, 2012 11:40 am
Re: Adding a Coordinate Actuator to the muscles of the arm
A CoordinateActuator applies a generalized force in the direction of a generalized coordinate (e.g., a knee joint torque at a knee joint). A TorqueActuator applies an arbitrary torque between two arbitrary bodies.i want to know the difference between CoordinateActuator and TorqueActuator.
Doxygen is more like a dictionary; I suggest looking at examples first. The "Dynamic Walker Competition January 2014" page in the Confluence documentation (http://simtk-confluence.stanford.edu:80 ... nuary+2014) includes a link to a .zip file (https://simtk.org/frs/download.php?file_id=3862) that contains sample MATLAB code you might find helpful (see, for example, UserFunctions\AddCoordinateActuator.m). The example on the main GitHub page (https://github.com/opensim-org/opensim-core) demonstrates adding a controller to a model.by studying the CoordinateActuator() structure in Doxygen, i get
OpenSim::CoordinateActuator::CoordinateActuator ( const std::string & coordinateName = " ").
the thing is it only asks for the name and does not really say how i need to define this actuator: how to put that between bodies, does it need to have initial force, how to connect it to a controller,...
- shayan moradkhani
- Posts: 41
- Joined: Fri May 05, 2017 5:12 pm
Re: Adding a Coordinate Actuator to the muscles of the arm
dear Tom,
thank you very much for your help, that was really beneficial. at least it was a success for me to write a few lines of code. i added : CoordinateActuator *TorqueGenerator = new CoordinateActuator("ankle");
TorqueGenerator->setName("TorqueGenerator");
TorqueGenerator->setOptimalForce(10.0);
TorqueGenerator->setMinControl(-20000);
TorqueGenerator->setMaxControl(20000);
osimModel.addForce(TorqueGenerator);
it build successfully, however, created no simulation.
what i did was i took the example on "creating customized actuator" and edited the "toyLeg_example". i commented the "controllable spring", and instead, added the above code.
i suppose one problem is related to the legController which i kept a linear function and did not change.
please find the .cpp file in the attachment.
best regards
Shayan
thank you very much for your help, that was really beneficial. at least it was a success for me to write a few lines of code. i added : CoordinateActuator *TorqueGenerator = new CoordinateActuator("ankle");
TorqueGenerator->setName("TorqueGenerator");
TorqueGenerator->setOptimalForce(10.0);
TorqueGenerator->setMinControl(-20000);
TorqueGenerator->setMaxControl(20000);
osimModel.addForce(TorqueGenerator);
it build successfully, however, created no simulation.
what i did was i took the example on "creating customized actuator" and edited the "toyLeg_example". i commented the "controllable spring", and instead, added the above code.
i suppose one problem is related to the legController which i kept a linear function and did not change.
please find the .cpp file in the attachment.
best regards
Shayan
- Attachments
-
- test.cpp
- (10.05 KiB) Downloaded 16 times
- Thomas Uchida
- Posts: 1795
- Joined: Wed May 16, 2012 11:40 am
Re: Adding a Coordinate Actuator to the muscles of the arm
On line 160, you haveit build successfully, however, created no simulation.
Code: Select all
CoordinateActuator *TorqueGenerator = new CoordinateActuator("ankle");
Code: Select all
OpenSim::CoordinateActuator::CoordinateActuator ( const std::string& coordinateName = "" )