Problem with Function ()

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Kamil Antos
Posts: 7
Joined: Tue Sep 24, 2013 2:10 am

Problem with Function ()

Post by Kamil Antos » Mon Jul 14, 2014 9:03 am

Dear All
I would like to create new model using matlab. I tried to create Custom Joint, but I can't define Transform function because every time I get information:
No constructor 'org.opensim.modeling.Function' with matching signature found.

Here is part of my code:
...
tr = TransformAxis();
tr.setAxis(Vec3(0,0,1));
tr.setCoordinateNames(ArrayStr('rotation1'));
my_function = Function();
No constructor 'org.opensim.modeling.Function' with matching signature found.

I use 64 bit system, with 64 bit matlab and OpenSim. Do you have any idea why it doesn't work?

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

Re: Problem with Function ()

Post by jimmy d » Thu Jul 17, 2014 1:41 pm

Hi Kamil,

You can't call Function directly. You have to build and attach fucntions like simmsplines(), LinearFunctions(), etc...

Just to show the hierarchy, first ill show how to get access to a function.

Code: Select all

import org.opensim.modeling.*
% get a model
myModel = Model('C:\OpenSim3.2\Models\Gait2392_Simbody\gait2392_simbody.osim')
% get the custom joint
jnt = myModel.getJointSet().get('knee_r');
% Downcast to custom joint
customjoint = CustomJoint.safeDownCast(jnt);
% Get the custom joints spatial transform 
sTran = customjoint.getSpatialTransform();
% Get the one of the translation axes 
g = sTran.getTransformAxis(3);
% get a reference to the function  
h = g.getFunction;
% safedowncast to the simmspline 
simmspline = SimmSpline.safeDownCast(h);
% get the X and Y references.  
simmsplineX = simmspline.getX;
simmsplineY = simmspline.getY;
To create my own function I can do something like this;

Code: Select all

% create a default spatial transform
emptyTransform = SpatialTransform()
% create a default simmspline
emptySimmSpline = SimmSpline()
% get a handle to a translation axis
emptyTransformAxis = emptyTransform.getTransformAxis(3)
% set the function of that axis using the simmspline
emptyTransformAxis.setFunction(emptySimmSpline)
Hope that helps,
-james

User avatar
Kamil Antos
Posts: 7
Joined: Tue Sep 24, 2013 2:10 am

Re: Problem with Function ()

Post by Kamil Antos » Fri Jul 25, 2014 2:33 am

Dear James
Thank you for help! I will try this approach.
- Kamil

POST REPLY