This is a follow up to my previous question (here) regarding the geometry path of a spring, but I have run into new issues.
I now have code that is able to successfully find the geometry path of the spring, iterate through, and print out the location of each path point. However, it is only returning the fixed points in the path, ignoring the fact that it curves around a wrap object.
Code: Select all
import org.opensim.modeling.*
% Load model
model = Model('Plot_ThighWrap.osim');
state = model.initSystem();
% Return path point set
springAsForce = model.getForceSet.get('thighBand1');
pathSpring = PathSpring.safeDownCast(springAsForce);
path = pathSpring.get_GeometryPath();
pathPointSet = path.getPathPointSet();
% Loop through points in muscle path.
for i = 0:pathPointSet.getSize()-1
pathPoint = pathPointSet.get(i);
% Location of point and body in which it's expressed.
pathPoint = PathPoint.safeDownCast(pathPoint);
locInBody = pathPoint.get_location();
BodyName = pathPoint.getBodyName();
fprintf('point %d expressed in %s: %s\n', i, BodyName, char(locInBody));
end
This is all with the end goal of finding the moment created by the spring about the hip; maybe there is a more efficient way to be doing this that I do not know. I saw in the documentation that GeometryPath has .computeMomentArm(), however MatLab said there was no method with matching signature.
Thank you,
Finn