Page 1 of 1

muscle actuation

Posted: Tue May 14, 2019 5:34 am
by sjullien
Hi guys!
I'm trying to implement an excitation to the muscles by coding directly, not using the GUI. So I tried adding an excitation value and adding a force but none of them seem to work even if I put crazy values. Is there another way?
Thank you so much in advance for your help!
Regards

Re: muscle actuation

Posted: Tue May 14, 2019 8:30 am
by tkuchida
Please see the example in the README file on GitHub: https://github.com/opensim-org/opensim-core (scroll down a bit to the "Simple example" section).

Re: muscle actuation

Posted: Tue May 14, 2019 9:13 am
by sjullien
Thank you! I don't know how I missed it.
In the same algorithm you showed me, a reporter is used to print some coordinates in the terminal. Do you know how I could save them (and other variables) in a file (txt file for example)? ^^

Re: muscle actuation

Posted: Tue May 14, 2019 11:22 am
by tkuchida
a reporter is used to print some coordinates in the terminal. Do you know how I could save them (and other variables) in a file
You can replace the ConsoleReporter with a TableReporter

Code: Select all

TableReporter* myReporter = new TableReporter();
//etc.
and then use the STOFileAdapter to write to file:

Code: Select all

auto myTable = myReporter->getTable();
STOFileAdapter::write(myTable, "filename.sto");
There are a few other FileAdapters as well; see the inheritance diagram here: https://simtk.org/api_docs/opensim/api_ ... apter.html.

Re: muscle actuation

Posted: Thu May 23, 2019 7:25 am
by sjullien
That's really great!! Thank you very much, worked like a charm. :D