Issue importing geometry bodies in Matlab
Posted: Mon Jul 20, 2020 8:37 am
I'm currently trying to create my own model using pre-defined geometries. However, I keep getting the following message whenever I try to import the pelvis geometry:
I have tried calling 'pelvis', 'l_pelvis' and so on, and it seems I am able to import the basic files as per the dynamic walker example, but I don't want to use a sphere to represent the pelvis.
Here is my code:
Alternatively, is there any way of me constructing this geometry using markers? I created a marker file, but when I tried to apply it to an osim model, it rejected it as it said there are too many markers. I don't know how to go around this.
Any help would be much appreciated. Thank you in advance!
Code: Select all
Error using BGSM (line 269)
Java exception occurred:
java.lang.RuntimeException: ArrayPtrs.get(aName): No object with name r_pelvis
at org.opensim.modeling.opensimSimulationJNI.SetBodies_get__SWIG_1(Native Method)
at org.opensim.modeling.SetBodies.get(SetBodies.java:149)
Here is my code:
Code: Select all
pelvis = Body(); % Creates a body
massCenter = Vec3(-0.0707,0.0,0.0); % Create a Vec3 Object with mass center information
inertia = Inertia(0.128, 0.0871, 0.0579, 0, 0, 0); % Create an Inertia object with only principal axes
pelvis.setName('Pelvis'); % Set the name of the body
pelvis.setMass(pelvisMass); % Set the mass of the body
pelvis.setMassCenter(massCenter); % Set the mass center
pelvis.setInertia(inertia); % Set the body's inertia
r_pelvis = model.getBodySet().get('r_pelvis');
pelvis = pelvis.attachGeometry(pelvis);
osimModel.addBody(pelvis);
Any help would be much appreciated. Thank you in advance!