Adding coordinates to a model and determining marker locations wrt ground

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Radhakrishnan Vignesh
Posts: 104
Joined: Tue Jun 01, 2021 8:09 am

Adding coordinates to a model and determining marker locations wrt ground

Post by Radhakrishnan Vignesh » Fri Dec 29, 2023 4:01 pm

Hello,

Hope you are doing well. I would like some advice on how to proceed with the following issue.

I have joint angle data and marker data in their respective local cooridnate system. Unlike OpenSim, the marker location in the LCS seem to vary throughout the trial (unless my understanding is incorrect wrt OpenSim). However, I would like to determine the location of the markers with respect to ground. So far I have:

1) Created a model and added markers to it based on a static trial
2) Loaded the coordinates to the model. However, I am not sure how to proceed next

I have added the code below

Thanks,
Vignesh



dfAngleData = [data.Norm02.Walk_SS.AnglesHipDF.Y,data.Norm02.Walk_SS.AnglesHipDF.Z,data.Norm02.Walk_SS.AnglesHipDF.X];
osimModel = Model("Norm02FreeJoint.osim");
coordinateSet = osimModel.getCoordinateSet();
% osimModel.initSystem();
%
s = osimModel.initSystem();
markerSet = osimModel.get_MarkerSet();
marker = markerSet.get(2);
gnd = osimModel.getGround();
% % marker.findLocationInFrame(s,osimModel.getGround())
location = [];
for i=1:length(time)
for j=7:9
currCord = coordinateSet.get(j-1);
k=j-6;
currCord.setValue(s,dfAngleData(i,k),false);
end
manager = Manager(osimModel);
manager.initialize(s);
s1 = manager.getState();
s = manager.integrate(time(i));
osimModel.realizePosition(s);
a = marker.findLocationInFrame(s,gnd);
location = [location, a.getAsMat()];

end

POST REPLY