How do I use TableReporter with a Coordinate

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Ismail Raslan
Posts: 5
Joined: Thu Feb 04, 2021 4:01 am

How do I use TableReporter with a Coordinate

Post by Ismail Raslan » Mon Apr 19, 2021 1:04 am

Hello,

I have gone over the example "wiringinputsandoutputswithTableReporter.m" and tried to implement the TableReporter but with coordinates instead of outputs.

Code: Select all

%creating reporter
reporter = TableReporter();
reporter.setName('reporter');
reporter.set_report_time_interval(0.1);

%coordinates of interest
roll1 = model.getCoordinateSet().get('roll1');
pitch1 = model.getCoordinateSet().get('pitch1');
yaw1 = model.getCoordinateSet().get('yaw1');
roll2 = model.getCoordinateSet().get('roll2');
pitch2 = model.getCoordinateSet().get('pitch2');
yaw2 = model.getCoordinateSet().get('yaw2');

%Report the disred RPY coordinates
reporter.addToReport(roll1, 'roll1')
reporter.addToReport(roll2, 'roll2')
reporter.addToReport(pitch1, 'pitch1')
reporter.addToReport(pitch2, 'pitch2')
reporter.addToReport(yaw1, 'yaw1')
reporter.addToReport(yaw2, 'yaw2')
I get an error saying that TableReporter does not take this type of argument but I need these exact coordinates for when I run the forward simulation.

Can I get some help with this?

Tags:

User avatar
Thomas Uchida
Posts: 1790
Joined: Wed May 16, 2012 11:40 am

Re: How do I use TableReporter with a Coordinate

Post by Thomas Uchida » Mon Apr 19, 2021 1:20 pm

Please see the example in the README.md file on GitHub: https://github.com/opensim-org/opensim-core (scroll down to "Simple example" and expand the "Matlab" section below the example table).

Code: Select all

...
elbow_coord = elbow.getCoordinate().getOutput('value');
reporter.addToReport(elbow_coord, 'elbow_angle');
...
The Outputs associated with the Coordinate class can be found in the API documentation here: https://simtk.org/api_docs/opensim/api_ ... inate.html.

User avatar
Ismail Raslan
Posts: 5
Joined: Thu Feb 04, 2021 4:01 am

Re: How do I use TableReporter with a Coordinate

Post by Ismail Raslan » Mon Apr 19, 2021 4:45 pm

it worked thank you!

how do i extract the columns of the table with type double?

POST REPLY