Search found 79 matches

by Brad Humphreys
Wed Jun 01, 2016 6:20 am
Forum: OpenSim
Topic: python API : -add a marker to a model
Replies: 3
Views: 860

Re: python API : -add a marker to a model

Fabien, I'm not sure what is missing? I checked and the following works from the scripting page: creates a new marker set when one does not exist, adds a marker, them overwrites it: myModel=modeling.Model("tug_of_war.osim") gndBody=myModel.getBodySet().get("ground") newMarkerSet=modeling.MarkerSet()...
by Brad Humphreys
Tue May 31, 2016 9:13 am
Forum: OpenSim
Topic: python API : -add a marker to a model
Replies: 3
Views: 860

Re: python API : -add a marker to a model

Fabien, I run into this problem periodically and I believe it has something to do with you overwriting a already instantiated reference. I can't remember how I get around that, but I do know there are some nice example code on how to create marker sets from scratch. Scroll down to "Building a Marker...
by Brad Humphreys
Tue May 31, 2016 8:57 am
Forum: OpenSim
Topic: Set ForceSet to AnalyzeTool-Instance with Python API
Replies: 1
Views: 426

Re: Set ForceSet to AnalyzeTool-Instance with Python API

There is a post on the forum (could not quickly find it) that says not all of the Static Opt methods were made available as of 3.3 (but are supposed to be in the next coming release). The work around I came up with was to make a simple Static Opt xml template file (basically one with minimal options...
by Brad Humphreys
Sun May 22, 2016 9:08 am
Forum: OpenSim
Topic: Speed of Video Recording
Replies: 3
Views: 571

Re: Speed of Video Recording

Here is some MATLAB code that is a work around: viewtopicPhpbb.php?f=91&t=6029&p=15342&start=0&view=

Brad
by Brad Humphreys
Sun Apr 10, 2016 7:38 am
Forum: OpenSim
Topic: Matlab crash using API functions
Replies: 4
Views: 1095

Re: Matlab crash using API functions

Clara,

Have you looked at Dominic Farris's prescribeMotionInModel.m? I have used (variations) of it successfully:
https://github.com/opensim-org/opensim- ... nInModel.m

Regards,

Brad
by Brad Humphreys
Sun Apr 10, 2016 7:06 am
Forum: OpenSim
Topic: Jacobian / getMatterSubsystem
Replies: 4
Views: 922

Re: Jacobian / getMatterSubsystem

Bas, Availability of the Jacobian is a project that I am interested in; we use it in optimization for predictive modeling. For now we calculate it though using finite differences. Brian Umberger and Leng-Feng Lee wrote a nice paper that does something similar. But even better, they shared the code: ...
by Brad Humphreys
Mon Apr 04, 2016 5:15 pm
Forum: OpenSim
Topic: Getting Joint Location in Matlab
Replies: 7
Views: 1157

Re: Getting Joint Location in Matlab

Try this: import org.opensim.modeling.* osimModel= Model(modelFile1); p=Vec3(); % This creates an empty opensim vector which will contain the location in the parent frame osimModel.getJointSet().get("ankle_r").getLocationInParent(p); %Now convert into native MATLAB double pval(1)=p.get(0); pval(2)=p...
by Brad Humphreys
Mon Apr 04, 2016 1:36 pm
Forum: OpenSim
Topic: Wrap Object Set with API
Replies: 8
Views: 1908

Re: Wrap Object Set with API

Malavika,

I did not get any further than my responses here as my reason for doing this went away due to taking a different approach unrelated to the wrap surface. Since then I have not needed to programmaticly create a wrap surface.

Regards,

Brad
by Brad Humphreys
Mon Mar 14, 2016 1:47 pm
Forum: OpenSim
Topic: Follow Markers
Replies: 2
Views: 666

Re: Follow Markers

Here is a MATLAB code snippet (easily made into a function) that gets marker locations via the API. Set the coords (q) and it creates a matrix with marker locations (markerLoc) in the ground body CS: % Set the angles of the coordinates (rad). In Arm26, there are 2 coords: q=[0 0]; % Load Library imp...
by Brad Humphreys
Thu Mar 10, 2016 11:46 am
Forum: OpenSim
Topic: Using the Forward Tool with Matlab
Replies: 1
Views: 533

Re: Using the Forward Tool with Matlab

Nihar, I believe you have to do the following to use the Forward Dynamics tool (or at least this is the way that works for me): 1) Your controller needs to be written in C++ and compiled and registered with OpenSim (Let OpenSim know it exists). 2) Add the controller to your model (.osim file) 3) The...