Extract values from ArrayDouble in Matlab

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
Brian Umberger
Posts: 48
Joined: Tue Aug 28, 2007 2:03 pm

Re: Extract values from ArrayDouble in Matlab

Post by Brian Umberger » Mon May 06, 2013 2:53 pm

Hi Ayman,

Thanks again for the help. Based on your suggestions, I was able to create a vector and set the values of the controls in version 3.1 beta. However, I am now unable to extract the center of mass velocity of the forearm/hand segment using the getVelocity method. This line of code:

simbodyEngine.getVelocity(s, osimModel.getBodySet().get('r_ulna_radius_hand'), massCenter, velocity);

gives me this error:

No appropriate method, property, or field getVelocity for class
org.opensim.modeling.SimbodyEngine.

I've used getVelocity before and had something similar to this working in version 3.0.1. If I understand the error message, Matlab thinks that the class SimbodyEngine doesn't have a method getVelocity. Below I've provided the section of code that this line appears in. Again, any feedback in greatly appreciated!

Cheers,
Brian

modelStatePair = OpenSimContext(s, osimModel);
massCenter = ArrayDouble.createVec3([0.0,0.0,0.0]);
velocity = ArrayDouble.createVec3([0.0,0.0,0.0]);
bodySet = osimModel.getBodySet();
bodySet.get('r_ulna_radius_hand').getMassCenter(massCenter);
modelStatePair.realizeVelocity();
simbodyEngine = osimModel.getSimbodyEngine()
simbodyEngine.getVelocity(s, osimModel.getBodySet().get('r_ulna_radius_hand'), massCenter, velocity);
velocityArray = ArrayDouble.getValuesFromVec3(velocity);
f = -1 * velocityArray.getitem(0);

POST REPLY