Closed Kinematic Chains

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Rory Turnbull
Posts: 28
Joined: Mon Dec 16, 2019 1:57 am

Closed Kinematic Chains

Post by Rory Turnbull » Thu Jun 10, 2021 8:30 am

Hi All,

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});
The model successfully builds running the matlab script, however I get the following error when I attempt to put the model into MOCO.


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

Tags:

User avatar
Ayman Habib
Posts: 2248
Joined: Fri Apr 01, 2005 12:24 pm

Re: Closed Kinematic Chains

Post by Ayman Habib » Mon Jun 14, 2021 9:30 am

Hi Rory,

Looking at your code snippet it's a bit hard to identify the issue since more context is needed. My guess is that the code that builds the multibody tree, correctly identifies that it needs to break a loop but fails downstream. I'd suggest you create a minimal example/code-snippet that reproduces the problem and either post it here or open a bug report and attach it. In the meantime, if you're making modifications to an existing model, you can piecemeal those changes, save the model after each change and load it in the GUI to see if it is working as expected, it would help you understand the topology as seen by OpenSim if you open the topology viewer (Window -> Topology View).

Hope this helps,
-Ayman

User avatar
Rory Turnbull
Posts: 28
Joined: Mon Dec 16, 2019 1:57 am

Re: Closed Kinematic Chains

Post by Rory Turnbull » Mon Jun 14, 2021 10:28 am

Hi Ayman,

Thank you for your response. You are correct the issue was due to the structure of the multibody tree, to form the closed kinematic chain I needed to use a constraint rather than a joint for the final connection between the exoskeleton and body. Ended up using the PointConstraint() for anyone interested.

I tried the topological view however all of the components were layered on top of each other. After moving the components around the default re-stacked all of the components. Is there a way of altering the default view as there is with model coordinates?

Separately when posting the original post I had tried to include some images to help explain things a bit better but it said "Sorry, the board attachment quota has been reached." not sure if that is my account or generally forum-related or not.

Thank you for your help!

Best wishes,
Rory

POST REPLY