Page 1 of 1

Error occurs when attempting to add 6DoF joint between the foot and ground

Posted: Thu Jul 01, 2021 9:33 am
by edooley
Hello,

I am working with the human model: FullBody_SimpleArms_Hamner2010, and I am trying to add a 6DoF joint between the each talus body and ground. I want the ankle joint to continue to exist as is. I want to use the "foot-to-floor" joint to ensure the foot is flat during scaling and output global measures of foot position.

I have tried both in Matlab and by manually editting the .osim model file to add this joint. In either case when I go to load the new model into opensim I get the same error:
Java exception occurred:
java.io.IOException: Attempting to assign an invalid SimTK::MobilizedBodyIndex
In Object 'tibia_r_slave_0_offset' of type PhysicalOffsetFrame.
Thrown at PhysicalFrame.cpp:73 in setMobilizedBodyIndex().

at org.opensim.modeling.opensimSimulationJNI.Model_initSystem(Native Method)

at org.opensim.modeling.Model.initSystem(Model.java:848)
I understand that MobilizedBodyIndex is a protected function very intentionally, so I am wondering if there is another way to go about creating this joint, or where I have gone wrong in my current thinking/attempt?

In Matlab, I made the change by finding the position of the talus relative to the ground in the default state of the model then made a free joint between the ground and the talus with the default coordinate values being those that I found:

Code: Select all

%% make foot-floor joints
% RIGHT
Talus2Ground_r = FreeJoint('TalusToGround_r',ground, Vec3(0),Vec3(0),...
                                                 foot_r,Vec3(0),Vec3(0));
% Set coordinates of joint
TalusToGround_r_RX = Talus2Ground_r.upd_coordinates(0); % OpenSim starts counting at 0
% TalusToGround_r_RX.setRange([-12.566, 12.566]);
TalusToGround_r_RX.setName('TalusToGround_r_RX');
TalusToGround_r_RX.setDefaultValue(rot_r_matArray(1)); % set default value to be current position

TalusToGround_r_RY = Talus2Ground_r.upd_coordinates(1);
% TalusToGround_r_RY.setRange([-12.566, 12.566]);
TalusToGround_r_RY.setName('TalusToGround_r_RY');
TalusToGround_r_RY.setDefaultValue(rot_r_matArray(2));

TalusToGround_r_RZ = Talus2Ground_r.upd_coordinates(2);
% TalusToGround_r_RZ.setRange([-12.566, 12.566]);
TalusToGround_r_RZ.setName('TalusToGround_r_RZ');
TalusToGround_r_RZ.setDefaultValue(rot_r_matArray(3));

TalusToGround_r_TX = Talus2Ground_r.upd_coordinates(3); % OpenSim starts counting at 0
% TalusToGround_r_TX.setRange([-10, 10]);
TalusToGround_r_TX.setName('TalusToGround_r_TX');
TalusToGround_r_TX.setDefaultValue(pos_r_matArray(1));

TalusToGround_r_TY = Talus2Ground_r.upd_coordinates(4);
% TalusToGround_r_TY.setRange([-5, 5]);
TalusToGround_r_TY.setName('TalusToGround_r_TY');
TalusToGround_r_TY.setDefaultValue(pos_r_matArray(2));

TalusToGround_r_TZ = Talus2Ground_r.upd_coordinates(5);
% TalusToGround_r_TZ.setRange([-5, 5]);
TalusToGround_r_TZ.setName('TalusToGround_r_TZ');
TalusToGround_r_TZ.setDefaultValue(pos_r_matArray(3));

model.addJoint(Talus2Ground_r);

model.finalizeConnections();
The connections do all finalize and I can print the model to an osim file but if I try to run "model.initSystem()" or open the model in the OSim GUI, I get the error I printed above.

Any corrections or suggestions would be greatly appreciated.

Respectfully,
Evan

Re: Error occurs when attempting to add 6DoF joint between the foot and ground

Posted: Fri Jul 02, 2021 9:57 am
by aymanh
Hi Evan,

The fundamental issue here is not the syntax of adding joints but the fact that adding joints at the feet violates the tree structure of the multibody-system topology. Instead of introducing joints (causing closed loops), you should find constraints that perform a similar job which would be more appropriate in this case. Constraints are enforced on top of the multibody tree and as such do not affect the tree structure.

Hope this helps,
-Ayman

Re: Error occurs when attempting to add 6DoF joint between the foot and ground

Posted: Fri Jul 02, 2021 12:13 pm
by edooley
Hello Ayman,

Thanks so much. That's a great point.

I was investigating the constraint methods available and can't seem to find a combination that results in reducing two rotational DoF between the foot and the ground.

On doxygen (https://simtk.org/api_docs/opensim/api_ ... raint.html) I found six available constraints:
  • constant distnace
    coordinate coupler
    point constraint
    point on line
    rolling on surface
    weld constraint
Most of these restrict translational motion but leave all of the rotations between the frames free. Is there a method to reduce the rotations allowed? In the description for the weld constraint it says that it constrains "up to 6 DoF" but in attempting to implement it, the only option seems to be enabled or not. Is there something I'm missing about implementing this component?

My end goal is to allow all 3 translations, but only allow rotation about the global y(vertical) axis.

Thanks again for your help,
Evan