Page 1 of 1

Problem with Function ()

Posted: Mon Jul 14, 2014 9:03 am
by kamilantos
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?

Re: Problem with Function ()

Posted: Thu Jul 17, 2014 1:41 pm
by jimmy
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

Re: Problem with Function ()

Posted: Fri Jul 25, 2014 2:33 am
by kamilantos
Dear James
Thank you for help! I will try this approach.
- Kamil