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
Move model using API
- Joel Quarnstrom
- Posts: 15
- Joined: Sat Mar 02, 2019 6:18 pm
Re: Move model using API
You could check out the OpenSim source code, since you are using C++.
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.
Code: Select all
// loading a model
Model model("Pendulum.osim");
State &s = model.initSystem();
- Joel Quarnstrom
- Posts: 15
- Joined: Sat Mar 02, 2019 6:18 pm
Re: Move model using API
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
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
Re: Move model using API
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.
- Joel Quarnstrom
- Posts: 15
- Joined: Sat Mar 02, 2019 6:18 pm
Re: Move model using API
Ok thank you, I will try that and ask more questions as they develop.
- Joel Quarnstrom
- Posts: 15
- Joined: Sat Mar 02, 2019 6:18 pm
Re: Move model using API
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?