Importing bodies from existing models in OpenSim3.3
Posted: Mon Jul 12, 2021 5:48 am
Hi All,
I am currently trying to convert a file backwards from 4.2 to 3.3 for use in SCONE.
I have taken a pre existing gait model and loaded it into MATLAB. In 4.2 I used the following command to load the bodies in as variables so that I could make additions to them.
I found in 3.3 that the version of this code is
This works, however, it saves the Body as an "OpenSimObject" rather than a "Body". Further on in the code when I am trying to create a WeldJoint:
It throws up the following error for the line of code that reads exoJoint{1}.setBody(BodyList{1});
Check for missing argument or incorrect argument data type in call to function 'setBody'.
Is this due to the fact the imported bodies have been saved as OpenSimObjects? and if so is there a way of importing them differently or converting the data type to a body?
Thank you for your help,
Rory Turnbull
I am currently trying to convert a file backwards from 4.2 to 3.3 for use in SCONE.
I have taken a pre existing gait model and loaded it into MATLAB. In 4.2 I used the following command to load the bodies in as variables so that I could make additions to them.
Code: Select all
% BodyList = osimList2MatlabCell(model,'Body'); % Get a cell array of references to all the bodies in a model
Code: Select all
BodyList{1} = model.getObjectByTypeAndName('Body','pelvis');
Code: Select all
exoJoint{1} = WeldJoint();
exoJoint{1}.setName('Exo_Anchor_Pelvis');
exoJoint{1}.setParentBody(exoBody{1});
exoJoint{1}.setLocationInParent(locationInParent);
exoJoint{1}.setOrientationInParent(orientationInParent);
exoJoint{1}.setBody(BodyList{1});
% exoJoint{1}.setLocationInChild(locationInChild);
% exoJoint{1}.setOrientationInChild(orientationInChild);
Check for missing argument or incorrect argument data type in call to function 'setBody'.
Is this due to the fact the imported bodies have been saved as OpenSimObjects? and if so is there a way of importing them differently or converting the data type to a body?
Thank you for your help,
Rory Turnbull