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:
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?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)
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();
Any corrections or suggestions would be greatly appreciated.
Respectfully,
Evan