Understanding the API: How to know the possible column names

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Vishal R
Posts: 47
Joined: Wed Oct 29, 2014 4:20 pm

Understanding the API: How to know the possible column names

Post by Vishal R » Tue Aug 28, 2018 9:43 am

Hi again,

I was trying to follow the program for making a simple arm model as provided in the OpenSim github https://github.com/opensim-org/opensim-core.
I was wondering on how do we know or look into the API for understanding what are the probable names that are supported to view the output in the reporter.

For example, a snippet of the code from repo is shown below:

Code: Select all

// Add a console reporter to print the muscle fiber force and elbow angle.
    ConsoleReporter* reporter = new ConsoleReporter();
    reporter->set_report_time_interval(1.0);
    reporter->addToReport(biceps->getOutput("fiber_force"));
    reporter->addToReport(
        elbow->getCoordinate(PinJoint::Coord::RotationZ).getOutput("value"),
        "elbow_angle");
    model.addComponent(reporter);
As you can see that, you have used getOutput() and as arguments, "fiber_force" and "value" has been provided. First question is : May I know how did you know them or where can I find them as well ?
Because I tried the following, say in order to view the muscle power, and it was of course wrong

Code: Select all

reporter->addToReport(biceps->getOutput("muscle_power"),"biceps_power");
reporter->addToReport(biceps->getOutput("excitations"), "excitations");
As you can see from the above code snippet that when I comment the excitations, I guessed the "muscle_power" argument right and I could see the result in console. But it did not work for excitations/activations. Could you please point me to where I can understand or look up those? I am still learning to use API.

Thanks,
Vishal

Tags:

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Understanding the API: How to know the possible column names

Post by jimmy d » Tue Aug 28, 2018 9:57 am

The outputs for each class are located in the Class documentation. Here is an example of the Class Muscle.

User avatar
Vishal R
Posts: 47
Joined: Wed Oct 29, 2014 4:20 pm

Re: Understanding the API: How to know the possible column names

Post by Vishal R » Tue Aug 28, 2018 10:05 am

jimmy wrote:
Tue Aug 28, 2018 9:57 am
The outputs for each class are located in the Class documentation. Here is an example of the Class Muscle.
Thanks a lot, James. Just what I was looking for. :)

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Understanding the API: How to know the possible column names

Post by jimmy d » Wed Aug 29, 2018 7:25 am

Also, there is a method to write components inputs and outputs to the terminal ;

Code: Select all

Component::printOutputInfo()

Component::printInputInfo()

User avatar
Vishal R
Posts: 47
Joined: Wed Oct 29, 2014 4:20 pm

Re: Understanding the API: How to know the possible column names

Post by Vishal R » Wed Aug 29, 2018 7:55 am

jimmy wrote:
Wed Aug 29, 2018 7:25 am
Also, there is a method to write components inputs and outputs to the terminal ;

Code: Select all

Component::printOutputInfo()

Component::printInputInfo()
That's even more beautiful. Thank you :)

POST REPLY