I am using the 2D MOCO example to test a model I would like to run. Building on the 2D_gait.osim model I have added a single DOF exoskeleton on either side matching the joints of the skeleton model using pin joints (hip, knee and ankle). The hip section attaches at the pelvis with a weld joint, the system then move down to the feet where there is a weld joint between the footplate and the calcaneus of each side creating a closed kinematic chain.
When I try and connect the footplate to the calcaneus it seems to break the original joints (talus-calc and calc-mtp). Having set the parent-child origins to be visible within the GUI, when the model is in the default pose the talus-calc and calc-mtp joints align but when the exoskeleton is moved the joint is broken. The talus-calc and calc-mtp still show up on the navigation window.
Code: Select all
%% Exoskeleton Left Foot
% Make and add a Left Foot Body
exoBody{6} = Body();
exoBody{6}.setName('LeftFootExo');
exoBody{6}.setMass(0.1);
exoBody{6}.setInertia(Inertia(2,2,0.002,0,0,0));
% Add geometry for display
exoBody{6}.attachGeometry(Mesh('LeftFoot.STL'));
% Add Body to the Model
model.addBody(exoBody{6});
% Make and add a Pin joint for the Left Foot Body
locationInParent = Vec3(0,-shankLength/2,0);
orientationInParent = Vec3(0,0,0);
locationInChild = Vec3(0,footLength/2,0);
orientationInChild = Vec3(0,0,0);
exoJoint{6} = PinJoint('Exo_Ankle_L',...
exoBody{5},...
locationInParent,...
orientationInParent,...
exoBody{6},...
locationInChild,...
orientationInChild);
% Update the coordinates of the new joint
coordShift{5,1} = exoJoint{6}.updCoordinate();
coordShift{5,1}.setRange([deg2rad(-40), deg2rad(30)]);
% coordShift{5,1}.setName('LAnkle_rz');
coordShift{5,1}.setDefaultValue(deg2rad(0));
coordShift{5,1}.setDefaultSpeedValue(0)
% Add Joint to the Model
model.addJoint(exoJoint{6});
% Make and add a Pin joint for the exo Left Foot Body to human foot
locationInParent = Vec3(0,-0.0230457,0.0807731);
orientationInParent = Vec3(0,0,0);
locationInChild = Vec3(0.0473681,-0.00996184,0.000328108);
orientationInChild = Vec3(0,0,0);
exoJoint{7} = WeldJoint('Foot_Anchor_L',...
exoBody{6},... % Human left foot
locationInParent,...
orientationInParent,...
BodyList{8},... % exo left foot
locationInChild,...
orientationInChild);
model.addJoint(exoJoint{7});
Error using example2DWalking (line 92)
Java exception occurred:
java.lang.RuntimeException: Component 'Foot_Anchor_L_Loop' of type WeldConstraint has no owner and is not the root.
Verify that finalizeFromProperties() has been invoked on the root Component or that this Component is not a clone, which has not been added to another Component.
Thrown at Component.cpp:1681 in initComponentTreeTraversal().
at org.opensim.modeling.opensimMocoJNI.MocoTrack_initialize(Native Method)
at org.opensim.modeling.MocoTrack.initialize(MocoTrack.java:549)
Based on the error it looks like it has something to do with how the joint has been added to the model. Having looked up finalizeFromProperties() I tried to apply it to both bodies without any effect. The joints have followed the same process throughout the model so I am not exactly sure how to progress.
Any help is appreciated as I am a little stumped!
Cheers,
Rory Turnbull