Move model using API

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Joel Quarnstrom
Posts: 15
Joined: Sat Mar 02, 2019 6:18 pm

Move model using API

Post by Joel Quarnstrom » Tue Jul 09, 2019 1:11 pm

Hello,

I am trying to run a mot file on a preexisting model file using visual studio. All of the example programs that I have looked at each create a new model, and I am wondering how to load a preexisting model. Also from what I can gather, none of the example programs use an mot file on a model. Is there a way to load an mot file using visual studio? If not, is there a way to hard code joint angle values into a c++ program on visual studio, and have those values change the model's position?

Thank you,
Joel Quarnstrom

Tags:

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

Re: Move model using API

Post by jimmy d » Tue Jul 09, 2019 1:55 pm

You could check out the OpenSim source code, since you are using C++.

Code: Select all

// loading a model
Model model("Pendulum.osim");
State &s = model.initSystem();
For updating the model coordinates, you could look at StaticOptimization, which builds an (incomplete) state from the motion and then updates based on time. Or you could use the STOFileAdapter() to read the motion into an OpenSim table, then update the coordinate values of the model from the table data.

User avatar
Joel Quarnstrom
Posts: 15
Joined: Sat Mar 02, 2019 6:18 pm

Re: Move model using API

Post by Joel Quarnstrom » Wed Jul 10, 2019 3:02 pm

Thank you for the response,

Using a Time Series Table seems like it would work for my purposes. I am unsure on what the syntax is to use the time series table function.

Is it something like: OpenSim::TimeSeriesTable_()

I am pretty new to using Visual Studio with OpenSim, so I am probably missing something obvious on the syntax.

Also, how do I organize the values in the table? Can I create a table directly in Visual Studio, or do I need to pull it from an excel file?

Thank you,
Joel

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

Re: Move model using API

Post by jimmy d » Wed Jul 10, 2019 3:11 pm

A good place to look is the tests for the classes. Here is the dataTable test that shows how to build a table from scratch. In terms of methods, once you have setup a table you should be able to use the Visual Studio IDE features to view the methods available to you. You also can use doxygen to find the different table types.

User avatar
Joel Quarnstrom
Posts: 15
Joined: Sat Mar 02, 2019 6:18 pm

Re: Move model using API

Post by Joel Quarnstrom » Wed Jul 10, 2019 3:19 pm

Ok thank you, I will try that and ask more questions as they develop.

User avatar
Joel Quarnstrom
Posts: 15
Joined: Sat Mar 02, 2019 6:18 pm

Re: Move model using API

Post by Joel Quarnstrom » Thu Jul 11, 2019 12:50 pm

I tried to use the test data table code that you referenced, but I do not have the #include <OpenSim/Auxiliary/auxiliaryTestFunctions.h> library. Do you know how I could install it?

POST REPLY