Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
-
kristen jakubowski
- Posts: 15
- Joined: Tue Jun 19, 2012 10:40 am
Post
by kristen jakubowski » Wed Nov 19, 2014 8:24 pm
Hi,
I am trying to edit the dynamic walker model files, so they will execute a muscle that I have modeled in MATLAB. I have been able to successfully edit the model so my model will run in place of an added path actuator. However, I am trying to edit the initial condition, velocity. By editing the Coordinate class reference I should be able to use the function setSpeedValue to set the initial velocity of the model?
I have been trying to implement the following code, but continue to get errors, and I am unsure of how to fix it. Tab completion comes up with no matches.
Code: Select all
Vint=Coordinate();
Vint.setMotionType(Translational);
Vint.setdefultValue(-0.009);
Vint.setRangeMin(-inf);
Vint.setRangeMax(inf);
the error is
Code: Select all
No method 'setMotionType' with matching signature found for class
'org.opensim.modeling.Coordinate'.
any function i try to run from the Coordinate class reference from Doxygen I get a similar error.
Thanks
Kristen
-
jimmy d
- Posts: 1375
- Joined: Thu Oct 04, 2007 11:51 pm
Post
by jimmy d » Thu Nov 20, 2014 11:43 am
Kristen,
Coordinate objects can be tricky to work with and have been suggested to be hidden in the future.
Perhaps working with Joint will have better results. Move down the tree from the model, to the joint, to the coordinate and then update the ranges and speeds from there.
Example matlab script for changing the knee coordinate speed value
Code: Select all
myModel = Model('path2model')
kneeJoint = myModel.getJointSet.get(2)
coordinate = kneeJoint.getCoordinateSet.get(0)
coordinate.setSpeedValue(X)
Let us know if that helps,
-james
-
kristen jakubowski
- Posts: 15
- Joined: Tue Jun 19, 2012 10:40 am
Post
by kristen jakubowski » Thu Nov 20, 2014 8:32 pm
Hi James,
Thank you for your reply.
I am still getting the same errors if I run setSpeedValue
Code: Select all
No method 'setSpeedValue' with matching signature found for class
'org.opensim.modeling.Coordinate'.
However, if i change it to setDefaultSpeedValue, I can get it to run without error. From my model, I do not believe that is changing the initial velocity of the system because there is no change in my output. However, I might be asking two different questions. Would that change the initial velocity of the path actuator? I am using the following command to get the velocity from the path actuator to plug into my muscle.
Code: Select all
velocity= pathAct.getLengtheningSpeed(osimState)
Are those the correct commands?
Thanks
Kristen
-
Ajay Seth
- Posts: 136
- Joined: Thu Mar 15, 2007 10:39 am
Post
by Ajay Seth » Thu Nov 20, 2014 10:29 pm
coordinate.setSpeedValue(state, value) takes the state object and the value of the speed you want to set in the state.
To ensure that the actuator then respects the new speed, you want to call model.computeStateVariableDerivatives(state); to make sure all internal dynamics are realized.
Then you can interrogate the model for forces (e.g. ask the path actuator for its force).
coord.setDefaultSpeed(speed) will be the value that a new state will take on upon initialization (e.g. model.initSystem()) but if the system is already initialized it has no effect on the state in hand.